This commit is contained in:
@@ -35,16 +35,27 @@ namespace AyaNova.DataList
|
||||
listOptions.ListView = DataList.DefaultListView;
|
||||
}
|
||||
|
||||
//parse the list view
|
||||
var ListViewArray = JArray.Parse(listOptions.ListView);
|
||||
//parse the list view(s)
|
||||
//This one is for the return list to the Client for grid column display
|
||||
var PublicListViewArray = JArray.Parse(listOptions.ListView);
|
||||
|
||||
//this one is for internal use here to build the filter and sort etc
|
||||
var InternalListViewArray = JArray.Parse(listOptions.ListView);
|
||||
var MetaListViewArray = JArray.Parse(listOptions.MetaView ?? "[]");
|
||||
foreach (JToken jt in MetaListViewArray)
|
||||
InternalListViewArray.Add(jt);
|
||||
|
||||
|
||||
//Get the field key names in a list from the listview
|
||||
List<string> ListViewFieldList = DataList.GetFieldListFromListView(ListViewArray);
|
||||
//Get the public field key names in a list from the listview
|
||||
List<string> PublicListViewFieldList = DataList.GetFieldListFromListView(PublicListViewArray);
|
||||
|
||||
//Get the internal only field key names from the internal list view
|
||||
List<string> InternalListViewFieldList = DataList.GetFieldListFromListView(InternalListViewArray);
|
||||
|
||||
|
||||
//BUILD THE QUERY
|
||||
//SELECT FRAGMENT COLUMNS FROM TEMPLATE
|
||||
var SelectBuild = DataListSqlSelectBuilder.Build(DataList.FieldDefinitions, ListViewFieldList);
|
||||
var SelectBuild = DataListSqlSelectBuilder.Build(DataList.FieldDefinitions, InternalListViewFieldList);
|
||||
|
||||
//FROM CLAUSE
|
||||
var qFrom = DataList.SQLFrom;
|
||||
@@ -53,11 +64,11 @@ namespace AyaNova.DataList
|
||||
var qOrderBy = string.Empty;
|
||||
|
||||
//WHERE CLAUSE - FILTER
|
||||
qWhere = DataListSqlFilterCriteriaBuilder.DataFilterToSQLCriteria(DataList.FieldDefinitions, ListViewArray);
|
||||
qWhere = DataListSqlFilterCriteriaBuilder.DataFilterToSQLCriteria(DataList.FieldDefinitions, InternalListViewArray);
|
||||
|
||||
//ORDER BY CLAUSE - SORT
|
||||
//BUILD ORDER BY
|
||||
qOrderBy = DataListSqlFilterOrderByBuilder.DataFilterToSQLOrderBy(DataList.FieldDefinitions, ListViewArray);
|
||||
qOrderBy = DataListSqlFilterOrderByBuilder.DataFilterToSQLOrderBy(DataList.FieldDefinitions, InternalListViewArray);
|
||||
|
||||
//LIMIT AND OFFSET CLAUSE - PAGING
|
||||
listOptions.Offset = listOptions.Offset ?? ListOptions.DefaultOffset;
|
||||
@@ -72,7 +83,7 @@ namespace AyaNova.DataList
|
||||
qTotalRecordsQuery = $"SELECT COUNT(*) {qFrom} {qWhere}".Replace(" ", " ");
|
||||
|
||||
//RETURN OBJECTS
|
||||
int returnRowColumnCount = ListViewFieldList.Count();
|
||||
int returnRowColumnCount = PublicListViewFieldList.Count();
|
||||
List<List<AyaFieldData>> rows = new List<List<AyaFieldData>>();
|
||||
long totalRecordCount = 0;
|
||||
|
||||
@@ -93,7 +104,7 @@ namespace AyaNova.DataList
|
||||
|
||||
|
||||
//INSERT REMAINING FIELDS FROM TEMPLATE INTO THE RETURN ROWS LIST
|
||||
foreach (string TemplateField in ListViewFieldList)
|
||||
foreach (string TemplateField in PublicListViewFieldList)
|
||||
{
|
||||
|
||||
//get the AyaObjectFieldDefinition
|
||||
@@ -194,7 +205,7 @@ namespace AyaNova.DataList
|
||||
//BUILD THE COLUMNS RETURN PROPERTY JSON FRAGMENT
|
||||
Newtonsoft.Json.Linq.JArray ColumnsJSON = null;
|
||||
|
||||
ColumnsJSON = DataList.GenerateListColumnsJSONFromListView(ListViewArray);
|
||||
ColumnsJSON = DataList.GenerateListColumnsJSONFromListView(PublicListViewArray);
|
||||
|
||||
return new ApiDataListResponse(rows, totalRecordCount, ColumnsJSON);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user