This commit is contained in:
2022-07-10 22:29:39 +00:00
parent 0f3ad85a45
commit 9bd86523a9
2 changed files with 111 additions and 79 deletions

View File

@@ -3604,11 +3604,17 @@ namespace AyaNovaQBI
public static string CrackException(Exception ex)
{
while (ex.InnerException != null)
StringBuilder sb = new StringBuilder();
sb.AppendLine($"Exception {ex.Message}");
if (ex.InnerException != null)
{
ex = ex.InnerException;
while (ex.InnerException != null)
{
ex = ex.InnerException;
sb.AppendLine($"Inner Exception: {ex.Message}");
}
}
return ex.Message + "\r\n-------TRACE------\r\n" + ex.StackTrace;
return $"{sb.ToString()}\r\n-------TRACE------\r\n{ex.StackTrace}";
}
@@ -3616,7 +3622,7 @@ namespace AyaNovaQBI
public static async Task CrackDisplayAndIntegrationLogException(Exception ex, string methodText = "n/a", string extraText = "n/a")
{
string message = "Exception error\r\nMethod: " + methodText + "\r\nExtra: " + extraText + "\r\n Error:" + CrackException(ex);
string message = $"Exception error\r\nMethod: {methodText}\r\nExtra: {extraText}\r\n Error:{CrackException(ex)}";
//Log it so we have it forever in the log
await IntegrationLog(message);
//display it to the user
@@ -5679,6 +5685,8 @@ namespace AyaNovaQBI
public decimal AyaPrice { get; set; }
public decimal QBPrice { get; set; }
public long WorkOrderItemPartId { get; set; }
public long WorkOrderItemId { get; set; }
public long WorkOrderId { get; set; }
public string QBListID { get; set; }
public string Fix { get; set; }
@@ -5716,6 +5724,8 @@ namespace AyaNovaQBI
AddMisMatch(AyaClientList.FirstOrDefault(z => z.Id == w.CustomerId).Name,
w.CustomerId,
AyaType.Customer,
0,
0,
MisMatchReason.NotLinkedToQB,
MisMatches);
}
@@ -5741,6 +5751,8 @@ namespace AyaNovaQBI
AddMisMatch(AyaServiceRateList.FirstOrDefault(z => z.Id == wl.ServiceRateId).Name,
(long)wl.ServiceRateId,
AyaType.ServiceRate,
wi.WorkOrderId,
wi.Id,
MisMatchReason.NotLinkedToQB,
MisMatches);
}
@@ -5765,6 +5777,8 @@ namespace AyaNovaQBI
AddMisMatch(AyaTravelRateList.FirstOrDefault(z => z.Id == wt.TravelRateId).Name,
(long)wt.TravelRateId,
AyaType.TravelRate,
wi.WorkOrderId,
wi.Id,
MisMatchReason.NotLinkedToQB,
MisMatches); ;
}
@@ -5785,6 +5799,8 @@ namespace AyaNovaQBI
AddMisMatch(AyaPartList.FirstOrDefault(z => z.Id == wp.PartId).Name,
wp.PartId,
AyaType.Part,
wi.WorkOrderId,
wi.Id,
MisMatchReason.NotLinkedToQB,
MisMatches);
@@ -5821,6 +5837,8 @@ namespace AyaNovaQBI
AddMisMatch($"WO: {w.Serial}{disco} Part: {ayaPartRecord.Name}",
wp.PartId,
AyaType.Part,
wi.WorkOrderId,
wi.Id,
MisMatchReason.PriceDifferent,
MisMatches,
qbPrice,
@@ -5851,6 +5869,8 @@ namespace AyaNovaQBI
AddMisMatch("Outside services - can't be billed as not yet mapped to a QB Charge item\r\nSet in Tools->Preferences",
0,
AyaType.WorkOrderItemOutsideService,
wi.WorkOrderId,
wi.Id,
MisMatchReason.NotLinkedToQB,
MisMatches);
@@ -5881,6 +5901,8 @@ namespace AyaNovaQBI
AddMisMatch("Workorder item loan - can't be billed as not yet mapped to a QB Charge item\r\nSet in Tools->Preferences",
0,
AyaType.WorkOrderItemLoan,
wi.WorkOrderId,
wi.Id,
MisMatchReason.NotLinkedToQB,
MisMatches);
break;
@@ -5908,6 +5930,8 @@ namespace AyaNovaQBI
AddMisMatch("Workorder item expense - can't be billed as not yet mapped to a QB Charge item\r\nSet in Tools->Preferences",
0,
AyaType.WorkOrderItemExpense,
wi.WorkOrderId,
wi.Id,
MisMatchReason.NotLinkedToQB,
MisMatches);
break;
@@ -5929,6 +5953,8 @@ namespace AyaNovaQBI
AddMisMatch("WO: " + w.Serial + " - Nothing chargeable on it, will not be invoiced",
0,
AyaType.NoType,
0,
0,
MisMatchReason.NothingToInvoice,
MisMatches);
@@ -5941,14 +5967,16 @@ namespace AyaNovaQBI
private static void AddMisMatch(string Name, long ObjectId, AyaType ObjectType, MisMatchReason Reason, List<MisMatch> Mismatches)
private static void AddMisMatch(string Name, long ObjectId, AyaType ObjectType, long WorkOrderId, long WorkOrderItemId, MisMatchReason Reason, List<MisMatch> Mismatches)
{
AddMisMatch(Name, ObjectId, ObjectType, Reason, Mismatches, 0m, 0m, 0, "");
AddMisMatch(Name, ObjectId, ObjectType, WorkOrderId, WorkOrderItemId, Reason, Mismatches, 0m, 0m, 0, "");
}
private static void AddMisMatch(string Name,
long ObjectId,
AyaType ObjectType,
long WorkOrderId,
long WorkOrderItemId,
MisMatchReason Reason,
List<MisMatch> Mismatches,
decimal QBPrice,
@@ -6011,6 +6039,8 @@ namespace AyaNovaQBI
AyaPrice = AyaPrice,
QBPrice = QBPrice,
WorkOrderItemPartId = WorkOrderItemPartId,
WorkOrderItemId=WorkOrderItemId,
WorkOrderId=WorkOrderId,
QBListID = QBListID,
Fix = theFix
});