This commit is contained in:
2021-01-27 22:15:28 +00:00
parent 071339d251
commit 92cc3ebbd1
6 changed files with 149 additions and 137 deletions

View File

@@ -1,9 +1,9 @@
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json.Linq; using AyaNova.Models;
using AyaNova.Biz; using AyaNova.Biz;
namespace AyaNova.DataList namespace AyaNova.DataList
{ {
internal class OutsideUserDataList : AyaDataList internal class OutsideUserDataList : AyaDataList, IAyaDataListServerCriteria
{ {
public OutsideUserDataList() public OutsideUserDataList()
@@ -13,45 +13,37 @@ namespace AyaNova.DataList
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
//Default ListView // //Default ListView
dynamic dlistView = new JArray(); // dynamic dlistView = new JArray();
dynamic cm = new JObject(); // dynamic cm = new JObject();
cm.fld = "name"; // cm.fld = "name";
cm.sort = "+"; // cm.sort = "+";
dlistView.Add(cm); // dlistView.Add(cm);
cm = new JObject(); // cm = new JObject();
cm.fld = "active"; // cm.fld = "active";
dlistView.Add(cm); // dlistView.Add(cm);
cm = new JObject(); // cm = new JObject();
cm.fld = "usercustomer"; // cm.fld = "usercustomer";
dlistView.Add(cm); // dlistView.Add(cm);
cm = new JObject(); // cm = new JObject();
cm.fld = "userheadoffice"; // cm.fld = "userheadoffice";
dlistView.Add(cm); // dlistView.Add(cm);
cm = new JObject(); // cm = new JObject();
cm.fld = "lastlogin"; // cm.fld = "lastlogin";
dlistView.Add(cm); // dlistView.Add(cm);
DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None); // DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
DefaultColumns = new List<string>() { "name", "active", "usercustomer", "userheadoffice", "lastlogin" };
DefaultSortBy = new Dictionary<string, string>() { { "name", "+" } };
/*
Id = z.Id,
Active = z.Active,
Name = z.Name,
Roles = z.Roles,
UserType = z.UserType,
EmployeeNumber = z.EmployeeNumber,
LastLogin = z.LastLogin
*/
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined (in this case User) table need to be specified completely
FieldDefinitions = new List<AyaDataListFieldDefinition>(); FieldDefinitions = new List<AyaDataListFieldDefinition>();
//DPRECATED FieldDefinitions.Add(new AyaDataListFieldDefinition { FieldKey = "df", AyaObjectType = (int)AyaType.User, SqlIdColumnName = "auser.id" });
FieldDefinitions.Add(new AyaDataListFieldDefinition FieldDefinitions.Add(new AyaDataListFieldDefinition
{ {
TKey = "User", TKey = "User",
@@ -126,8 +118,18 @@ namespace AyaNova.DataList
SqlIdColumnName = "acustomer.id", SqlIdColumnName = "acustomer.id",
SqlValueColumnName = "acustomer.name" SqlValueColumnName = "acustomer.name"
}); });
}
public List<DataListFilterOption> DataListServerCriteria(long currentUserId, AuthorizationRoles userRoles, DataListBase dataListBase)
{
List<DataListFilterOption> ret = new List<DataListFilterOption>();
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "usertype" };
FilterOption.items.Add(new DataListColumnFilter() { value = ((int)UserType.Customer).ToString(), op = DataListFilterComparisonOperator.Equality });
FilterOption.items.Add(new DataListColumnFilter() { value = ((int)UserType.HeadOffice).ToString(), op = DataListFilterComparisonOperator.Equality });
ret.Add(FilterOption);
return ret;
} }
}//eoc }//eoc

View File

@@ -12,21 +12,23 @@ 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 = null; // dynamic cm = null;
cm = new JObject(); // cm = new JObject();
cm.fld = "partassemblyname"; // cm.fld = "partassemblyname";
cm.sort = "+"; // cm.sort = "+";
dlistView.Add(cm); // dlistView.Add(cm);
DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None); // DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
DefaultColumns = new List<string>() { "partassemblyname" };
DefaultSortBy = new Dictionary<string, string>() { { "partassemblyname", "+" } };
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined table need to be specified completely
FieldDefinitions = new List<AyaDataListFieldDefinition>(); FieldDefinitions = new List<AyaDataListFieldDefinition>();
FieldDefinitions.Add(new AyaDataListFieldDefinition FieldDefinitions.Add(new AyaDataListFieldDefinition

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
{ {
@@ -17,33 +16,36 @@ 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 = null; // dynamic cm = null;
cm = new JObject(); // cm = new JObject();
cm.fld = "PartPartNumber"; // cm.fld = "PartPartNumber";
cm.sort = "+"; // cm.sort = "+";
dlistView.Add(cm); // dlistView.Add(cm);
cm = new JObject(); // cm = new JObject();
cm.fld = "PartName"; // cm.fld = "PartName";
dlistView.Add(cm); // dlistView.Add(cm);
cm = new JObject(); // cm = new JObject();
cm.fld = "PartManufacturerID"; // cm.fld = "PartManufacturerID";
dlistView.Add(cm); // dlistView.Add(cm);
cm = new JObject(); // cm = new JObject();
cm.fld = "PartWholesalerID"; // cm.fld = "PartWholesalerID";
dlistView.Add(cm); // dlistView.Add(cm);
cm = new JObject(); // cm = new JObject();
cm.fld = "Tags"; // cm.fld = "Tags";
dlistView.Add(cm); // dlistView.Add(cm);
DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None); // DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
DefaultColumns = new List<string>() { "PartPartNumber", "PartName", "PartManufacturerID", "PartWholesalerID", "Tags" };
DefaultSortBy = new Dictionary<string, string>() { { "PartPartNumber", "+" } };
//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

View File

@@ -1,6 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using AyaNova.Models;
using AyaNova.Biz; using AyaNova.Biz;
namespace AyaNova.DataList namespace AyaNova.DataList
{ {
@@ -16,32 +14,35 @@ 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 - show all transactions in order // //Default ListView - show all transactions in order
dynamic dlistView = new JArray(); // dynamic dlistView = new JArray();
dynamic cm = null; // dynamic cm = null;
cm = new JObject();
cm.fld = "PartPartNumber";
cm.sort = "+";
dlistView.Add(cm);
cm = new JObject();
cm.fld = "PartWarehouseName";
cm.sort = "+";
dlistView.Add(cm);
cm = new JObject();
cm.fld = "PartInventoryBalance";
dlistView.Add(cm);
// cm = new JObject(); // cm = new JObject();
// cm.fld = "PartInventoryTransactionDescription"; // cm.fld = "PartPartNumber";
// cm.sort = "+";
// dlistView.Add(cm); // dlistView.Add(cm);
DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None); // cm = new JObject();
// cm.fld = "PartWarehouseName";
// cm.sort = "+";
// dlistView.Add(cm);
// cm = new JObject();
// cm.fld = "PartInventoryBalance";
// dlistView.Add(cm);
// // cm = new JObject();
// // cm.fld = "PartInventoryTransactionDescription";
// // dlistView.Add(cm);
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
DefaultColumns = new List<string>() { "PartPartNumber", "PartWarehouseName", "PartInventoryBalance", "PartInventoryTransactionDescription" };
DefaultSortBy = new Dictionary<string, string>() { { "PartPartNumber", "+" }, { "PartWarehouseName", "+" } };
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined table need to be specified completely
FieldDefinitions = new List<AyaDataListFieldDefinition>(); FieldDefinitions = new List<AyaDataListFieldDefinition>();
// FieldDefinitions.Add(new AyaDataListFieldDefinition // FieldDefinitions.Add(new AyaDataListFieldDefinition

View File

@@ -1,6 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using AyaNova.Models;
using AyaNova.Biz; using AyaNova.Biz;
namespace AyaNova.DataList namespace AyaNova.DataList
{ {
@@ -16,43 +14,49 @@ 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 - show all transactions in order // //Default ListView - show all transactions in order
dynamic dlistView = new JArray(); // dynamic dlistView = new JArray();
dynamic cm = null; // dynamic cm = null;
cm = new JObject(); // cm = new JObject();
cm.fld = "PartInventoryTransactionEntryDate"; // cm.fld = "PartInventoryTransactionEntryDate";
cm.sort = "-"; // cm.sort = "-";
dlistView.Add(cm); // dlistView.Add(cm);
cm = new JObject(); // cm = new JObject();
cm.fld = "PartPartNumber"; // cm.fld = "PartPartNumber";
dlistView.Add(cm); // dlistView.Add(cm);
cm = new JObject(); // cm = new JObject();
cm.fld = "PartWarehouseName"; // cm.fld = "PartWarehouseName";
dlistView.Add(cm); // dlistView.Add(cm);
cm = new JObject(); // cm = new JObject();
cm.fld = "PartInventoryTransactionQuantity"; // cm.fld = "PartInventoryTransactionQuantity";
dlistView.Add(cm); // dlistView.Add(cm);
cm = new JObject(); // cm = new JObject();
cm.fld = "PartInventoryTransactionDescription"; // cm.fld = "PartInventoryTransactionDescription";
dlistView.Add(cm); // dlistView.Add(cm);
cm = new JObject(); // cm = new JObject();
cm.fld = "PartInventoryTransactionSource"; // cm.fld = "PartInventoryTransactionSource";
dlistView.Add(cm); // dlistView.Add(cm);
cm = new JObject(); // cm = new JObject();
cm.fld = "PartInventoryBalance"; // cm.fld = "PartInventoryBalance";
dlistView.Add(cm); // dlistView.Add(cm);
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
DefaultColumns = new List<string>() {
"PartInventoryTransactionEntryDate", "PartPartNumber", "PartWarehouseName", "PartInventoryTransactionQuantity",
"PartInventoryTransactionDescription", "PartInventoryTransactionSource", "PartInventoryBalance"
};
DefaultSortBy = new Dictionary<string, string>() { { "PartInventoryTransactionEntryDate", "-" } };
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
FieldDefinitions = new List<AyaDataListFieldDefinition>(); FieldDefinitions = new List<AyaDataListFieldDefinition>();
FieldDefinitions.Add(new AyaDataListFieldDefinition FieldDefinitions.Add(new AyaDataListFieldDefinition

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
{ {
@@ -12,28 +11,30 @@ 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 = null; // dynamic cm = null;
cm = new JObject(); // cm = new JObject();
cm.fld = "PartWarehouseName"; // cm.fld = "PartWarehouseName";
cm.sort = "+"; // cm.sort = "+";
dlistView.Add(cm); // dlistView.Add(cm);
cm = new JObject(); // cm = new JObject();
cm.fld = "Active"; // cm.fld = "Active";
dlistView.Add(cm); // dlistView.Add(cm);
cm = new JObject(); // cm = new JObject();
cm.fld = "Tags"; // cm.fld = "Tags";
dlistView.Add(cm); // dlistView.Add(cm);
DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None); // DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
DefaultColumns = new List<string>() { "PartWarehouseName", "Active", "Tags" };
DefaultSortBy = new Dictionary<string, string>() { { "PartWarehouseName", "+" } };
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined table need to be specified completely
FieldDefinitions = new List<AyaDataListFieldDefinition>(); FieldDefinitions = new List<AyaDataListFieldDefinition>();
FieldDefinitions.Add(new AyaDataListFieldDefinition FieldDefinitions.Add(new AyaDataListFieldDefinition