This commit is contained in:
2020-01-17 19:59:27 +00:00
parent 9a64b8310e
commit 8c7d5119a8
13 changed files with 96 additions and 96 deletions

View File

@@ -145,7 +145,7 @@ namespace AyaNova.Api.Controllers
if (!ModelState.IsValid) if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState)); return BadRequest(new ApiErrorResponse(ModelState));
return Ok(ApiOkResponse.Response(ObjectFields.AvailableObjectKeys, true)); return Ok(ApiOkResponse.Response(AyaObjectFields.AvailableObjectKeys, true));
} }

View File

@@ -59,9 +59,9 @@ namespace AyaNova.Api.Controllers
if (!ModelState.IsValid) if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState)); return BadRequest(new ApiErrorResponse(ModelState));
if (ObjectFields.IsValidObjectKey(objectKey)) if (AyaObjectFields.IsValidObjectKey(objectKey))
{ {
return Ok(ApiOkResponse.Response(ObjectFields.ObjectFieldsList(objectKey), true)); return Ok(ApiOkResponse.Response(AyaObjectFields.ObjectFieldsList(objectKey), true));
} }
else else
{ {

View File

@@ -16,7 +16,7 @@ namespace AyaNova.Biz
return; return;
var FormTemplate = JArray.Parse(formCustom.Template); var FormTemplate = JArray.Parse(formCustom.Template);
var ThisFormCustomFieldsList = ObjectFields.ObjectFieldsList(formCustom.FormKey).Where(x => x.IsCustomField == true).Select(x => x.LtKey).ToList(); var ThisFormCustomFieldsList = AyaObjectFields.ObjectFieldsList(formCustom.FormKey).Where(x => x.IsCustomField == true).Select(x => x.LtKey).ToList();
//If the customFields string is empty then only validation is if any of the fields are required to be filled in //If the customFields string is empty then only validation is if any of the fields are required to be filled in
if (!hasCustomData) if (!hasCustomData)
@@ -52,7 +52,7 @@ namespace AyaNova.Biz
{ {
//Translate the LT field key to the actual customFieldData field key //Translate the LT field key to the actual customFieldData field key
var InternalCustomFieldName = ObjectFields.TranslateLTCustomFieldToInternalCustomFieldName(iFldKey); var InternalCustomFieldName = AyaObjectFields.TranslateLTCustomFieldToInternalCustomFieldName(iFldKey);
//Check if it's set to required //Check if it's set to required
var isRequired = CustomFieldIsSetToRequired(FormTemplate, iFldKey); var isRequired = CustomFieldIsSetToRequired(FormTemplate, iFldKey);

View File

@@ -247,14 +247,14 @@ namespace AyaNova.Biz
AddError(ApiErrorCode.VALIDATION_REQUIRED, "ListKey"); AddError(ApiErrorCode.VALIDATION_REQUIRED, "ListKey");
List<ObjectField> FieldList = null; List<AyaField> FieldList = null;
if (!ObjectFields.IsValidObjectKey(inObj.ListKey)) if (!AyaObjectFields.IsValidObjectKey(inObj.ListKey))
{ {
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "ListKey", $"ListKey \"{inObj.ListKey}\" is empty or in-valid"); AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "ListKey", $"ListKey \"{inObj.ListKey}\" is empty or in-valid");
} }
else else
{ {
FieldList = ObjectFields.ObjectFieldsList(inObj.ListKey); FieldList = AyaObjectFields.ObjectFieldsList(inObj.ListKey);
} }

View File

@@ -96,7 +96,7 @@ namespace AyaNova.Biz
} }
//If it doesn't exist, vet the form key name is ok by checking with this list //If it doesn't exist, vet the form key name is ok by checking with this list
if (!ObjectFields.AvailableObjectKeys.Contains(formKey)) if (!AyaObjectFields.AvailableObjectKeys.Contains(formKey))
{ {
//Nope, whatever it is, it's not valid //Nope, whatever it is, it's not valid
return null; return null;
@@ -165,7 +165,7 @@ namespace AyaNova.Biz
AddError(ApiErrorCode.VALIDATION_REQUIRED, "FormKey"); AddError(ApiErrorCode.VALIDATION_REQUIRED, "FormKey");
else else
{ {
if (!ObjectFields.IsValidObjectKey(inObj.FormKey)) if (!AyaObjectFields.IsValidObjectKey(inObj.FormKey))
{ {
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "FormKey"); AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "FormKey");
} }
@@ -192,7 +192,7 @@ namespace AyaNova.Biz
if ((!PropertyHasErrors("FormKey") && !string.IsNullOrWhiteSpace(inObj.Template))) if ((!PropertyHasErrors("FormKey") && !string.IsNullOrWhiteSpace(inObj.Template)))
{ {
var ValidCustomFieldTypes = CustomFieldType.ValidCustomFieldTypes; var ValidCustomFieldTypes = CustomFieldType.ValidCustomFieldTypes;
var ValidFormFields = ObjectFields.ObjectFieldsList(inObj.FormKey); var ValidFormFields = AyaObjectFields.ObjectFieldsList(inObj.FormKey);
try try
{ {
//Parse the json, expecting something like this: //Parse the json, expecting something like this:
@@ -206,7 +206,7 @@ namespace AyaNova.Biz
for (int i = 0; i < v.Count; i++) for (int i = 0; i < v.Count; i++)
{ {
ObjectField MasterFormField = null; AyaField MasterFormField = null;
var formFieldItem = v[i]; var formFieldItem = v[i];
if (formFieldItem["fld"] == null) if (formFieldItem["fld"] == null)

View File

@@ -15,7 +15,7 @@ namespace AyaNova.Biz
// - Essentially this replaces all the attribute decoration in v7 and the individual classes with objects // - Essentially this replaces all the attribute decoration in v7 and the individual classes with objects
public static class ObjectFields public static class AyaObjectFields
{ {
//DEFINE VALID KEYS HERE //DEFINE VALID KEYS HERE
@@ -42,7 +42,7 @@ namespace AyaNova.Biz
return AvailableObjectKeys.Contains(key); return AvailableObjectKeys.Contains(key);
} }
public static List<ObjectField> ObjectFieldsList(string key) public static List<AyaField> ObjectFieldsList(string key)
{ {
/* /*
***************************** WARNING: Be careful here, if a standard field is hideable and also it's DB SCHEMA is set to NON NULLABLE then the CLIENT end needs to set a default ***************************** WARNING: Be careful here, if a standard field is hideable and also it's DB SCHEMA is set to NON NULLABLE then the CLIENT end needs to set a default
@@ -55,7 +55,7 @@ namespace AyaNova.Biz
Sortable = true; Sortable = true;
MiniAvailable = true; MiniAvailable = true;
*/ */
List<ObjectField> l = new List<ObjectField>(); List<AyaField> l = new List<AyaField>();
switch (key) switch (key)
{ {
/* /*
@@ -157,66 +157,66 @@ namespace AyaNova.Biz
//first column is the non visible Default Id column so that the client knows what to open when there is no field with ID selected that matches underlying record type //first column is the non visible Default Id column so that the client knows what to open when there is no field with ID selected that matches underlying record type
//in this case the default of id is sufficient for this list //in this case the default of id is sufficient for this list
l.Add(new ObjectField { LtKey = "df", AyaObjectType = (int)AyaType.Widget }); l.Add(new AyaField { LtKey = "df", AyaObjectType = (int)AyaType.Widget });
l.Add(new ObjectField { LtKey = "WidgetName", FieldName = "Name", UiFieldDataType = (int)AyaUiFieldDataType.Text, Hideable = false }); l.Add(new AyaField { LtKey = "WidgetName", FieldName = "Name", UiFieldDataType = (int)AyaUiFieldDataType.Text, Hideable = false });
l.Add(new ObjectField { LtKey = "WidgetSerial", FieldName = "Serial", UiFieldDataType = (int)AyaUiFieldDataType.Integer }); l.Add(new AyaField { LtKey = "WidgetSerial", FieldName = "Serial", UiFieldDataType = (int)AyaUiFieldDataType.Integer });
l.Add(new ObjectField { LtKey = "WidgetDollarAmount", FieldName = "DollarAmount", UiFieldDataType = (int)AyaUiFieldDataType.Currency }); l.Add(new AyaField { LtKey = "WidgetDollarAmount", FieldName = "DollarAmount", UiFieldDataType = (int)AyaUiFieldDataType.Currency });
l.Add(new ObjectField { LtKey = "WidgetCount", FieldName = "Count", UiFieldDataType = (int)AyaUiFieldDataType.Integer }); l.Add(new AyaField { LtKey = "WidgetCount", FieldName = "Count", UiFieldDataType = (int)AyaUiFieldDataType.Integer });
l.Add(new ObjectField { LtKey = "WidgetRoles", FieldName = "Roles", UiFieldDataType = (int)AyaUiFieldDataType.Enum, EnumType = typeof(AuthorizationRoles).ToString() }); l.Add(new AyaField { LtKey = "WidgetRoles", FieldName = "Roles", UiFieldDataType = (int)AyaUiFieldDataType.Enum, EnumType = typeof(AuthorizationRoles).ToString() });
l.Add(new ObjectField { LtKey = "WidgetStartDate", FieldName = "StartDate", UiFieldDataType = (int)AyaUiFieldDataType.DateTime }); l.Add(new AyaField { LtKey = "WidgetStartDate", FieldName = "StartDate", UiFieldDataType = (int)AyaUiFieldDataType.DateTime });
l.Add(new ObjectField { LtKey = "WidgetEndDate", FieldName = "EndDate", UiFieldDataType = (int)AyaUiFieldDataType.DateTime }); l.Add(new AyaField { LtKey = "WidgetEndDate", FieldName = "EndDate", UiFieldDataType = (int)AyaUiFieldDataType.DateTime });
l.Add(new ObjectField { LtKey = "WidgetNotes", FieldName = "Notes", UiFieldDataType = (int)AyaUiFieldDataType.Text }); l.Add(new AyaField { LtKey = "WidgetNotes", FieldName = "Notes", UiFieldDataType = (int)AyaUiFieldDataType.Text });
//More to do on this, maybe the datatype should be a LINK or something for UI purposes //More to do on this, maybe the datatype should be a LINK or something for UI purposes
//circle back on this when there is enough infrastructure to test //circle back on this when there is enough infrastructure to test
l.Add(new ObjectField { LtKey = "User", FieldName = "userid", UiFieldDataType = (int)AyaUiFieldDataType.Text, AyaObjectType = (int)AyaType.User }); l.Add(new AyaField { LtKey = "User", FieldName = "userid", UiFieldDataType = (int)AyaUiFieldDataType.Text, AyaObjectType = (int)AyaType.User });
l.Add(new ObjectField { LtKey = "Active", FieldName = "Active", UiFieldDataType = (int)AyaUiFieldDataType.Bool, Hideable = false }); l.Add(new AyaField { LtKey = "Active", FieldName = "Active", UiFieldDataType = (int)AyaUiFieldDataType.Bool, Hideable = false });
l.Add(new ObjectField { LtKey = "Tags", FieldName = "Tags", UiFieldDataType = (int)AyaUiFieldDataType.Tags }); l.Add(new AyaField { LtKey = "Tags", FieldName = "Tags", UiFieldDataType = (int)AyaUiFieldDataType.Tags });
l.Add(new ObjectField { LtKey = "WidgetCustom1", FieldName = "WidgetCustom1", IsCustomField = true }); l.Add(new AyaField { LtKey = "WidgetCustom1", FieldName = "WidgetCustom1", IsCustomField = true });
l.Add(new ObjectField { LtKey = "WidgetCustom2", FieldName = "WidgetCustom2", IsCustomField = true }); l.Add(new AyaField { LtKey = "WidgetCustom2", FieldName = "WidgetCustom2", IsCustomField = true });
l.Add(new ObjectField { LtKey = "WidgetCustom3", FieldName = "WidgetCustom3", IsCustomField = true }); l.Add(new AyaField { LtKey = "WidgetCustom3", FieldName = "WidgetCustom3", IsCustomField = true });
l.Add(new ObjectField { LtKey = "WidgetCustom4", FieldName = "WidgetCustom4", IsCustomField = true }); l.Add(new AyaField { LtKey = "WidgetCustom4", FieldName = "WidgetCustom4", IsCustomField = true });
l.Add(new ObjectField { LtKey = "WidgetCustom5", FieldName = "WidgetCustom5", IsCustomField = true }); l.Add(new AyaField { LtKey = "WidgetCustom5", FieldName = "WidgetCustom5", IsCustomField = true });
l.Add(new ObjectField { LtKey = "WidgetCustom6", FieldName = "WidgetCustom6", IsCustomField = true }); l.Add(new AyaField { LtKey = "WidgetCustom6", FieldName = "WidgetCustom6", IsCustomField = true });
l.Add(new ObjectField { LtKey = "WidgetCustom7", FieldName = "WidgetCustom7", IsCustomField = true }); l.Add(new AyaField { LtKey = "WidgetCustom7", FieldName = "WidgetCustom7", IsCustomField = true });
l.Add(new ObjectField { LtKey = "WidgetCustom8", FieldName = "WidgetCustom8", IsCustomField = true }); l.Add(new AyaField { LtKey = "WidgetCustom8", FieldName = "WidgetCustom8", IsCustomField = true });
l.Add(new ObjectField { LtKey = "WidgetCustom9", FieldName = "WidgetCustom9", IsCustomField = true }); l.Add(new AyaField { LtKey = "WidgetCustom9", FieldName = "WidgetCustom9", IsCustomField = true });
l.Add(new ObjectField { LtKey = "WidgetCustom10", FieldName = "WidgetCustom10", IsCustomField = true }); l.Add(new AyaField { LtKey = "WidgetCustom10", FieldName = "WidgetCustom10", IsCustomField = true });
l.Add(new ObjectField { LtKey = "WidgetCustom11", FieldName = "WidgetCustom11", IsCustomField = true }); l.Add(new AyaField { LtKey = "WidgetCustom11", FieldName = "WidgetCustom11", IsCustomField = true });
l.Add(new ObjectField { LtKey = "WidgetCustom12", FieldName = "WidgetCustom12", IsCustomField = true }); l.Add(new AyaField { LtKey = "WidgetCustom12", FieldName = "WidgetCustom12", IsCustomField = true });
l.Add(new ObjectField { LtKey = "WidgetCustom13", FieldName = "WidgetCustom13", IsCustomField = true }); l.Add(new AyaField { LtKey = "WidgetCustom13", FieldName = "WidgetCustom13", IsCustomField = true });
l.Add(new ObjectField { LtKey = "WidgetCustom14", FieldName = "WidgetCustom14", IsCustomField = true }); l.Add(new AyaField { LtKey = "WidgetCustom14", FieldName = "WidgetCustom14", IsCustomField = true });
l.Add(new ObjectField { LtKey = "WidgetCustom15", FieldName = "WidgetCustom15", IsCustomField = true }); l.Add(new AyaField { LtKey = "WidgetCustom15", FieldName = "WidgetCustom15", IsCustomField = true });
l.Add(new ObjectField { LtKey = "WidgetCustom16", FieldName = "WidgetCustom16", IsCustomField = true }); l.Add(new AyaField { LtKey = "WidgetCustom16", FieldName = "WidgetCustom16", IsCustomField = true });
break; break;
#endregion #endregion
case USER_KEY: case USER_KEY:
#region USER_KEY #region USER_KEY
l.Add(new ObjectField { LtKey = "df", AyaObjectType = (int)AyaType.User }); l.Add(new AyaField { LtKey = "df", AyaObjectType = (int)AyaType.User });
l.Add(new ObjectField { LtKey = "Name", FieldName = "Name", UiFieldDataType = (int)AyaUiFieldDataType.Text, Hideable = false }); l.Add(new AyaField { LtKey = "Name", FieldName = "Name", UiFieldDataType = (int)AyaUiFieldDataType.Text, Hideable = false });
l.Add(new ObjectField { LtKey = "UserEmployeeNumber", FieldName = "EmployeeNumber", UiFieldDataType = (int)AyaUiFieldDataType.Text }); l.Add(new AyaField { LtKey = "UserEmployeeNumber", FieldName = "EmployeeNumber", UiFieldDataType = (int)AyaUiFieldDataType.Text });
l.Add(new ObjectField { LtKey = "AuthorizationRoles", FieldName = "Roles", Hideable = false, UiFieldDataType = (int)AyaUiFieldDataType.Enum, EnumType = typeof(AuthorizationRoles).ToString() }); l.Add(new AyaField { LtKey = "AuthorizationRoles", FieldName = "Roles", Hideable = false, UiFieldDataType = (int)AyaUiFieldDataType.Enum, EnumType = typeof(AuthorizationRoles).ToString() });
l.Add(new ObjectField { LtKey = "UserNotes", FieldName = "Notes", UiFieldDataType = (int)AyaUiFieldDataType.Text }); l.Add(new AyaField { LtKey = "UserNotes", FieldName = "Notes", UiFieldDataType = (int)AyaUiFieldDataType.Text });
l.Add(new ObjectField { LtKey = "UserUserType", FieldName = "UserType", Hideable = false, UiFieldDataType = (int)AyaUiFieldDataType.Enum, EnumType = typeof(UserType).ToString() }); l.Add(new AyaField { LtKey = "UserUserType", FieldName = "UserType", Hideable = false, UiFieldDataType = (int)AyaUiFieldDataType.Enum, EnumType = typeof(UserType).ToString() });
l.Add(new ObjectField { LtKey = "Active", FieldName = "Active", UiFieldDataType = (int)AyaUiFieldDataType.Bool, Hideable = false }); l.Add(new AyaField { LtKey = "Active", FieldName = "Active", UiFieldDataType = (int)AyaUiFieldDataType.Bool, Hideable = false });
l.Add(new ObjectField { LtKey = "Tags", FieldName = "Tags", UiFieldDataType = (int)AyaUiFieldDataType.Tags }); l.Add(new AyaField { LtKey = "Tags", FieldName = "Tags", UiFieldDataType = (int)AyaUiFieldDataType.Tags });
l.Add(new ObjectField { LtKey = "UserCustom1", FieldName = "UserCustom1", IsCustomField = true }); l.Add(new AyaField { LtKey = "UserCustom1", FieldName = "UserCustom1", IsCustomField = true });
l.Add(new ObjectField { LtKey = "UserCustom2", FieldName = "UserCustom2", IsCustomField = true }); l.Add(new AyaField { LtKey = "UserCustom2", FieldName = "UserCustom2", IsCustomField = true });
l.Add(new ObjectField { LtKey = "UserCustom3", FieldName = "UserCustom3", IsCustomField = true }); l.Add(new AyaField { LtKey = "UserCustom3", FieldName = "UserCustom3", IsCustomField = true });
l.Add(new ObjectField { LtKey = "UserCustom4", FieldName = "UserCustom4", IsCustomField = true }); l.Add(new AyaField { LtKey = "UserCustom4", FieldName = "UserCustom4", IsCustomField = true });
l.Add(new ObjectField { LtKey = "UserCustom5", FieldName = "UserCustom5", IsCustomField = true }); l.Add(new AyaField { LtKey = "UserCustom5", FieldName = "UserCustom5", IsCustomField = true });
l.Add(new ObjectField { LtKey = "UserCustom6", FieldName = "UserCustom6", IsCustomField = true }); l.Add(new AyaField { LtKey = "UserCustom6", FieldName = "UserCustom6", IsCustomField = true });
l.Add(new ObjectField { LtKey = "UserCustom7", FieldName = "UserCustom7", IsCustomField = true }); l.Add(new AyaField { LtKey = "UserCustom7", FieldName = "UserCustom7", IsCustomField = true });
l.Add(new ObjectField { LtKey = "UserCustom8", FieldName = "UserCustom8", IsCustomField = true }); l.Add(new AyaField { LtKey = "UserCustom8", FieldName = "UserCustom8", IsCustomField = true });
l.Add(new ObjectField { LtKey = "UserCustom9", FieldName = "UserCustom9", IsCustomField = true }); l.Add(new AyaField { LtKey = "UserCustom9", FieldName = "UserCustom9", IsCustomField = true });
l.Add(new ObjectField { LtKey = "UserCustom10", FieldName = "UserCustom10", IsCustomField = true }); l.Add(new AyaField { LtKey = "UserCustom10", FieldName = "UserCustom10", IsCustomField = true });
l.Add(new ObjectField { LtKey = "UserCustom11", FieldName = "UserCustom11", IsCustomField = true }); l.Add(new AyaField { LtKey = "UserCustom11", FieldName = "UserCustom11", IsCustomField = true });
l.Add(new ObjectField { LtKey = "UserCustom12", FieldName = "UserCustom12", IsCustomField = true }); l.Add(new AyaField { LtKey = "UserCustom12", FieldName = "UserCustom12", IsCustomField = true });
l.Add(new ObjectField { LtKey = "UserCustom13", FieldName = "UserCustom13", IsCustomField = true }); l.Add(new AyaField { LtKey = "UserCustom13", FieldName = "UserCustom13", IsCustomField = true });
l.Add(new ObjectField { LtKey = "UserCustom14", FieldName = "UserCustom14", IsCustomField = true }); l.Add(new AyaField { LtKey = "UserCustom14", FieldName = "UserCustom14", IsCustomField = true });
l.Add(new ObjectField { LtKey = "UserCustom15", FieldName = "UserCustom15", IsCustomField = true }); l.Add(new AyaField { LtKey = "UserCustom15", FieldName = "UserCustom15", IsCustomField = true });
l.Add(new ObjectField { LtKey = "UserCustom16", FieldName = "UserCustom16", IsCustomField = true }); l.Add(new AyaField { LtKey = "UserCustom16", FieldName = "UserCustom16", IsCustomField = true });
break; break;
#endregion #endregion
case TEST_WIDGET_USER_EMAIL_ADDRESS_LIST_KEY: case TEST_WIDGET_USER_EMAIL_ADDRESS_LIST_KEY:
@@ -299,17 +299,17 @@ So rename things and see what breaks I guess
*/ */
l.Add(new ObjectField { LtKey = "df", AyaObjectType = (int)AyaType.Widget, SqlIdColumnName = "awidget.id as df" }); l.Add(new AyaField { LtKey = "df", AyaObjectType = (int)AyaType.Widget, SqlIdColumnName = "awidget.id as df" });
l.Add(new ObjectField l.Add(new AyaField
{ {
LtKey = "WidgetName", LtKey = "WidgetName",
FieldName = "widgetname", FieldName = "widgetname",
UiFieldDataType = (int)AyaUiFieldDataType.Text, UiFieldDataType = (int)AyaUiFieldDataType.Text,
AyaObjectType = (int)AyaType.Widget, AyaObjectType = (int)AyaType.Widget,
SqlIdColumnName = "awidget.id as widgetid", SqlIdColumnName = "awidget.id",
SqlDisplayColumnName = "awidget.name as widgetname" SqlDisplayColumnName = "awidget.name"
}); });
l.Add(new ObjectField l.Add(new AyaField
{ {
LtKey = "User", LtKey = "User",
FieldName = "username", FieldName = "username",
@@ -318,7 +318,7 @@ So rename things and see what breaks I guess
SqlIdColumnName = "userid", SqlIdColumnName = "userid",
SqlDisplayColumnName = "auser.name as username" SqlDisplayColumnName = "auser.name as username"
}); });
l.Add(new ObjectField { LtKey = "UserEmailAddress", FieldName = "emailaddress", UiFieldDataType = (int)AyaUiFieldDataType.EmailAddress }); l.Add(new AyaField { LtKey = "UserEmailAddress", FieldName = "emailaddress", UiFieldDataType = (int)AyaUiFieldDataType.EmailAddress });
break; break;
#endregion #endregion
@@ -372,7 +372,7 @@ So rename things and see what breaks I guess
foreach (string s in fullFields) foreach (string s in fullFields)
{ {
ObjectField o = fields.FirstOrDefault(x => x.LtKey == s); AyaField o = fields.FirstOrDefault(x => x.LtKey == s);
#if (DEBUG) #if (DEBUG)
//Developers little helper //Developers little helper
if (o == null) if (o == null)
@@ -406,7 +406,7 @@ So rename things and see what breaks I guess
}//eoc ObjectFields }//eoc ObjectFields
public class ObjectField public class AyaField
{ {
public string LtKey { get; set; } public string LtKey { get; set; }
public string FieldName { get; set; } public string FieldName { get; set; }
@@ -431,7 +431,7 @@ So rename things and see what breaks I guess
public string SqlDisplayColumnName { get; set; } public string SqlDisplayColumnName { get; set; }
public ObjectField() public AyaField()
{ {
//most common defaults //most common defaults
Hideable = true; Hideable = true;

View File

@@ -10,7 +10,7 @@ namespace AyaNova.Biz
internal static class PickListFetcher internal static class PickListFetcher
{ {
internal static PickListResult GetPickList(AyContext ct, long userId, ListOptions pagingOptions, List<ObjectField> objectFields, string tableName) internal static PickListResult GetPickList(AyContext ct, long userId, ListOptions pagingOptions, List<AyaField> objectFields, string tableName)
{ {
List<NameIdItem> listItems = new List<NameIdItem>(); List<NameIdItem> listItems = new List<NameIdItem>();

View File

@@ -18,7 +18,7 @@ namespace AyaNova.Biz
//var OuterJson=JObject.Parse(formCustom.Template); //var OuterJson=JObject.Parse(formCustom.Template);
var FormTemplate = JArray.Parse(formCustom.Template); var FormTemplate = JArray.Parse(formCustom.Template);
// var FormTemplate=(JArray)OuterJson["template"]; // var FormTemplate=(JArray)OuterJson["template"];
var FormFields = ObjectFields.ObjectFieldsList(formCustom.FormKey); var FormFields = AyaObjectFields.ObjectFieldsList(formCustom.FormKey);
// var ThisFormNormalFieldsList = FormFields.Where(x => x.Custom == false).Select(x => x.Key).ToList(); // var ThisFormNormalFieldsList = FormFields.Where(x => x.Custom == false).Select(x => x.Key).ToList();
foreach (JObject jo in FormTemplate) foreach (JObject jo in FormTemplate)
@@ -30,7 +30,7 @@ namespace AyaNova.Biz
// - e.g.: {template:[{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"bool"},{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"text"]} // - e.g.: {template:[{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"bool"},{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"text"]}
//get the FormField object //get the FormField object
ObjectField FF = FormFields.Where(x => x.LtKey == FldLtKey).Single(); AyaField FF = FormFields.Where(x => x.LtKey == FldLtKey).Single();
//don't validate custom fields, just skip them //don't validate custom fields, just skip them
// if (!string.IsNullOrWhiteSpace(FF.PropertyName))//this used to work because there would be no property name but now there is so it doesn't // if (!string.IsNullOrWhiteSpace(FF.PropertyName))//this used to work because there would be no property name but now there is so it doesn't

View File

@@ -11,7 +11,7 @@ namespace AyaNova.Biz
{ {
public static class SqlFilterCriteriaBuilder public static class SqlFilterCriteriaBuilder
{ {
public static string DataFilterToSQLCriteria(AyaNova.Models.DataFilter dataFilter, List<ObjectField> objectFields, long userId) public static string DataFilterToSQLCriteria(AyaNova.Models.DataFilter dataFilter, List<AyaField> objectFields, long userId)
{ {
if (string.IsNullOrWhiteSpace(dataFilter.Filter)) if (string.IsNullOrWhiteSpace(dataFilter.Filter))

View File

@@ -20,7 +20,7 @@ namespace AyaNova.Biz
var jtemplate = JObject.Parse(template); var jtemplate = JObject.Parse(template);
//get the fields list //get the fields list
var objectFieldsList = ObjectFields.ObjectFieldsList(objectKey); var objectFieldsList = AyaObjectFields.ObjectFieldsList(objectKey);
//convert to strings array (https://stackoverflow.com/a/33836599/8939) //convert to strings array (https://stackoverflow.com/a/33836599/8939)
string[] templateFieldList; string[] templateFieldList;
@@ -37,7 +37,7 @@ namespace AyaNova.Biz
sb.Append("SELECT "); sb.Append("SELECT ");
//Default ID column for each row (always is aliased as df) //Default ID column for each row (always is aliased as df)
ObjectField def = objectFieldsList.FirstOrDefault(x => x.LtKey == "df"); AyaField def = objectFieldsList.FirstOrDefault(x => x.LtKey == "df");
if (def == null) if (def == null)
{ {
throw new System.ArgumentNullException($"SqlSelectBuilder: objectFieldList for key \"{objectKey}\" is missing the df default field"); throw new System.ArgumentNullException($"SqlSelectBuilder: objectFieldList for key \"{objectKey}\" is missing the df default field");
@@ -55,7 +55,7 @@ namespace AyaNova.Biz
foreach (string ColumnName in templateFieldList) foreach (string ColumnName in templateFieldList)
{ {
ObjectField o = objectFieldsList.FirstOrDefault(x => x.LtKey == ColumnName); AyaField o = objectFieldsList.FirstOrDefault(x => x.LtKey == ColumnName);
#if (DEBUG) #if (DEBUG)
//Developers little helper //Developers little helper
if (o == null) if (o == null)

View File

@@ -191,7 +191,7 @@ namespace AyaNova.Biz
var TheFilter = await ct.DataFilter.FirstOrDefaultAsync(x => x.Id == pagingOptions.DataFilterId); var TheFilter = await ct.DataFilter.FirstOrDefaultAsync(x => x.Id == pagingOptions.DataFilterId);
//BUILD WHERE AND APPEND IT //BUILD WHERE AND APPEND IT
q = q + SqlFilterCriteriaBuilder.DataFilterToSQLCriteria(TheFilter, ObjectFields.ObjectFieldsList(ObjectFields.USER_KEY), UserId); q = q + SqlFilterCriteriaBuilder.DataFilterToSQLCriteria(TheFilter, AyaObjectFields.ObjectFieldsList(AyaObjectFields.USER_KEY), UserId);
//BUILD ORDER BY AND APPEND IT //BUILD ORDER BY AND APPEND IT
q = q + SqlFilterOrderByBuilder.DataFilterToSQLOrderBy(TheFilter); q = q + SqlFilterOrderByBuilder.DataFilterToSQLOrderBy(TheFilter);
@@ -252,7 +252,7 @@ namespace AyaNova.Biz
pagingOptions.Limit = pagingOptions.Limit ?? ListOptions.DefaultLimit; pagingOptions.Limit = pagingOptions.Limit ?? ListOptions.DefaultLimit;
var ret = PickListFetcher.GetPickList(ct, UserId, pagingOptions, ObjectFields.ObjectFieldsList(ObjectFields.USER_KEY), "auser"); var ret = PickListFetcher.GetPickList(ct, UserId, pagingOptions, AyaObjectFields.ObjectFieldsList(AyaObjectFields.USER_KEY), "auser");
var pageLinks = new PaginationLinkBuilder(Url, routeName, null, pagingOptions, ret.TotalRecordCount).PagingLinksObject(); var pageLinks = new PaginationLinkBuilder(Url, routeName, null, pagingOptions, ret.TotalRecordCount).PagingLinksObject();
@@ -531,7 +531,7 @@ namespace AyaNova.Biz
AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "EmployeeNumber", "255 max"); AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "EmployeeNumber", "255 max");
//Any form customizations to validate? //Any form customizations to validate?
var FormCustomization = ct.FormCustom.SingleOrDefault(x => x.FormKey == ObjectFields.USER_KEY); var FormCustomization = ct.FormCustom.SingleOrDefault(x => x.FormKey == AyaObjectFields.USER_KEY);
if (FormCustomization != null) if (FormCustomization != null)
{ {
//Yeppers, do the validation, there are two, the custom fields and the regular fields that might be set to required //Yeppers, do the validation, there are two, the custom fields and the regular fields that might be set to required

View File

@@ -289,7 +289,7 @@ namespace AyaNova.Biz
//SELECT FRAGMENT COLUMNS FROM TEMPLATE //SELECT FRAGMENT COLUMNS FROM TEMPLATE
//"select clm,clm,clm" //"select clm,clm,clm"
var qSelectColumns = SqlSelectBuilder.Build(ObjectFields.WIDGET_KEY, MOCK_WIDGET_DISPLAY_TEMPLATE_JSON, listOptions.Mini); var qSelectColumns = SqlSelectBuilder.Build(AyaObjectFields.WIDGET_KEY, MOCK_WIDGET_DISPLAY_TEMPLATE_JSON, listOptions.Mini);
var qFrom = "FROM AWIDGET"; var qFrom = "FROM AWIDGET";
@@ -304,7 +304,7 @@ namespace AyaNova.Biz
var qWhere = string.Empty; var qWhere = string.Empty;
if (listOptions.DataFilterId > 0) if (listOptions.DataFilterId > 0)
{ {
qWhere = SqlFilterCriteriaBuilder.DataFilterToSQLCriteria(TheFilter, ObjectFields.ObjectFieldsList(ObjectFields.WIDGET_KEY), UserId); qWhere = SqlFilterCriteriaBuilder.DataFilterToSQLCriteria(TheFilter, AyaObjectFields.ObjectFieldsList(AyaObjectFields.WIDGET_KEY), UserId);
} }
//ORDER BY CLAUSE - SORT //ORDER BY CLAUSE - SORT
@@ -383,11 +383,11 @@ namespace AyaNova.Biz
string ColumnsJSON = string.Empty; string ColumnsJSON = string.Empty;
if (listOptions.Mini) if (listOptions.Mini)
{ {
ColumnsJSON = ObjectFields.GenerateMINIListColumnsJSON(AyaType.Widget); ColumnsJSON = AyaObjectFields.GenerateMINIListColumnsJSON(AyaType.Widget);
} }
else else
{ {
ColumnsJSON = ObjectFields.GenerateListColumnsJSONFromTemplate(AyaType.Widget, ObjectFields.WIDGET_KEY, MOCK_WIDGET_DISPLAY_TEMPLATE_JSON); ColumnsJSON = AyaObjectFields.GenerateListColumnsJSONFromTemplate(AyaType.Widget, AyaObjectFields.WIDGET_KEY, MOCK_WIDGET_DISPLAY_TEMPLATE_JSON);
} }
//TODO: BUILD THE RETURN LIST OF DATA ITEMS //TODO: BUILD THE RETURN LIST OF DATA ITEMS
@@ -425,7 +425,7 @@ namespace AyaNova.Biz
*/ */
//SELECT FRAGMENT COLUMNS FROM TEMPLATE //SELECT FRAGMENT COLUMNS FROM TEMPLATE
//"select clm,clm,clm" //"select clm,clm,clm"
var qSelectColumns = SqlSelectBuilder.Build(ObjectFields.WIDGET_KEY, MOCK_WIDGET_USER_EMAIL_DISPLAY_TEMPLATE_JSON, listOptions.Mini); var qSelectColumns = SqlSelectBuilder.Build(AyaObjectFields.WIDGET_KEY, MOCK_WIDGET_USER_EMAIL_DISPLAY_TEMPLATE_JSON, listOptions.Mini);
//FROM CLAUSE //FROM CLAUSE
//this is where the full SQL statement needs to be made with JOINS etc //this is where the full SQL statement needs to be made with JOINS etc
@@ -443,7 +443,7 @@ namespace AyaNova.Biz
var qWhere = string.Empty; var qWhere = string.Empty;
if (listOptions.DataFilterId > 0) if (listOptions.DataFilterId > 0)
{ {
qWhere = SqlFilterCriteriaBuilder.DataFilterToSQLCriteria(TheFilter, ObjectFields.ObjectFieldsList(ObjectFields.WIDGET_KEY), UserId); qWhere = SqlFilterCriteriaBuilder.DataFilterToSQLCriteria(TheFilter, AyaObjectFields.ObjectFieldsList(AyaObjectFields.WIDGET_KEY), UserId);
} }
//ORDER BY CLAUSE - SORT //ORDER BY CLAUSE - SORT
@@ -522,11 +522,11 @@ namespace AyaNova.Biz
string ColumnsJSON = string.Empty; string ColumnsJSON = string.Empty;
if (listOptions.Mini) if (listOptions.Mini)
{ {
ColumnsJSON = ObjectFields.GenerateMINIListColumnsJSON(AyaType.Widget); ColumnsJSON = AyaObjectFields.GenerateMINIListColumnsJSON(AyaType.Widget);
} }
else else
{ {
ColumnsJSON = ObjectFields.GenerateListColumnsJSONFromTemplate(AyaType.Widget, ObjectFields.WIDGET_KEY, MOCK_WIDGET_USER_EMAIL_DISPLAY_TEMPLATE_JSON); ColumnsJSON = AyaObjectFields.GenerateListColumnsJSONFromTemplate(AyaType.Widget, AyaObjectFields.WIDGET_KEY, MOCK_WIDGET_USER_EMAIL_DISPLAY_TEMPLATE_JSON);
} }
//TODO: BUILD THE RETURN LIST OF DATA ITEMS //TODO: BUILD THE RETURN LIST OF DATA ITEMS
@@ -606,7 +606,7 @@ namespace AyaNova.Biz
} }
//Any form customizations to validate? //Any form customizations to validate?
var FormCustomization = ct.FormCustom.SingleOrDefault(x => x.FormKey == ObjectFields.WIDGET_KEY); var FormCustomization = ct.FormCustom.SingleOrDefault(x => x.FormKey == AyaObjectFields.WIDGET_KEY);
if (FormCustomization != null) if (FormCustomization != null)
{ {
//Yeppers, do the validation, there are two, the custom fields and the regular fields that might be set to required //Yeppers, do the validation, there are two, the custom fields and the regular fields that might be set to required

View File

@@ -82,7 +82,7 @@ namespace AyaNova.Util
var fc = new FormCustom() var fc = new FormCustom()
{ {
FormKey = ObjectFields.WIDGET_KEY, FormKey = AyaObjectFields.WIDGET_KEY,
Template = @"[ Template = @"[
{ {
""fld"": ""WidgetNotes"", ""fld"": ""WidgetNotes"",