From 92cc3ebbd16d0ddddf4902158f2e33a42dcba3d4 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 27 Jan 2021 22:15:28 +0000 Subject: [PATCH] --- .../AyaNova/DataList/OutsideUserDataList.cs | 66 ++++++++++--------- .../AyaNova/DataList/PartAssemblyDataList.cs | 22 ++++--- server/AyaNova/DataList/PartDataList.cs | 48 +++++++------- .../AyaNova/DataList/PartInventoryDataList.cs | 47 ++++++------- .../PartInventoryTransactionsDataList.cs | 64 +++++++++--------- .../AyaNova/DataList/PartWarehouseDataList.cs | 39 +++++------ 6 files changed, 149 insertions(+), 137 deletions(-) diff --git a/server/AyaNova/DataList/OutsideUserDataList.cs b/server/AyaNova/DataList/OutsideUserDataList.cs index 3094c291..f36bd4b8 100644 --- a/server/AyaNova/DataList/OutsideUserDataList.cs +++ b/server/AyaNova/DataList/OutsideUserDataList.cs @@ -1,9 +1,9 @@ using System.Collections.Generic; -using Newtonsoft.Json.Linq; +using AyaNova.Models; using AyaNova.Biz; namespace AyaNova.DataList { - internal class OutsideUserDataList : AyaDataList + internal class OutsideUserDataList : AyaDataList, IAyaDataListServerCriteria { public OutsideUserDataList() @@ -13,45 +13,37 @@ namespace AyaNova.DataList var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; - //Default ListView - dynamic dlistView = new JArray(); + // //Default ListView + // dynamic dlistView = new JArray(); - dynamic cm = new JObject(); - cm.fld = "name"; - cm.sort = "+"; - dlistView.Add(cm); + // dynamic cm = new JObject(); + // cm.fld = "name"; + // cm.sort = "+"; + // dlistView.Add(cm); - cm = new JObject(); - cm.fld = "active"; - dlistView.Add(cm); + // cm = new JObject(); + // cm.fld = "active"; + // dlistView.Add(cm); - cm = new JObject(); - cm.fld = "usercustomer"; - dlistView.Add(cm); + // cm = new JObject(); + // cm.fld = "usercustomer"; + // dlistView.Add(cm); - cm = new JObject(); - cm.fld = "userheadoffice"; - dlistView.Add(cm); + // cm = new JObject(); + // cm.fld = "userheadoffice"; + // dlistView.Add(cm); - cm = new JObject(); - cm.fld = "lastlogin"; - dlistView.Add(cm); + // cm = new JObject(); + // cm.fld = "lastlogin"; + // dlistView.Add(cm); - DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None); + // DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None); + + DefaultColumns = new List() { "name", "active", "usercustomer", "userheadoffice", "lastlogin" }; + DefaultSortBy = new Dictionary() { { "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(); - //DPRECATED FieldDefinitions.Add(new AyaDataListFieldDefinition { FieldKey = "df", AyaObjectType = (int)AyaType.User, SqlIdColumnName = "auser.id" }); FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "User", @@ -126,8 +118,18 @@ namespace AyaNova.DataList SqlIdColumnName = "acustomer.id", SqlValueColumnName = "acustomer.name" }); + } + public List DataListServerCriteria(long currentUserId, AuthorizationRoles userRoles, DataListBase dataListBase) + { + List ret = new List(); + 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 diff --git a/server/AyaNova/DataList/PartAssemblyDataList.cs b/server/AyaNova/DataList/PartAssemblyDataList.cs index bf792dae..7e7483cd 100644 --- a/server/AyaNova/DataList/PartAssemblyDataList.cs +++ b/server/AyaNova/DataList/PartAssemblyDataList.cs @@ -12,21 +12,23 @@ namespace AyaNova.DataList var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; - //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############ - //Default ListView - dynamic dlistView = new JArray(); - dynamic cm = null; + // //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############ + // //Default ListView + // dynamic dlistView = new JArray(); + // dynamic cm = null; - cm = new JObject(); - cm.fld = "partassemblyname"; - cm.sort = "+"; - dlistView.Add(cm); + // cm = new JObject(); + // cm.fld = "partassemblyname"; + // cm.sort = "+"; + // dlistView.Add(cm); - DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None); + // DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None); + + DefaultColumns = new List() { "partassemblyname" }; + DefaultSortBy = new Dictionary() { { "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(); FieldDefinitions.Add(new AyaDataListFieldDefinition diff --git a/server/AyaNova/DataList/PartDataList.cs b/server/AyaNova/DataList/PartDataList.cs index ad8f8141..7c71976c 100644 --- a/server/AyaNova/DataList/PartDataList.cs +++ b/server/AyaNova/DataList/PartDataList.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Newtonsoft.Json.Linq; using AyaNova.Biz; namespace AyaNova.DataList { @@ -17,33 +16,36 @@ namespace AyaNova.DataList var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; - //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############ - //Default ListView - dynamic dlistView = new JArray(); - dynamic cm = null; + // //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############ + // //Default ListView + // dynamic dlistView = new JArray(); + // dynamic cm = null; - cm = new JObject(); - cm.fld = "PartPartNumber"; - cm.sort = "+"; - dlistView.Add(cm); + // cm = new JObject(); + // cm.fld = "PartPartNumber"; + // cm.sort = "+"; + // dlistView.Add(cm); - cm = new JObject(); - cm.fld = "PartName"; - dlistView.Add(cm); + // cm = new JObject(); + // cm.fld = "PartName"; + // dlistView.Add(cm); - cm = new JObject(); - cm.fld = "PartManufacturerID"; - dlistView.Add(cm); + // cm = new JObject(); + // cm.fld = "PartManufacturerID"; + // dlistView.Add(cm); - cm = new JObject(); - cm.fld = "PartWholesalerID"; - dlistView.Add(cm); + // cm = new JObject(); + // cm.fld = "PartWholesalerID"; + // dlistView.Add(cm); - cm = new JObject(); - cm.fld = "Tags"; - dlistView.Add(cm); + // cm = new JObject(); + // cm.fld = "Tags"; + // dlistView.Add(cm); - DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None); + // DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None); + + DefaultColumns = new List() { "PartPartNumber", "PartName", "PartManufacturerID", "PartWholesalerID", "Tags" }; + DefaultSortBy = new Dictionary() { { "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 @@ -109,7 +111,7 @@ namespace AyaNova.DataList SqlValueColumnName = "apart.retail" }); - + FieldDefinitions.Add(new AyaDataListFieldDefinition { FieldKey = "PartManufacturerID", diff --git a/server/AyaNova/DataList/PartInventoryDataList.cs b/server/AyaNova/DataList/PartInventoryDataList.cs index 8aa1dd0d..646a2758 100644 --- a/server/AyaNova/DataList/PartInventoryDataList.cs +++ b/server/AyaNova/DataList/PartInventoryDataList.cs @@ -1,6 +1,4 @@ using System.Collections.Generic; -using Newtonsoft.Json.Linq; -using AyaNova.Models; using AyaNova.Biz; namespace AyaNova.DataList { @@ -16,32 +14,35 @@ namespace AyaNova.DataList var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; - //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############ - //Default ListView - show all transactions in order - dynamic dlistView = new JArray(); - 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); + // //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############ + // //Default ListView - show all transactions in order + // dynamic dlistView = new JArray(); + // dynamic cm = null; // cm = new JObject(); - // cm.fld = "PartInventoryTransactionDescription"; + // cm.fld = "PartPartNumber"; + // cm.sort = "+"; // 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() { "PartPartNumber", "PartWarehouseName", "PartInventoryBalance", "PartInventoryTransactionDescription" }; + DefaultSortBy = new Dictionary() { { "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(); // FieldDefinitions.Add(new AyaDataListFieldDefinition diff --git a/server/AyaNova/DataList/PartInventoryTransactionsDataList.cs b/server/AyaNova/DataList/PartInventoryTransactionsDataList.cs index 1de2fdde..02db92c6 100644 --- a/server/AyaNova/DataList/PartInventoryTransactionsDataList.cs +++ b/server/AyaNova/DataList/PartInventoryTransactionsDataList.cs @@ -1,6 +1,4 @@ using System.Collections.Generic; -using Newtonsoft.Json.Linq; -using AyaNova.Models; using AyaNova.Biz; namespace AyaNova.DataList { @@ -16,43 +14,49 @@ namespace AyaNova.DataList var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; - //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############ - //Default ListView - show all transactions in order - dynamic dlistView = new JArray(); - dynamic cm = null; - cm = new JObject(); + // //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############ + // //Default ListView - show all transactions in order + // dynamic dlistView = new JArray(); + // dynamic cm = null; + // cm = new JObject(); - cm.fld = "PartInventoryTransactionEntryDate"; - cm.sort = "-"; - dlistView.Add(cm); + // cm.fld = "PartInventoryTransactionEntryDate"; + // cm.sort = "-"; + // dlistView.Add(cm); - cm = new JObject(); - cm.fld = "PartPartNumber"; - dlistView.Add(cm); + // cm = new JObject(); + // cm.fld = "PartPartNumber"; + // dlistView.Add(cm); - cm = new JObject(); - cm.fld = "PartWarehouseName"; - dlistView.Add(cm); + // cm = new JObject(); + // cm.fld = "PartWarehouseName"; + // dlistView.Add(cm); - cm = new JObject(); - cm.fld = "PartInventoryTransactionQuantity"; - dlistView.Add(cm); + // cm = new JObject(); + // cm.fld = "PartInventoryTransactionQuantity"; + // dlistView.Add(cm); - cm = new JObject(); - cm.fld = "PartInventoryTransactionDescription"; - dlistView.Add(cm); + // cm = new JObject(); + // cm.fld = "PartInventoryTransactionDescription"; + // dlistView.Add(cm); - cm = new JObject(); - cm.fld = "PartInventoryTransactionSource"; - dlistView.Add(cm); + // cm = new JObject(); + // cm.fld = "PartInventoryTransactionSource"; + // dlistView.Add(cm); - cm = new JObject(); - cm.fld = "PartInventoryBalance"; - dlistView.Add(cm); + // cm = new JObject(); + // cm.fld = "PartInventoryBalance"; + // dlistView.Add(cm); + + // DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None); + + DefaultColumns = new List() { + "PartInventoryTransactionEntryDate", "PartPartNumber", "PartWarehouseName", "PartInventoryTransactionQuantity", + "PartInventoryTransactionDescription", "PartInventoryTransactionSource", "PartInventoryBalance" + }; + DefaultSortBy = new Dictionary() { { "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(); FieldDefinitions.Add(new AyaDataListFieldDefinition diff --git a/server/AyaNova/DataList/PartWarehouseDataList.cs b/server/AyaNova/DataList/PartWarehouseDataList.cs index 93862ed5..029d5fdb 100644 --- a/server/AyaNova/DataList/PartWarehouseDataList.cs +++ b/server/AyaNova/DataList/PartWarehouseDataList.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Newtonsoft.Json.Linq; using AyaNova.Biz; namespace AyaNova.DataList { @@ -12,28 +11,30 @@ namespace AyaNova.DataList var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; - //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############ - //Default ListView - dynamic dlistView = new JArray(); - dynamic cm = null; + // //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############ + // //Default ListView + // dynamic dlistView = new JArray(); + // dynamic cm = null; - cm = new JObject(); - cm.fld = "PartWarehouseName"; - cm.sort = "+"; - dlistView.Add(cm); - - cm = new JObject(); - cm.fld = "Active"; - dlistView.Add(cm); + // cm = new JObject(); + // cm.fld = "PartWarehouseName"; + // cm.sort = "+"; + // dlistView.Add(cm); - cm = new JObject(); - cm.fld = "Tags"; - dlistView.Add(cm); + // cm = new JObject(); + // cm.fld = "Active"; + // dlistView.Add(cm); - DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None); + // cm = new JObject(); + // cm.fld = "Tags"; + // dlistView.Add(cm); + + // DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None); + + DefaultColumns = new List() { "PartWarehouseName", "Active", "Tags" }; + DefaultSortBy = new Dictionary() { { "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(); FieldDefinitions.Add(new AyaDataListFieldDefinition @@ -72,7 +73,7 @@ namespace AyaNova.DataList }); - + //----------- FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "PartWarehouseCustom1", FieldKey = "partwarehousecustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apartwarehouse.customfields" });