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 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<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>();
//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<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

View File

@@ -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<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.Add(new AyaDataListFieldDefinition

View File

@@ -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<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
@@ -109,7 +111,7 @@ namespace AyaNova.DataList
SqlValueColumnName = "apart.retail"
});
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
FieldKey = "PartManufacturerID",

View File

@@ -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<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.Add(new AyaDataListFieldDefinition

View File

@@ -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<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.Add(new AyaDataListFieldDefinition

View File

@@ -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<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.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" });