114 lines
4.0 KiB
C#
114 lines
4.0 KiB
C#
using System.Collections.Generic;
|
|
using Newtonsoft.Json.Linq;
|
|
using AyaNova.Biz;
|
|
namespace AyaNova.PickList
|
|
{
|
|
internal class UnitPickList : AyaPickList
|
|
{
|
|
public UnitPickList()
|
|
{
|
|
|
|
DefaultListObjectType = AyaType.Unit;
|
|
SQLFrom = "from aunit "
|
|
+ "left join aunitmodel on (aunit.unitmodelid=aunitmodel.id) "
|
|
+ "left join avendor on (aunitmodel.vendorid=avendor.id) ";
|
|
|
|
AllowedRoles = BizRoles.GetRoleSet(DefaultListObjectType).Select;
|
|
dynamic dTemplate = new JArray();
|
|
dynamic cm = null;
|
|
|
|
cm = new JObject();
|
|
cm.fld = "UnitSerial";
|
|
dTemplate.Add(cm);
|
|
|
|
cm = new JObject();
|
|
cm.fld = "UnitModel";
|
|
dTemplate.Add(cm);
|
|
|
|
cm = new JObject();
|
|
cm.fld = "UnitModelVendorID";
|
|
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 = "unitactive",
|
|
ColumnDataType = UiFieldDataType.Bool,
|
|
SqlValueColumnName = "aunit.active",
|
|
IsActiveColumn = true
|
|
});
|
|
|
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
|
{
|
|
TKey = "UnitSerial",
|
|
FieldKey = "UnitSerial",
|
|
ColumnDataType = UiFieldDataType.Text,
|
|
SqlIdColumnName = "aunit.id",
|
|
SqlValueColumnName = "aunit.serial",
|
|
IsRowId = true
|
|
});
|
|
|
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
|
{
|
|
FieldKey = "UnitModelVendorID",
|
|
TKey = "UnitModelVendorID",
|
|
ColumnDataType = UiFieldDataType.Text,
|
|
SqlIdColumnName = "avendor.id",
|
|
SqlValueColumnName = "avendor.name"
|
|
});
|
|
|
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
|
{
|
|
TKey = "UnitDescription",
|
|
FieldKey = "UnitDescription",
|
|
ColumnDataType = UiFieldDataType.Text,
|
|
SqlValueColumnName = "aunit.description"
|
|
});
|
|
|
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
|
{
|
|
TKey = "UnitText1",
|
|
FieldKey = "UnitText1",
|
|
ColumnDataType = UiFieldDataType.Text,
|
|
SqlValueColumnName = "aunit.text1"
|
|
});
|
|
|
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
|
{
|
|
TKey = "UnitText2",
|
|
FieldKey = "UnitText2",
|
|
ColumnDataType = UiFieldDataType.Text,
|
|
SqlValueColumnName = "aunit.text2"
|
|
});
|
|
|
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
|
{
|
|
TKey = "UnitText3",
|
|
FieldKey = "UnitText3",
|
|
ColumnDataType = UiFieldDataType.Text,
|
|
SqlValueColumnName = "aunit.text3"
|
|
});
|
|
|
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
|
{
|
|
TKey = "UnitText4",
|
|
FieldKey = "UnitText4",
|
|
ColumnDataType = UiFieldDataType.Text,
|
|
SqlValueColumnName = "aunit.text4"
|
|
});
|
|
|
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
|
{
|
|
TKey = "Tags",
|
|
FieldKey = "unittags",
|
|
ColumnDataType = UiFieldDataType.Tags,
|
|
SqlValueColumnName = "aunit.tags"
|
|
});
|
|
|
|
}
|
|
}//eoc
|
|
}//eons |