From 7cd71444268ea9f55e6487b0c1f05048b9b17b89 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 16 Mar 2021 22:47:47 +0000 Subject: [PATCH] --- server/AyaNova/biz/ApiErrorCode.cs | 3 ++- server/AyaNova/biz/RequiredFieldsValidator.cs | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/server/AyaNova/biz/ApiErrorCode.cs b/server/AyaNova/biz/ApiErrorCode.cs index ffc09957..51fa4f5a 100644 --- a/server/AyaNova/biz/ApiErrorCode.cs +++ b/server/AyaNova/biz/ApiErrorCode.cs @@ -29,7 +29,8 @@ namespace AyaNova.Biz VALIDATION_STARTDATE_AFTER_ENDDATE = 2207, VALIDATION_REFERENTIAL_INTEGRITY = 2208, VALIDATION_NOT_CHANGEABLE = 2209, - CHILD_OBJECT_ERROR = 2210 + CHILD_OBJECT_ERROR = 2210, + VALIDATION_REQUIRED_CUSTOM = 2211 /* | 2000 | API closed - Server is running but access to the API has been closed to all users | diff --git a/server/AyaNova/biz/RequiredFieldsValidator.cs b/server/AyaNova/biz/RequiredFieldsValidator.cs index 1ee6b729..8bbd1c62 100644 --- a/server/AyaNova/biz/RequiredFieldsValidator.cs +++ b/server/AyaNova/biz/RequiredFieldsValidator.cs @@ -55,7 +55,7 @@ namespace AyaNova.Biz { var fieldValue = ChildObject.GetType().GetProperty(FieldKeyParts[1]).GetValue(ChildObject, null); if (fieldValue == null || string.IsNullOrWhiteSpace(fieldValue.ToString())) - biz.AddError(ApiErrorCode.VALIDATION_REQUIRED, $"{FieldKeyParts[0]}[{index}].{FieldKeyParts[1]}"); + biz.AddError(ApiErrorCode.VALIDATION_CUSTOM_REQUIRED_EMPTY, $"{FieldKeyParts[0]}[{index}].{FieldKeyParts[1]}"); index++; } } @@ -73,7 +73,7 @@ namespace AyaNova.Biz { var fieldValue = ChildObject.GetType().GetProperty(FieldKeyParts[1]).GetValue(ChildObject, null); if (fieldValue == null || string.IsNullOrWhiteSpace(fieldValue.ToString())) - biz.AddError(ApiErrorCode.VALIDATION_REQUIRED, $"{FieldKeyParts[0]}[{GrandParentIndex}].{FieldKeyParts[1]}[{ParentIndex}].{FieldKeyParts[2]}"); + biz.AddError(ApiErrorCode.VALIDATION_CUSTOM_REQUIRED_EMPTY, $"{FieldKeyParts[0]}[{GrandParentIndex}].{FieldKeyParts[1]}[{ParentIndex}].{FieldKeyParts[2]}"); ParentIndex++; } GrandParentIndex++; @@ -86,7 +86,7 @@ namespace AyaNova.Biz //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_REQUIRED, RequiredPropertyName); + biz.AddError(ApiErrorCode.VALIDATION_CUSTOM_REQUIRED_EMPTY, RequiredPropertyName); } } }