This commit is contained in:
2021-04-13 21:38:23 +00:00
parent 113f5ee60d
commit 578d2c1644
2 changed files with 10 additions and 8 deletions

View File

@@ -14,9 +14,11 @@ namespace AyaNova.Biz
{ {
/* /*
############### ###############
todo: Don't all *child items require a transaction to be passed for *any* crud op, i.e. including put and etc?
As they might be called from a parent transaction?
(wait until front end to decide this and do some testing etc grok it out) todo: remember, some users should not even have data sent from the server / scrubbed and not affect updating.
for example a user may not be able to see part costs so that should not even be sent over the wire
workorder will have to handle that as necessary and expect sometimes data is not forthcoming
*/ */
internal class WorkOrderBiz : BizObject, IJobObject, ISearchAbleObject, IReportAbleObject, IExportAbleObject internal class WorkOrderBiz : BizObject, IJobObject, ISearchAbleObject, IReportAbleObject, IExportAbleObject

View File

@@ -41,11 +41,11 @@ namespace AyaNova.Biz
if (HasErrors) if (HasErrors)
return null; return null;
else else
{ {
await ct.WorkOrderStatus.AddAsync(newObject); await ct.WorkOrderStatus.AddAsync(newObject);
await ct.SaveChangesAsync(); await ct.SaveChangesAsync();
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
await SearchIndexAsync(newObject, true); await SearchIndexAsync(newObject, true);
return newObject; return newObject;
} }
} }
@@ -77,7 +77,7 @@ namespace AyaNova.Biz
await ct.WorkOrderStatus.AddAsync(newObject); await ct.WorkOrderStatus.AddAsync(newObject);
await ct.SaveChangesAsync(); await ct.SaveChangesAsync();
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
await SearchIndexAsync(newObject, true); await SearchIndexAsync(newObject, true);
return newObject; return newObject;
} }
@@ -109,7 +109,7 @@ namespace AyaNova.Biz
return null; return null;
} }
await ValidateAsync(putObject, dbObject); await ValidateAsync(putObject, dbObject);
if (HasErrors) return null; if (HasErrors) return null;
ct.Replace(dbObject, putObject); ct.Replace(dbObject, putObject);
@@ -228,7 +228,7 @@ namespace AyaNova.Biz
private async Task ValidateCanDeleteAsync(WorkOrderStatus inObj) private async Task ValidateCanDeleteAsync(WorkOrderStatus inObj)
{ {
//MIGRATE_OUTSTANDING - check workorder records once wo is coded here //MIGRATE_OUTSTANDING - check workorder records once wo is coded here
await Task.CompletedTask;
//Referential integrity //Referential integrity
//FOREIGN KEY CHECKS //FOREIGN KEY CHECKS
// if (await ct.PurchaseOrder.AnyAsync(m => m.WorkOrderStatusId == inObj.Id)) // if (await ct.PurchaseOrder.AnyAsync(m => m.WorkOrderStatusId == inObj.Id))