From 9d25ef3da4bb128b4b2155d3b90be4e57645b462 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 7 Sep 2020 19:02:39 +0000 Subject: [PATCH] --- server/AyaNova/DataList/ReportDataList.cs | 74 +++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 server/AyaNova/DataList/ReportDataList.cs diff --git a/server/AyaNova/DataList/ReportDataList.cs b/server/AyaNova/DataList/ReportDataList.cs new file mode 100644 index 00000000..559ce31d --- /dev/null +++ b/server/AyaNova/DataList/ReportDataList.cs @@ -0,0 +1,74 @@ +using System.Collections.Generic; +using Newtonsoft.Json.Linq; +using AyaNova.Biz; +namespace AyaNova.DataList +{ + internal class ReportDataList : AyaDataList + { + + public ReportDataList() + { + DefaultListObjectType = AyaType.Report; + SQLFrom = "from aReport"; + var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; + + //Default ListView + dynamic dlistView = new JArray(); + + dynamic cm = new JObject(); + cm.fld = "name"; + dlistView.Add(cm); + + cm = new JObject(); + cm.fld = "objecttype"; + dlistView.Add(cm); + + + + cm = new JObject(); + cm.fld = "active"; + dlistView.Add(cm); + + DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None); + + + + //NOTE: Due to the join, all the sql id and name fields that can conflict with the joined (in this case User) table need to be specified completely + FieldDefinitions = new List(); + //DPRECATED FieldDefinitions.Add(new AyaDataListFieldDefinition { FieldKey = "df", AyaObjectType = (int)AyaType.User, SqlIdColumnName = "auser.id" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition + { + TKey = "Report", + FieldKey = "name", + AyaObjectType = (int)AyaType.Report, + UiFieldDataType = (int)UiFieldDataType.Text, + SqlIdColumnName = "aReport.id", + SqlValueColumnName = "aReport.name", + IsRowId = true + }); + + + FieldDefinitions.Add(new AyaDataListFieldDefinition + { + TKey = "AyaType", + FieldKey = "objecttype", + UiFieldDataType = (int)UiFieldDataType.Enum, + EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(AyaType).ToString()), + SqlValueColumnName = "areport.ObjectType" + }); + + + FieldDefinitions.Add(new AyaDataListFieldDefinition + { + TKey = "Active", + FieldKey = "active", + UiFieldDataType = (int)UiFieldDataType.Bool, + SqlValueColumnName = "aReport.active" + }); + + + + } + }//eoc +}//eons \ No newline at end of file