This commit is contained in:
@@ -42,12 +42,11 @@ namespace AyaNova.Biz
|
|||||||
//Now get the actual property name from the available fields using the lt key
|
//Now get the actual property name from the available fields using the lt key
|
||||||
string RequiredPropertyName = FF.FieldKey;
|
string RequiredPropertyName = FF.FieldKey;
|
||||||
|
|
||||||
//Is it a child collection field?
|
//Is it an indexed collection field?
|
||||||
if (RequiredPropertyName.Contains("."))
|
if (RequiredPropertyName.Contains("."))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
flag errors to include parent e.g in PO item validation error field name could be "Items[3].QuantityReceived" to indicate poitems collection 4th row has error in qtyreceived
|
flag errors to include parent e.g in PO item validation error field name could be "Items[3].QuantityReceived" to indicate poitems collection 4th row has error in qtyreceived
|
||||||
|
|
||||||
Note: collections are logically never more than 3 deep so for example the deepest would be workorder granchildren: e.g. Workorder.Items.Parts and most
|
Note: collections are logically never more than 3 deep so for example the deepest would be workorder granchildren: e.g. Workorder.Items.Parts and most
|
||||||
are two deep however like Po.PoItems.field
|
are two deep however like Po.PoItems.field
|
||||||
for purposes of rule checking they would be flagged by their immediate parent "Items[3].QuantityReceived" for po or for workorder it could be
|
for purposes of rule checking they would be flagged by their immediate parent "Items[3].QuantityReceived" for po or for workorder it could be
|
||||||
@@ -89,38 +88,32 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var item = proposedObject.GetType().GetProperty(FieldKeyParts[0]).GetValue(proposedObject, null);
|
// var item = proposedObject.GetType().GetProperty(FieldKeyParts[0]).GetValue(proposedObject, null);
|
||||||
if (item is System.Collections.IEnumerable)
|
// if (item is System.Collections.IEnumerable)
|
||||||
{
|
// {
|
||||||
foreach (object o in (item as System.Collections.IEnumerable))
|
// foreach (object o in (item as System.Collections.IEnumerable))
|
||||||
{
|
// {
|
||||||
var subitem = o.GetType().GetProperty(FieldKeyParts[1]).GetValue(o, null);
|
// var subitem = o.GetType().GetProperty(FieldKeyParts[1]).GetValue(o, null);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
// reflect over item
|
// // reflect over item
|
||||||
}
|
// }
|
||||||
// object propertyValue = proposedObject.GetType().GetProperty(RequiredPropertyName).GetValue(proposedObject, null);
|
// // object propertyValue = proposedObject.GetType().GetProperty(RequiredPropertyName).GetValue(proposedObject, null);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//It's a simple property on the main object
|
||||||
//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, FldLtKey);//was returning the ltkey in the error but that's not a match to the client end object so instead...
|
|
||||||
biz.AddError(ApiErrorCode.VALIDATION_REQUIRED, RequiredPropertyName);
|
biz.AddError(ApiErrorCode.VALIDATION_REQUIRED, RequiredPropertyName);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static
|
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
}//ens
|
}//ens
|
||||||
|
|||||||
Reference in New Issue
Block a user