using System.Collections.Generic; using Newtonsoft.Json.Linq; using Sockeye.Biz; namespace Sockeye.PickList { internal class ReportPickList : AyaPickList, IAyaPickListVariant { public ReportPickList() { DefaultListAType = SockType.Report; SQLFrom = "from areport"; AllowedRoles = BizRoles.GetRoleSet(DefaultListAType).Select; dynamic dTemplate = new JArray(); dynamic cm = new JObject(); cm.fld = "reportname"; dTemplate.Add(cm); base.DefaultTemplate = dTemplate.ToString(Newtonsoft.Json.Formatting.None); //NOTE: Due to the join, all the sql id and name fields that can conflict with the joined table need to be specified completely ColumnDefinitions = new List(); ColumnDefinitions.Add(new AyaPickListFieldDefinition { TKey = "Active", FieldKey = "reportactive", ColumnDataType = UiFieldDataType.Bool, SqlValueColumnName = "areport.active", IsActiveColumn = true }); ColumnDefinitions.Add(new AyaPickListFieldDefinition { TKey = "Name", FieldKey = "reportname", ColumnDataType = UiFieldDataType.Text, SqlIdColumnName = "areport.id", SqlValueColumnName = "areport.name", IsRowId = true }); } public string GetVariantCriteria(string variant) { //has for type variant if (string.IsNullOrWhiteSpace(variant)) return string.Empty; int forType; if (!int.TryParse(variant, out forType)) return string.Empty; return $"areport.sockType={forType}"; } }//eoc }//eons