184 lines
10 KiB
C#
184 lines
10 KiB
C#
using System.Collections.Generic;
|
|
using Newtonsoft.Json.Linq;
|
|
using AyaNova.Biz;
|
|
namespace AyaNova.DataList
|
|
{
|
|
internal class LoanUnitDataList : AyaDataList
|
|
{
|
|
public LoanUnitDataList()
|
|
{
|
|
DefaultListObjectType = AyaType.LoanUnit;
|
|
SQLFrom = "from aloanunit " +
|
|
"left join aunit as shadowunit on (aloanunit.unitid=shadowunit.id) " +
|
|
"left join aworkorderitemloan as wil on (aloanunit.workorderitemloanid=wil.id) " +
|
|
"left join aworkorderitem as wi on (wil.workorderitemid=wi.id)" +
|
|
"left join aworkorder as w on (wi.workorderid=w.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 = null;
|
|
|
|
cm = new JObject();
|
|
cm.fld = "LoanUnitName";
|
|
cm.sort = "+";
|
|
dlistView.Add(cm);
|
|
|
|
cm = new JObject();
|
|
cm.fld = "LoanUnitSerial";
|
|
dlistView.Add(cm);
|
|
|
|
cm = new JObject();
|
|
cm.fld = "Tags";
|
|
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 = "LoanUnitName",
|
|
FieldKey = "LoanUnitName",
|
|
AyaObjectType = (int)AyaType.LoanUnit,
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlIdColumnName = "aloanunit.id",
|
|
SqlValueColumnName = "aloanunit.name",
|
|
IsRowId = true
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "LoanUnitSerial",
|
|
FieldKey = "LoanUnitSerial",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "aloanunit.serial"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "LoanUnitNotes",
|
|
FieldKey = "LoanUnitNotes",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "aloanunit.notes"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "Active",
|
|
FieldKey = "Active",
|
|
UiFieldDataType = (int)UiFieldDataType.Bool,
|
|
SqlValueColumnName = "aloanunit.active"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "Tags",
|
|
FieldKey = "Tags",
|
|
UiFieldDataType = (int)UiFieldDataType.Tags,
|
|
SqlValueColumnName = "aloanunit.tags"
|
|
});
|
|
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
FieldKey = "LoanUnitCurrentWorkOrderItemLoan",
|
|
TKey = "LoanUnitCurrentWorkOrderItemLoan",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
AyaObjectType = (int)AyaType.WorkOrderItemLoan,
|
|
SqlIdColumnName = "wil.id",
|
|
SqlValueColumnName = "w.serial"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "LoanUnitRateDay",
|
|
FieldKey = "LoanUnitRateDay",
|
|
UiFieldDataType = (int)UiFieldDataType.Currency,
|
|
SqlValueColumnName = "aloanunit.rateday"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "LoanUnitRateHalfDay",
|
|
FieldKey = "LoanUnitRateHalfDay",
|
|
UiFieldDataType = (int)UiFieldDataType.Currency,
|
|
SqlValueColumnName = "aloanunit.ratehalfday"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "LoanUnitRateHour",
|
|
FieldKey = "LoanUnitRateHour",
|
|
UiFieldDataType = (int)UiFieldDataType.Currency,
|
|
SqlValueColumnName = "aloanunit.ratehour"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "LoanUnitRateMonth",
|
|
FieldKey = "LoanUnitRateMonth",
|
|
UiFieldDataType = (int)UiFieldDataType.Currency,
|
|
SqlValueColumnName = "aloanunit.ratemonth"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "LoanUnitRateWeek",
|
|
FieldKey = "LoanUnitRateWeek",
|
|
UiFieldDataType = (int)UiFieldDataType.Currency,
|
|
SqlValueColumnName = "aloanunit.rateweek"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "LoanUnitRateYear",
|
|
FieldKey = "LoanUnitRateYear",
|
|
UiFieldDataType = (int)UiFieldDataType.Currency,
|
|
SqlValueColumnName = "aloanunit.rateyear"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "LoanUnitDefaultRate",
|
|
FieldKey = "LoanUnitDefaultRate",
|
|
UiFieldDataType = (int)UiFieldDataType.Enum,
|
|
EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(LoanUnitRateUnit).ToString()),
|
|
SqlValueColumnName = "aloanunit.defaultrate"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
FieldKey = "LoanUnitShadowUnit",
|
|
TKey = "LoanUnitShadowUnit",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
AyaObjectType = (int)AyaType.Unit,
|
|
SqlIdColumnName = "shadowunit.id",
|
|
SqlValueColumnName = "shadowunit.serial"
|
|
});
|
|
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "LoanUnitCustom1", FieldKey = "loanunitcustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "LoanUnitCustom2", FieldKey = "loanunitcustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "LoanUnitCustom3", FieldKey = "loanunitcustom3", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "LoanUnitCustom4", FieldKey = "loanunitcustom4", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "LoanUnitCustom5", FieldKey = "loanunitcustom5", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "LoanUnitCustom6", FieldKey = "loanunitcustom6", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "LoanUnitCustom7", FieldKey = "loanunitcustom7", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "LoanUnitCustom8", FieldKey = "loanunitcustom8", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "LoanUnitCustom9", FieldKey = "loanunitcustom9", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "LoanUnitCustom10", FieldKey = "loanunitcustom10", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "LoanUnitCustom11", FieldKey = "loanunitcustom11", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "LoanUnitCustom12", FieldKey = "loanunitcustom12", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "LoanUnitCustom13", FieldKey = "loanunitcustom13", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "LoanUnitCustom14", FieldKey = "loanunitcustom14", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "LoanUnitCustom15", FieldKey = "loanunitcustom15", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "LoanUnitCustom16", FieldKey = "loanunitcustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
|
}
|
|
}//eoc
|
|
}//eons |