This commit is contained in:
2022-01-23 20:14:23 +00:00
parent c7d85751dc
commit 55361b04bc
2 changed files with 18 additions and 4 deletions

View File

@@ -862,8 +862,8 @@ namespace AyaNova.Biz
l.Add(new FormField { TKey = "Tags", FieldKey = "WorkOrderItemTags", TKeySection = "WorkOrderItem", ModelProperty="Tags" });
l.Add(new FormField { TKey = "Wiki", FieldKey = "WorkOrderItemWiki", TKeySection = "WorkOrderItem", ModelProperty="Wiki" });
l.Add(new FormField { TKey = "Attachments", FieldKey = "WorkOrderItemAttachments", TKeySection = "WorkOrderItem" });
l.Add(new FormField { TKey = "WorkOrderItemWorkOrderStatusID", FieldKey = "WorkOrderItemWorkOrderStatusID", TKeySection = "WorkOrderItem" });
l.Add(new FormField { TKey = "WorkOrderItemPriorityID", FieldKey = "WorkOrderItemPriorityID", TKeySection = "WorkOrderItem" });
l.Add(new FormField { TKey = "WorkOrderItemWorkOrderStatusID", FieldKey = "WorkOrderItemStatusId", TKeySection = "WorkOrderItem" });
l.Add(new FormField { TKey = "WorkOrderItemPriorityID", FieldKey = "WorkOrderItemPriorityId", TKeySection = "WorkOrderItem" });
l.Add(new FormField { TKey = "WorkOrderItemRequestDate", FieldKey = "RequestDate", TKeySection = "WorkOrderItem" });
l.Add(new FormField { TKey = "WorkOrderItemWarrantyService", FieldKey = "WorkOrderItemWarrantyService", TKeySection = "WorkOrderItem" });
l.Add(new FormField { TKey = "WorkOrderItemCustom1", FieldKey = "WorkOrderItemCustom1", IsCustomField = true, TKeySection = "WorkOrderItem" });

View File

@@ -88,8 +88,22 @@ namespace AyaNova.Biz
//It's a simple property on the main object
//use reflection to get the underlying value from the proposed object to be saved
object propertyValue = proposedObject.GetType().GetProperty(RequiredPropertyName).GetValue(proposedObject, null);
if (propertyValue == null || string.IsNullOrWhiteSpace(propertyValue.ToString()))
biz.AddError(ApiErrorCode.VALIDATION_CUSTOM_REQUIRED_EMPTY, RequiredPropertyName);
if (propertyValue == null)
biz.AddError(ApiErrorCode.VALIDATION_CUSTOM_REQUIRED_EMPTY, FF.FieldKey);
else
{
if (RequiredPropertyName == "Tags")
{
if (((System.Collections.Generic.List<string>)propertyValue).Count == 0)
{
biz.AddError(ApiErrorCode.VALIDATION_CUSTOM_REQUIRED_EMPTY, FF.FieldKey);
}
}
else
if (string.IsNullOrWhiteSpace(propertyValue.ToString()))
biz.AddError(ApiErrorCode.VALIDATION_CUSTOM_REQUIRED_EMPTY, FF.FieldKey);
}
}
}
}