This commit is contained in:
2021-01-27 20:18:21 +00:00
parent 05877d0a3e
commit ecfb5dcea5
4 changed files with 64 additions and 38 deletions

View File

@@ -18,8 +18,13 @@ namespace AyaNova.DataList
//well, not here exactly but add a new DATALIST class if it will be displayed as a list anywhere in the UI or reported on //well, not here exactly but add a new DATALIST class if it will be displayed as a list anywhere in the UI or reported on
public AyaDataList() public AyaDataList()
{ {
// DefaultColumns = new List<string>(); /*
// DefaultSortBy = new Dictionary<string, string>();
DefaultColumns = new List<string>() { "XXX", "XXXX", "XXXX", "XXXX", "XXXX", "XXX", "XXXX", "XXXX", "XXXX", "XXXX" };
DefaultSortBy = new Dictionary<string, string>() { { "XXXX", "+" }, { "XXXX", "-" } };
*/
} }
public string SQLFrom { get; set; } public string SQLFrom { get; set; }

View File

@@ -1,5 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using AyaNova.Biz; using AyaNova.Biz;
namespace AyaNova.DataList namespace AyaNova.DataList
{ {
@@ -14,28 +13,32 @@ namespace AyaNova.DataList
//######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############ //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
//Default ListView // //Default ListView
dynamic dlistView = new JArray(); // dynamic dlistView = new JArray();
dynamic cm = new JObject(); // dynamic cm = new JObject();
cm.fld = "customername"; // cm.fld = "customername";
cm.sort = "+"; // cm.sort = "+";
dlistView.Add(cm); // dlistView.Add(cm);
cm = new JObject(); // cm = new JObject();
cm.fld = "customerphone1"; // cm.fld = "customerphone1";
dlistView.Add(cm); // dlistView.Add(cm);
cm = new JObject(); // cm = new JObject();
cm.fld = "customeremail"; // cm.fld = "customeremail";
dlistView.Add(cm); // dlistView.Add(cm);
cm = new JObject(); // cm = new JObject();
cm.fld = "customerheadoffice"; // cm.fld = "customerheadoffice";
dlistView.Add(cm); // dlistView.Add(cm);
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
DefaultColumns = new List<string>() { "customername", "customerphone1", "customeremail", "customerheadoffice" };
DefaultSortBy = new Dictionary<string, string>() { { "customername", "+" } };
DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined table need to be specified completely //NOTE: Due to the join, all the sql id and name fields that can conflict with the joined table need to be specified completely
@@ -310,7 +313,7 @@ namespace AyaNova.DataList
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "CustomerCustom16", FieldKey = "customercustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "acustomer.customfields" }); FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "CustomerCustom16", FieldKey = "customercustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "acustomer.customfields" });
} }
}//eoc }//eoc
}//eons }//eons

View File

@@ -14,24 +14,27 @@ namespace AyaNova.DataList
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
//######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############ // //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
//Default ListView // //Default ListView
dynamic dlistView = new JArray(); // dynamic dlistView = new JArray();
dynamic cm = new JObject(); // dynamic cm = new JObject();
cm.fld = "notedate"; // cm.fld = "notedate";
cm.sort = "-"; // cm.sort = "-";
dlistView.Add(cm); // dlistView.Add(cm);
cm = new JObject(); // cm = new JObject();
cm.fld = "notes"; // cm.fld = "notes";
dlistView.Add(cm); // dlistView.Add(cm);
cm = new JObject(); // cm = new JObject();
cm.fld = "username"; // cm.fld = "username";
dlistView.Add(cm); // dlistView.Add(cm);
DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None); // DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
DefaultColumns = new List<string>() { "notedate", "notes", "username" };
DefaultSortBy = new Dictionary<string, string>() { { "notedate", "-" } };
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined table need to be specified completely //NOTE: Due to the join, all the sql id and name fields that can conflict with the joined table need to be specified completely
@@ -78,10 +81,25 @@ namespace AyaNova.DataList
}); });
} }
public string DataListServerCriteria(AyaNova.Models.AyContext ct, long currentUserId, DataListOptions dataListOptions)
public List<DataListFilterOption> DataListServerCriteria(long currentUserId, AuthorizationRoles userRoles, DataListBase dataListBase)
{ {
throw new System.NotImplementedException(); List<DataListFilterOption> ret = new List<DataListFilterOption>();
//ClientCriteria MUST be CustomerId
if (string.IsNullOrWhiteSpace(dataListBase.ClientCriteria))
throw new System.ArgumentNullException("CustomerNoteDataList - ClientCriteria is empty, should be Customer ID");
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metacustomer" };
DataListColumnFilter ColumnFilter = new DataListColumnFilter();
ColumnFilter.value = dataListBase.ClientCriteria;
ColumnFilter.op = "=";
FilterOption.items.Add(ColumnFilter);
ret.Add(FilterOption);
return ret;
} }
}//eoc }//eoc
}//eons }//eons

View File

@@ -33,7 +33,7 @@ namespace AyaNova.Models
public string Column { get; set; } public string Column { get; set; }
public List<DataListColumnFilter> items { get; set; } public List<DataListColumnFilter> items { get; set; }
public bool Any { get; set; }//means "or" the filter conditions public bool Any { get; set; }//means "or" the filter conditions
DataListFilterOption() public DataListFilterOption()
{ {
items = new List<DataListColumnFilter>(); items = new List<DataListColumnFilter>();
} }