This commit is contained in:
57
server/AyaNova/PickList/PartAssemblyPickList.cs
Normal file
57
server/AyaNova/PickList/PartAssemblyPickList.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using AyaNova.Biz;
|
||||
namespace AyaNova.PickList
|
||||
{
|
||||
internal class PartAssemblyPickList : AyaPickList
|
||||
{
|
||||
public PartAssemblyPickList()
|
||||
{
|
||||
|
||||
DefaultListObjectType = AyaType.PartAssembly;
|
||||
SQLFrom = "from apartassembly";
|
||||
AllowedRoles = BizRoles.GetRoleSet(DefaultListObjectType).Select;
|
||||
dynamic dTemplate = new JArray();
|
||||
dynamic cm = null;
|
||||
|
||||
cm = new JObject();
|
||||
cm.fld = "partassemblyname";
|
||||
dTemplate.Add(cm);
|
||||
|
||||
cm = new JObject();
|
||||
cm.fld = "partassemblytags";
|
||||
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 = "partassemblyactive",
|
||||
ColumnDataType = UiFieldDataType.Bool,
|
||||
SqlValueColumnName = "apartassembly.active",
|
||||
IsActiveColumn = true
|
||||
});
|
||||
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
||||
{
|
||||
TKey = "Name",
|
||||
FieldKey = "partassemblyname",
|
||||
ColumnDataType = UiFieldDataType.Text,
|
||||
SqlIdColumnName = "apartassembly.id",
|
||||
SqlValueColumnName = "apartassembly.name",
|
||||
IsRowId = true
|
||||
});
|
||||
|
||||
ColumnDefinitions.Add(new AyaPickListFieldDefinition
|
||||
{
|
||||
TKey = "Tags",
|
||||
FieldKey = "partassemblytags",
|
||||
ColumnDataType = UiFieldDataType.Tags,
|
||||
SqlValueColumnName = "apartassembly.tags"
|
||||
});
|
||||
|
||||
}
|
||||
}//eoc
|
||||
}//eons
|
||||
150
server/AyaNova/PickList/PartPickList.cs
Normal file
150
server/AyaNova/PickList/PartPickList.cs
Normal file
@@ -0,0 +1,150 @@
|
||||
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
|
||||
Reference in New Issue
Block a user