Files
raven/server/AyaNova/DataList/TaxCodeDataList.cs
2020-12-29 01:29:43 +00:00

128 lines
7.3 KiB
C#

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<AyaDataListFieldDefinition>();
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.Decimal,
SqlValueColumnName = "ataxcode.taxa"
});
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "TaxCodeTaxB",
FieldKey = "TaxCodeTaxB",
UiFieldDataType = (int)UiFieldDataType.Decimal,
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