207 lines
10 KiB
C#
207 lines
10 KiB
C#
using System.Collections.Generic;
|
|
using AyaNova.Biz;
|
|
namespace AyaNova.DataList
|
|
{
|
|
internal class PartDataList : AyaDataList
|
|
{
|
|
public PartDataList()
|
|
{
|
|
DefaultListObjectType = AyaType.Part;
|
|
|
|
SQLFrom = "from apart "
|
|
+ "left join avendor as aman on (apart.manufacturerid=aman.id) "
|
|
+ "left join avendor as awhole on (apart.wholesalerid=awhole.id) "
|
|
+ "left join avendor as aaltwhole on (apart.alternativewholesalerid=aaltwhole.id)";
|
|
|
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
|
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
|
|
|
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
|
// //Default ListView
|
|
// dynamic dlistView = new JArray();
|
|
// dynamic cm = null;
|
|
|
|
// cm = new JObject();
|
|
// cm.fld = "PartPartNumber";
|
|
// cm.sort = "+";
|
|
// dlistView.Add(cm);
|
|
|
|
// cm = new JObject();
|
|
// cm.fld = "PartName";
|
|
// dlistView.Add(cm);
|
|
|
|
// cm = new JObject();
|
|
// cm.fld = "PartManufacturerID";
|
|
// dlistView.Add(cm);
|
|
|
|
// cm = new JObject();
|
|
// cm.fld = "PartWholesalerID";
|
|
// dlistView.Add(cm);
|
|
|
|
// cm = new JObject();
|
|
// cm.fld = "Tags";
|
|
// dlistView.Add(cm);
|
|
|
|
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
|
|
|
DefaultColumns = new List<string>() { "PartPartNumber", "PartName", "PartManufacturerID", "PartWholesalerID", "Tags" };
|
|
DefaultSortBy = new Dictionary<string, string>() { { "PartPartNumber", "+" } };
|
|
|
|
|
|
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined table need to be specified completely
|
|
FieldDefinitions = new List<AyaDataListFieldDefinition>();
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "PartPartNumber",
|
|
FieldKey = "PartPartNumber",
|
|
AyaObjectType = (int)AyaType.Part,
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlIdColumnName = "apart.id",
|
|
SqlValueColumnName = "apart.partnumber",
|
|
IsRowId = true
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "PartName",
|
|
FieldKey = "PartName",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "apart.name"
|
|
});
|
|
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "PartNotes",
|
|
FieldKey = "PartNotes",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "apart.notes"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "Active",
|
|
FieldKey = "Active",
|
|
UiFieldDataType = (int)UiFieldDataType.Bool,
|
|
SqlValueColumnName = "apart.active"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "Tags",
|
|
FieldKey = "Tags",
|
|
UiFieldDataType = (int)UiFieldDataType.Tags,
|
|
SqlValueColumnName = "apart.tags"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "PartCost",
|
|
FieldKey = "PartCost",
|
|
UiFieldDataType = (int)UiFieldDataType.Currency,
|
|
SqlValueColumnName = "apart.cost"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "PartRetail",
|
|
FieldKey = "PartRetail",
|
|
UiFieldDataType = (int)UiFieldDataType.Currency,
|
|
SqlValueColumnName = "apart.retail"
|
|
});
|
|
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
FieldKey = "PartManufacturerID",
|
|
TKey = "PartManufacturerID",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
AyaObjectType = (int)AyaType.Vendor,
|
|
SqlIdColumnName = "aman.id",
|
|
SqlValueColumnName = "aman.name"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
FieldKey = "PartWholesalerID",
|
|
TKey = "PartWholesalerID",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
AyaObjectType = (int)AyaType.Vendor,
|
|
SqlIdColumnName = "awhole.id",
|
|
SqlValueColumnName = "awhole.name"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
FieldKey = "PartAlternativeWholesalerID",
|
|
TKey = "PartAlternativeWholesalerID",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
AyaObjectType = (int)AyaType.Vendor,
|
|
SqlIdColumnName = "aaltwhole.id",
|
|
SqlValueColumnName = "aaltwhole.name"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "PartManufacturerNumber",
|
|
FieldKey = "PartManufacturerNumber",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "apart.manufacturernumber"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "PartWholesalerNumber",
|
|
FieldKey = "PartWholesalerNumber",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "apart.wholesalernumber"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "PartAlternativeWholesalerNumber",
|
|
FieldKey = "PartAlternativeWholesalerNumber",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "apart.alternativewholesalernumber"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "UnitOfMeasure",
|
|
FieldKey = "UnitOfMeasure",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "apart.unitofmeasure"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "PartUPC",
|
|
FieldKey = "PartUPC",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "apart.upc"
|
|
});
|
|
|
|
|
|
|
|
//-----------
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "PartCustom1", FieldKey = "partcustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "PartCustom2", FieldKey = "partcustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "PartCustom3", FieldKey = "partcustom3", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "PartCustom4", FieldKey = "partcustom4", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "PartCustom5", FieldKey = "partcustom5", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "PartCustom6", FieldKey = "partcustom6", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "PartCustom7", FieldKey = "partcustom7", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "PartCustom8", FieldKey = "partcustom8", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "PartCustom9", FieldKey = "partcustom9", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "PartCustom10", FieldKey = "partcustom10", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "PartCustom11", FieldKey = "partcustom11", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "PartCustom12", FieldKey = "partcustom12", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "PartCustom13", FieldKey = "partcustom13", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "PartCustom14", FieldKey = "partcustom14", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "PartCustom15", FieldKey = "partcustom15", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "PartCustom16", FieldKey = "partcustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
|
|
}
|
|
}//eoc
|
|
}//eons |