150 lines
5.4 KiB
C#
150 lines
5.4 KiB
C#
using System.Collections.Generic;
|
|
using Newtonsoft.Json.Linq;
|
|
using AyaNova.Biz;
|
|
namespace AyaNova.PickList
|
|
{
|
|
internal class PartPickList : AyaPickList
|
|
{
|
|
public PartPickList()
|
|
{
|
|
|
|
DefaultListObjectType = AyaType.Part;
|
|
SQLFrom = "from apart "
|
|
+ "left join avendor as amanufacturer on (apart.manufacturerid = amanufacturer.id) "
|
|
+ "left join avendor as awholesaler on (apart.wholesalerid = awholesaler.id) "
|
|
+ "left join avendor as aalternativewholesaler on (apart.wholesalerid = aalternativewholesaler.id) ";
|
|
AllowedRoles = BizRoles.GetRoleSet(DefaultListObjectType).Select;
|
|
dynamic dTemplate = new JArray();
|
|
dynamic cm = null;
|
|
|
|
cm = new JObject();
|
|
cm.fld = "PartPartNumber";
|
|
dTemplate.Add(cm);
|
|
|
|
cm = new JObject();
|
|
cm.fld = "PartName";
|
|
dTemplate.Add(cm);
|
|
|
|
cm = new JObject();
|
|
cm.fld = "PartManufacturerID";
|
|
dTemplate.Add(cm);
|
|
|
|
cm = new JObject();
|
|
cm.fld = "parttags";
|
|
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 = "partactive",
|
|
ColumnDataType = UiFieldDataType.Bool,
|
|
SqlValueColumnName = "apart.active",
|
|
IsActiveColumn = true
|
|
});
|
|
|
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
|
{
|
|
TKey = "PartPartNumber",
|
|
FieldKey = "PartPartNumber",
|
|
ColumnDataType = UiFieldDataType.Text,
|
|
SqlIdColumnName = "apart.id",
|
|
SqlValueColumnName = "apart.partnumber",
|
|
IsRowId = true
|
|
});
|
|
|
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
|
{
|
|
TKey = "PartName",
|
|
FieldKey = "PartName",
|
|
ColumnDataType = UiFieldDataType.Text,
|
|
SqlValueColumnName = "apart.name"
|
|
});
|
|
|
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
|
{
|
|
TKey = "PartManufacturerNumber",
|
|
FieldKey = "PartManufacturerNumber",
|
|
ColumnDataType = UiFieldDataType.Text,
|
|
SqlValueColumnName = "apart.manufacturernumber"
|
|
});
|
|
|
|
|
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
|
{
|
|
TKey = "PartWholesalerNumber",
|
|
FieldKey = "PartWholesalerNumber",
|
|
ColumnDataType = UiFieldDataType.Text,
|
|
SqlValueColumnName = "apart.wholesalernumber"
|
|
});
|
|
|
|
|
|
|
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
|
{
|
|
TKey = "PartAlternativeWholesalerNumber",
|
|
FieldKey = "PartAlternativeWholesalerNumber",
|
|
ColumnDataType = UiFieldDataType.Text,
|
|
SqlValueColumnName = "apart.alternativewholesalernumber"
|
|
});
|
|
|
|
|
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
|
{
|
|
TKey = "UnitOfMeasure",
|
|
FieldKey = "UnitOfMeasure",
|
|
ColumnDataType = UiFieldDataType.Text,
|
|
SqlValueColumnName = "apart.unitofmeasure"
|
|
});
|
|
|
|
|
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
|
{
|
|
TKey = "PartUPC",
|
|
FieldKey = "PartUPC",
|
|
ColumnDataType = UiFieldDataType.Text,
|
|
SqlValueColumnName = "apart.upc"
|
|
});
|
|
|
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
|
{
|
|
FieldKey = "PartManufacturerID",
|
|
TKey = "PartManufacturerID",
|
|
ColumnDataType = UiFieldDataType.Text,
|
|
SqlIdColumnName = "amanufacturer.id",
|
|
SqlValueColumnName = "amanufacturer.name"
|
|
});
|
|
|
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
|
{
|
|
FieldKey = "PartWholesalerID",
|
|
TKey = "PartWholesalerID",
|
|
ColumnDataType = UiFieldDataType.Text,
|
|
SqlIdColumnName = "awholesaler.id",
|
|
SqlValueColumnName = "awholesaler.name"
|
|
});
|
|
|
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
|
{
|
|
FieldKey = "PartAlternativeWholesalerID",
|
|
TKey = "PartAlternativeWholesalerID",
|
|
ColumnDataType = UiFieldDataType.Text,
|
|
SqlIdColumnName = "aalternativewholesaler.id",
|
|
SqlValueColumnName = "aalternativewholesaler.name"
|
|
});
|
|
|
|
|
|
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
|
{
|
|
TKey = "Tags",
|
|
FieldKey = "parttags",
|
|
ColumnDataType = UiFieldDataType.Tags,
|
|
SqlValueColumnName = "apart.tags"
|
|
});
|
|
|
|
}
|
|
}//eoc
|
|
}//eons |