This commit is contained in:
180
server/AyaNova/DataList/PartInventoryDataList.cs
Normal file
180
server/AyaNova/DataList/PartInventoryDataList.cs
Normal file
@@ -0,0 +1,180 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using AyaNova.Models;
|
||||
using AyaNova.Biz;
|
||||
namespace AyaNova.DataList
|
||||
{
|
||||
internal class PartInventoryDataList : AyaDataList
|
||||
{
|
||||
public PartInventoryDataList()
|
||||
{
|
||||
|
||||
DefaultListObjectType = AyaType.PartInventory;
|
||||
SQLFrom = "from apartinventory";
|
||||
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 = "PartInventoryCreated";
|
||||
cm.sort = "-";
|
||||
dlistView.Add(cm);
|
||||
|
||||
cm = new JObject();
|
||||
cm.fld = "Object";
|
||||
dlistView.Add(cm);
|
||||
|
||||
cm = new JObject();
|
||||
cm.fld = "PartInventoryCurrency";
|
||||
dlistView.Add(cm);
|
||||
|
||||
cm = new JObject();
|
||||
cm.fld = "PartInventoryCurrencyBalance";
|
||||
dlistView.Add(cm);
|
||||
|
||||
cm = new JObject();
|
||||
cm.fld = "PartInventoryIncidents";
|
||||
dlistView.Add(cm);
|
||||
|
||||
cm = new JObject();
|
||||
cm.fld = "PartInventoryIncidentsBalance";
|
||||
dlistView.Add(cm);
|
||||
|
||||
cm = new JObject();
|
||||
cm.fld = "PartInventoryHours";
|
||||
dlistView.Add(cm);
|
||||
|
||||
cm = new JObject();
|
||||
cm.fld = "PartInventoryHoursBalance";
|
||||
dlistView.Add(cm);
|
||||
|
||||
cm = new JObject();
|
||||
cm.fld = "PartInventoryDescription";
|
||||
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 = "PartInventorySourceRootObjectType",
|
||||
FieldKey = "PartInventorySourceRootObjectType",
|
||||
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
SqlIdColumnName = "apartinventory.sourceid",
|
||||
SqlValueColumnName = "AYGETNAME(apartinventory.sourceid, apartinventory.sourcetype)",
|
||||
SqlAyTypeColumnName = "apartinventory.sourcetype"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
{
|
||||
TKey = "Object",
|
||||
FieldKey = "Object",
|
||||
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
SqlIdColumnName = "apartinventory.objectid",
|
||||
SqlValueColumnName = "AYGETNAME(apartinventory.objectid, apartinventory.objecttype)",
|
||||
SqlAyTypeColumnName = "apartinventory.objecttype"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
{
|
||||
TKey = "AyaType",
|
||||
FieldKey = "AyaType",
|
||||
UiFieldDataType = (int)UiFieldDataType.Enum,
|
||||
EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(AyaType).ToString()),
|
||||
SqlValueColumnName = "apartinventory.objecttype"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
{
|
||||
TKey = "PartInventoryDescription",
|
||||
FieldKey = "PartInventoryDescription",
|
||||
AyaObjectType = (int)AyaType.PartInventory,
|
||||
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
SqlIdColumnName = "apartinventory.id",
|
||||
SqlValueColumnName = "apartinventory.name",
|
||||
IsRowId = true
|
||||
});
|
||||
|
||||
|
||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
{
|
||||
TKey = "PartInventoryCreated",
|
||||
FieldKey = "PartInventoryCreated",
|
||||
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
||||
SqlValueColumnName = "apartinventory.entrydate"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
{
|
||||
TKey = "PartInventoryCurrency",
|
||||
FieldKey = "PartInventoryCurrency",
|
||||
UiFieldDataType = (int)UiFieldDataType.Currency,
|
||||
SqlValueColumnName = "apartinventory.currency"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
{
|
||||
TKey = "PartInventoryCurrencyBalance",
|
||||
FieldKey = "PartInventoryCurrencyBalance",
|
||||
UiFieldDataType = (int)UiFieldDataType.Currency,
|
||||
SqlValueColumnName = "apartinventory.currencybalance"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
{
|
||||
TKey = "PartInventoryIncidents",
|
||||
FieldKey = "PartInventoryIncidents",
|
||||
UiFieldDataType = (int)UiFieldDataType.Decimal,
|
||||
SqlValueColumnName = "apartinventory.incidents"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
{
|
||||
TKey = "PartInventoryIncidentsBalance",
|
||||
FieldKey = "PartInventoryIncidentsBalance",
|
||||
UiFieldDataType = (int)UiFieldDataType.Decimal,
|
||||
SqlValueColumnName = "apartinventory.incidentsbalance"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
{
|
||||
TKey = "PartInventoryHours",
|
||||
FieldKey = "PartInventoryHours",
|
||||
UiFieldDataType = (int)UiFieldDataType.Decimal,
|
||||
SqlValueColumnName = "apartinventory.hours"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
{
|
||||
TKey = "PartInventoryHoursBalance",
|
||||
FieldKey = "PartInventoryHoursBalance",
|
||||
UiFieldDataType = (int)UiFieldDataType.Decimal,
|
||||
SqlValueColumnName = "apartinventory.hoursbalance"
|
||||
});
|
||||
|
||||
//META object id column
|
||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
{
|
||||
FieldKey = "metapartinventoryobjectid",
|
||||
SqlIdColumnName = "apartinventory.objectid",
|
||||
SqlValueColumnName = "apartinventory.objectid",
|
||||
IsMeta = true
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}//eoc
|
||||
}//eons
|
||||
Reference in New Issue
Block a user