This commit is contained in:
2020-01-14 18:52:19 +00:00
parent bf68b276ae
commit d4a5827b65
6 changed files with 98 additions and 52 deletions

View File

@@ -16,7 +16,7 @@ namespace AyaNova.Biz
return;
var FormTemplate = JArray.Parse(formCustom.Template);
var ThisFormCustomFieldsList = ObjectFields.ObjectFields(formCustom.FormKey).Where(x => x.Custom == true).Select(x => x.Key).ToList();
var ThisFormCustomFieldsList = ObjectFields.ObjectFieldsList(formCustom.FormKey).Where(x => x.Custom == true).Select(x => x.Key).ToList();
//If the customFields string is empty then only validation is if any of the fields are required to be filled in
if (!hasCustomData)

View File

@@ -192,7 +192,7 @@ namespace AyaNova.Biz
if ((!PropertyHasErrors("FormKey") && !string.IsNullOrWhiteSpace(inObj.Template)))
{
var ValidCustomFieldTypes = CustomFieldType.ValidCustomFieldTypes;
var ValidFormFields = ObjectFields.ObjectFields(inObj.FormKey);
var ValidFormFields = ObjectFields.ObjectFieldsList(inObj.FormKey);
try
{
//Parse the json, expecting something like this:

View File

@@ -110,7 +110,7 @@ namespace AyaNova.Biz
default:
throw new System.ArgumentOutOfRangeException($"FormAvailableFields: {key} is not a valid form key");
throw new System.ArgumentOutOfRangeException($"ObjectFields: {key} is not a valid form key");
}
return l;
}
@@ -129,7 +129,7 @@ namespace AyaNova.Biz
}//eoc FormAvailableFields
}//eoc ObjectFields
public class ObjectField
{
@@ -158,24 +158,24 @@ namespace AyaNova.Biz
MiniAvailable = true;
}
public ObjectField(string key, string propertyName, bool sharedLTKey = false, bool hideable = true, bool custom = false)
{
Key = key;
Hideable = hideable;
Custom = custom;
SharedLTKey = sharedLTKey;
PropertyName = propertyName;//Only if hideable do they require this as non-hideable ones are automatically validated anyway and this is only required for validation
}
// public ObjectField(string key, string propertyName, bool sharedLTKey = false, bool hideable = true, bool custom = false)
// {
// Key = key;
// Hideable = hideable;
// Custom = custom;
// SharedLTKey = sharedLTKey;
// PropertyName = propertyName;//Only if hideable do they require this as non-hideable ones are automatically validated anyway and this is only required for validation
// }
public ObjectField(string key, bool sharedLTKey = false, bool hideable = true, bool custom = false)
{
Key = key;
Hideable = hideable;
Custom = custom;
SharedLTKey = sharedLTKey;
PropertyName = null;
// public ObjectField(string key, bool sharedLTKey = false, bool hideable = true, bool custom = false)
// {
// Key = key;
// Hideable = hideable;
// Custom = custom;
// SharedLTKey = sharedLTKey;
// PropertyName = null;
}
// }
}

View File

@@ -18,7 +18,7 @@ namespace AyaNova.Biz
//var OuterJson=JObject.Parse(formCustom.Template);
var FormTemplate = JArray.Parse(formCustom.Template);
// var FormTemplate=(JArray)OuterJson["template"];
var FormFields = ObjectFields.ObjectFields(formCustom.FormKey);
var FormFields = ObjectFields.ObjectFieldsList(formCustom.FormKey);
// var ThisFormNormalFieldsList = FormFields.Where(x => x.Custom == false).Select(x => x.Key).ToList();
foreach (JObject jo in FormTemplate)