diff --git a/server/AyaNova/Controllers/DataListSavedFilterController.cs b/server/AyaNova/Controllers/DataListSavedFilterController.cs
index 460c967f..beb38353 100644
--- a/server/AyaNova/Controllers/DataListSavedFilterController.cs
+++ b/server/AyaNova/Controllers/DataListSavedFilterController.cs
@@ -1,18 +1,12 @@
-using System.Linq;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Authorization;
-
-using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
-
using AyaNova.Models;
using AyaNova.Api.ControllerHelpers;
using AyaNova.Biz;
-
namespace AyaNova.Api.Controllers
{
@@ -59,9 +53,6 @@ namespace AyaNova.Api.Controllers
//Instantiate the business object handler
DataListSavedFilterBiz biz = DataListSavedFilterBiz.GetBiz(ct, HttpContext);
- // if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType))
- // return StatusCode(403, new ApiNotAuthorizedResponse());
-
if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState));
@@ -141,10 +132,7 @@ namespace AyaNova.Api.Controllers
//Instantiate the business object handler
DataListSavedFilterBiz biz = DataListSavedFilterBiz.GetBiz(ct, HttpContext);
- // //check roles
- // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
- // return StatusCode(403, new ApiNotAuthorizedResponse());
-
+
if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState));
@@ -186,42 +174,13 @@ namespace AyaNova.Api.Controllers
if (o == null)
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
- // if (!Authorized.HasDeleteRole(HttpContext.Items, biz.BizType))
- // return StatusCode(403, new ApiNotAuthorizedResponse());
-
if (!await biz.DeleteAsync(o))
return BadRequest(new ApiErrorResponse(biz.Errors));
return NoContent();
}
- // ///
- // /// Get default Columns and Sort for DataList
- // ///
- // /// Key of an existing DataList
- // /// Columns and Sort
- // [HttpGet("default/{dataListKey}")]
- // public ActionResult GetDefaultDataListSavedFilter([FromRoute] string dataListKey)
- // {
- // if (!serverState.IsOpen)
- // return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
-
- // //Instantiate the business object handler
- // DataListSavedFilterBiz biz = DataListSavedFilterBiz.GetBiz(ct, HttpContext);
-
- // if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType))
- // return StatusCode(403, new ApiNotAuthorizedResponse());
-
- // if (!ModelState.IsValid)
- // return BadRequest(new ApiErrorResponse(ModelState));
-
- // var o = AyaNova.DataList.DataListFactory.GetAyaDataList(dataListKey); ;
- // if (o == null)
- // return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
-
- // return Ok(ApiOkResponse.Response(new { Columns = o.DefaultColumns, SortBy = o.DefaultSortBy }));
- // }
-
+
//------------
diff --git a/server/AyaNova/DataList/AttachmentDataList.cs b/server/AyaNova/DataList/AttachmentDataList.cs
index 1ac83cb2..fd728ce3 100644
--- a/server/AyaNova/DataList/AttachmentDataList.cs
+++ b/server/AyaNova/DataList/AttachmentDataList.cs
@@ -4,48 +4,18 @@ namespace AyaNova.DataList
{
internal class AttachmentDataList : DataListProcessingBase
{
-
public AttachmentDataList()
{
DefaultListObjectType = AyaType.FileAttachment;
SQLFrom = "from afileattachment";
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
-
- // //Default ListView
- // dynamic dlistView = new JArray();
-
- // dynamic cm = new JObject();
- // cm.fld = "displayfilename";
- // cm.sort = "+";
- // dlistView.Add(cm);
-
- // cm = new JObject();
- // cm.fld = "object";
- // dlistView.Add(cm);
-
- // cm = new JObject();
- // cm.fld = "size";
- // cm.sort = "-";
- // dlistView.Add(cm);
-
- // cm = new JObject();
- // cm.fld = "notes";
- // dlistView.Add(cm);
-
- // cm = new JObject();
- // cm.fld = "exists";
- // dlistView.Add(cm);
-
- // DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
-
DefaultColumns = new List() { "displayfilename", "object", "size", "notes", "exists" };
DefaultSortBy = new Dictionary() { { "displayfilename", "+" }, { "size", "-" } };
- //NOTE: Due to the join, all the sql id and name fields that can conflict with the joined (in this case User) table need to be specified completely
FieldDefinitions = new List();
- //DPRECATED FieldDefinitions.Add(new AyaDataListFieldDefinition { FieldKey = "df", AyaObjectType = (int)AyaType.User, SqlIdColumnName = "auser.id" });
+
FieldDefinitions.Add(new DataListFieldDefinition
{
TKey = "FileAttachment",
diff --git a/server/AyaNova/DataList/CustomerDataList.cs b/server/AyaNova/DataList/CustomerDataList.cs
index 13c1f322..68e7a363 100644
--- a/server/AyaNova/DataList/CustomerDataList.cs
+++ b/server/AyaNova/DataList/CustomerDataList.cs
@@ -10,38 +10,9 @@ namespace AyaNova.DataList
SQLFrom = "from acustomer left join aheadoffice on (acustomer.headofficeid=aheadoffice.id) left join acontract on (acustomer.contractid=acontract.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 = "customername";
- // cm.sort = "+";
- // dlistView.Add(cm);
-
- // cm = new JObject();
- // cm.fld = "customerphone1";
- // dlistView.Add(cm);
-
- // cm = new JObject();
- // cm.fld = "customeremail";
- // dlistView.Add(cm);
-
-
- // cm = new JObject();
- // cm.fld = "customerheadoffice";
- // dlistView.Add(cm);
-
- // DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
-
DefaultColumns = new List() { "customername", "customerphone1", "customeremail", "customerheadoffice" };
DefaultSortBy = new Dictionary() { { "customername", "+" } };
-
-
- //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 DataListFieldDefinition
diff --git a/server/AyaNova/DataList/CustomerNoteDataList.cs b/server/AyaNova/DataList/CustomerNoteDataList.cs
index dc974da3..6e25988e 100644
--- a/server/AyaNova/DataList/CustomerNoteDataList.cs
+++ b/server/AyaNova/DataList/CustomerNoteDataList.cs
@@ -12,31 +12,9 @@ namespace AyaNova.DataList
SQLFrom = "from acustomernote left join auser on (acustomernote.userid=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 = "notedate";
- // cm.sort = "-";
- // dlistView.Add(cm);
-
- // cm = new JObject();
- // cm.fld = "notes";
- // dlistView.Add(cm);
-
- // cm = new JObject();
- // cm.fld = "username";
- // dlistView.Add(cm);
- // DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
-
DefaultColumns = new List() { "notedate", "notes", "username" };
DefaultSortBy = new Dictionary() { { "notedate", "-" } };
-
- //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 DataListFieldDefinition
@@ -89,7 +67,7 @@ namespace AyaNova.DataList
if (string.IsNullOrWhiteSpace(clientCriteria))
throw new System.ArgumentNullException("CustomerNoteDataList - ClientCriteria is empty, should be Customer ID");
- DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metacustomer" };
+ DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metacustomer" };
FilterOption.Items.Add(new DataListColumnFilter() { value = clientCriteria, op = DataListFilterComparisonOperator.Equality });
ret.Add(FilterOption);
diff --git a/server/AyaNova/DataList/CustomerServiceRequestDataList.cs b/server/AyaNova/DataList/CustomerServiceRequestDataList.cs
index b84b6bf5..4793c2dc 100644
--- a/server/AyaNova/DataList/CustomerServiceRequestDataList.cs
+++ b/server/AyaNova/DataList/CustomerServiceRequestDataList.cs
@@ -15,39 +15,9 @@ namespace AyaNova.DataList
"left join aworkorder as w on (wi.workorderid=w.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 = "Created";
- // cm.sort = "-";
- // dlistView.Add(cm);
-
- // cm = new JObject();
- // cm.fld = "Customer";
- // dlistView.Add(cm);
-
- // cm = new JObject();
- // cm.fld = "CustomerServiceRequestTitle";
- // dlistView.Add(cm);
-
- // cm = new JObject();
- // cm.fld = "CustomerServiceRequestPriority";
- // dlistView.Add(cm);
-
- // cm = new JObject();
- // cm.fld = "CustomerServiceRequestStatus";
- // dlistView.Add(cm);
-
- // DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
-
DefaultColumns = new List() { "Created", "Customer", "CustomerServiceRequestTitle", "CustomerServiceRequestPriority", "CustomerServiceRequestStatus" };
DefaultSortBy = new Dictionary() { { "Created", "-" } };
- //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 DataListFieldDefinition
diff --git a/server/AyaNova/DataList/DataListFactory.cs b/server/AyaNova/DataList/DataListFactory.cs
index 1a3f2402..b33cb52c 100644
--- a/server/AyaNova/DataList/DataListFactory.cs
+++ b/server/AyaNova/DataList/DataListFactory.cs
@@ -1,8 +1,6 @@
using System.Collections.Generic;
using System.Linq;
-
-
namespace AyaNova.DataList
{
internal static class DataListFactory
diff --git a/server/AyaNova/DataList/DataListFetcher.cs b/server/AyaNova/DataList/DataListFetcher.cs
index b6c78346..1dda2c0f 100644
--- a/server/AyaNova/DataList/DataListFetcher.cs
+++ b/server/AyaNova/DataList/DataListFetcher.cs
@@ -6,7 +6,6 @@ using Microsoft.Extensions.Logging;
using AyaNova.Models;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
-using EnumsNET;
namespace AyaNova.DataList
{
@@ -19,39 +18,7 @@ namespace AyaNova.DataList
//
internal static async Task GetResponseAsync(AyContext ct, DataListTableProcessingOptions dataListTableProcessingOptions, IDataListProcessing DataList, AuthorizationRoles userRoles, ILogger log, long userId)
{
-
- // var DataList = DataListFactory.GetAyaDataList(dataListTableRequest.DataListKey);
-
- //was the name not found as a list?
- // if (DataList == null)
- // throw new System.ArgumentOutOfRangeException($"DataList \"{dataListTableRequest.DataListKey}\" specified does not exist");
-
- //turn the DataListTableRequest into a DataListTableProcesingOptions object here
- //hydrates filter and column selections etc
- // = new DataListTableProcessingOptions(dataListTableRequest, DataList, ct);
-
- //#### TODO: below block into above method to clean it up and centralize it
-
-
- // //STATIC filter options from server
- // List StaticServerFilterOptions = new List();
- // if (DataList is IDataListInternalCriteria)
- // StaticServerFilterOptions = ((IDataListInternalCriteria)DataList).DataListInternalCriteria(userId, userRoles, dataListTableOptions);
-
-
- // //Get the public field key names in a list from the listview
- // List PublicListViewFieldList = listOptions.Columns;
-
- //Get the combination of all unique fields from both StaticServerFilterOptions and listOptions
- //NOTE: this assumes no list options filter colums that don't exist in listoptions.columns
- // var AllUniqueFieldKeysRequiredForQuery = dataListTableOptions.Columns.Union(StaticServerFilterOptions.Select(z => z.Column).ToList()).ToList();
-
- // //Add the internal filters into the listoptions existing filters
- // //NOTE: There is currently no overlap between internal filtered columns and filters coming from the client
- // foreach (DataListFilterOption dfo in StaticServerFilterOptions)
- // dataListTableOptions.Filter.Add(dfo);
-
- //BUILD THE QUERY
+ //#BUILD THE QUERY
//SELECT CLAUSE
var qSelect = DataListSqlSelectBuilder.BuildForDataTableListResponse(DataList.FieldDefinitions, dataListTableProcessingOptions.AllUniqueColumnKeysReferenced);
@@ -100,17 +67,13 @@ namespace AyaNova.DataList
while (dr.Read())
{
List row = new List(returnRowColumnCount);
-
-
//INSERT REMAINING FIELDS FROM TEMPLATE INTO THE RETURN ROWS LIST
foreach (string TemplateField in dataListTableProcessingOptions.Columns)
{
-
//get the AyaObjectFieldDefinition
DataListFieldDefinition f = DataList.FieldDefinitions.FirstOrDefault(z => z.FieldKey == TemplateField);
if (f.IsCustomField)
{
-
DataListField AyaField = new DataListField();
//could be null
var rawValue = dr.GetValue(qSelect.map[f.GetSqlValueColumnName()]);
@@ -123,7 +86,6 @@ namespace AyaNova.DataList
//convert field name to cust name then get value
var InternalCustomFieldName = FormFieldReference.TranslateLTCustomFieldToInternalCustomFieldName(TemplateField);
//Sometimes a custom field is specified but doesn't exist in the collection so don't assume it's there
- // AyaField.v = j[InternalCustomFieldName].Value