From 23ffa04ce1b281bb21155334ce0c62aaf4ace1a0 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 9 Sep 2021 15:15:16 +0000 Subject: [PATCH] --- server/AyaNova/PickList/CustomerPickList.cs | 38 +++++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/server/AyaNova/PickList/CustomerPickList.cs b/server/AyaNova/PickList/CustomerPickList.cs index 41782548..73745da7 100644 --- a/server/AyaNova/PickList/CustomerPickList.cs +++ b/server/AyaNova/PickList/CustomerPickList.cs @@ -1,9 +1,11 @@ using System.Collections.Generic; using Newtonsoft.Json.Linq; using AyaNova.Biz; +using System.Linq; + namespace AyaNova.PickList { - internal class CustomerPickList : AyaPickList + internal class CustomerPickList : AyaPickList, IAyaPickListVariant { public CustomerPickList() { @@ -43,14 +45,44 @@ namespace AyaNova.PickList IsRowId = true }); - ColumnDefinitions.Add(new AyaPickListFieldDefinition + ColumnDefinitions.Add(new AyaPickListFieldDefinition { TKey = "Tags", FieldKey = "customertags", ColumnDataType = UiFieldDataType.Tags, SqlValueColumnName = "acustomer.tags" }); - + + } + public string GetVariantCriteria(string variant) + { + //Currently the only variant is a object type and id to indicate headoffice + + + + //ClientCriteria format for this list is "OBJECTID,AYATYPE" + var crit = (variant ?? "").Split(',').Select(z => z.Trim()).ToArray(); + if (crit.Length > 1) + { + int nType = 0; + if (!int.TryParse(crit[1], out nType)) return string.Empty; + AyaType forType = (AyaType)nType; + if (forType != AyaType.HeadOffice) return string.Empty; + + long lId = 0; + if (!long.TryParse(crit[0], out lId)) return string.Empty; + if (lId == 0) return string.Empty; + + //Have valid type, have an id, so filter away + switch (forType) + { + case AyaType.HeadOffice: + { + return $"aunit.customerid = {lId}"; + } + } + } + return string.Empty; } }//eoc }//eons \ No newline at end of file