This commit is contained in:
@@ -31,7 +31,7 @@ namespace AyaNova.Biz
|
|||||||
return new WorkOrderBiz(ct, 1, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, AuthorizationRoles.BizAdminFull);
|
return new WorkOrderBiz(ct, 1, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, AuthorizationRoles.BizAdminFull);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Workorder level
|
#region WorkOrder level
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//EXISTS
|
//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
|
//docs say this will not query twice but will recognize the duplicate woitem bit which is required for multiple grandchild collections
|
||||||
var ret =
|
var ret =
|
||||||
await ct.WorkOrder
|
await ct.WorkOrder
|
||||||
.Include(w => w.WorkorderItems)
|
.Include(w => w.WorkOrderItems)
|
||||||
.ThenInclude(wi => wi.WorkorderItemLabors)
|
.ThenInclude(wi => wi.WorkOrderItemLabors)
|
||||||
.Include(w => w.WorkorderItems)
|
.Include(w => w.WorkOrderItems)
|
||||||
.ThenInclude(wi => wi.WorkorderItemParts)
|
.ThenInclude(wi => wi.WorkOrderItemParts)
|
||||||
.SingleOrDefaultAsync(m => m.Id == id);
|
.SingleOrDefaultAsync(m => m.Id == id);
|
||||||
if (logTheGetEvent && ret != null)
|
if (logTheGetEvent && ret != null)
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, id, BizType, AyaEvent.Retrieved), ct);
|
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
|
//docs say this will not query twice but will recognize the duplicate woitem bit which is required for multiple grandchild collections
|
||||||
var ret =
|
var ret =
|
||||||
await ct.WorkOrderItem
|
await ct.WorkOrderItem
|
||||||
.Include(wi => wi.WorkorderItemLabors)
|
.Include(wi => wi.WorkOrderItemLabors)
|
||||||
.Include(wi => wi.WorkorderItemParts)
|
.Include(wi => wi.WorkOrderItemParts)
|
||||||
.SingleOrDefaultAsync(m => m.Id == id);
|
.SingleOrDefaultAsync(m => m.Id == id);
|
||||||
if (logTheGetEvent && ret != null)
|
if (logTheGetEvent && ret != null)
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, id, AyaType.WorkOrderItem, AyaEvent.Retrieved), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, id, AyaType.WorkOrderItem, AyaEvent.Retrieved), ct);
|
||||||
@@ -330,11 +330,11 @@ namespace AyaNova.Biz
|
|||||||
bool isNew = currentObj == null;
|
bool isNew = currentObj == null;
|
||||||
|
|
||||||
//does it have a valid workorder id
|
//does it have a valid workorder id
|
||||||
if (proposedObj.WorkorderId == 0)
|
if (proposedObj.WorkOrderId == 0)
|
||||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, "WorkorderId");
|
AddError(ApiErrorCode.VALIDATION_REQUIRED, "WorkOrderId");
|
||||||
else if (!await WorkOrderExistsAsync(proposedObj.WorkorderId))
|
else if (!await WorkOrderExistsAsync(proposedObj.WorkOrderId))
|
||||||
{
|
{
|
||||||
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "WorkorderId");
|
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "WorkOrderId");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Any form customizations to validate?
|
//Any form customizations to validate?
|
||||||
@@ -435,11 +435,11 @@ namespace AyaNova.Biz
|
|||||||
//run validation and biz rules
|
//run validation and biz rules
|
||||||
bool isNew = currentObj == null;
|
bool isNew = currentObj == null;
|
||||||
|
|
||||||
if (proposedObj.WorkorderItemId == 0)
|
if (proposedObj.WorkOrderItemId == 0)
|
||||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, "WorkorderItemId");
|
AddError(ApiErrorCode.VALIDATION_REQUIRED, "WorkOrderItemId");
|
||||||
else if (!await ItemExistsAsync(proposedObj.WorkorderItemId))
|
else if (!await ItemExistsAsync(proposedObj.WorkOrderItemId))
|
||||||
{
|
{
|
||||||
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "WorkorderItemId");
|
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "WorkOrderItemId");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Any form customizations to validate?
|
//Any form customizations to validate?
|
||||||
@@ -541,11 +541,11 @@ namespace AyaNova.Biz
|
|||||||
//run validation and biz rules
|
//run validation and biz rules
|
||||||
bool isNew = currentObj == null;
|
bool isNew = currentObj == null;
|
||||||
|
|
||||||
if (proposedObj.WorkorderItemId == 0)
|
if (proposedObj.WorkOrderItemId == 0)
|
||||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, "WorkorderItemId");
|
AddError(ApiErrorCode.VALIDATION_REQUIRED, "WorkOrderItemId");
|
||||||
else if (!await ItemExistsAsync(proposedObj.WorkorderItemId))
|
else if (!await ItemExistsAsync(proposedObj.WorkOrderItemId))
|
||||||
{
|
{
|
||||||
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "WorkorderItemId");
|
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "WorkOrderItemId");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Any form customizations to validate?
|
//Any form customizations to validate?
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace AyaNova.Models
|
|||||||
Tags = new List<string>();
|
Tags = new List<string>();
|
||||||
|
|
||||||
//dependents
|
//dependents
|
||||||
WorkorderItems = new List<WorkOrderItem>();
|
WorkOrderItems = new List<WorkOrderItem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
@@ -49,7 +49,7 @@ namespace AyaNova.Models
|
|||||||
public List<string> Tags { get; set; }
|
public List<string> Tags { get; set; }
|
||||||
|
|
||||||
//dependents
|
//dependents
|
||||||
public List<WorkOrderItem> WorkorderItems { get; set; }
|
public List<WorkOrderItem> WorkOrderItems { get; set; }
|
||||||
|
|
||||||
|
|
||||||
// [NotMapped]
|
// [NotMapped]
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace AyaNova.Models
|
|||||||
|
|
||||||
//Principle
|
//Principle
|
||||||
[Required]
|
[Required]
|
||||||
public long WorkorderId { get; set; }
|
public long WorkOrderId { get; set; }
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|
||||||
public class WorkOrderItem
|
public class WorkOrderItem
|
||||||
@@ -29,8 +29,8 @@ namespace AyaNova.Models
|
|||||||
{
|
{
|
||||||
Tags = new List<string>();
|
Tags = new List<string>();
|
||||||
//dependents
|
//dependents
|
||||||
WorkorderItemLabors = new List<WorkOrderItemLabor>();
|
WorkOrderItemLabors = new List<WorkOrderItemLabor>();
|
||||||
WorkorderItemParts = new List<WorkOrderItemPart>();
|
WorkOrderItemParts = new List<WorkOrderItemPart>();
|
||||||
}
|
}
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
public uint ConcurrencyToken { get; set; }
|
public uint ConcurrencyToken { get; set; }
|
||||||
@@ -41,13 +41,13 @@ namespace AyaNova.Models
|
|||||||
|
|
||||||
//Principle
|
//Principle
|
||||||
[Required]
|
[Required]
|
||||||
public long WorkorderId { get; set; }
|
public long WorkOrderId { get; set; }
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public WorkOrder WorkOrder { get; set; }
|
public WorkOrder WorkOrder { get; set; }
|
||||||
|
|
||||||
//dependents
|
//dependents
|
||||||
public List<WorkOrderItemLabor> WorkorderItemLabors { get; set; }
|
public List<WorkOrderItemLabor> WorkOrderItemLabors { get; set; }
|
||||||
public List<WorkOrderItemPart> WorkorderItemParts { get; set; }
|
public List<WorkOrderItemPart> WorkOrderItemParts { get; set; }
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|
||||||
}//eons
|
}//eons
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace AyaNova.Models
|
|||||||
|
|
||||||
//Principle
|
//Principle
|
||||||
[Required]
|
[Required]
|
||||||
public long WorkorderItemId { get; set; }//fk
|
public long WorkOrderItemId { get; set; }//fk
|
||||||
|
|
||||||
[JsonIgnore]//Avoid circular reference when serializing
|
[JsonIgnore]//Avoid circular reference when serializing
|
||||||
public WorkOrderItem WorkOrderItem { get; set; }
|
public WorkOrderItem WorkOrderItem { get; set; }
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace AyaNova.Models
|
|||||||
|
|
||||||
//Principle
|
//Principle
|
||||||
[Required]
|
[Required]
|
||||||
public long WorkorderItemId { get; set; }//fk
|
public long WorkOrderItemId { get; set; }//fk
|
||||||
|
|
||||||
[JsonIgnore]//Avoid circular reference when serializing
|
[JsonIgnore]//Avoid circular reference when serializing
|
||||||
public WorkOrderItem WorkOrderItem { get; set; }
|
public WorkOrderItem WorkOrderItem { get; set; }
|
||||||
|
|||||||
Reference in New Issue
Block a user