This commit is contained in:
81
server/DataList/AttachmentDataList.cs
Normal file
81
server/DataList/AttachmentDataList.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
using System.Collections.Generic;
|
||||
using Sockeye.Biz;
|
||||
namespace Sockeye.DataList
|
||||
{
|
||||
internal class AttachmentDataList : DataListProcessingBase
|
||||
{
|
||||
public AttachmentDataList(long translationId)
|
||||
{
|
||||
DefaultListAType = SockType.FileAttachment;
|
||||
SQLFrom = "from afileattachment left join auser on (afileattachment.attachedByUserId=auser.id)";
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListAType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
DefaultColumns = new List<string>() { "displayfilename", "object", "size", "username", "notes", "exists" };
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "displayfilename", "+" }, { "size", "-" } };
|
||||
|
||||
|
||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "FileAttachment",
|
||||
FieldKey = "displayfilename",
|
||||
SockType = (int)SockType.FileAttachment,
|
||||
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
SqlIdColumnName = "afileattachment.id",
|
||||
SqlValueColumnName = "afileattachment.displayfilename",
|
||||
IsRowId = true
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "User",
|
||||
FieldKey = "username",
|
||||
SockType = (int)SockType.User,
|
||||
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
SqlIdColumnName = "auser.id",
|
||||
SqlValueColumnName = "auser.name",
|
||||
IsRowId = false
|
||||
});
|
||||
|
||||
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.attachtosockType,{translationId})",
|
||||
SqlATypeColumnName = "afileattachment.attachtosockType",
|
||||
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
|
||||
Reference in New Issue
Block a user