169 lines
6.0 KiB
C#
169 lines
6.0 KiB
C#
using System.Collections.Generic;
|
|
using Newtonsoft.Json.Linq;
|
|
using AyaNova.Models;
|
|
using AyaNova.Biz;
|
|
namespace AyaNova.DataList
|
|
{
|
|
internal class ServiceBankDataList : AyaDataList
|
|
{
|
|
public ServiceBankDataList()
|
|
{
|
|
|
|
DefaultListObjectType = AyaType.ServiceBank;
|
|
SQLFrom = "from aservicebank";
|
|
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 = "ServiceBankCreated";
|
|
cm.sort = "-";
|
|
dlistView.Add(cm);
|
|
|
|
cm = new JObject();
|
|
cm.fld = "ServiceBankCurrency";
|
|
dlistView.Add(cm);
|
|
|
|
cm = new JObject();
|
|
cm.fld = "ServiceBankCurrencyBalance";
|
|
dlistView.Add(cm);
|
|
|
|
cm = new JObject();
|
|
cm.fld = "ServiceBankIncidents";
|
|
dlistView.Add(cm);
|
|
|
|
cm = new JObject();
|
|
cm.fld = "ServiceBankIncidentsBalance";
|
|
dlistView.Add(cm);
|
|
|
|
cm = new JObject();
|
|
cm.fld = "ServiceBankHours";
|
|
dlistView.Add(cm);
|
|
|
|
cm = new JObject();
|
|
cm.fld = "ServiceBankHoursBalance";
|
|
dlistView.Add(cm);
|
|
|
|
cm = new JObject();
|
|
cm.fld = "ServiceBankSourceRootObjectType";
|
|
dlistView.Add(cm);
|
|
|
|
cm = new JObject();
|
|
cm.fld = "ServiceBankDescription";
|
|
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 = "ServiceBankSourceRootObjectType",
|
|
FieldKey = "ServiceBankSourceRootObjectType",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlIdColumnName = "aservicebank.objectid",
|
|
SqlValueColumnName = "AYGETNAME(aservicebank.objectid, aservicebank.objecttype)",
|
|
SqlAyTypeColumnName = "aservicebank.objecttype"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "AyaType",
|
|
FieldKey = "AyaType",
|
|
UiFieldDataType = (int)UiFieldDataType.Enum,
|
|
EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(AyaType).ToString()),
|
|
SqlValueColumnName = "aservicebank.objecttype"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "ServiceBankDescription",
|
|
FieldKey = "ServiceBankDescription",
|
|
AyaObjectType = (int)AyaType.ServiceBank,
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlIdColumnName = "aservicebank.id",
|
|
SqlValueColumnName = "aservicebank.name",
|
|
IsRowId = true
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "ServiceBankCreated",
|
|
FieldKey = "ServiceBankCreated",
|
|
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
|
SqlValueColumnName = "aservicebank.entrydate"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "ServiceBankCurrency",
|
|
FieldKey = "ServiceBankCurrency",
|
|
UiFieldDataType = (int)UiFieldDataType.Currency,
|
|
SqlValueColumnName = "aservicebank.currency"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "ServiceBankCurrencyBalance",
|
|
FieldKey = "ServiceBankCurrencyBalance",
|
|
UiFieldDataType = (int)UiFieldDataType.Currency,
|
|
SqlValueColumnName = "aservicebank.currencybalance"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "ServiceBankIncidents",
|
|
FieldKey = "ServiceBankIncidents",
|
|
UiFieldDataType = (int)UiFieldDataType.Decimal,
|
|
SqlValueColumnName = "aservicebank.incidents"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "ServiceBankIncidentsBalance",
|
|
FieldKey = "ServiceBankIncidentsBalance",
|
|
UiFieldDataType = (int)UiFieldDataType.Decimal,
|
|
SqlValueColumnName = "aservicebank.incidentsbalance"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "ServiceBankHours",
|
|
FieldKey = "ServiceBankHours",
|
|
UiFieldDataType = (int)UiFieldDataType.Decimal,
|
|
SqlValueColumnName = "aservicebank.hours"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "ServiceBankHoursBalance",
|
|
FieldKey = "ServiceBankHoursBalance",
|
|
UiFieldDataType = (int)UiFieldDataType.Decimal,
|
|
SqlValueColumnName = "aservicebank.hoursbalance"
|
|
});
|
|
|
|
//META object id column
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
FieldKey = "metaservicebankobjectid",
|
|
SqlIdColumnName = "aservicebank.objectid",
|
|
SqlValueColumnName = "aservicebank.objectid",
|
|
IsMeta = true
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}//eoc
|
|
}//eons |