139 lines
8.0 KiB
C#
139 lines
8.0 KiB
C#
using System.Collections.Generic;
|
|
using Newtonsoft.Json.Linq;
|
|
using AyaNova.Biz;
|
|
namespace AyaNova.DataList
|
|
{
|
|
internal class UnitDataList : AyaDataList
|
|
{
|
|
public UnitDataList()
|
|
{
|
|
DefaultListObjectType = AyaType.Unit;
|
|
SQLFrom = "from aunit "
|
|
+ "left outer join acustomer on (aunit.customerid=acustomer.id) "
|
|
+ "left outer join aunit as aparentunit on (aunit.parentunitid=aunit.id) "
|
|
+ "left outer join aunitmodel on (aunit.unitmodelid=aunitmodel.id) "
|
|
+ "left outer join avendor on (aunit.purchasedfromvendorid=avendor.id) "
|
|
+ "left outer join aunit as areplacedbyunit on (aunit.replacedbyunitid=aunit.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 = "UnitSerial";
|
|
cm.sort = "+";
|
|
dlistView.Add(cm);
|
|
|
|
cm = new JObject();
|
|
cm.fld = "UnitModel";
|
|
dlistView.Add(cm);
|
|
|
|
cm = new JObject();
|
|
cm.fld = "Customer";
|
|
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 = "UnitName",
|
|
FieldKey = "unitname",
|
|
AyaObjectType = (int)AyaType.Unit,
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlIdColumnName = "aunit.id",
|
|
SqlValueColumnName = "aunit.name",
|
|
IsRowId = true
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "UnitNotes",
|
|
FieldKey = "unitnotes",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "aunit.notes"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "Active",
|
|
FieldKey = "unitactive",
|
|
UiFieldDataType = (int)UiFieldDataType.Bool,
|
|
SqlValueColumnName = "aunit.active"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "Tags",
|
|
FieldKey = "unittags",
|
|
UiFieldDataType = (int)UiFieldDataType.Tags,
|
|
SqlValueColumnName = "aunit.tags"
|
|
});
|
|
|
|
|
|
//------------
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "UnitAccountNumber",
|
|
FieldKey = "UnitAccountNumber",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "aunit.accountnumber"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
FieldKey = "UnitUnitOverseerID",
|
|
TKey = "UnitUnitOverseerID",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
AyaObjectType = (int)AyaType.User,
|
|
SqlIdColumnName = "auser.id",
|
|
SqlValueColumnName = "auser.name"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "UnitDateStarted",
|
|
FieldKey = "UnitDateStarted",
|
|
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
|
SqlValueColumnName = "aunit.datestarted"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "UnitDateCompleted",
|
|
FieldKey = "UnitDateCompleted",
|
|
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
|
SqlValueColumnName = "aunit.datecompleted"
|
|
});
|
|
//-----------
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitCustom1", FieldKey = "unitcustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitCustom2", FieldKey = "unitcustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitCustom3", FieldKey = "unitcustom3", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitCustom4", FieldKey = "unitcustom4", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitCustom5", FieldKey = "unitcustom5", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitCustom6", FieldKey = "unitcustom6", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitCustom7", FieldKey = "unitcustom7", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitCustom8", FieldKey = "unitcustom8", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitCustom9", FieldKey = "unitcustom9", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitCustom10", FieldKey = "unitcustom10", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitCustom11", FieldKey = "unitcustom11", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitCustom12", FieldKey = "unitcustom12", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitCustom13", FieldKey = "unitcustom13", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitCustom14", FieldKey = "unitcustom14", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitCustom15", FieldKey = "unitcustom15", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitCustom16", FieldKey = "unitcustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunit.customfields" });
|
|
}
|
|
}//eoc
|
|
}//eons |