This commit is contained in:
@@ -45,7 +45,7 @@ Server
|
|||||||
- Display value (the data to show, not formatted yet, that's up to the client)
|
- Display value (the data to show, not formatted yet, that's up to the client)
|
||||||
- Optional: ID value (if the object is openable **** MUST CHECK RIGHTS ALSO HERE **** then this is the id to open for the client to put a hyperlink on that column)
|
- Optional: ID value (if the object is openable **** MUST CHECK RIGHTS ALSO HERE **** then this is the id to open for the client to put a hyperlink on that column)
|
||||||
- To save bandwidth abbreviations are used in the column definitions:
|
- To save bandwidth abbreviations are used in the column definitions:
|
||||||
- ColumnsJSON=@"{[ {""cm"":""Widget"",""dt"":""text"",""ay"":"+ AyaType.Widget.ToString()+ "}]}";
|
- ColumnsJSON=@"""columns"":[ {""cm"":""Widget"",""dt"":""text"",""ay"":"+ AyaType.Widget.ToString()+ "}]";
|
||||||
- cm=column name locale key, dt=AyDataType, ay=AyaType to open on click of that column field (optional, not present if not openable)
|
- cm=column name locale key, dt=AyDataType, ay=AyaType to open on click of that column field (optional, not present if not openable)
|
||||||
- For example (wide list):
|
- For example (wide list):
|
||||||
data:{
|
data:{
|
||||||
@@ -136,9 +136,9 @@ Download
|
|||||||
"next": "http://localhost:7575/api/v8/Widget/ListWidgets?pageNo=2&pageSize=3",
|
"next": "http://localhost:7575/api/v8/Widget/ListWidgets?pageNo=2&pageSize=3",
|
||||||
"last": "http://localhost:7575/api/v8/Widget/ListWidgets?pageNo=34&pageSize=3"
|
"last": "http://localhost:7575/api/v8/Widget/ListWidgets?pageNo=34&pageSize=3"
|
||||||
},
|
},
|
||||||
"columns":{
|
"columns":[
|
||||||
{name:"lt_client_name",datatype:text,ayatype:client},{name:"lt_client_notes",datatype:text},{name:"lt_last_workorder",datatype:number,ayatype:workorder}
|
{name:"lt_client_name",datatype:text,ayatype:client},{name:"lt_client_notes",datatype:text},{name:"lt_last_workorder",datatype:number,ayatype:workorder}
|
||||||
}
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -408,7 +408,7 @@ namespace AyaNova
|
|||||||
// ******************** TESTING WIPE DB *****************************
|
// ******************** TESTING WIPE DB *****************************
|
||||||
//
|
//
|
||||||
//Set this to true to wipe the db and reinstall a trial license and re-seed the data
|
//Set this to true to wipe the db and reinstall a trial license and re-seed the data
|
||||||
var TESTING_REFRESH_DB = true;//#######################################################################################
|
var TESTING_REFRESH_DB = false;//#######################################################################################
|
||||||
|
|
||||||
#if (DEBUG)
|
#if (DEBUG)
|
||||||
//TESTING
|
//TESTING
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace AyaNova.Biz
|
namespace AyaNova.Biz
|
||||||
{
|
{
|
||||||
@@ -52,6 +54,7 @@ namespace AyaNova.Biz
|
|||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case WIDGET_KEY:
|
case WIDGET_KEY:
|
||||||
|
#region WIDGET_KEY
|
||||||
l.Add(new ObjectField { Key = "WidgetName", PropertyName = "Name", DataType = AyDataType.Text, Hideable = false });
|
l.Add(new ObjectField { Key = "WidgetName", PropertyName = "Name", DataType = AyDataType.Text, Hideable = false });
|
||||||
l.Add(new ObjectField { Key = "WidgetSerial", PropertyName = "Serial", DataType = AyDataType.Integer });
|
l.Add(new ObjectField { Key = "WidgetSerial", PropertyName = "Serial", DataType = AyDataType.Integer });
|
||||||
l.Add(new ObjectField { Key = "WidgetDollarAmount", PropertyName = "DollarAmount", DataType = AyDataType.Currency });
|
l.Add(new ObjectField { Key = "WidgetDollarAmount", PropertyName = "DollarAmount", DataType = AyDataType.Currency });
|
||||||
@@ -80,8 +83,9 @@ namespace AyaNova.Biz
|
|||||||
l.Add(new ObjectField { Key = "WidgetCustom15", PropertyName = "WidgetCustom15", Custom = true });
|
l.Add(new ObjectField { Key = "WidgetCustom15", PropertyName = "WidgetCustom15", Custom = true });
|
||||||
l.Add(new ObjectField { Key = "WidgetCustom16", PropertyName = "WidgetCustom16", Custom = true });
|
l.Add(new ObjectField { Key = "WidgetCustom16", PropertyName = "WidgetCustom16", Custom = true });
|
||||||
break;
|
break;
|
||||||
|
#endregion
|
||||||
case USER_KEY:
|
case USER_KEY:
|
||||||
|
#region USER_KEY
|
||||||
l.Add(new ObjectField { Key = "Name", PropertyName = "Name", SharedLTKey = true, DataType = AyDataType.Text, Hideable = false });
|
l.Add(new ObjectField { Key = "Name", PropertyName = "Name", SharedLTKey = true, DataType = AyDataType.Text, Hideable = false });
|
||||||
l.Add(new ObjectField { Key = "UserEmployeeNumber", PropertyName = "EmployeeNumber", DataType = AyDataType.Text });
|
l.Add(new ObjectField { Key = "UserEmployeeNumber", PropertyName = "EmployeeNumber", DataType = AyDataType.Text });
|
||||||
l.Add(new ObjectField { Key = "AuthorizationRoles", PropertyName = "Roles", Hideable = false, DataType = AyDataType.Enum, EnumType = typeof(AuthorizationRoles).ToString() });
|
l.Add(new ObjectField { Key = "AuthorizationRoles", PropertyName = "Roles", Hideable = false, DataType = AyDataType.Enum, EnumType = typeof(AuthorizationRoles).ToString() });
|
||||||
@@ -107,7 +111,7 @@ namespace AyaNova.Biz
|
|||||||
l.Add(new ObjectField { Key = "UserCustom15", PropertyName = "UserCustom15", Custom = true });
|
l.Add(new ObjectField { Key = "UserCustom15", PropertyName = "UserCustom15", Custom = true });
|
||||||
l.Add(new ObjectField { Key = "UserCustom16", PropertyName = "UserCustom16", Custom = true });
|
l.Add(new ObjectField { Key = "UserCustom16", PropertyName = "UserCustom16", Custom = true });
|
||||||
break;
|
break;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -135,9 +139,27 @@ namespace AyaNova.Biz
|
|||||||
{
|
{
|
||||||
//parse the template
|
//parse the template
|
||||||
var jtemplate = JObject.Parse(template);
|
var jtemplate = JObject.Parse(template);
|
||||||
var fields= ObjectFieldsList(ObjectKey);
|
var fields = ObjectFieldsList(ObjectKey);
|
||||||
|
|
||||||
return "";
|
//convert to strings (https://stackoverflow.com/a/33836599/8939)
|
||||||
|
var fullFields = ((JArray)jtemplate["full"]).ToObject<string[]>();
|
||||||
|
|
||||||
|
//Generate JSON fragment to return with column definitions
|
||||||
|
StringBuilder sb=new StringBuilder();
|
||||||
|
// StringWriter sw = new StringWriter();
|
||||||
|
// JsonTextWriter writer = new JsonTextWriter(sw);
|
||||||
|
// writer.WriteStartObject();//{
|
||||||
|
// ColumnsJSON=@"""columns"":[ {""cm"":""Widget"",""dt"":""text"",""ay"":"+ AyaType.Widget.ToString()+ "}]";
|
||||||
|
foreach (string s in fullFields)
|
||||||
|
{
|
||||||
|
ObjectField o = fields.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 it
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// writer.WriteEndObject();//}
|
||||||
|
return sw.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -334,7 +334,7 @@ namespace AyaNova.Biz
|
|||||||
string ColumnsJSON=string.Empty;
|
string ColumnsJSON=string.Empty;
|
||||||
if(listOptions.Mini){
|
if(listOptions.Mini){
|
||||||
//all mini lists will have an id so include the type to open
|
//all mini lists will have an id so include the type to open
|
||||||
ColumnsJSON=@"{[ {""cm"":""Widget"",""dt"":""text"",""ay"":"+ AyaType.Widget.ToString()+ "}]}";
|
ColumnsJSON=@"""columns"":[ {""cm"":""Widget"",""dt"":""text"",""ay"":"+ AyaType.Widget.ToString()+ "}]";
|
||||||
}else{
|
}else{
|
||||||
ColumnsJSON=ObjectFields.GenerateListColumnJSONFromTemplate(ObjectFields.WIDGET_KEY,MOCK_WIDGET_DISPLAY_TEMPLATE_JSON);
|
ColumnsJSON=ObjectFields.GenerateListColumnJSONFromTemplate(ObjectFields.WIDGET_KEY,MOCK_WIDGET_DISPLAY_TEMPLATE_JSON);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user