This commit is contained in:
56
server/PickList/ReportPickList.cs
Normal file
56
server/PickList/ReportPickList.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
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<AyaPickListFieldDefinition>();
|
||||
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
|
||||
Reference in New Issue
Block a user