This commit is contained in:
2022-06-24 21:40:04 +00:00
parent 55ba8ac9ff
commit 0b6ef95c66
2 changed files with 51 additions and 18 deletions

View File

@@ -22,7 +22,7 @@ namespace AyaNovaQBI
/// <remarks> /// <remarks>
/// Do not modify the definition of BuildAt as your changes will be discarded. /// Do not modify the definition of BuildAt as your changes will be discarded.
/// </remarks> /// </remarks>
public static DateTime BuildAt { get { return new DateTime(637916008895872612); } } //--** public static DateTime BuildAt { get { return new DateTime(637916783314883688); } } //--**
/// <summary> /// <summary>
/// The program that time stamped it. /// The program that time stamped it.
/// </summary> /// </summary>

View File

@@ -489,7 +489,20 @@ namespace AyaNovaQBI
//} //}
/*
██╗███╗ ██╗██╗████████╗██╗ █████╗ ██╗ ██╗███████╗███████╗
██║████╗ ██║██║╚══██╔══╝██║██╔══██╗██║ ██║╚══███╔╝██╔════╝
██║██╔██╗ ██║██║ ██║ ██║███████║██║ ██║ ███╔╝ █████╗
██║██║╚██╗██║██║ ██║ ██║██╔══██║██║ ██║ ███╔╝ ██╔══╝
██║██║ ╚████║██║ ██║ ██║██║ ██║███████╗██║███████╗███████╗
╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝╚══════╝╚══════╝
*/
public static async Task<bool> InitializeQBI(StringBuilder initErrors) public static async Task<bool> InitializeQBI(StringBuilder initErrors)
{ {
@@ -890,6 +903,26 @@ namespace AyaNovaQBI
return retvalue; return retvalue;
} }
/// <summary>
/// returns an empty string if passed in value is null or empty
/// else returns Prepend plus passed in string followed by append string
/// </summary>
/// <param name="sPrepend">Text to return to the left of sText</param>
/// <param name="sText">string to return if not null or empty</param>
/// <param name="sAppend">Text to return to the right of sText</param>
/// <returns></returns>
public static string SS(string sPrepend, string sText, string sAppend)
{
if (sText == null)
return "";
if (sText == "")
return "";
return sPrepend + sText + sAppend;
}
#endregion qb specific utils #endregion qb specific utils
#region QB API helper methods/ attributes/cached lists #region QB API helper methods/ attributes/cached lists
@@ -913,13 +946,13 @@ namespace AyaNovaQBI
w.Step = "Classes"; w.Step = "Classes";
PopulateQBClassCache(); await PopulateQBClassCacheAsync();
w.Step = "Vendors"; w.Step = "Vendors";
PopulateQBVendorCache(); await PopulateQBVendorCacheAsync();
w.Step = "Customers"; w.Step = "Customers";
PopulateQBClientCache(); await PopulateQBClientCacheAsync();
w.Step = "Items"; w.Step = "Items";
await PopulateQBItemCache(); await PopulateQBItemCache();
@@ -927,16 +960,16 @@ namespace AyaNovaQBI
if (!(QVersion < 3))//qbXML 3.0 or higher (QB 2004 any country or newer) if (!(QVersion < 3))//qbXML 3.0 or higher (QB 2004 any country or newer)
{ {
w.Step = "Invoice templates"; w.Step = "Invoice templates";
PopulateQBInvoiceTemplates(); await PopulateQBInvoiceTemplatesAsync();
} }
//case 632 //case 632
w.Step = "Accounts"; w.Step = "Accounts";
PopulateQBAccountCache(); await PopulateQBAccountCacheAsync();
//case 519 //case 519
w.Step = "Terms"; w.Step = "Terms";
PopulateQBTermsCache(); await PopulateQBTermsCache();
w.Close(); w.Close();
} }
@@ -1402,7 +1435,7 @@ namespace AyaNovaQBI
/// Populate the cached qb data /// Populate the cached qb data
/// billable /// billable
/// </summary> /// </summary>
private static void PopulateQBClassCache() private static async Task PopulateQBClassCacheAsync()
{ {
if (_dtQBClasses == null) if (_dtQBClasses == null)
{ {
@@ -1535,7 +1568,7 @@ namespace AyaNovaQBI
/// Populate the cached qb data /// Populate the cached qb data
/// Invoice templates /// Invoice templates
/// </summary> /// </summary>
private static void PopulateQBInvoiceTemplates() private static async Task PopulateQBInvoiceTemplatesAsync()
{ {
if (_dtQBInvoiceTemplates == null) if (_dtQBInvoiceTemplates == null)
{ {
@@ -1657,7 +1690,7 @@ namespace AyaNovaQBI
#region QuickBooks "Customers" #region QuickBooks "Customers"
private static string GetQBCustomerEditSequence(string customerid) private static async Task<string> GetQBCustomerEditSequenceAsync(string customerid)
{ {
string strEditSequence = ""; string strEditSequence = "";
@@ -1776,7 +1809,7 @@ namespace AyaNovaQBI
/// Populate the cached qb data /// Populate the cached qb data
/// of customers / clients /// of customers / clients
/// </summary> /// </summary>
private static void PopulateQBClientCache() private static async Task PopulateQBClientCacheAsync()
{ {
if (_dtQBClients == null) if (_dtQBClients == null)
{ {
@@ -1945,12 +1978,12 @@ namespace AyaNovaQBI
//the first line //the first line
//Assumption: First line always has *something* in it //Assumption: First line always has *something* in it
b.DeliveryAddress = ProcessQBString(a.Addr1); b.DeliveryAddress = ProcessQBString(a.Addr1);
b.DeliveryAddress += AyaBizUtils.SS("\r\n", ProcessQBString(a.Addr2), ""); b.DeliveryAddress += SS("\r\n", ProcessQBString(a.Addr2), "");
b.DeliveryAddress += AyaBizUtils.SS("\r\n", ProcessQBString(a.Addr3), ""); b.DeliveryAddress += SS("\r\n", ProcessQBString(a.Addr3), "");
//Address line 4 is a qbxml 2 or higher feature //Address line 4 is a qbxml 2 or higher feature
if (QVersion > 1.1) if (QVersion > 1.1)
b.DeliveryAddress += AyaBizUtils.SS("\r\n", ProcessQBString(a.Addr4), ""); b.DeliveryAddress += SS("\r\n", ProcessQBString(a.Addr4), "");
//Country specific: //Country specific:
b.City = ProcessQBString(a.City); b.City = ProcessQBString(a.City);
@@ -2006,7 +2039,7 @@ namespace AyaNovaQBI
/// Populate the cached qb data /// Populate the cached qb data
/// of Vendors /// of Vendors
/// </summary> /// </summary>
private static void PopulateQBVendorCache() private static async Task PopulateQBVendorCacheAsync()
{ {
if (_dtQBVendors == null) if (_dtQBVendors == null)
{ {
@@ -2173,7 +2206,7 @@ namespace AyaNovaQBI
/// <summary> /// <summary>
/// Populate the cached qb account list data /// Populate the cached qb account list data
/// </summary> /// </summary>
private static void PopulateQBAccountCache() private static async Task PopulateQBAccountCacheAsync()
{ {
if (_dtQBAccounts == null) if (_dtQBAccounts == null)
{ {
@@ -2267,7 +2300,7 @@ namespace AyaNovaQBI
} }
catch (Exception ex) catch (Exception ex)
{ {
await IntegrationLog("PopulateQBAccounts: Failed with exception:" + ex.Message); await IntegrationLog($"PopulateQBAccounts: Failed with exception:{ex.Message}");
if (booSessionBegun) if (booSessionBegun)
{ {
sessionManager.EndSession(); sessionManager.EndSession();
@@ -2304,7 +2337,7 @@ namespace AyaNovaQBI
/// <summary> /// <summary>
/// Populate the cached qb terms list data /// Populate the cached qb terms list data
/// </summary> /// </summary>
private async static void PopulateQBTermsCache() private async static Task PopulateQBTermsCache()
{ {
if (_dtQBTerms == null) if (_dtQBTerms == null)
{ {