From fc6527b0274d44b22b2cf99dbbb2a41450def2f5 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 29 Dec 2020 01:02:08 +0000 Subject: [PATCH] --- server/AyaNova/DataList/TaxCodeDataList.cs | 128 +++++++++++++++++++++ server/AyaNova/PickList/TaxCodePickList.cs | 56 +++++++++ server/AyaNova/biz/UiFieldDataType.cs | 3 +- 3 files changed, 186 insertions(+), 1 deletion(-) create mode 100644 server/AyaNova/DataList/TaxCodeDataList.cs create mode 100644 server/AyaNova/PickList/TaxCodePickList.cs diff --git a/server/AyaNova/DataList/TaxCodeDataList.cs b/server/AyaNova/DataList/TaxCodeDataList.cs new file mode 100644 index 00000000..91fe032a --- /dev/null +++ b/server/AyaNova/DataList/TaxCodeDataList.cs @@ -0,0 +1,128 @@ +using System.Collections.Generic; +using Newtonsoft.Json.Linq; +using AyaNova.Biz; +namespace AyaNova.DataList +{ + internal class TaxCodeDataList : AyaDataList + { + public TaxCodeDataList() + { + DefaultListObjectType = AyaType.TaxCode; + SQLFrom = "from ataxcode"; + var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; + + //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############ + //Default ListView + dynamic dlistView = new JArray(); + + dynamic cm = new JObject(); + cm.fld = "Name"; + cm.sort = "+"; + dlistView.Add(cm); + + cm = new JObject(); + cm.fld = "TaxCodeTaxA"; + dlistView.Add(cm); + + cm = new JObject(); + cm.fld = "TaxCodeTaxB"; + dlistView.Add(cm); + + cm = new JObject(); + cm.fld = "TaxCodeTaxOnTax"; + dlistView.Add(cm); + + cm = new JObject(); + cm.fld = "Active"; + 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 = "Name", + FieldKey = "Name", + AyaObjectType = (int)AyaType.TaxCode, + UiFieldDataType = (int)UiFieldDataType.Text, + SqlIdColumnName = "ataxcode.id", + SqlValueColumnName = "ataxcode.name", + IsRowId = true + }); + + FieldDefinitions.Add(new AyaDataListFieldDefinition + { + TKey = "TaxCodeNotes", + FieldKey = "TaxCodeNotes", + UiFieldDataType = (int)UiFieldDataType.Text, + SqlValueColumnName = "ataxcode.notes" + }); + + FieldDefinitions.Add(new AyaDataListFieldDefinition + { + TKey = "Active", + FieldKey = "Active", + UiFieldDataType = (int)UiFieldDataType.Bool, + SqlValueColumnName = "ataxcode.active" + }); + + FieldDefinitions.Add(new AyaDataListFieldDefinition + { + TKey = "Tags", + FieldKey = "Tags", + UiFieldDataType = (int)UiFieldDataType.Tags, + SqlValueColumnName = "ataxcode.tags" + }); + + + //------------ + + FieldDefinitions.Add(new AyaDataListFieldDefinition + { + TKey = "TaxCodeTaxA", + FieldKey = "TaxCodeTaxA", + UiFieldDataType = (int)UiFieldDataType.Percentage, + SqlValueColumnName = "ataxcode.taxa" + }); + + FieldDefinitions.Add(new AyaDataListFieldDefinition + { + TKey = "TaxCodeTaxB", + FieldKey = "TaxCodeTaxB", + UiFieldDataType = (int)UiFieldDataType.Percentage, + SqlValueColumnName = "ataxcode.taxb" + }); + + FieldDefinitions.Add(new AyaDataListFieldDefinition + { + TKey = "TaxCodeTaxOnTax", + FieldKey = "TaxCodeTaxOnTax", + UiFieldDataType = (int)UiFieldDataType.Bool, + SqlValueColumnName = "ataxcode.taxontax" + }); + + //----------- + + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "TaxCodeCustom1", FieldKey = "TaxCodecustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "ataxcode.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "TaxCodeCustom2", FieldKey = "TaxCodecustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "ataxcode.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "TaxCodeCustom3", FieldKey = "TaxCodecustom3", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "ataxcode.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "TaxCodeCustom4", FieldKey = "TaxCodecustom4", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "ataxcode.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "TaxCodeCustom5", FieldKey = "TaxCodecustom5", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "ataxcode.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "TaxCodeCustom6", FieldKey = "TaxCodecustom6", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "ataxcode.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "TaxCodeCustom7", FieldKey = "TaxCodecustom7", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "ataxcode.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "TaxCodeCustom8", FieldKey = "TaxCodecustom8", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "ataxcode.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "TaxCodeCustom9", FieldKey = "TaxCodecustom9", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "ataxcode.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "TaxCodeCustom10", FieldKey = "TaxCodecustom10", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "ataxcode.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "TaxCodeCustom11", FieldKey = "TaxCodecustom11", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "ataxcode.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "TaxCodeCustom12", FieldKey = "TaxCodecustom12", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "ataxcode.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "TaxCodeCustom13", FieldKey = "TaxCodecustom13", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "ataxcode.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "TaxCodeCustom14", FieldKey = "TaxCodecustom14", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "ataxcode.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "TaxCodeCustom15", FieldKey = "TaxCodecustom15", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "ataxcode.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "TaxCodeCustom16", FieldKey = "TaxCodecustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "ataxcode.customfields" }); + } + }//eoc +}//eons \ No newline at end of file diff --git a/server/AyaNova/PickList/TaxCodePickList.cs b/server/AyaNova/PickList/TaxCodePickList.cs new file mode 100644 index 00000000..060a0351 --- /dev/null +++ b/server/AyaNova/PickList/TaxCodePickList.cs @@ -0,0 +1,56 @@ +using System.Collections.Generic; +using Newtonsoft.Json.Linq; +using AyaNova.Biz; +namespace AyaNova.PickList +{ + internal class TaxCodePickList : AyaPickList + { + public TaxCodePickList() + { + + DefaultListObjectType = AyaType.TaxCode; + SQLFrom = "from ataxcode"; + AllowedRoles = BizRoles.GetRoleSet(DefaultListObjectType).Select; + dynamic dTemplate = new JArray(); + + dynamic cm = new JObject(); + cm.fld = "Name"; + dTemplate.Add(cm); + + cm = new JObject(); + cm.fld = "Tags"; + 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(); + ColumnDefinitions.Add(new AyaPickListFieldDefinition + { + TKey = "Active", + FieldKey = "Active", + ColumnDataType = UiFieldDataType.Bool, + SqlValueColumnName = "ataxcode.active", + IsActiveColumn = true + }); + ColumnDefinitions.Add(new AyaPickListFieldDefinition + { + TKey = "Name", + FieldKey = "Name", + ColumnDataType = UiFieldDataType.Text, + SqlIdColumnName = "ataxcode.id", + SqlValueColumnName = "ataxcode.name", + IsRowId = true + }); + + ColumnDefinitions.Add(new AyaPickListFieldDefinition + { + TKey = "Tags", + FieldKey = "Tags", + ColumnDataType = UiFieldDataType.Tags, + SqlValueColumnName = "ataxcode.tags" + }); + + } + }//eoc +}//eons \ No newline at end of file diff --git a/server/AyaNova/biz/UiFieldDataType.cs b/server/AyaNova/biz/UiFieldDataType.cs index 7d0ee8da..8c75bf70 100644 --- a/server/AyaNova/biz/UiFieldDataType.cs +++ b/server/AyaNova/biz/UiFieldDataType.cs @@ -22,6 +22,7 @@ namespace AyaNova.Biz MemorySize = 14,//this is so client can convert what would normally be an Integer type to human readable file / ram size value TimeSpan=15, PhoneNumber=16,//this is so client can dial directly, - Roles = 17//for grid display (users), + Roles = 17,//for grid display (users), + Percentage = 18 } }