using System.Collections.Generic; using Newtonsoft.Json.Linq; using AyaNova.Biz; namespace AyaNova.DataList { internal class EventDataList : AyaDataList {/* Select aevent.id, aevent.created, aevent.ayid, aevent.ayatype, aevent.ayevent, aevent.textra, auser.name, auser.id from aevent left outer join auser on (aevent.userid=auser.id) */ public EventDataList() { //NOTE: used this type because it's full BizFull and read only BizLimited only which is appropriate and there is no event type DefaultListObjectType = AyaType.Global; SQLFrom = "from aevent left outer join auser on (aevent.userid=auser.id)"; var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; //Default ListView dynamic dlistView = new JArray(); dynamic cm = new JObject(); cm.fld = "eventcreated"; cm.sort="-"; dlistView.Add(cm); cm = new JObject(); cm.fld = "event"; dlistView.Add(cm); cm = new JObject(); cm.fld = "ayatype"; dlistView.Add(cm); cm = new JObject(); cm.fld = "username"; dlistView.Add(cm); cm = new JObject(); cm.fld = "textra"; dlistView.Add(cm); DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None); FieldDefinitions = new List(); FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "EventCreated", FieldKey = "eventcreated", UiFieldDataType = (int)UiFieldDataType.DateTime, SqlValueColumnName = "aevent.created" }); FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "Event", FieldKey = "event", UiFieldDataType = (int)UiFieldDataType.Enum, EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(AyaEvent).ToString()), SqlValueColumnName = "aevent.ayevent" }); FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "AyaType", FieldKey = "ayatype", UiFieldDataType = (int)UiFieldDataType.Enum, EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(AyaType).ToString()), SqlValueColumnName = "aevent.ayatype", SqlIdColumnName = "aevent.ayid"//Test to see if can make this column openable }); FieldDefinitions.Add(new AyaDataListFieldDefinition { FieldKey = "username", TKey = "User", UiFieldDataType = (int)UiFieldDataType.Text, AyaObjectType = (int)AyaType.User, SqlIdColumnName = "auser.id", SqlValueColumnName = "auser.name" }); FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "EventTextra", FieldKey = "textra", UiFieldDataType = (int)UiFieldDataType.Text, SqlValueColumnName = "aevent.textra" }); } }//eoc }//eons