From 69f17a7eb032a6002b16961c3d7603ff1324b3f6 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Sat, 27 Jun 2020 15:37:17 +0000 Subject: [PATCH] --- server/AyaNova/DataList/AttachmentDataList.cs | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 server/AyaNova/DataList/AttachmentDataList.cs diff --git a/server/AyaNova/DataList/AttachmentDataList.cs b/server/AyaNova/DataList/AttachmentDataList.cs new file mode 100644 index 00000000..a70db1c9 --- /dev/null +++ b/server/AyaNova/DataList/AttachmentDataList.cs @@ -0,0 +1,86 @@ +using System.Collections.Generic; +using Newtonsoft.Json.Linq; +using AyaNova.Biz; +namespace AyaNova.DataList +{ + internal class AttachmentDataList : AyaDataList + { + + public AttachmentDataList() + { + DefaultListObjectType = AyaType.FileAttachment; + SQLFrom = "from afileattachment"; + var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); + AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; + + //Default ListView + dynamic dlistView = new JArray(); + + dynamic cm = new JObject(); + cm.fld = "username"; + dlistView.Add(cm); + + cm = new JObject(); + cm.fld = "useremployeenumber"; + dlistView.Add(cm); + + cm = new JObject(); + cm.fld = "usertype"; + dlistView.Add(cm); + + cm = new JObject(); + cm.fld = "useractive"; + dlistView.Add(cm); + + cm = new JObject(); + cm.fld = "userlastlogin"; + dlistView.Add(cm); + + cm = new JObject(); + cm.fld = "userroles"; + 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 = "FileAttachment", + FieldKey = "displayfilename", + AyaObjectType = (int)AyaType.FileAttachment, + UiFieldDataType = (int)UiFieldDataType.Text, + SqlIdColumnName = "afileattachment.id", + SqlValueColumnName = "afileattachment.displayfilename", + IsRowId = true + }); + + FieldDefinitions.Add(new AyaDataListFieldDefinition + { + TKey = "FileExists", + FieldKey = "exists", + UiFieldDataType = (int)UiFieldDataType.Bool, + SqlValueColumnName = "afileattachment.exists" + }); + + + + + FieldDefinitions.Add(new AyaDataListFieldDefinition + { + TKey = "Notes", + FieldKey = "notes", + UiFieldDataType = (int)UiFieldDataType.Text, + SqlValueColumnName = "afileattachment.notes" + }); + + + } + }//eoc +}//eons \ No newline at end of file