This commit is contained in:
@@ -1,8 +1,11 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using AyaNova.Biz;
|
using AyaNova.Biz;
|
||||||
|
using AyaNova.Models;
|
||||||
|
|
||||||
namespace AyaNova.DataList
|
namespace AyaNova.DataList
|
||||||
{
|
{
|
||||||
internal class UnitDataList : DataListProcessingBase
|
internal class UnitDataList : DataListProcessingBase, IDataListInternalCriteria
|
||||||
{
|
{
|
||||||
public UnitDataList()
|
public UnitDataList()
|
||||||
{
|
{
|
||||||
@@ -260,6 +263,55 @@ namespace AyaNova.DataList
|
|||||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "UnitCustom14", FieldKey = "unitcustom14", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "amainunit.customfields" });
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "UnitCustom14", FieldKey = "unitcustom14", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "amainunit.customfields" });
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "UnitCustom15", FieldKey = "unitcustom15", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "amainunit.customfields" });
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "UnitCustom15", FieldKey = "unitcustom15", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "amainunit.customfields" });
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "UnitCustom16", FieldKey = "unitcustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "amainunit.customfields" });
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "UnitCustom16", FieldKey = "unitcustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "amainunit.customfields" });
|
||||||
|
|
||||||
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
|
{
|
||||||
|
FieldKey = "metacustomer",
|
||||||
|
UiFieldDataType = (int)UiFieldDataType.InternalId,
|
||||||
|
SqlIdColumnName = "amainunit.customerid",
|
||||||
|
SqlValueColumnName = "amainunit.customerid",
|
||||||
|
IsMeta = true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
||||||
|
{
|
||||||
|
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||||
|
|
||||||
|
//ClientCriteria format for this list is "OBJECTID,AYATYPE"
|
||||||
|
var crit = (clientCriteria ?? "").Split(',').Select(z => z.Trim()).ToArray();
|
||||||
|
if (crit.Length > 1)
|
||||||
|
{
|
||||||
|
//will be filtered from different types, show all units from Customer and nothing else at this time
|
||||||
|
int nType = 0;
|
||||||
|
if (!int.TryParse(crit[1], out nType)) return ret;
|
||||||
|
AyaType forType = (AyaType)nType;
|
||||||
|
if (forType != AyaType.Customer) return ret;//only supports customer for now see workorderdatalist for alts
|
||||||
|
|
||||||
|
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.Customer:
|
||||||
|
{
|
||||||
|
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metacustomer" };
|
||||||
|
FilterOption.Items.Add(new DataListColumnFilter() { value = crit[0], op = DataListFilterComparisonOperator.Equality });
|
||||||
|
ret.Add(FilterOption);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
// case AyaType.Project:
|
||||||
|
// {
|
||||||
|
// DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metaproject" };
|
||||||
|
// FilterOption.Items.Add(new DataListColumnFilter() { value = crit[0], op = DataListFilterComparisonOperator.Equality });
|
||||||
|
// ret.Add(FilterOption);
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
}//eoc
|
}//eoc
|
||||||
}//eons
|
}//eons
|
||||||
Reference in New Issue
Block a user