70 lines
2.6 KiB
C#
70 lines
2.6 KiB
C#
using System.Collections.Generic;
|
|
using AyaNova.Biz;
|
|
namespace AyaNova.DataList
|
|
{
|
|
internal class AttachmentDataList : DataListProcessingBase
|
|
{
|
|
public AttachmentDataList(long translationId)
|
|
{
|
|
DefaultListAType = AyaType.FileAttachment;
|
|
SQLFrom = "from afileattachment";
|
|
var RoleSet = BizRoles.GetRoleSet(DefaultListAType);
|
|
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
|
DefaultColumns = new List<string>() { "displayfilename", "object", "size", "notes", "exists" };
|
|
DefaultSortBy = new Dictionary<string, string>() { { "displayfilename", "+" }, { "size", "-" } };
|
|
|
|
|
|
FieldDefinitions = new List<DataListFieldDefinition>();
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "FileAttachment",
|
|
FieldKey = "displayfilename",
|
|
AType = (int)AyaType.FileAttachment,
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlIdColumnName = "afileattachment.id",
|
|
SqlValueColumnName = "afileattachment.displayfilename",
|
|
IsRowId = true
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "AttachmentExists",
|
|
FieldKey = "exists",
|
|
UiFieldDataType = (int)UiFieldDataType.Bool,
|
|
SqlValueColumnName = "afileattachment.exists"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "Object",
|
|
FieldKey = "object",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlIdColumnName = "afileattachment.AttachToObjectid",
|
|
SqlValueColumnName = $"AYGETNAME(afileattachment.AttachToObjectid, afileattachment.attachtoatype,{translationId})",
|
|
SqlATypeColumnName = "afileattachment.attachtoatype",
|
|
Translate=true
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "FileSize",
|
|
FieldKey = "size",
|
|
UiFieldDataType = (int)UiFieldDataType.MemorySize,
|
|
SqlValueColumnName = "afileattachment.size"
|
|
});
|
|
|
|
FieldDefinitions.Add(new DataListFieldDefinition
|
|
{
|
|
TKey = "AttachmentNotes",
|
|
FieldKey = "notes",
|
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
|
SqlValueColumnName = "afileattachment.notes"
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
}//eoc
|
|
}//eons |