This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user