From 55e58e0697c055113d5701965e0020b862a938d5 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 23 Jun 2022 20:35:37 +0000 Subject: [PATCH] --- AyaNovaQBI/Timestamp.cs | 2 +- AyaNovaQBI/util.cs | 32 +++++++++++++++++++++++--------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/AyaNovaQBI/Timestamp.cs b/AyaNovaQBI/Timestamp.cs index f206003..bb2994b 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(637915168428123684); } } //--** + public static DateTime BuildAt { get { return new DateTime(637915880684659436); } } //--** /// /// The program that time stamped it. /// diff --git a/AyaNovaQBI/util.cs b/AyaNovaQBI/util.cs index 7688304..e89d201 100644 --- a/AyaNovaQBI/util.cs +++ b/AyaNovaQBI/util.cs @@ -505,7 +505,6 @@ namespace AyaNovaQBI return false; } - //BUILD DATE VERSION ALLOWED? if (ALicense.maintenanceExpiration < Timestamp.BuildAt) { @@ -525,11 +524,20 @@ namespace AyaNovaQBI //cache company name and other qb info //PFC - PopulateQBListCache() //PFC - PopulateAyaListCache() - //PFC - integration object check (fetch or create if not present) (Util.integrationObjectCheck()) + //PFC - integration object check (fetch or create if not present) if (!await IntegrationCheck(initErrors)) return false; - //NOTE: probably can make a class for this and use newtonsoft to convert dynamic returned from api call to class object? + + //todo: logger needs to be enabled for integration next in a convenient to call util method and then make it work in UI + await IntegrationLog("Test: boot up"); + for (int x = 0; x < 25; x++) + await IntegrationLog($"Test entry {x}"); + + var res=await GetAsync($"integration/log/{QBIntegration.Id}"); + + //TODO: if QBIntegration.IntegrationData==null then nothing is set yet and it's fresh so trigger the setup stuff + //PFC - Validate settings, create if necessary (Util.ValidateSettings()) and save //PFC - verify integration mapped objects still exist at each end (Util.PreFlightCheck() line 199) //DONE @@ -540,11 +548,13 @@ namespace AyaNovaQBI } - + /// + /// Ensure existance of QBI Integration object + /// + /// + /// public static async Task IntegrationCheck(StringBuilder initErrors) { - //Check for integration object at server, if not there then create one if have sufficient rights - ApiResponse r = null; try { @@ -559,7 +569,6 @@ namespace AyaNovaQBI QBIntegration.Name = "QBI - QuickBooks Desktop integration"; r = await PostAsync("integration", Newtonsoft.Json.JsonConvert.SerializeObject(QBIntegration)); var id = IdFromResponse(r); - } else { @@ -574,8 +583,6 @@ namespace AyaNovaQBI } } - - return true; } catch (Exception ex) @@ -587,6 +594,13 @@ namespace AyaNovaQBI } + } + + public static async Task IntegrationLog(string logLine) + { + + await PostAsync("integration/log", Newtonsoft.Json.JsonConvert.SerializeObject(new NameIdItem { Id=QBIntegration.Id, Name=logLine})); + } #endregion