This commit is contained in:
2021-03-16 22:47:47 +00:00
parent c7eeb60ff1
commit 7cd7144426
2 changed files with 5 additions and 4 deletions

View File

@@ -29,7 +29,8 @@ namespace AyaNova.Biz
VALIDATION_STARTDATE_AFTER_ENDDATE = 2207, VALIDATION_STARTDATE_AFTER_ENDDATE = 2207,
VALIDATION_REFERENTIAL_INTEGRITY = 2208, VALIDATION_REFERENTIAL_INTEGRITY = 2208,
VALIDATION_NOT_CHANGEABLE = 2209, 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 | | 2000 | API closed - Server is running but access to the API has been closed to all users |

View File

@@ -55,7 +55,7 @@ namespace AyaNova.Biz
{ {
var fieldValue = ChildObject.GetType().GetProperty(FieldKeyParts[1]).GetValue(ChildObject, null); var fieldValue = ChildObject.GetType().GetProperty(FieldKeyParts[1]).GetValue(ChildObject, null);
if (fieldValue == null || string.IsNullOrWhiteSpace(fieldValue.ToString())) 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++; index++;
} }
} }
@@ -73,7 +73,7 @@ namespace AyaNova.Biz
{ {
var fieldValue = ChildObject.GetType().GetProperty(FieldKeyParts[1]).GetValue(ChildObject, null); var fieldValue = ChildObject.GetType().GetProperty(FieldKeyParts[1]).GetValue(ChildObject, null);
if (fieldValue == null || string.IsNullOrWhiteSpace(fieldValue.ToString())) 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++; ParentIndex++;
} }
GrandParentIndex++; GrandParentIndex++;
@@ -86,7 +86,7 @@ namespace AyaNova.Biz
//use reflection to get the underlying value from the proposed object to be saved //use reflection to get the underlying value from the proposed object to be saved
object propertyValue = proposedObject.GetType().GetProperty(RequiredPropertyName).GetValue(proposedObject, null); object propertyValue = proposedObject.GetType().GetProperty(RequiredPropertyName).GetValue(proposedObject, null);
if (propertyValue == null || string.IsNullOrWhiteSpace(propertyValue.ToString())) if (propertyValue == null || string.IsNullOrWhiteSpace(propertyValue.ToString()))
biz.AddError(ApiErrorCode.VALIDATION_REQUIRED, RequiredPropertyName); biz.AddError(ApiErrorCode.VALIDATION_CUSTOM_REQUIRED_EMPTY, RequiredPropertyName);
} }
} }
} }