After code cleanup

This commit is contained in:
2022-07-09 04:17:38 +00:00
parent aaed4430f1
commit f9baf2b3df
53 changed files with 255 additions and 465 deletions

View File

@@ -1,11 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace AyaNovaQBI namespace AyaNovaQBI

View File

@@ -1,8 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI namespace AyaNovaQBI
{ {

View File

@@ -1,8 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI namespace AyaNovaQBI
{ {

View File

@@ -1,9 +1,4 @@
using System; namespace AyaNovaQBI
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI
{ {
/// <summary> /// <summary>
/// All AyaNova types and their attributes indicating what features that type will support (tagging, attachments etc) /// All AyaNova types and their attributes indicating what features that type will support (tagging, attachments etc)

View File

@@ -1,11 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace AyaNovaQBI namespace AyaNovaQBI

View File

@@ -1,8 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI namespace AyaNovaQBI
{ {

View File

@@ -1,8 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI namespace AyaNovaQBI
{ {

View File

@@ -1,11 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace AyaNovaQBI namespace AyaNovaQBI

View File

@@ -1,10 +1,4 @@
using System; namespace AyaNovaQBI
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI
{ {
internal class InvoiceableItem internal class InvoiceableItem
{ {

View File

@@ -1,8 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Data; using System.Data;
using System.Drawing;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
@@ -20,7 +18,7 @@ namespace AyaNovaQBI
Icon = AyaNovaQBI.Properties.Resources.logo; Icon = AyaNovaQBI.Properties.Resources.logo;
} }
async private void MainForm_Load(object sender, EventArgs e) private async void MainForm_Load(object sender, EventArgs e)
{ {
//Initialize //Initialize

View File

@@ -1,11 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace AyaNovaQBI namespace AyaNovaQBI
@@ -19,7 +12,9 @@ namespace AyaNovaQBI
public bool ShowUpdatePriceCostOnlyCheckBox { get; set; } = false; public bool ShowUpdatePriceCostOnlyCheckBox { get; set; } = false;
public bool PriceOnly { get public bool PriceOnly
{
get
{ {
return ckUpdatePriceCostOnly.Checked; return ckUpdatePriceCostOnly.Checked;
} }

View File

@@ -1,11 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data; using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace AyaNovaQBI namespace AyaNovaQBI

View File

@@ -1,11 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data; using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace AyaNovaQBI namespace AyaNovaQBI

View File

@@ -1,10 +1,4 @@
using System; namespace AyaNovaQBI
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI
{ {
public class NameIdActiveChargeCostItem public class NameIdActiveChargeCostItem
{ {

View File

@@ -1,10 +1,4 @@
using System; namespace AyaNovaQBI
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI
{ {
public class NameIdActiveItem public class NameIdActiveItem
{ {

View File

@@ -1,10 +1,4 @@
using System; namespace AyaNovaQBI
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI
{ {
public class NameIdItem public class NameIdItem

View File

@@ -1,8 +1,4 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI namespace AyaNovaQBI
{ {

View File

@@ -1,8 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI namespace AyaNovaQBI
{ {

View File

@@ -1,10 +1,4 @@
using System; namespace AyaNovaQBI
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI
{ {
public class PartStockLevel public class PartStockLevel
{ {

View File

@@ -1,7 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace AyaNovaQBI namespace AyaNovaQBI

View File

@@ -1,5 +1,4 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following

View File

@@ -1,9 +1,4 @@
using System; using Newtonsoft.Json;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI namespace AyaNovaQBI
{ {

View File

@@ -1,8 +1,4 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI namespace AyaNovaQBI
{ {

View File

@@ -1,5 +1,4 @@
using System; using System;
using System.Data;
using System.Windows.Forms; using System.Windows.Forms;
namespace AyaNovaQBI namespace AyaNovaQBI

View File

@@ -1,5 +1,4 @@
using System; using System;
using System.Data;
using System.Windows.Forms; using System.Windows.Forms;
namespace AyaNovaQBI namespace AyaNovaQBI

View File

@@ -1,5 +1,4 @@
using System; using System;
using System.Data;
using System.Windows.Forms; using System.Windows.Forms;
namespace AyaNovaQBI namespace AyaNovaQBI

View File

@@ -1,11 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data; using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace AyaNovaQBI namespace AyaNovaQBI

View File

@@ -1,11 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace AyaNovaQBI namespace AyaNovaQBI

View File

@@ -1,11 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace AyaNovaQBI namespace AyaNovaQBI

View File

@@ -1,5 +1,4 @@
using System; using System;
using System.Data;
using System.Windows.Forms; using System.Windows.Forms;
namespace AyaNovaQBI namespace AyaNovaQBI

View File

@@ -1,11 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Data; using System.Data;
using System.Drawing;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace AyaNovaQBI namespace AyaNovaQBI

View File

@@ -1,8 +1,4 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI namespace AyaNovaQBI
{ {

View File

@@ -1,10 +1,4 @@
using System; namespace AyaNovaQBI
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI
{ {
/// <summary> /// <summary>
/// AyaNova User types /// AyaNova User types

View File

@@ -1,8 +1,4 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI namespace AyaNovaQBI
{ {

View File

@@ -1,12 +1,4 @@
using System; using System.Windows.Forms;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AyaNovaQBI namespace AyaNovaQBI
{ {

View File

@@ -1,8 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI namespace AyaNovaQBI
{ {

View File

@@ -1,8 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI namespace AyaNovaQBI
{ {
@@ -10,15 +6,15 @@ namespace AyaNovaQBI
/// <summary> /// <summary>
/// DTO object to receive list from server of billable workorders /// DTO object to receive list from server of billable workorders
/// </summary> /// </summary>
internal class WorkOrderAccountingListItem public class WorkOrderAccountingListItem
{ {
internal long id { get; set; } public long id { get; set; }
internal long customerId { get; set; } public long customerId { get; set; }
internal string customerName { get; set; } public string customerName { get; set; }
internal string workorderStatusName { get; set; } public string workorderStatusName { get; set; }
internal long serial { get; set; } public long serial { get; set; }
internal DateTime? serviceDate { get; set; } public DateTime? serviceDate { get; set; }
internal string color { get; set; } public string color { get; set; }
internal string projectName { get; set; } public string projectName { get; set; }
} }
} }

View File

@@ -1,25 +1,21 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI namespace AyaNovaQBI
{ {
/// <summary> /// <summary>
/// Working list for selection by user in grid /// Working list for selection by user in grid
/// </summary> /// </summary>
internal class WorkOrderGridListItem public class WorkOrderGridListItem
{ {
internal long Id { get; set; } public long Id { get; set; }
internal long CustomerId { get; set; } public long CustomerId { get; set; }
internal string CustomerName { get; set; } public string CustomerName { get; set; }
internal string WorkorderStatusName { get; set; } public string WorkorderStatusName { get; set; }
internal long Serial { get; set; } public long Serial { get; set; }
internal DateTime? ServiceDate { get; set; } public DateTime? ServiceDate { get; set; }
internal string Color { get; set; } public string Color { get; set; }
internal string ProjectName { get; set; } public string ProjectName { get; set; }
internal bool Linked { get; set; } public bool Linked { get; set; }
} }
} }

View File

@@ -1,8 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI namespace AyaNovaQBI
{ {

View File

@@ -1,10 +1,4 @@
using System; namespace AyaNovaQBI
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI
{ {
internal class WorkOrderItemExpense internal class WorkOrderItemExpense
{ {

View File

@@ -1,8 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI namespace AyaNovaQBI
{ {

View File

@@ -1,8 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI namespace AyaNovaQBI
{ {

View File

@@ -1,8 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI namespace AyaNovaQBI
{ {

View File

@@ -1,8 +1,4 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI namespace AyaNovaQBI
{ {

View File

@@ -1,8 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI namespace AyaNovaQBI
{ {

View File

@@ -1,10 +1,4 @@
using System; namespace AyaNovaQBI
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI
{ {
internal class WorkOrderStatus internal class WorkOrderStatus
{ {

View File

@@ -1,11 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace AyaNovaQBI namespace AyaNovaQBI

View File

@@ -1,17 +1,16 @@
using System; using Interop.QBFC15;
using Newtonsoft.Json.Linq;
using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http; using System.Net.Http;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using Newtonsoft.Json.Linq; using System.Text;
using Interop.QBFC15;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.Data;
using System.Collections;
namespace AyaNovaQBI namespace AyaNovaQBI
{ {
@@ -91,7 +90,7 @@ namespace AyaNovaQBI
} }
public async static Task<bool> AuthenticateAsync(string login, string password = null) public static async Task<bool> AuthenticateAsync(string login, string password = null)
{ {
InitClient(); InitClient();
@@ -202,7 +201,7 @@ namespace AyaNovaQBI
public async static Task<ApiResponse> GetAsync(string route) public static async Task<ApiResponse> GetAsync(string route)
{ {
Exception FirstException = null; Exception FirstException = null;
@@ -224,7 +223,7 @@ namespace AyaNovaQBI
throw new Exception($"API call failed after {MAX_TRIES.ToString()} attempts", FirstException); throw new Exception($"API call failed after {MAX_TRIES.ToString()} attempts", FirstException);
} }
private async static Task<ApiResponse> TryGetAsync(string route) private static async Task<ApiResponse> TryGetAsync(string route)
{ {
var requestMessage = new HttpRequestMessage(HttpMethod.Get, ApiBaseUrl + route); var requestMessage = new HttpRequestMessage(HttpMethod.Get, ApiBaseUrl + route);
@@ -258,7 +257,7 @@ namespace AyaNovaQBI
public async static Task<ApiResponse> PostAsync(string route, dynamic d) public static async Task<ApiResponse> PostAsync(string route, dynamic d)
{ {
Exception FirstException = null; Exception FirstException = null;
@@ -280,7 +279,7 @@ namespace AyaNovaQBI
throw new Exception($"API call failed after {MAX_TRIES.ToString()} attempts", FirstException); throw new Exception($"API call failed after {MAX_TRIES.ToString()} attempts", FirstException);
} }
public async static Task<ApiResponse> PostAsync(string route, string s = null) public static async Task<ApiResponse> PostAsync(string route, string s = null)
{ {
Exception FirstException = null; Exception FirstException = null;
@@ -303,7 +302,7 @@ namespace AyaNovaQBI
} }
internal async static Task<ApiResponse> TryPostAsync(string route, string postJson = null) internal static async Task<ApiResponse> TryPostAsync(string route, string postJson = null)
{ {
var requestMessage = new HttpRequestMessage(HttpMethod.Post, ApiBaseUrl + route); var requestMessage = new HttpRequestMessage(HttpMethod.Post, ApiBaseUrl + route);
@@ -367,7 +366,7 @@ namespace AyaNovaQBI
public async static Task<ApiResponse> PutAsync(string route, dynamic d) public static async Task<ApiResponse> PutAsync(string route, dynamic d)
{ {
Exception FirstException = null; Exception FirstException = null;
@@ -389,7 +388,7 @@ namespace AyaNovaQBI
throw new Exception($"API call failed after {MAX_TRIES.ToString()} attempts", FirstException); throw new Exception($"API call failed after {MAX_TRIES.ToString()} attempts", FirstException);
} }
public async static Task<ApiResponse> PutAsync(string route, string s = null) public static async Task<ApiResponse> PutAsync(string route, string s = null)
{ {
Exception FirstException = null; Exception FirstException = null;
@@ -411,7 +410,7 @@ namespace AyaNovaQBI
throw new Exception($"API call failed after {MAX_TRIES.ToString()} attempts", FirstException); throw new Exception($"API call failed after {MAX_TRIES.ToString()} attempts", FirstException);
} }
public async static Task<ApiResponse> PutAsync(string route) public static async Task<ApiResponse> PutAsync(string route)
{ {
Exception FirstException = null; Exception FirstException = null;
@@ -433,7 +432,7 @@ namespace AyaNovaQBI
throw new Exception($"API call failed after {MAX_TRIES.ToString()} attempts", FirstException); throw new Exception($"API call failed after {MAX_TRIES.ToString()} attempts", FirstException);
} }
public async static Task<ApiResponse> TryPutAsync(string route, string putJson = null) public static async Task<ApiResponse> TryPutAsync(string route, string putJson = null)
{ {
var requestMessage = new HttpRequestMessage(HttpMethod.Put, ApiBaseUrl + route); var requestMessage = new HttpRequestMessage(HttpMethod.Put, ApiBaseUrl + route);
@@ -1384,7 +1383,7 @@ namespace AyaNovaQBI
/// gather info required for future /// gather info required for future
/// transactions /// transactions
/// </summary> /// </summary>
public async static Task<pfstat> QBValidate() public static async Task<pfstat> QBValidate()
{ {
// We want to know if we begun a session so we can end it if an // We want to know if we begun a session so we can end it if an
// error happens // error happens
@@ -1750,7 +1749,7 @@ namespace AyaNovaQBI
/// Populate the cached qb data /// Populate the cached qb data
/// billable /// billable
/// </summary> /// </summary>
internal async static Task PopulateQBItemCacheAsync() internal static async Task PopulateQBItemCacheAsync()
{ {
if (_dtQBItems == null) if (_dtQBItems == null)
{ {
@@ -3144,7 +3143,7 @@ namespace AyaNovaQBI
/// <summary> /// <summary>
/// Populate the cached qb terms list data /// Populate the cached qb terms list data
/// </summary> /// </summary>
private async static Task PopulateQBTermsCache() private static async Task PopulateQBTermsCache()
{ {
if (_dtQBTerms == null) if (_dtQBTerms == null)
{ {
@@ -3411,7 +3410,7 @@ namespace AyaNovaQBI
#endregion QB api helper methods end #endregion QB api helper methods end
#region AyaNova cached lists #region AyaNova cached lists
public async static Task PopulateAyaListCache() public static async Task PopulateAyaListCache()
{ {
//Get the cached QB data //Get the cached QB data
Waiting w = new Waiting(); Waiting w = new Waiting();
@@ -5965,7 +5964,7 @@ namespace AyaNovaQBI
#endregion qbi stuff (anything not api) #endregion qbi stuff (anything not api)
#region general utils #region general utils
static public void OpenWebURL(object oUrl) public static void OpenWebURL(object oUrl)
{ {
if (oUrl == null) return; if (oUrl == null) return;