558 lines
32 KiB
C#
558 lines
32 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using AyaNova.Biz;
|
|
using AyaNova.Models;
|
|
|
|
namespace AyaNova.DataList
|
|
{
|
|
internal class PMItemUnitDataList : DataListProcessingBase, IDataListInternalCriteria
|
|
{
|
|
public PMItemUnitDataList(long translationId)
|
|
{
|
|
DefaultListAType = AyaType.PM;
|
|
SQLFrom = "from apm "
|
|
+ "left join acustomer on (apm.customerid = acustomer.id) "
|
|
+ "left join aheadoffice on (acustomer.headofficeid = aheadoffice.id) "
|
|
+ "left join aproject on (apm.projectid = aproject.id) "
|
|
+ "left join acontract on (apm.contractid = acontract.id)"
|
|
+ "left join apmitem on apm.id=apmitem.pmid "
|
|
+ "left join aworkorderitemstatus on (apmitem.workorderitemstatusid = aworkorderitemstatus.id) "
|
|
+ "left join aworkorderitempriority on (apmitem.workorderitempriorityid = aworkorderitempriority.id) "
|
|
|
|
//workorder item unit
|
|
+ "left join apmitemunit on apmitem.id=apmitemunit.pmitemid "
|
|
+ "left join aunit on (apmitemunit.unitid=aunit.id) "
|
|
;
|
|
|
|
var RoleSet = BizRoles.GetRoleSet(DefaultListAType);
|
|
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
|
DefaultColumns = new List<string>() {
|
|
"PMSerialNumber",
|
|
"Customer",
|
|
"PMNextServiceDate",
|
|
"PMNextWoGenerateDate",
|
|
"WorkOrderItemSequence",
|
|
"WorkOrderItemSummary",
|
|
//------
|
|
"WorkOrderItemUnit",
|
|
"WorkOrderItemUnitNotes"
|
|
};
|
|
DefaultSortBy = new Dictionary<string, string>() { { "PMSerialNumber", "-" }, { "WorkOrderItemSequence", "+" }, { "WorkOrderItemUnit", "-" } };
|
|
FieldDefinitions = new List<DataListFieldDefinition>();
|
|
|
|
|
|
/*
|
|
██╗ ██╗███╗ ██╗██╗████████╗
|
|
██║ ██║████╗ ██║██║╚══██╔══╝
|
|
██║ ██║██╔██╗ ██║██║ ██║
|
|
██║ ██║██║╚██╗██║██║ ██║
|
|
╚██████╔╝██║ ╚████║██║ ██║
|
|
╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝
|
|
*/
|
|
|
|
#region WorkOrderItemUnit fields
|
|
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "Unit",
|
|
FieldKey = "WorkOrderItemUnit",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
AType = (int)AyaType.PMItemUnit,
|
|
SqlIdColumnName = "apmitemunit.id",
|
|
SqlValueColumnName = "aunit.serial",
|
|
IsRowId = true
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "WorkOrderItemUnitNotes",
|
|
FieldKey = "WorkOrderItemUnitNotes",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
AType = (int)AyaType.PMItemUnit,
|
|
SqlIdColumnName = "apmitemunit.id",
|
|
SqlValueColumnName = "apmitemunit.notes"
|
|
});
|
|
|
|
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemUnitCustom1", FieldKey = "workorderitemunitcustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitemunit.customfields", TKeySection = "WorkOrderItemUnit" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemUnitCustom2", FieldKey = "workorderitemunitcustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitemunit.customfields", TKeySection = "WorkOrderItemUnit" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemUnitCustom3", FieldKey = "workorderitemunitcustom3", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitemunit.customfields", TKeySection = "WorkOrderItemUnit" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemUnitCustom4", FieldKey = "workorderitemunitcustom4", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitemunit.customfields", TKeySection = "WorkOrderItemUnit" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemUnitCustom5", FieldKey = "workorderitemunitcustom5", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitemunit.customfields", TKeySection = "WorkOrderItemUnit" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemUnitCustom6", FieldKey = "workorderitemunitcustom6", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitemunit.customfields", TKeySection = "WorkOrderItemUnit" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemUnitCustom7", FieldKey = "workorderitemunitcustom7", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitemunit.customfields", TKeySection = "WorkOrderItemUnit" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemUnitCustom8", FieldKey = "workorderitemunitcustom8", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitemunit.customfields", TKeySection = "WorkOrderItemUnit" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemUnitCustom9", FieldKey = "workorderitemunitcustom9", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitemunit.customfields", TKeySection = "WorkOrderItemUnit" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemUnitCustom10", FieldKey = "workorderitemunitcustom10", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitemunit.customfields", TKeySection = "WorkOrderItemUnit" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemUnitCustom11", FieldKey = "workorderitemunitcustom11", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitemunit.customfields", TKeySection = "WorkOrderItemUnit" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemUnitCustom12", FieldKey = "workorderitemunitcustom12", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitemunit.customfields", TKeySection = "WorkOrderItemUnit" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemUnitCustom13", FieldKey = "workorderitemunitcustom13", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitemunit.customfields", TKeySection = "WorkOrderItemUnit" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemUnitCustom14", FieldKey = "workorderitemunitcustom14", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitemunit.customfields", TKeySection = "WorkOrderItemUnit" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemUnitCustom15", FieldKey = "workorderitemunitcustom15", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitemunit.customfields", TKeySection = "WorkOrderItemUnit" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemUnitCustom16", FieldKey = "workorderitemunitcustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitemunit.customfields", TKeySection = "WorkOrderItemUnit" });
|
|
|
|
|
|
//META columns
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
FieldKey = "metapmitemunitid",
|
|
UiFieldDataType = (int)UiFieldDataType.InternalId,
|
|
SqlIdColumnName = "apmitemunit.id",
|
|
SqlValueColumnName = "apmitemunit.id",
|
|
IsMeta = true
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
FieldKey = "metaunit",
|
|
UiFieldDataType = (int)UiFieldDataType.InternalId,
|
|
SqlIdColumnName = "apmitemunit.unitid",
|
|
SqlValueColumnName = "apmitemunit.unitid",
|
|
IsMeta = true
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
FieldKey = "metaunitmodel",
|
|
UiFieldDataType = (int)UiFieldDataType.InternalId,
|
|
SqlIdColumnName = "aunit.unitmodelid",
|
|
SqlValueColumnName = "aunit.unitmodelid",
|
|
IsMeta = true
|
|
});
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/*
|
|
██╗████████╗███████╗███╗ ███╗███████╗
|
|
██║╚══██╔══╝██╔════╝████╗ ████║██╔════╝
|
|
██║ ██║ █████╗ ██╔████╔██║███████╗
|
|
██║ ██║ ██╔══╝ ██║╚██╔╝██║╚════██║
|
|
██║ ██║ ███████╗██║ ╚═╝ ██║███████║
|
|
╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚══════╝
|
|
*/
|
|
#region PMItem fields
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "WorkOrderItemSummary",
|
|
FieldKey = "WorkOrderItemSummary",
|
|
AType = (int)AyaType.PMItem,
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlIdColumnName = "apmitem.id",
|
|
SqlValueColumnName = "apmitem.notes"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "Sequence",
|
|
FieldKey = "WorkOrderItemSequence",
|
|
AType = (int)AyaType.PMItem,
|
|
UiFieldDataType = (int)UiFieldDataType.Integer,
|
|
SqlIdColumnName = "apmitem.id",
|
|
SqlValueColumnName = "apmitem.sequence"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "WorkOrderItemTechNotes",
|
|
FieldKey = "WorkOrderItemTechNotes",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "apmitem.technotes"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "WorkOrderItemTags",
|
|
FieldKey = "WorkOrderItemTags",
|
|
UiFieldDataType = (int)UiFieldDataType.Tags,
|
|
SqlValueColumnName = "apmitem.tags"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "WorkOrderItemWorkOrderStatusID",
|
|
FieldKey = "WorkOrderItemWorkOrderStatusID",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
AType = (int)AyaType.WorkOrderItemStatus,
|
|
SqlIdColumnName = "apmitem.workorderitemstatusid",
|
|
SqlColorColumnName = "aworkorderitemstatus.color",
|
|
SqlValueColumnName = "aworkorderitemstatus.name"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "WorkOrderItemPriorityID",
|
|
FieldKey = "WorkOrderItemPriorityID",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
AType = (int)AyaType.WorkOrderItemPriority,
|
|
SqlIdColumnName = "apmitem.workorderitempriorityid",
|
|
SqlColorColumnName = "aworkorderitempriority.color",
|
|
SqlValueColumnName = "aworkorderitempriority.name"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "WorkOrderItemRequestDate",
|
|
FieldKey = "WorkOrderItemRequestDate",
|
|
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
|
SqlValueColumnName = "apmitem.requestdate"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "WorkOrderItemWarrantyService",
|
|
FieldKey = "WorkOrderItemWarrantyService",
|
|
UiFieldDataType = (int)UiFieldDataType.Bool,
|
|
SqlValueColumnName = "apmitem.warrantyservice"
|
|
});
|
|
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemCustom1", FieldKey = "workorderitemcustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitem.customfields", TKeySection = "WorkOrderItem" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemCustom2", FieldKey = "workorderitemcustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitem.customfields", TKeySection = "WorkOrderItem" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemCustom3", FieldKey = "workorderitemcustom3", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitem.customfields", TKeySection = "WorkOrderItem" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemCustom4", FieldKey = "workorderitemcustom4", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitem.customfields", TKeySection = "WorkOrderItem" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemCustom5", FieldKey = "workorderitemcustom5", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitem.customfields", TKeySection = "WorkOrderItem" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemCustom6", FieldKey = "workorderitemcustom6", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitem.customfields", TKeySection = "WorkOrderItem" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemCustom7", FieldKey = "workorderitemcustom7", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitem.customfields", TKeySection = "WorkOrderItem" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemCustom8", FieldKey = "workorderitemcustom8", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitem.customfields", TKeySection = "WorkOrderItem" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemCustom9", FieldKey = "workorderitemcustom9", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitem.customfields", TKeySection = "WorkOrderItem" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemCustom10", FieldKey = "workorderitemcustom10", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitem.customfields", TKeySection = "WorkOrderItem" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemCustom11", FieldKey = "workorderitemcustom11", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitem.customfields", TKeySection = "WorkOrderItem" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemCustom12", FieldKey = "workorderitemcustom12", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitem.customfields", TKeySection = "WorkOrderItem" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemCustom13", FieldKey = "workorderitemcustom13", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitem.customfields", TKeySection = "WorkOrderItem" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemCustom14", FieldKey = "workorderitemcustom14", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitem.customfields", TKeySection = "WorkOrderItem" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemCustom15", FieldKey = "workorderitemcustom15", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitem.customfields", TKeySection = "WorkOrderItem" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderItemCustom16", FieldKey = "workorderitemcustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apmitem.customfields", TKeySection = "WorkOrderItem" });
|
|
|
|
|
|
//META column
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
FieldKey = "metapmitemid",
|
|
UiFieldDataType = (int)UiFieldDataType.InternalId,
|
|
SqlIdColumnName = "apmitem.id",
|
|
SqlValueColumnName = "apmitem.id",
|
|
IsMeta = true
|
|
});
|
|
|
|
#endregion workorderitem fields
|
|
|
|
|
|
|
|
/*
|
|
PM
|
|
*/
|
|
#region PM Header fields
|
|
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "PMSerialNumber",
|
|
FieldKey = "PMSerialNumber",
|
|
AType = (int)AyaType.PM,
|
|
UiFieldDataType = (int)UiFieldDataType.Integer,
|
|
SqlIdColumnName = "apm.id",
|
|
SqlValueColumnName = "apm.serial"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "PMStopGeneratingDate",
|
|
FieldKey = "PMStopGeneratingDate",
|
|
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
|
SqlValueColumnName = "apm.stopgeneratingdate"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "Active",
|
|
FieldKey = "pmactive",
|
|
UiFieldDataType = (int)UiFieldDataType.Bool,
|
|
SqlValueColumnName = "apm.active"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "PMNextServiceDate",
|
|
FieldKey = "PMNextServiceDate",
|
|
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
|
SqlValueColumnName = "apm.nextservicedate"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "PMNextWoGenerateDate",
|
|
FieldKey = "PMNextWoGenerateDate",
|
|
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
|
SqlValueColumnName = "apm.generatedate"
|
|
});
|
|
//----------
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
FieldKey = "Customer",
|
|
TKey = "Customer",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
AType = (int)AyaType.Customer,
|
|
SqlIdColumnName = "acustomer.id",
|
|
SqlValueColumnName = "acustomer.name"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "HeadOffice",
|
|
FieldKey = "workorderheadoffice",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
AType = (int)AyaType.HeadOffice,
|
|
SqlIdColumnName = "aheadoffice.id",
|
|
SqlValueColumnName = "aheadoffice.name"
|
|
});
|
|
|
|
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "WorkOrderSummary",
|
|
FieldKey = "workordernotes",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "apm.notes"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "Tags",
|
|
FieldKey = "workordertags",
|
|
UiFieldDataType = (int)UiFieldDataType.Tags,
|
|
SqlValueColumnName = "apm.tags"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
FieldKey = "Project",
|
|
TKey = "Project",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
AType = (int)AyaType.Project,
|
|
SqlIdColumnName = "aproject.id",
|
|
SqlValueColumnName = "aproject.name"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "Contract",
|
|
FieldKey = "Contract",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
AType = (int)AyaType.Contract,
|
|
SqlIdColumnName = "acontract.id",
|
|
SqlValueColumnName = "acontract.name"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "WorkOrderInternalReferenceNumber",
|
|
FieldKey = "WorkOrderInternalReferenceNumber",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "apm.internalreferencenumber"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "WorkOrderCustomerReferenceNumber",
|
|
FieldKey = "WorkOrderCustomerReferenceNumber",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "apm.customerreferencenumber"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "WorkOrderCustomerContactName",
|
|
FieldKey = "WorkOrderCustomerContactName",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "apm.customercontactname"
|
|
});
|
|
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "WorkOrderOnsite",
|
|
FieldKey = "WorkOrderOnsite",
|
|
UiFieldDataType = (int)UiFieldDataType.Bool,
|
|
SqlValueColumnName = "apm.onsite"
|
|
});
|
|
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "AddressPostalDeliveryAddress",
|
|
FieldKey = "workorderpostaddress",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "apm.postaddress"
|
|
});
|
|
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "AddressPostalCity",
|
|
FieldKey = "workorderpostcity",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "apm.postcity"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "AddressPostalStateProv",
|
|
FieldKey = "workorderpostregion",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "apm.postregion"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "AddressPostalCountry",
|
|
FieldKey = "workorderpostcountry",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "apm.postcountry"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "AddressPostalPostal",
|
|
FieldKey = "workorderpostcode",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "apm.postcode"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "AddressDeliveryAddress",
|
|
FieldKey = "workorderaddress",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "apm.address"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "AddressCity",
|
|
FieldKey = "workordercity",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "apm.city"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "AddressStateProv",
|
|
FieldKey = "workorderregion",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "apm.region"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "AddressCountry",
|
|
FieldKey = "workordercountry",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "apm.country"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "AddressPostal",
|
|
FieldKey = "workorderaddresspostal",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "apm.addresspostal"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "AddressLatitude",
|
|
FieldKey = "workorderlatitude",
|
|
UiFieldDataType = (int)UiFieldDataType.Decimal,
|
|
SqlValueColumnName = "apm.latitude"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "AddressLongitude",
|
|
FieldKey = "workorderlongitude",
|
|
UiFieldDataType = (int)UiFieldDataType.Decimal,
|
|
SqlValueColumnName = "apm.longitude"
|
|
});
|
|
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderCustom1", FieldKey = "workordercustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apm.customfields" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderCustom2", FieldKey = "workordercustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apm.customfields" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderCustom3", FieldKey = "workordercustom3", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apm.customfields" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderCustom4", FieldKey = "workordercustom4", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apm.customfields" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderCustom5", FieldKey = "workordercustom5", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apm.customfields" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderCustom6", FieldKey = "workordercustom6", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apm.customfields" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderCustom7", FieldKey = "workordercustom7", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apm.customfields" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderCustom8", FieldKey = "workordercustom8", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apm.customfields" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderCustom9", FieldKey = "workordercustom9", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apm.customfields" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderCustom10", FieldKey = "workordercustom10", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apm.customfields" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderCustom11", FieldKey = "workordercustom11", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apm.customfields" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderCustom12", FieldKey = "workordercustom12", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apm.customfields" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderCustom13", FieldKey = "workordercustom13", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apm.customfields" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderCustom14", FieldKey = "workordercustom14", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apm.customfields" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderCustom15", FieldKey = "workordercustom15", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apm.customfields" });
|
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "WorkOrderCustom16", FieldKey = "workordercustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apm.customfields" });
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
|
|
|
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
|
{
|
|
|
|
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
|
|
|
//This is required to filter out rows where there are no matching scheduled user otherwise we'd get all workorders and items regardless
|
|
{
|
|
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metapmitemunitid" };
|
|
FilterOption.Items.Add(new DataListColumnFilter() { value = "*NULL*", op = DataListFilterComparisonOperator.NotEqual });
|
|
ret.Add(FilterOption);
|
|
}
|
|
|
|
//This is an optional filter generated at client to restrict to particular item's workorders
|
|
//ClientCriteria format for this list is "OBJECTID,AYATYPE"
|
|
var crit = (clientCriteria ?? "").Split(',').Select(z => z.Trim()).ToArray();
|
|
if (crit.Length > 1)
|
|
{
|
|
int nType = 0;
|
|
if (!int.TryParse(crit[1], out nType)) return ret;
|
|
AyaType forType = (AyaType)nType;
|
|
if (forType != AyaType.Unit && forType != AyaType.UnitModel) return ret;
|
|
|
|
long lId = 0;
|
|
if (!long.TryParse(crit[0], out lId)) return ret;
|
|
if (lId == 0) return ret;
|
|
|
|
//Have valid type, have an id, so filter away
|
|
switch (forType)
|
|
{
|
|
case AyaType.Unit:
|
|
{
|
|
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metaunit" };
|
|
FilterOption.Items.Add(new DataListColumnFilter() { value = crit[0], op = DataListFilterComparisonOperator.Equality });
|
|
ret.Add(FilterOption);
|
|
}
|
|
break;
|
|
case AyaType.UnitModel:
|
|
{
|
|
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metaunitmodel" };
|
|
FilterOption.Items.Add(new DataListColumnFilter() { value = crit[0], op = DataListFilterComparisonOperator.Equality });
|
|
ret.Add(FilterOption);
|
|
}
|
|
break;
|
|
|
|
}
|
|
}
|
|
return ret;
|
|
}
|
|
}//eoc
|
|
}//eons |