This commit is contained in:
@@ -8,8 +8,6 @@ using AyaNova.Api.ControllerHelpers;
|
|||||||
using AyaNova.Biz;
|
using AyaNova.Biz;
|
||||||
using AyaNova.PickList;
|
using AyaNova.PickList;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
|
|
||||||
namespace AyaNova.Api.Controllers
|
namespace AyaNova.Api.Controllers
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using AyaNova.Biz;
|
using AyaNova.Biz;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,8 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using AyaNova.Biz;
|
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using EnumsNET;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
76
server/AyaNova/PickList/UserPickList.cs
Normal file
76
server/AyaNova/PickList/UserPickList.cs
Normal 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
|
||||||
@@ -7,7 +7,6 @@ using AyaNova.Util;
|
|||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
using AyaNova.PickList;
|
using AyaNova.PickList;
|
||||||
using EnumsNET;
|
|
||||||
|
|
||||||
namespace AyaNova.Biz
|
namespace AyaNova.Biz
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user