This commit is contained in:
2020-03-17 16:01:07 +00:00
parent d1763bbba5
commit 514ac54c3d
5 changed files with 76 additions and 9 deletions

View File

@@ -8,8 +8,6 @@ using AyaNova.Api.ControllerHelpers;
using AyaNova.Biz;
using AyaNova.PickList;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace AyaNova.Api.Controllers
{

View File

@@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.Linq;
using AyaNova.Biz;
using AyaNova.Models;

View File

@@ -1,13 +1,8 @@
using System.Collections.Generic;
using System.Linq;
using AyaNova.Biz;
using Newtonsoft.Json.Linq;
using AyaNova.Api.ControllerHelpers;
using Microsoft.AspNetCore.Mvc;
using AyaNova.Models;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using EnumsNET;

View File

@@ -0,0 +1,76 @@
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using AyaNova.Biz;
namespace AyaNova.PickList
{
internal class UserPickList : AyaPickList
{
public UserPickList()
{
DefaultListObjectType = AyaType.User;
SQLFrom = "from auser";
AllowedRoles = BizRoles.GetRoleSet(DefaultListObjectType).Select;
//Default template
dynamic dTemplate = new JArray();
dynamic cm = new JObject();
cm.fld = "username";
dTemplate.Add(cm);
cm = new JObject();
cm.fld = "useremployeenumber";
dTemplate.Add(cm);
cm = new JObject();
cm.fld = "usertags";
dTemplate.Add(cm);
base.DefaultTemplate = dTemplate.ToString(Newtonsoft.Json.Formatting.None);
//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
ColumnDefinitions = new List<AyaPickListFieldDefinition>();
ColumnDefinitions.Add(new AyaPickListFieldDefinition
{
LtKey = "Active",
FieldKey = "useractive",
ColumnDataType = UiFieldDataType.Bool,
SqlValueColumnName = "auser.active",
IsActiveColumn = true
});
ColumnDefinitions.Add(new AyaPickListFieldDefinition
{
LtKey = "UserName",
FieldKey = "username",
AyaObjectType = AyaType.User,
ColumnDataType = UiFieldDataType.Text,
SqlIdColumnName = "auser.id",
SqlValueColumnName = "auser.name",
IsRowId = true
});
ColumnDefinitions.Add(new AyaPickListFieldDefinition
{
LtKey = "UserEmployeeNumber",
FieldKey = "useremployeenumber",
ColumnDataType = UiFieldDataType.Text,
SqlValueColumnName = "auser.employeenumber"
});
ColumnDefinitions.Add(new AyaPickListFieldDefinition
{
LtKey = "Tags",
FieldKey = "usertags",
ColumnDataType = UiFieldDataType.Tags,
SqlValueColumnName = "auser.tags"
});
}
}//eoc
}//eons

View File

@@ -7,7 +7,6 @@ using AyaNova.Util;
using AyaNova.Api.ControllerHelpers;
using AyaNova.Models;
using AyaNova.PickList;
using EnumsNET;
namespace AyaNova.Biz
{