This commit is contained in:
2021-05-17 21:41:34 +00:00
parent dc3e7df2a6
commit 8354193584
2 changed files with 15 additions and 11 deletions

2
.vscode/launch.json vendored
View File

@@ -53,7 +53,7 @@
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
"AYANOVA_SERVER_TEST_MODE": "true",
"AYANOVA_SERVER_TEST_MODE": "false",
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"

View File

@@ -12,7 +12,7 @@ using System.Collections.Generic;
namespace AyaNova.Biz
{
internal class WorkOrderBiz : BizObject, IJobObject, ISearchAbleObject, IReportAbleObject, IExportAbleObject
{
@@ -83,7 +83,7 @@ namespace AyaNova.Biz
await ProcessChangeOfContractAsync(newObject.Id);
}
await WorkOrderPopulateVizFields(newObject, true);//doing this here ahead of notification because notification may require the viz field lookup anyway and afaict no harm in it
await WorkOrderHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
return newObject;
}
@@ -140,6 +140,7 @@ namespace AyaNova.Biz
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
await WorkOrderSearchIndexAsync(newObject, true);
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
await WorkOrderPopulateVizFields(newObject, false);//doing this here ahead of notification because notification may require the viz field lookup anyway and afaict no harm in it
await WorkOrderHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
return newObject;
}
@@ -185,7 +186,7 @@ namespace AyaNova.Biz
ret.IsDirty = false;
if (populateDisplayFields)
await WorkOrderPopulateVizFields(ret);
await WorkOrderPopulateVizFields(ret, false);
if (logTheGetEvent && ret != null)
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, id, BizType, AyaEvent.Retrieved), ct);
@@ -250,6 +251,7 @@ namespace AyaNova.Biz
await GetCurrentContractFromContractIdAsync(newContractId);
await ProcessChangeOfContractAsync(putObject.Id);
}
await WorkOrderPopulateVizFields(putObject, true);//doing this here ahead of notification because notification may require the viz field lookup anyway and afaict no harm in it
await WorkOrderHandlePotentialNotificationEvent(AyaEvent.Modified, putObject, dbObject);
return putObject;
}
@@ -396,7 +398,7 @@ namespace AyaNova.Biz
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, workOrderId, BizType, AyaEvent.Modified), ct);
await GetCurrentContractFromContractIdAsync(newContractId);
var updatedWorkOrder = await ProcessChangeOfContractAsync(workOrderId);
await WorkOrderPopulateVizFields(updatedWorkOrder);
await WorkOrderPopulateVizFields(updatedWorkOrder, false);
return updatedWorkOrder;//return entire workorder
}
@@ -717,13 +719,15 @@ namespace AyaNova.Biz
////////////////////////////////////////////////////////////////////////////////////////////////
//VIZ POPULATE
//
private async Task WorkOrderPopulateVizFields(WorkOrder o)
private async Task WorkOrderPopulateVizFields(WorkOrder o, bool headerOnly)
{
await Task.CompletedTask;
foreach (var v in o.States)
await StatePopulateVizFields(v);
foreach (var v in o.Items)
await ItemPopulateVizFields(v);
if (!headerOnly)
{
foreach (var v in o.States)
await StatePopulateVizFields(v);
foreach (var v in o.Items)
await ItemPopulateVizFields(v);
}
//popup Alert notes
//Customer notes first then others below