This commit is contained in:
2020-05-09 14:09:28 +00:00
parent 035d37854a
commit 17bde3f8e1
5 changed files with 29 additions and 29 deletions

View File

@@ -31,7 +31,7 @@ namespace AyaNova.Biz
return new WorkOrderBiz(ct, 1, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, AuthorizationRoles.BizAdminFull);
}
#region Workorder level
#region WorkOrder level
////////////////////////////////////////////////////////////////////////////////////////////////
//EXISTS
@@ -103,10 +103,10 @@ namespace AyaNova.Biz
//docs say this will not query twice but will recognize the duplicate woitem bit which is required for multiple grandchild collections
var ret =
await ct.WorkOrder
.Include(w => w.WorkorderItems)
.ThenInclude(wi => wi.WorkorderItemLabors)
.Include(w => w.WorkorderItems)
.ThenInclude(wi => wi.WorkorderItemParts)
.Include(w => w.WorkOrderItems)
.ThenInclude(wi => wi.WorkOrderItemLabors)
.Include(w => w.WorkOrderItems)
.ThenInclude(wi => wi.WorkOrderItemParts)
.SingleOrDefaultAsync(m => m.Id == id);
if (logTheGetEvent && ret != null)
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, id, BizType, AyaEvent.Retrieved), ct);
@@ -312,8 +312,8 @@ namespace AyaNova.Biz
//docs say this will not query twice but will recognize the duplicate woitem bit which is required for multiple grandchild collections
var ret =
await ct.WorkOrderItem
.Include(wi => wi.WorkorderItemLabors)
.Include(wi => wi.WorkorderItemParts)
.Include(wi => wi.WorkOrderItemLabors)
.Include(wi => wi.WorkOrderItemParts)
.SingleOrDefaultAsync(m => m.Id == id);
if (logTheGetEvent && ret != null)
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, id, AyaType.WorkOrderItem, AyaEvent.Retrieved), ct);
@@ -330,11 +330,11 @@ namespace AyaNova.Biz
bool isNew = currentObj == null;
//does it have a valid workorder id
if (proposedObj.WorkorderId == 0)
AddError(ApiErrorCode.VALIDATION_REQUIRED, "WorkorderId");
else if (!await WorkOrderExistsAsync(proposedObj.WorkorderId))
if (proposedObj.WorkOrderId == 0)
AddError(ApiErrorCode.VALIDATION_REQUIRED, "WorkOrderId");
else if (!await WorkOrderExistsAsync(proposedObj.WorkOrderId))
{
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "WorkorderId");
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "WorkOrderId");
}
//Any form customizations to validate?
@@ -435,11 +435,11 @@ namespace AyaNova.Biz
//run validation and biz rules
bool isNew = currentObj == null;
if (proposedObj.WorkorderItemId == 0)
AddError(ApiErrorCode.VALIDATION_REQUIRED, "WorkorderItemId");
else if (!await ItemExistsAsync(proposedObj.WorkorderItemId))
if (proposedObj.WorkOrderItemId == 0)
AddError(ApiErrorCode.VALIDATION_REQUIRED, "WorkOrderItemId");
else if (!await ItemExistsAsync(proposedObj.WorkOrderItemId))
{
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "WorkorderItemId");
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "WorkOrderItemId");
}
//Any form customizations to validate?
@@ -541,11 +541,11 @@ namespace AyaNova.Biz
//run validation and biz rules
bool isNew = currentObj == null;
if (proposedObj.WorkorderItemId == 0)
AddError(ApiErrorCode.VALIDATION_REQUIRED, "WorkorderItemId");
else if (!await ItemExistsAsync(proposedObj.WorkorderItemId))
if (proposedObj.WorkOrderItemId == 0)
AddError(ApiErrorCode.VALIDATION_REQUIRED, "WorkOrderItemId");
else if (!await ItemExistsAsync(proposedObj.WorkOrderItemId))
{
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "WorkorderItemId");
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "WorkOrderItemId");
}
//Any form customizations to validate?