162 lines
9.2 KiB
C#
162 lines
9.2 KiB
C#
using System.Collections.Generic;
|
|
using Newtonsoft.Json.Linq;
|
|
using AyaNova.Biz;
|
|
namespace AyaNova.DataList
|
|
{
|
|
internal class UnitModelDataList : AyaDataList
|
|
{
|
|
public UnitModelDataList()
|
|
{
|
|
DefaultListObjectType = AyaType.UnitModel;
|
|
SQLFrom = "from aunitmodel left outer join avendor on (aunitmodel.vendorid=avendor.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 = "UnitModelModelNumber";
|
|
cm.sort = "+";
|
|
dlistView.Add(cm);
|
|
|
|
cm = new JObject();
|
|
cm.fld = "Name";
|
|
dlistView.Add(cm);
|
|
|
|
cm = new JObject();
|
|
cm.fld = "UnitModelVendorID";
|
|
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 = "UnitModelModelNumber",
|
|
FieldKey = "UnitModelModelNumber",
|
|
AyaObjectType = (int)AyaType.UnitModel,
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlIdColumnName = "aunitmodel.id",
|
|
SqlValueColumnName = "aunitmodel.number",
|
|
IsRowId = true
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "Name",
|
|
FieldKey = "Name",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "aunitmodel.name"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "Active",
|
|
FieldKey = "Active",
|
|
UiFieldDataType = (int)UiFieldDataType.Bool,
|
|
SqlValueColumnName = "aunitmodel.active"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "Tags",
|
|
FieldKey = "unitmodeltags",
|
|
UiFieldDataType = (int)UiFieldDataType.Tags,
|
|
SqlValueColumnName = "aunitmodel.tags"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
FieldKey = "UnitModelVendorID",
|
|
TKey = "UnitModelVendorID",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
AyaObjectType = (int)AyaType.Vendor,
|
|
SqlIdColumnName = "avendor.id",
|
|
SqlValueColumnName = "avendor.name"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "UnitModelUPC",
|
|
FieldKey = "UnitModelUPC",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "aunitmodel.upc"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "UnitModelLifeTimeWarranty",
|
|
FieldKey = "UnitModelLifeTimeWarranty",
|
|
UiFieldDataType = (int)UiFieldDataType.Bool,
|
|
SqlValueColumnName = "aunitmodel.lifetimewarranty"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "UnitModelIntroducedDate",
|
|
FieldKey = "UnitModelIntroducedDate",
|
|
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
|
SqlValueColumnName = "aunitmodel.introduceddate"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "UnitModelDiscontinued",
|
|
FieldKey = "UnitModelDiscontinued",
|
|
UiFieldDataType = (int)UiFieldDataType.Bool,
|
|
SqlValueColumnName = "aunitmodel.discontinued"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "UnitModelDiscontinuedDate",
|
|
FieldKey = "UnitModelDiscontinuedDate",
|
|
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
|
SqlValueColumnName = "aunitmodel.discontinueddate"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "UnitModelWarrantyLength",
|
|
FieldKey = "UnitModelWarrantyLength",
|
|
UiFieldDataType = (int)UiFieldDataType.Integer,
|
|
SqlValueColumnName = "aunitmodel.warrantylength"
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "UnitModelWarrantyTerms",
|
|
FieldKey = "UnitModelWarrantyTerms",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "aunitmodel.warrantyterms"
|
|
});
|
|
//-----------
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitModelCustom1", FieldKey = "unitmodelcustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunitmodel.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitModelCustom2", FieldKey = "unitmodelcustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunitmodel.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitModelCustom3", FieldKey = "unitmodelcustom3", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunitmodel.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitModelCustom4", FieldKey = "unitmodelcustom4", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunitmodel.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitModelCustom5", FieldKey = "unitmodelcustom5", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunitmodel.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitModelCustom6", FieldKey = "unitmodelcustom6", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunitmodel.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitModelCustom7", FieldKey = "unitmodelcustom7", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunitmodel.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitModelCustom8", FieldKey = "unitmodelcustom8", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunitmodel.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitModelCustom9", FieldKey = "unitmodelcustom9", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunitmodel.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitModelCustom10", FieldKey = "unitmodelcustom10", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunitmodel.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitModelCustom11", FieldKey = "unitmodelcustom11", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunitmodel.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitModelCustom12", FieldKey = "unitmodelcustom12", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunitmodel.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitModelCustom13", FieldKey = "unitmodelcustom13", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunitmodel.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitModelCustom14", FieldKey = "unitmodelcustom14", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunitmodel.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitModelCustom15", FieldKey = "unitmodelcustom15", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunitmodel.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "UnitModelCustom16", FieldKey = "unitmodelcustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aunitmodel.customfields" });
|
|
}
|
|
}//eoc
|
|
}//eons |