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 CustomerDataList : DataListProcessingBase
|
internal class CustomerDataList : DataListProcessingBase, IDataListInternalCriteria
|
||||||
{
|
{
|
||||||
public CustomerDataList()
|
public CustomerDataList()
|
||||||
{
|
{
|
||||||
@@ -282,9 +285,53 @@ namespace AyaNova.DataList
|
|||||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "CustomerCustom14", FieldKey = "customercustom14", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "acustomer.customfields" });
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "CustomerCustom14", FieldKey = "customercustom14", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "acustomer.customfields" });
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "CustomerCustom15", FieldKey = "customercustom15", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "acustomer.customfields" });
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "CustomerCustom15", FieldKey = "customercustom15", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "acustomer.customfields" });
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "CustomerCustom16", FieldKey = "customercustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "acustomer.customfields" });
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "CustomerCustom16", FieldKey = "customercustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "acustomer.customfields" });
|
||||||
|
|
||||||
|
|
||||||
|
//META COLUMNS
|
||||||
|
|
||||||
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
|
{
|
||||||
|
FieldKey = "metaheadoffice",
|
||||||
|
UiFieldDataType = (int)UiFieldDataType.InternalId,
|
||||||
|
SqlIdColumnName = "aheadoffice.id",
|
||||||
|
SqlValueColumnName = "aheadoffice.id",
|
||||||
|
IsMeta = true //"I'm So Meta Even This Acronym"
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
//for now just show all customers of headoffice
|
||||||
|
int nType = 0;
|
||||||
|
if (!int.TryParse(crit[1], out nType)) return ret;
|
||||||
|
AyaType forType = (AyaType)nType;
|
||||||
|
if (forType != AyaType.HeadOffice) 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.HeadOffice:
|
||||||
|
{
|
||||||
|
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metaheadoffice" };
|
||||||
|
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