diff --git a/server/AyaNova/DataList/ProjectDataList.cs b/server/AyaNova/DataList/ProjectDataList.cs new file mode 100644 index 00000000..29fcfa23 --- /dev/null +++ b/server/AyaNova/DataList/ProjectDataList.cs @@ -0,0 +1,145 @@ +using System.Collections.Generic; +using Newtonsoft.Json.Linq; +using AyaNova.Biz; +namespace AyaNova.DataList +{ + internal class ProjectDataList : AyaDataList + { + public ProjectDataList() + { + DefaultListObjectType = AyaType.Project; + SQLFrom = "from aproject left outer 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 = 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); + + + //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(); + + FieldDefinitions.Add(new AyaDataListFieldDefinition + { + TKey = "ProjectName", + FieldKey = "projectname", + AyaObjectType = (int)AyaType.Project, + UiFieldDataType = (int)UiFieldDataType.Text, + SqlIdColumnName = "aproject.id", + SqlValueColumnName = "aproject.name", + IsRowId = true + }); + + FieldDefinitions.Add(new AyaDataListFieldDefinition + { + TKey = "ProjectNotes", + FieldKey = "projectnotes", + UiFieldDataType = (int)UiFieldDataType.Text, + SqlValueColumnName = "aproject.notes" + }); + + FieldDefinitions.Add(new AyaDataListFieldDefinition + { + TKey = "Active", + FieldKey = "projectactive", + UiFieldDataType = (int)UiFieldDataType.Bool, + SqlValueColumnName = "aproject.active" + }); + + FieldDefinitions.Add(new AyaDataListFieldDefinition + { + TKey = "Tags", + FieldKey = "projecttags", + UiFieldDataType = (int)UiFieldDataType.Tags, + SqlValueColumnName = "aproject.tags" + }); + + + //------------ + + FieldDefinitions.Add(new AyaDataListFieldDefinition + { + TKey = "ProjectAccountNumber", + FieldKey = "projectaccountnumber", + UiFieldDataType = (int)UiFieldDataType.Text, + SqlValueColumnName = "aproject.accountnumber" + }); + + FieldDefinitions.Add(new AyaDataListFieldDefinition + { + FieldKey = "ProjectProjectOverseerID", + TKey = "ProjectProjectOverseerID", + UiFieldDataType = (int)UiFieldDataType.Text, + AyaObjectType = (int)AyaType.User, + SqlIdColumnName = "auser.id", + SqlValueColumnName = "auser.name" + }); + + FieldDefinitions.Add(new AyaDataListFieldDefinition + { + TKey = "ProjectDateStarted", + FieldKey = "ProjectDateStarted", + UiFieldDataType = (int)UiFieldDataType.DateTime, + SqlValueColumnName = "aproject.datestarted" + }); + + FieldDefinitions.Add(new AyaDataListFieldDefinition + { + TKey = "ProjectDateCompleted", + FieldKey = "ProjectDateCompleted", + UiFieldDataType = (int)UiFieldDataType.DateTime, + SqlValueColumnName = "aproject.datecompleted" + }); + //----------- + + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "ProjectCustom1", FieldKey = "projectcustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "ProjectCustom2", FieldKey = "projectcustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "ProjectCustom3", FieldKey = "projectcustom3", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "ProjectCustom4", FieldKey = "projectcustom4", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "ProjectCustom5", FieldKey = "projectcustom5", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "ProjectCustom6", FieldKey = "projectcustom6", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "ProjectCustom7", FieldKey = "projectcustom7", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "ProjectCustom8", FieldKey = "projectcustom8", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "ProjectCustom9", FieldKey = "projectcustom9", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "ProjectCustom10", FieldKey = "projectcustom10", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "ProjectCustom11", FieldKey = "projectcustom11", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "ProjectCustom12", FieldKey = "projectcustom12", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "ProjectCustom13", FieldKey = "projectcustom13", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "ProjectCustom14", FieldKey = "projectcustom14", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "ProjectCustom15", FieldKey = "projectcustom15", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "ProjectCustom16", FieldKey = "projectcustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" }); + } + }//eoc +}//eons \ No newline at end of file diff --git a/server/AyaNova/biz/AyaFormFieldDefinitions.cs b/server/AyaNova/biz/AyaFormFieldDefinitions.cs index 0db180c8..5573b0a6 100644 --- a/server/AyaNova/biz/AyaFormFieldDefinitions.cs +++ b/server/AyaNova/biz/AyaFormFieldDefinitions.cs @@ -412,6 +412,11 @@ namespace AyaNova.Biz l.Add(new AyaFormFieldDefinition { TKey = "Wiki", FieldKey = "Wiki" }); l.Add(new AyaFormFieldDefinition { TKey = "Attachments", FieldKey = "Attachments" }); + l.Add(new AyaFormFieldDefinition { TKey = "ProjectAccountNumber", FieldKey = "ProjectAccountNumber" }); + l.Add(new AyaFormFieldDefinition { TKey = "ProjectProjectOverseerID", FieldKey = "ProjectProjectOverseerID" }); + l.Add(new AyaFormFieldDefinition { TKey = "ProjectDateStarted", FieldKey = "ProjectDateStarted" }); + l.Add(new AyaFormFieldDefinition { TKey = "ProjectDateCompleted", FieldKey = "ProjectDateCompleted" }); + l.Add(new AyaFormFieldDefinition { TKey = "ProjectCustom1", FieldKey = "ProjectCustom1", IsCustomField = true }); l.Add(new AyaFormFieldDefinition { TKey = "ProjectCustom2", FieldKey = "ProjectCustom2", IsCustomField = true }); l.Add(new AyaFormFieldDefinition { TKey = "ProjectCustom3", FieldKey = "ProjectCustom3", IsCustomField = true });