This commit is contained in:
@@ -20,7 +20,7 @@ namespace AyaNova.Biz
|
||||
|
||||
//DEFINE VALID KEYS HERE
|
||||
//For objects that are both list and edit form it's just the name of the object
|
||||
//For objects that are compound list objects or reporting objects it's whatever uniquely but clearly identifies that
|
||||
//For objects that are compound list objects or reporting objects it's whatever uniquely but clearly identifies that and ends in _LIST
|
||||
public const string WIDGET_KEY = "widget";
|
||||
public const string USER_KEY = "user";
|
||||
|
||||
@@ -153,6 +153,10 @@ namespace AyaNova.Biz
|
||||
*/
|
||||
case WIDGET_KEY:
|
||||
#region WIDGET_KEY
|
||||
|
||||
//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
|
||||
l.Add(new ObjectField { Key = "_df_", AyObjectType=(int)AyaType.Widget });
|
||||
l.Add(new ObjectField { Key = "WidgetName", PropertyName = "Name", DataType = (int)AyaDataType.Text, Hideable = false });
|
||||
l.Add(new ObjectField { Key = "WidgetSerial", PropertyName = "Serial", DataType = (int)AyaDataType.Integer });
|
||||
l.Add(new ObjectField { Key = "WidgetDollarAmount", PropertyName = "DollarAmount", DataType = (int)AyaDataType.Currency });
|
||||
@@ -184,6 +188,7 @@ namespace AyaNova.Biz
|
||||
#endregion
|
||||
case USER_KEY:
|
||||
#region USER_KEY
|
||||
l.Add(new ObjectField { Key = "_df_", AyObjectType=(int)AyaType.User });
|
||||
l.Add(new ObjectField { Key = "Name", PropertyName = "Name", SharedLTKey = true, DataType = (int)AyaDataType.Text, Hideable = false });
|
||||
l.Add(new ObjectField { Key = "UserEmployeeNumber", PropertyName = "EmployeeNumber", DataType = (int)AyaDataType.Text });
|
||||
l.Add(new ObjectField { Key = "AuthorizationRoles", PropertyName = "Roles", Hideable = false, DataType = (int)AyaDataType.Enum, EnumType = typeof(AuthorizationRoles).ToString() });
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace AyaNova.Biz
|
||||
var jtemplate = JObject.Parse(template);
|
||||
|
||||
//get the fields list
|
||||
var FieldsList = ObjectFields.ObjectFieldsList(objectKey);
|
||||
var objectFieldsList = ObjectFields.ObjectFieldsList(objectKey);
|
||||
|
||||
//convert to strings array (https://stackoverflow.com/a/33836599/8939)
|
||||
string[] templateFieldList;
|
||||
@@ -32,21 +32,39 @@ namespace AyaNova.Biz
|
||||
{
|
||||
templateFieldList = ((JArray)jtemplate["full"]).ToObject<string[]>();
|
||||
}
|
||||
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.Append("SELECT ");
|
||||
|
||||
//Default ID column
|
||||
ObjectField def = objectFieldsList.FirstOrDefault(x => x.Key == "_df_");
|
||||
sb.Append(def.SqlIdColumn);
|
||||
sb.Append(" AS _df_ ");
|
||||
|
||||
foreach (string ColumnName in templateFieldList)
|
||||
{
|
||||
//NOPE, NOPE, NOPE....rather than this, it needs to get the names by consulting the ObjectFields list which may contain overrides for the sql name etc
|
||||
sb.Append(ColumnName);
|
||||
ObjectField o = objectFieldsList.FirstOrDefault(x => x.Key == s);
|
||||
if (o != null)
|
||||
{//Here is where we can vet the field name, if it doesn't exist though, for now we'll just ignore those ones
|
||||
|
||||
sb.Append(",");
|
||||
sb.Append("{");
|
||||
//Build required part of column definition
|
||||
sb.Append($"\"cm\":\"{o.Key}\",\"dt\":{(int)o.DataType}");
|
||||
|
||||
//Has a AyObjectType? (linkable / openable)
|
||||
if (o.AyObjectType != 0)
|
||||
sb.Append($",\"ay\":{(int)o.AyObjectType}");
|
||||
|
||||
sb.Append("}");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return sb.ToString();
|
||||
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user