This commit is contained in:
@@ -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 |
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user