119 lines
6.8 KiB
C#
119 lines
6.8 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 = "MemoSubject",
|
|
FieldKey = "MemoSubject",
|
|
AyaObjectType = (int)AyaType.Memo,
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlIdColumnName = "amemo.id",
|
|
SqlValueColumnName = "amemo.name",
|
|
IsRowId = true
|
|
});
|
|
|
|
|
|
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 = "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
|
|
});
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "CustomerCustom1", FieldKey = "customercustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "acustomer.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "CustomerCustom2", FieldKey = "customercustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "acustomer.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "CustomerCustom3", FieldKey = "customercustom3", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "acustomer.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "CustomerCustom4", FieldKey = "customercustom4", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "acustomer.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "CustomerCustom5", FieldKey = "customercustom5", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "acustomer.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "CustomerCustom6", FieldKey = "customercustom6", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "acustomer.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "CustomerCustom7", FieldKey = "customercustom7", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "acustomer.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "CustomerCustom8", FieldKey = "customercustom8", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "acustomer.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "CustomerCustom9", FieldKey = "customercustom9", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "acustomer.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "CustomerCustom10", FieldKey = "customercustom10", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "acustomer.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "CustomerCustom11", FieldKey = "customercustom11", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "acustomer.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "CustomerCustom12", FieldKey = "customercustom12", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "acustomer.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "CustomerCustom13", FieldKey = "customercustom13", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "acustomer.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "CustomerCustom14", FieldKey = "customercustom14", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "acustomer.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "CustomerCustom15", FieldKey = "customercustom15", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "acustomer.customfields" });
|
|
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "CustomerCustom16", FieldKey = "customercustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "acustomer.customfields" });
|
|
|
|
|
|
|
|
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 |