This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using AyaNova.Biz;
|
using AyaNova.Biz;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|
||||||
@@ -146,6 +147,15 @@ namespace AyaNova.DataList
|
|||||||
IsMeta = true
|
IsMeta = true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
|
{
|
||||||
|
FieldKey = "metauser",
|
||||||
|
UiFieldDataType = (int)UiFieldDataType.InternalId,
|
||||||
|
SqlIdColumnName = "aworkorderitemlabor.userid",
|
||||||
|
SqlValueColumnName = "aworkorderitemlabor.userid",
|
||||||
|
IsMeta = true
|
||||||
|
});
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
@@ -526,11 +536,42 @@ namespace AyaNova.DataList
|
|||||||
|
|
||||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
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>();
|
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||||
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metawoitemlaborid" };
|
|
||||||
FilterOption.Items.Add(new DataListColumnFilter() { value = "*NULL*", op = DataListFilterComparisonOperator.NotEqual });
|
//This is required to filter out rows where there are no matching scheduled user otherwise we'd get all workorders and items regardless
|
||||||
ret.Add(FilterOption);
|
{
|
||||||
|
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metawoitemlaborid" };
|
||||||
|
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.User) 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.User:
|
||||||
|
{
|
||||||
|
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metauser" };
|
||||||
|
FilterOption.Items.Add(new DataListColumnFilter() { value = crit[0], op = DataListFilterComparisonOperator.Equality });
|
||||||
|
ret.Add(FilterOption);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using AyaNova.Biz;
|
using AyaNova.Biz;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|
||||||
@@ -117,6 +118,15 @@ namespace AyaNova.DataList
|
|||||||
IsMeta = true
|
IsMeta = true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
|
{
|
||||||
|
FieldKey = "metauser",
|
||||||
|
UiFieldDataType = (int)UiFieldDataType.InternalId,
|
||||||
|
SqlIdColumnName = "aworkorderitemscheduleduser.userid",
|
||||||
|
SqlValueColumnName = "aworkorderitemscheduleduser.userid",
|
||||||
|
IsMeta = true
|
||||||
|
});
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
@@ -498,11 +508,43 @@ namespace AyaNova.DataList
|
|||||||
|
|
||||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
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>();
|
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||||
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metawoitemscheduserid" };
|
|
||||||
FilterOption.Items.Add(new DataListColumnFilter() { value = "*NULL*", op = DataListFilterComparisonOperator.NotEqual });
|
//This is required to filter out rows where there are no matching scheduled user otherwise we'd get all workorders and items regardless
|
||||||
ret.Add(FilterOption);
|
{
|
||||||
|
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metawoitemscheduserid" };
|
||||||
|
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.User) 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.User:
|
||||||
|
{
|
||||||
|
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metauser" };
|
||||||
|
FilterOption.Items.Add(new DataListColumnFilter() { value = crit[0], op = DataListFilterComparisonOperator.Equality });
|
||||||
|
ret.Add(FilterOption);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|||||||
Reference in New Issue
Block a user