This commit is contained in:
2022-06-23 20:35:37 +00:00
parent 4b196e05cb
commit 55e58e0697
2 changed files with 24 additions and 10 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(637915168428123684); } } //--** public static DateTime BuildAt { get { return new DateTime(637915880684659436); } } //--**
/// <summary> /// <summary>
/// The program that time stamped it. /// The program that time stamped it.
/// </summary> /// </summary>

View File

@@ -505,7 +505,6 @@ namespace AyaNovaQBI
return false; return false;
} }
//BUILD DATE VERSION ALLOWED? //BUILD DATE VERSION ALLOWED?
if (ALicense.maintenanceExpiration < Timestamp.BuildAt) if (ALicense.maintenanceExpiration < Timestamp.BuildAt)
{ {
@@ -525,11 +524,20 @@ namespace AyaNovaQBI
//cache company name and other qb info //cache company name and other qb info
//PFC - PopulateQBListCache() //PFC - PopulateQBListCache()
//PFC - PopulateAyaListCache() //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)) if (!await IntegrationCheck(initErrors))
return false; 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 - Validate settings, create if necessary (Util.ValidateSettings()) and save
//PFC - verify integration mapped objects still exist at each end (Util.PreFlightCheck() line 199) //PFC - verify integration mapped objects still exist at each end (Util.PreFlightCheck() line 199)
//DONE //DONE
@@ -540,11 +548,13 @@ namespace AyaNovaQBI
} }
/// <summary>
/// Ensure existance of QBI Integration object
/// </summary>
/// <param name="initErrors"></param>
/// <returns></returns>
public static async Task<bool> IntegrationCheck(StringBuilder initErrors) public static async Task<bool> IntegrationCheck(StringBuilder initErrors)
{ {
//Check for integration object at server, if not there then create one if have sufficient rights
ApiResponse r = null; ApiResponse r = null;
try try
{ {
@@ -559,7 +569,6 @@ namespace AyaNovaQBI
QBIntegration.Name = "QBI - QuickBooks Desktop integration"; QBIntegration.Name = "QBI - QuickBooks Desktop integration";
r = await PostAsync("integration", Newtonsoft.Json.JsonConvert.SerializeObject(QBIntegration)); r = await PostAsync("integration", Newtonsoft.Json.JsonConvert.SerializeObject(QBIntegration));
var id = IdFromResponse(r); var id = IdFromResponse(r);
} }
else else
{ {
@@ -574,8 +583,6 @@ namespace AyaNovaQBI
} }
} }
return true; return true;
} }
catch (Exception ex) 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 #endregion