273 lines
14 KiB
C#
273 lines
14 KiB
C#
using System.Collections.Generic;
|
|
using Newtonsoft.Json.Linq;
|
|
using AyaNova.Biz;
|
|
namespace AyaNova.DataList
|
|
{
|
|
internal class HeadOfficeDataList : AyaDataList
|
|
{
|
|
public HeadOfficeDataList()
|
|
{
|
|
DefaultListObjectType = AyaType.HeadOffice;
|
|
SQLFrom = "from aheadoffice left outer join acontract on (aheadoffice.contractid=acontract.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 = new JObject();
|
|
cm.fld = "headofficename";
|
|
cm.sort = "+";
|
|
dlistView.Add(cm);
|
|
|
|
cm = new JObject();
|
|
cm.fld = "headofficephone1";
|
|
dlistView.Add(cm);
|
|
|
|
cm = new JObject();
|
|
cm.fld = "headofficeemail";
|
|
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 = "HeadOfficeName",
|
|
FieldKey = "headofficename",
|
|
AyaObjectType = (int)AyaType.HeadOffice,
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlIdColumnName = "aheadoffice.id",
|
|
SqlValueColumnName = "aheadoffice.name",
|
|
IsRowId = true
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "HeadOfficeNotes",
|
|
FieldKey = "headofficenotes",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "aheadoffice.notes"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "Active",
|
|
FieldKey = "headofficeactive",
|
|
UiFieldDataType = (int)UiFieldDataType.Bool,
|
|
SqlValueColumnName = "aheadoffice.active"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "Tags",
|
|
FieldKey = "headofficetags",
|
|
UiFieldDataType = (int)UiFieldDataType.Tags,
|
|
SqlValueColumnName = "aheadoffice.tags"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "WebAddress",
|
|
FieldKey = "headofficewebaddress",
|
|
UiFieldDataType = (int)UiFieldDataType.HTTP,
|
|
SqlValueColumnName = "aheadoffice.webaddress"
|
|
});
|
|
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "HeadOfficeAccountNumber",
|
|
FieldKey = "headofficeaccountnumber",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "aheadoffice.accountnumber"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "UsesBanking",
|
|
FieldKey = "headofficeusesbanking",
|
|
UiFieldDataType = (int)UiFieldDataType.Bool,
|
|
SqlValueColumnName = "aheadoffice.usesbanking"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "Contract",
|
|
FieldKey = "headofficecontract",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
AyaObjectType = (int)AyaType.Contract,
|
|
SqlIdColumnName = "acontract.id",
|
|
SqlValueColumnName = "acontract.name"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "ContractExpires",
|
|
FieldKey = "headofficecontractexpires",
|
|
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
|
SqlValueColumnName = "aheadoffice.contractexpires"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "HeadOfficePhone1",
|
|
FieldKey = "headofficephone1",
|
|
UiFieldDataType = (int)UiFieldDataType.PhoneNumber,
|
|
SqlValueColumnName = "aheadoffice.phone1"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "HeadOfficePhone2",
|
|
FieldKey = "headofficephone2",
|
|
UiFieldDataType = (int)UiFieldDataType.PhoneNumber,
|
|
SqlValueColumnName = "aheadoffice.phone2"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "HeadOfficePhone3",
|
|
FieldKey = "headofficephone3",
|
|
UiFieldDataType = (int)UiFieldDataType.PhoneNumber,
|
|
SqlValueColumnName = "aheadoffice.phone3"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "HeadOfficePhone4",
|
|
FieldKey = "headofficephone4",
|
|
UiFieldDataType = (int)UiFieldDataType.PhoneNumber,
|
|
SqlValueColumnName = "aheadoffice.phone4"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "HeadOfficePhone5",
|
|
FieldKey = "headofficephone5",
|
|
UiFieldDataType = (int)UiFieldDataType.PhoneNumber,
|
|
SqlValueColumnName = "aheadoffice.phone5"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "HeadOfficeEmail",
|
|
FieldKey = "headofficeemail",
|
|
UiFieldDataType = (int)UiFieldDataType.EmailAddress,
|
|
SqlValueColumnName = "aheadoffice.emailaddress"
|
|
});
|
|
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "AddressPostalDeliveryAddress",
|
|
FieldKey = "headofficepostaddress",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "aheadoffice.postaddress"
|
|
});
|
|
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "AddressPostalCity",
|
|
FieldKey = "headofficepostcity",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "aheadoffice.postcity"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "AddressPostalStateProv",
|
|
FieldKey = "headofficepostregion",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "aheadoffice.postregion"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "AddressPostalCountry",
|
|
FieldKey = "headofficepostcountry",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "aheadoffice.postcountry"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "AddressPostalPostal",
|
|
FieldKey = "headofficepostcode",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "aheadoffice.postcode"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "AddressDeliveryAddress",
|
|
FieldKey = "headofficeaddress",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "aheadoffice.address"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "AddressCity",
|
|
FieldKey = "headofficecity",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "aheadoffice.city"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "AddressStateProv",
|
|
FieldKey = "headofficeregion",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "aheadoffice.region"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "AddressCountry",
|
|
FieldKey = "headofficecountry",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "aheadoffice.country"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "AddressLatitude",
|
|
FieldKey = "headofficelatitude",
|
|
UiFieldDataType = (int)UiFieldDataType.Decimal,
|
|
SqlValueColumnName = "aheadoffice.latitude"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "AddressLongitude",
|
|
FieldKey = "headofficelongitude",
|
|
UiFieldDataType = (int)UiFieldDataType.Decimal,
|
|
SqlValueColumnName = "aheadoffice.longitude"
|
|
});
|
|
|
|
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "HeadOfficeCustom1", FieldKey = "headofficecustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aheadoffice.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "HeadOfficeCustom2", FieldKey = "headofficecustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aheadoffice.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "HeadOfficeCustom3", FieldKey = "headofficecustom3", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aheadoffice.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "HeadOfficeCustom4", FieldKey = "headofficecustom4", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aheadoffice.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "HeadOfficeCustom5", FieldKey = "headofficecustom5", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aheadoffice.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "HeadOfficeCustom6", FieldKey = "headofficecustom6", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aheadoffice.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "HeadOfficeCustom7", FieldKey = "headofficecustom7", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aheadoffice.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "HeadOfficeCustom8", FieldKey = "headofficecustom8", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aheadoffice.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "HeadOfficeCustom9", FieldKey = "headofficecustom9", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aheadoffice.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "HeadOfficeCustom10", FieldKey = "headofficecustom10", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aheadoffice.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "HeadOfficeCustom11", FieldKey = "headofficecustom11", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aheadoffice.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "HeadOfficeCustom12", FieldKey = "headofficecustom12", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aheadoffice.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "HeadOfficeCustom13", FieldKey = "headofficecustom13", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aheadoffice.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "HeadOfficeCustom14", FieldKey = "headofficecustom14", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aheadoffice.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "HeadOfficeCustom15", FieldKey = "headofficecustom15", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aheadoffice.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "HeadOfficeCustom16", FieldKey = "headofficecustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aheadoffice.customfields" });
|
|
}
|
|
}//eoc
|
|
}//eons |