From 0b6ef95c666980fa57dfcfa8ac00fb00a3eecd57 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 24 Jun 2022 21:40:04 +0000 Subject: [PATCH] --- AyaNovaQBI/Timestamp.cs | 2 +- AyaNovaQBI/util.cs | 67 ++++++++++++++++++++++++++++++----------- 2 files changed, 51 insertions(+), 18 deletions(-) diff --git a/AyaNovaQBI/Timestamp.cs b/AyaNovaQBI/Timestamp.cs index 8a7a1dd..7e375f0 100644 --- a/AyaNovaQBI/Timestamp.cs +++ b/AyaNovaQBI/Timestamp.cs @@ -22,7 +22,7 @@ namespace AyaNovaQBI /// /// Do not modify the definition of BuildAt as your changes will be discarded. /// - public static DateTime BuildAt { get { return new DateTime(637916008895872612); } } //--** + public static DateTime BuildAt { get { return new DateTime(637916783314883688); } } //--** /// /// The program that time stamped it. /// diff --git a/AyaNovaQBI/util.cs b/AyaNovaQBI/util.cs index f6b1240..a3929f8 100644 --- a/AyaNovaQBI/util.cs +++ b/AyaNovaQBI/util.cs @@ -489,7 +489,20 @@ namespace AyaNovaQBI //} + /* + + + ██╗███╗ ██╗██╗████████╗██╗ █████╗ ██╗ ██╗███████╗███████╗ + ██║████╗ ██║██║╚══██╔══╝██║██╔══██╗██║ ██║╚══███╔╝██╔════╝ + ██║██╔██╗ ██║██║ ██║ ██║███████║██║ ██║ ███╔╝ █████╗ + ██║██║╚██╗██║██║ ██║ ██║██╔══██║██║ ██║ ███╔╝ ██╔══╝ + ██║██║ ╚████║██║ ██║ ██║██║ ██║███████╗██║███████╗███████╗ + ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝╚══════╝╚══════╝ + + + + */ public static async Task InitializeQBI(StringBuilder initErrors) { @@ -890,6 +903,26 @@ namespace AyaNovaQBI return retvalue; } + /// + /// returns an empty string if passed in value is null or empty + /// else returns Prepend plus passed in string followed by append string + /// + /// Text to return to the left of sText + /// string to return if not null or empty + /// Text to return to the right of sText + /// + 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 #region QB API helper methods/ attributes/cached lists @@ -913,13 +946,13 @@ namespace AyaNovaQBI w.Step = "Classes"; - PopulateQBClassCache(); + await PopulateQBClassCacheAsync(); w.Step = "Vendors"; - PopulateQBVendorCache(); + await PopulateQBVendorCacheAsync(); w.Step = "Customers"; - PopulateQBClientCache(); + await PopulateQBClientCacheAsync(); w.Step = "Items"; await PopulateQBItemCache(); @@ -927,16 +960,16 @@ namespace AyaNovaQBI if (!(QVersion < 3))//qbXML 3.0 or higher (QB 2004 any country or newer) { w.Step = "Invoice templates"; - PopulateQBInvoiceTemplates(); + await PopulateQBInvoiceTemplatesAsync(); } //case 632 w.Step = "Accounts"; - PopulateQBAccountCache(); + await PopulateQBAccountCacheAsync(); //case 519 w.Step = "Terms"; - PopulateQBTermsCache(); + await PopulateQBTermsCache(); w.Close(); } @@ -1402,7 +1435,7 @@ namespace AyaNovaQBI /// Populate the cached qb data /// billable /// - private static void PopulateQBClassCache() + private static async Task PopulateQBClassCacheAsync() { if (_dtQBClasses == null) { @@ -1535,7 +1568,7 @@ namespace AyaNovaQBI /// Populate the cached qb data /// Invoice templates /// - private static void PopulateQBInvoiceTemplates() + private static async Task PopulateQBInvoiceTemplatesAsync() { if (_dtQBInvoiceTemplates == null) { @@ -1657,7 +1690,7 @@ namespace AyaNovaQBI #region QuickBooks "Customers" - private static string GetQBCustomerEditSequence(string customerid) + private static async Task GetQBCustomerEditSequenceAsync(string customerid) { string strEditSequence = ""; @@ -1776,7 +1809,7 @@ namespace AyaNovaQBI /// Populate the cached qb data /// of customers / clients /// - private static void PopulateQBClientCache() + private static async Task PopulateQBClientCacheAsync() { if (_dtQBClients == null) { @@ -1945,12 +1978,12 @@ namespace AyaNovaQBI //the first line //Assumption: First line always has *something* in it b.DeliveryAddress = ProcessQBString(a.Addr1); - b.DeliveryAddress += AyaBizUtils.SS("\r\n", ProcessQBString(a.Addr2), ""); - b.DeliveryAddress += AyaBizUtils.SS("\r\n", ProcessQBString(a.Addr3), ""); + b.DeliveryAddress += SS("\r\n", ProcessQBString(a.Addr2), ""); + b.DeliveryAddress += SS("\r\n", ProcessQBString(a.Addr3), ""); //Address line 4 is a qbxml 2 or higher feature if (QVersion > 1.1) - b.DeliveryAddress += AyaBizUtils.SS("\r\n", ProcessQBString(a.Addr4), ""); + b.DeliveryAddress += SS("\r\n", ProcessQBString(a.Addr4), ""); //Country specific: b.City = ProcessQBString(a.City); @@ -2006,7 +2039,7 @@ namespace AyaNovaQBI /// Populate the cached qb data /// of Vendors /// - private static void PopulateQBVendorCache() + private static async Task PopulateQBVendorCacheAsync() { if (_dtQBVendors == null) { @@ -2173,7 +2206,7 @@ namespace AyaNovaQBI /// /// Populate the cached qb account list data /// - private static void PopulateQBAccountCache() + private static async Task PopulateQBAccountCacheAsync() { if (_dtQBAccounts == null) { @@ -2267,7 +2300,7 @@ namespace AyaNovaQBI } catch (Exception ex) { - await IntegrationLog("PopulateQBAccounts: Failed with exception:" + ex.Message); + await IntegrationLog($"PopulateQBAccounts: Failed with exception:{ex.Message}"); if (booSessionBegun) { sessionManager.EndSession(); @@ -2304,7 +2337,7 @@ namespace AyaNovaQBI /// /// Populate the cached qb terms list data /// - private async static void PopulateQBTermsCache() + private async static Task PopulateQBTermsCache() { if (_dtQBTerms == null) {