90 lines
3.0 KiB
C#
90 lines
3.0 KiB
C#
using System.Collections.Generic;
|
|
using Newtonsoft.Json.Linq;
|
|
using AyaNova.Biz;
|
|
namespace AyaNova.DataList
|
|
{
|
|
internal class MemoDataList : AyaDataList,IAyaDataListViewServerCriteria
|
|
{
|
|
public MemoDataList()
|
|
{
|
|
|
|
DefaultListObjectType = AyaType.Memo;
|
|
SQLFrom = "from amemo left outer join auser on (amemo.fromid=auser.id)";
|
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
|
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
|
|
|
|
|
|
|
|
|
//######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
|
//Default ListView
|
|
dynamic dlistView = new JArray();
|
|
|
|
|
|
dynamic cm = new JObject();
|
|
cm.fld = "MemoSubject";
|
|
dlistView.Add(cm);
|
|
|
|
cm = new JObject();
|
|
cm.fld = "MemoFromID";
|
|
dlistView.Add(cm);
|
|
|
|
cm = new JObject();
|
|
cm.fld = "MemoSent";
|
|
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 table need to be specified completely
|
|
FieldDefinitions = new List<AyaDataListFieldDefinition>();
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "User",
|
|
FieldKey = "username",
|
|
AyaObjectType = (int)AyaType.User,
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlIdColumnName = "auser.id",
|
|
SqlValueColumnName = "auser.name",
|
|
IsRowId = false
|
|
});
|
|
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "MemoNotes",
|
|
FieldKey = "notes",
|
|
AyaObjectType = (int)AyaType.Memo,
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlIdColumnName = "amemo.id",
|
|
SqlValueColumnName = "amemo.notes",
|
|
IsRowId = true
|
|
});
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
TKey = "MemoNoteDate",
|
|
FieldKey = "notedate",
|
|
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
|
SqlValueColumnName = "amemo.notedate"
|
|
});
|
|
|
|
//META column
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
{
|
|
FieldKey = "metacustomer",
|
|
SqlIdColumnName = "amemo.customerid",
|
|
SqlValueColumnName = "amemo.customerid",
|
|
IsMeta = true
|
|
});
|
|
}
|
|
|
|
string IAyaDataListViewServerCriteria.ListViewServerCriteria(long userId)
|
|
{
|
|
//todo: take user id here and return additional criteria listview
|
|
//ensuring only current user can view their own memo datalist
|
|
throw new System.NotImplementedException();
|
|
}
|
|
|
|
}//eoc
|
|
}//eons |