This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AyaNova.Biz;
|
||||
using AyaNova.Models;
|
||||
|
||||
@@ -124,7 +125,7 @@ namespace AyaNova.DataList
|
||||
SqlValueColumnName = "ataxcode.name"
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
//META column
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
@@ -136,6 +137,15 @@ namespace AyaNova.DataList
|
||||
IsMeta = true
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
FieldKey = "metapart",
|
||||
UiFieldDataType = (int)UiFieldDataType.InternalId,
|
||||
SqlIdColumnName = "aworkorderitempart.partid",
|
||||
SqlValueColumnName = "aworkorderitempart.partid",
|
||||
IsMeta = true
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -517,11 +527,44 @@ namespace AyaNova.DataList
|
||||
|
||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
||||
{
|
||||
//This is required to filter out rows where there are no matching scheduled user otherwise we'd get all workorders and items regardless
|
||||
|
||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metawoitempartid" };
|
||||
FilterOption.Items.Add(new DataListColumnFilter() { value = "*NULL*", op = DataListFilterComparisonOperator.NotEqual });
|
||||
ret.Add(FilterOption);
|
||||
|
||||
//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 = "metawoitempartid" };
|
||||
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.Part) 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.Part:
|
||||
{
|
||||
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metapart" };
|
||||
FilterOption.Items.Add(new DataListColumnFilter() { value = crit[0], op = DataListFilterComparisonOperator.Equality });
|
||||
ret.Add(FilterOption);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}//eoc
|
||||
|
||||
Reference in New Issue
Block a user