From bd5f54550378e5af9b67f3b3d4be81bac0173461 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Sat, 16 Jan 2021 16:02:36 +0000 Subject: [PATCH] --- server/AyaNova/DataList/PartDataList.cs | 213 ++++++++++++++++++++++++ 1 file changed, 213 insertions(+) create mode 100644 server/AyaNova/DataList/PartDataList.cs diff --git a/server/AyaNova/DataList/PartDataList.cs b/server/AyaNova/DataList/PartDataList.cs new file mode 100644 index 00000000..b936e8bf --- /dev/null +++ b/server/AyaNova/DataList/PartDataList.cs @@ -0,0 +1,213 @@ +using System.Collections.Generic; +using Newtonsoft.Json.Linq; +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); + + + //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(); + + 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 = "partactive", + UiFieldDataType = (int)UiFieldDataType.Bool, + SqlValueColumnName = "apart.active" + }); + + FieldDefinitions.Add(new AyaDataListFieldDefinition + { + TKey = "Tags", + FieldKey = "parttags", + 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 + { + TKey = "PartTrackSerialNumber", + FieldKey = "PartTrackSerialNumber", + UiFieldDataType = (int)UiFieldDataType.Bool, + SqlValueColumnName = "apart.trackserialnumber" + }); + + + 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 \ No newline at end of file