Files
raven/server/AyaNova/DataList/ProjectDataList.cs
2021-01-29 21:31:09 +00:00

148 lines
8.3 KiB
C#

using System.Collections.Generic;
using AyaNova.Biz;
namespace AyaNova.DataList
{
internal class ProjectDataList : DataListProcessingBase
{
public ProjectDataList()
{
DefaultListObjectType = AyaType.Project;
SQLFrom = "from aproject left join auser on (aproject.projectoverseerid=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 = null;
// cm = new JObject();
// cm.fld = "projectname";
// cm.sort = "+";
// dlistView.Add(cm);
// cm = new JObject();
// cm.fld = "ProjectProjectOverseerID";
// dlistView.Add(cm);
// cm = new JObject();
// cm.fld = "ProjectDateStarted";
// dlistView.Add(cm);
// cm = new JObject();
// cm.fld = "ProjectDateCompleted";
// dlistView.Add(cm);
// cm = new JObject();
// cm.fld = "ProjectAccountNumber";
// dlistView.Add(cm);
// cm = new JObject();
// cm.fld = "projectactive";
// dlistView.Add(cm);
// cm = new JObject();
// cm.fld = "projecttags";
// dlistView.Add(cm);
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
DefaultColumns = new List<string>() { "projectname", "ProjectProjectOverseerID", "ProjectDateStarted", "ProjectDateCompleted",
"ProjectAccountNumber", "projectactive", "projecttags" };
DefaultSortBy = new Dictionary<string, string>() { { "projectname", "+" } };
FieldDefinitions = new List<DataListFieldDefinition>();
FieldDefinitions.Add(new DataListFieldDefinition
{
TKey = "ProjectName",
FieldKey = "projectname",
AyaObjectType = (int)AyaType.Project,
UiFieldDataType = (int)UiFieldDataType.Text,
SqlIdColumnName = "aproject.id",
SqlValueColumnName = "aproject.name",
IsRowId = true
});
FieldDefinitions.Add(new DataListFieldDefinition
{
TKey = "ProjectNotes",
FieldKey = "projectnotes",
UiFieldDataType = (int)UiFieldDataType.Text,
SqlValueColumnName = "aproject.notes"
});
FieldDefinitions.Add(new DataListFieldDefinition
{
TKey = "Active",
FieldKey = "projectactive",
UiFieldDataType = (int)UiFieldDataType.Bool,
SqlValueColumnName = "aproject.active"
});
FieldDefinitions.Add(new DataListFieldDefinition
{
TKey = "Tags",
FieldKey = "projecttags",
UiFieldDataType = (int)UiFieldDataType.Tags,
SqlValueColumnName = "aproject.tags"
});
//------------
FieldDefinitions.Add(new DataListFieldDefinition
{
TKey = "ProjectAccountNumber",
FieldKey = "ProjectAccountNumber",
UiFieldDataType = (int)UiFieldDataType.Text,
SqlValueColumnName = "aproject.accountnumber"
});
FieldDefinitions.Add(new DataListFieldDefinition
{
FieldKey = "ProjectProjectOverseerID",
TKey = "ProjectProjectOverseerID",
UiFieldDataType = (int)UiFieldDataType.Text,
AyaObjectType = (int)AyaType.User,
SqlIdColumnName = "auser.id",
SqlValueColumnName = "auser.name"
});
FieldDefinitions.Add(new DataListFieldDefinition
{
TKey = "ProjectDateStarted",
FieldKey = "ProjectDateStarted",
UiFieldDataType = (int)UiFieldDataType.DateTime,
SqlValueColumnName = "aproject.datestarted"
});
FieldDefinitions.Add(new DataListFieldDefinition
{
TKey = "ProjectDateCompleted",
FieldKey = "ProjectDateCompleted",
UiFieldDataType = (int)UiFieldDataType.DateTime,
SqlValueColumnName = "aproject.datecompleted"
});
//-----------
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ProjectCustom1", FieldKey = "projectcustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" });
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ProjectCustom2", FieldKey = "projectcustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" });
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ProjectCustom3", FieldKey = "projectcustom3", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" });
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ProjectCustom4", FieldKey = "projectcustom4", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" });
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ProjectCustom5", FieldKey = "projectcustom5", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" });
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ProjectCustom6", FieldKey = "projectcustom6", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" });
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ProjectCustom7", FieldKey = "projectcustom7", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" });
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ProjectCustom8", FieldKey = "projectcustom8", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" });
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ProjectCustom9", FieldKey = "projectcustom9", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" });
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ProjectCustom10", FieldKey = "projectcustom10", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" });
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ProjectCustom11", FieldKey = "projectcustom11", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" });
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ProjectCustom12", FieldKey = "projectcustom12", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" });
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ProjectCustom13", FieldKey = "projectcustom13", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" });
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ProjectCustom14", FieldKey = "projectcustom14", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" });
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ProjectCustom15", FieldKey = "projectcustom15", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" });
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ProjectCustom16", FieldKey = "projectcustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" });
}
}//eoc
}//eons