This commit is contained in:
566
server/AyaNova/DataList/PMItemLoanDataList.cs
Normal file
566
server/AyaNova/DataList/PMItemLoanDataList.cs
Normal file
@@ -0,0 +1,566 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AyaNova.Biz;
|
||||
using AyaNova.Models;
|
||||
|
||||
namespace AyaNova.DataList
|
||||
{
|
||||
internal class PMItemLoanDataList : DataListProcessingBase, IDataListInternalCriteria
|
||||
{
|
||||
public PMItemLoanDataList()
|
||||
{
|
||||
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 loan
|
||||
+ "left join apmitemloan on apmitem.id=apmitemloan.pmitemid "
|
||||
+ "left join aloanunit on (apmitemloan.loanunitid=aloanunit.id) "
|
||||
+ "left join ataxcode on (apmitemloan.taxcodeid=ataxcode.id) "
|
||||
;
|
||||
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListAType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
DefaultColumns = new List<string>() {
|
||||
"PMSerialNumber",
|
||||
"Customer",
|
||||
"PMNextServiceDate",
|
||||
"PMNextWoGenerateDate",
|
||||
"WorkOrderItemSequence",
|
||||
"WorkOrderItemSummary",
|
||||
//------
|
||||
"WorkOrderItemLoanUnit",
|
||||
"WorkOrderItemLoanOutDate",
|
||||
"WorkOrderItemLoanDueDate",
|
||||
"WorkOrderItemLoanReturnDate"
|
||||
|
||||
};
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "PMSerialNumber", "-" }, { "WorkOrderItemSequence", "+" }, { "WorkOrderItemLoanUnit", "+" } };
|
||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||
|
||||
|
||||
/*
|
||||
██╗ ██████╗ █████╗ ███╗ ██╗
|
||||
██║ ██╔═══██╗██╔══██╗████╗ ██║
|
||||
██║ ██║ ██║███████║██╔██╗ ██║
|
||||
██║ ██║ ██║██╔══██║██║╚██╗██║
|
||||
███████╗╚██████╔╝██║ ██║██║ ╚████║
|
||||
*/
|
||||
|
||||
#region PMItemLoan fields
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "WorkOrderItemLoanUnit",
|
||||
FieldKey = "WorkOrderItemLoanUnit",
|
||||
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
AType = (int)AyaType.PMItemLoan,
|
||||
SqlIdColumnName = "apmitemloan.id",
|
||||
SqlValueColumnName = "aloanunit.name",
|
||||
IsRowId = true
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "WorkOrderItemLoanRate",
|
||||
FieldKey = "WorkOrderItemLoanRate",
|
||||
UiFieldDataType = (int)UiFieldDataType.Enum,
|
||||
EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(LoanUnitRateUnit).ToString()),
|
||||
SqlValueColumnName = "apmitemloan.rate"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "WorkOrderItemLoanNotes",
|
||||
FieldKey = "WorkOrderItemLoanNotes",
|
||||
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
SqlValueColumnName = "apmitemloan.notes"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "WorkOrderItemLoanOutDate",
|
||||
FieldKey = "WorkOrderItemLoanOutDate",
|
||||
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
||||
SqlValueColumnName = "apmitemloan.outdate"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "WorkOrderItemLoanDueDate",
|
||||
FieldKey = "WorkOrderItemLoanDueDate",
|
||||
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
||||
SqlValueColumnName = "apmitemloan.duedate"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "WorkOrderItemLoanReturnDate",
|
||||
FieldKey = "WorkOrderItemLoanReturnDate",
|
||||
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
||||
SqlValueColumnName = "apmitemloan.returndate"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "WorkOrderItemLoanQuantity",
|
||||
FieldKey = "WorkOrderItemLoanQuantity",
|
||||
UiFieldDataType = (int)UiFieldDataType.Decimal,
|
||||
SqlValueColumnName = "apmitemloan.quantity"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "WorkOrderItemLoanTaxCodeID",
|
||||
FieldKey = "WorkOrderItemLoanTaxCodeID",
|
||||
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
AType = (int)AyaType.TaxCode,
|
||||
SqlIdColumnName = "apmitemloan.taxcodeid",
|
||||
SqlValueColumnName = "ataxcode.name"
|
||||
});
|
||||
|
||||
|
||||
//META column
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
FieldKey = "metapmitemloanid",
|
||||
UiFieldDataType = (int)UiFieldDataType.InternalId,
|
||||
SqlIdColumnName = "apmitemloan.id",
|
||||
SqlValueColumnName = "apmitemloan.id",
|
||||
IsMeta = true
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
FieldKey = "metaloanunit",
|
||||
UiFieldDataType = (int)UiFieldDataType.InternalId,
|
||||
SqlIdColumnName = "apmitemloan.loanunitid",
|
||||
SqlValueColumnName = "apmitemloan.loanunitid",
|
||||
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",
|
||||
IsRowId = true
|
||||
});
|
||||
|
||||
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 = "Tags",
|
||||
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.WorkOrderItemStatus,
|
||||
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",
|
||||
IsRowId = true
|
||||
});
|
||||
|
||||
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 = "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 = "metapmitemloanid" };
|
||||
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.LoanUnit) return ret;//could be more later
|
||||
|
||||
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.LoanUnit:
|
||||
{
|
||||
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metaloanunit" };
|
||||
FilterOption.Items.Add(new DataListColumnFilter() { value = crit[0], op = DataListFilterComparisonOperator.Equality });
|
||||
ret.Add(FilterOption);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}//eoc
|
||||
}//eons
|
||||
Reference in New Issue
Block a user