75 lines
2.5 KiB
C#
75 lines
2.5 KiB
C#
using System.Collections.Generic;
|
|
using Newtonsoft.Json.Linq;
|
|
using AyaNova.Biz;
|
|
namespace AyaNova.PickList
|
|
{
|
|
internal class UnitModelPickList : AyaPickList
|
|
{
|
|
public UnitModelPickList()
|
|
{
|
|
|
|
DefaultListAType = AyaType.UnitModel;
|
|
SQLFrom = "from aunitmodel left join avendor on (aunitmodel.vendorid=avendor.id)";
|
|
AllowedRoles = BizRoles.GetRoleSet(DefaultListAType).Select;
|
|
dynamic dTemplate = new JArray();
|
|
dynamic cm = null;
|
|
|
|
cm = new JObject();
|
|
cm.fld = "UnitModelName";
|
|
dTemplate.Add(cm);
|
|
|
|
|
|
|
|
cm = new JObject();
|
|
cm.fld = "UnitModelVendorID";
|
|
dTemplate.Add(cm);
|
|
|
|
cm = new JObject();
|
|
cm.fld = "unitmodeltags";
|
|
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 = "unitmodelactive",
|
|
ColumnDataType = UiFieldDataType.Bool,
|
|
SqlValueColumnName = "aunitmodel.active",
|
|
IsActiveColumn = true
|
|
});
|
|
|
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
|
{
|
|
TKey = "UnitModelName",
|
|
FieldKey = "UnitModelName",
|
|
ColumnDataType = UiFieldDataType.Text,
|
|
SqlIdColumnName = "aunitmodel.id",
|
|
SqlValueColumnName = "aunitmodel.name",
|
|
IsRowId = true
|
|
});
|
|
|
|
|
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
|
{
|
|
FieldKey = "UnitModelVendorID",
|
|
TKey = "UnitModelVendorID",
|
|
ColumnDataType = UiFieldDataType.Text,
|
|
SqlIdColumnName = "avendor.id",
|
|
SqlValueColumnName = "avendor.name"
|
|
});
|
|
|
|
|
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
|
{
|
|
TKey = "Tags",
|
|
FieldKey = "unitmodeltags",
|
|
ColumnDataType = UiFieldDataType.Tags,
|
|
SqlValueColumnName = "aunitmodel.tags"
|
|
});
|
|
|
|
}
|
|
}//eoc
|
|
}//eons |