Files
raven/server/AyaNova/PickList/ContractPickList.cs

57 lines
2.0 KiB
C#

using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using AyaNova.Biz;
namespace AyaNova.PickList
{
internal class ContractPickList : AyaPickList
{
public ContractPickList()
{
DefaultListAType = AyaType.Contract;
SQLFrom = "from acontract";
AllowedRoles = BizRoles.GetRoleSet(DefaultListAType).Select;
dynamic dTemplate = new JArray();
dynamic cm = new JObject();
cm.fld = "contractname";
dTemplate.Add(cm);
cm = new JObject();
cm.fld = "contracttags";
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 table need to be specified completely
ColumnDefinitions = new List<AyaPickListFieldDefinition>();
ColumnDefinitions.Add(new AyaPickListFieldDefinition
{
TKey = "Active",
FieldKey = "contractactive",
ColumnDataType = UiFieldDataType.Bool,
SqlValueColumnName = "acontract.active",
IsActiveColumn = true
});
ColumnDefinitions.Add(new AyaPickListFieldDefinition
{
TKey = "Name",
FieldKey = "contractname",
ColumnDataType = UiFieldDataType.Text,
SqlIdColumnName = "acontract.id",
SqlValueColumnName = "acontract.name",
IsRowId = true
});
ColumnDefinitions.Add(new AyaPickListFieldDefinition
{
TKey = "Tags",
FieldKey = "contracttags",
ColumnDataType = UiFieldDataType.Tags,
SqlValueColumnName = "acontract.tags"
});
}
}//eoc
}//eons