LISTS WORKING cleanup afterwords
This commit is contained in:
@@ -1,18 +1,12 @@
|
|||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Biz;
|
using AyaNova.Biz;
|
||||||
|
|
||||||
|
|
||||||
namespace AyaNova.Api.Controllers
|
namespace AyaNova.Api.Controllers
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -59,9 +53,6 @@ namespace AyaNova.Api.Controllers
|
|||||||
//Instantiate the business object handler
|
//Instantiate the business object handler
|
||||||
DataListSavedFilterBiz biz = DataListSavedFilterBiz.GetBiz(ct, HttpContext);
|
DataListSavedFilterBiz biz = DataListSavedFilterBiz.GetBiz(ct, HttpContext);
|
||||||
|
|
||||||
// if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType))
|
|
||||||
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
|
||||||
|
|
||||||
if (!ModelState.IsValid)
|
if (!ModelState.IsValid)
|
||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
|
|
||||||
@@ -141,10 +132,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
//Instantiate the business object handler
|
//Instantiate the business object handler
|
||||||
DataListSavedFilterBiz biz = DataListSavedFilterBiz.GetBiz(ct, HttpContext);
|
DataListSavedFilterBiz biz = DataListSavedFilterBiz.GetBiz(ct, HttpContext);
|
||||||
|
|
||||||
// //check roles
|
|
||||||
// if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
|
|
||||||
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
|
||||||
|
|
||||||
if (!ModelState.IsValid)
|
if (!ModelState.IsValid)
|
||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
|
|
||||||
@@ -186,42 +174,13 @@ namespace AyaNova.Api.Controllers
|
|||||||
if (o == null)
|
if (o == null)
|
||||||
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||||
|
|
||||||
// if (!Authorized.HasDeleteRole(HttpContext.Items, biz.BizType))
|
|
||||||
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
|
||||||
|
|
||||||
if (!await biz.DeleteAsync(o))
|
if (!await biz.DeleteAsync(o))
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
|
|
||||||
return NoContent();
|
return NoContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// Get default Columns and Sort for DataList
|
|
||||||
// /// </summary>
|
|
||||||
// /// <param name="dataListKey">Key of an existing DataList</param>
|
|
||||||
// /// <returns>Columns and Sort</returns>
|
|
||||||
// [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 }));
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
//------------
|
//------------
|
||||||
|
|
||||||
|
|||||||
@@ -4,48 +4,18 @@ namespace AyaNova.DataList
|
|||||||
{
|
{
|
||||||
internal class AttachmentDataList : DataListProcessingBase
|
internal class AttachmentDataList : DataListProcessingBase
|
||||||
{
|
{
|
||||||
|
|
||||||
public AttachmentDataList()
|
public AttachmentDataList()
|
||||||
{
|
{
|
||||||
DefaultListObjectType = AyaType.FileAttachment;
|
DefaultListObjectType = AyaType.FileAttachment;
|
||||||
SQLFrom = "from afileattachment";
|
SQLFrom = "from afileattachment";
|
||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
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<string>() { "displayfilename", "object", "size", "notes", "exists" };
|
DefaultColumns = new List<string>() { "displayfilename", "object", "size", "notes", "exists" };
|
||||||
DefaultSortBy = new Dictionary<string, string>() { { "displayfilename", "+" }, { "size", "-" } };
|
DefaultSortBy = new Dictionary<string, string>() { { "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<DataListFieldDefinition>();
|
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||||
//DPRECATED FieldDefinitions.Add(new AyaDataListFieldDefinition { FieldKey = "df", AyaObjectType = (int)AyaType.User, SqlIdColumnName = "auser.id" });
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
{
|
{
|
||||||
TKey = "FileAttachment",
|
TKey = "FileAttachment",
|
||||||
|
|||||||
@@ -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)";
|
SQLFrom = "from acustomer left join aheadoffice on (acustomer.headofficeid=aheadoffice.id) left join acontract on (acustomer.contractid=acontract.id)";
|
||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
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<string>() { "customername", "customerphone1", "customeremail", "customerheadoffice" };
|
DefaultColumns = new List<string>() { "customername", "customerphone1", "customeremail", "customerheadoffice" };
|
||||||
DefaultSortBy = new Dictionary<string, string>() { { "customername", "+" } };
|
DefaultSortBy = new Dictionary<string, string>() { { "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<DataListFieldDefinition>();
|
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
|
|||||||
@@ -12,31 +12,9 @@ namespace AyaNova.DataList
|
|||||||
SQLFrom = "from acustomernote left join auser on (acustomernote.userid=auser.id)";
|
SQLFrom = "from acustomernote left join auser on (acustomernote.userid=auser.id)";
|
||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
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<string>() { "notedate", "notes", "username" };
|
DefaultColumns = new List<string>() { "notedate", "notes", "username" };
|
||||||
DefaultSortBy = new Dictionary<string, string>() { { "notedate", "-" } };
|
DefaultSortBy = new Dictionary<string, string>() { { "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<DataListFieldDefinition>();
|
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
@@ -89,7 +67,7 @@ namespace AyaNova.DataList
|
|||||||
if (string.IsNullOrWhiteSpace(clientCriteria))
|
if (string.IsNullOrWhiteSpace(clientCriteria))
|
||||||
throw new System.ArgumentNullException("CustomerNoteDataList - ClientCriteria is empty, should be Customer ID");
|
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 });
|
FilterOption.Items.Add(new DataListColumnFilter() { value = clientCriteria, op = DataListFilterComparisonOperator.Equality });
|
||||||
|
|
||||||
ret.Add(FilterOption);
|
ret.Add(FilterOption);
|
||||||
|
|||||||
@@ -15,39 +15,9 @@ namespace AyaNova.DataList
|
|||||||
"left join aworkorder as w on (wi.workorderid=w.id)";
|
"left join aworkorder as w on (wi.workorderid=w.id)";
|
||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
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<string>() { "Created", "Customer", "CustomerServiceRequestTitle", "CustomerServiceRequestPriority", "CustomerServiceRequestStatus" };
|
DefaultColumns = new List<string>() { "Created", "Customer", "CustomerServiceRequestTitle", "CustomerServiceRequestPriority", "CustomerServiceRequestStatus" };
|
||||||
DefaultSortBy = new Dictionary<string, string>() { { "Created", "-" } };
|
DefaultSortBy = new Dictionary<string, string>() { { "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<DataListFieldDefinition>();
|
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace AyaNova.DataList
|
namespace AyaNova.DataList
|
||||||
{
|
{
|
||||||
internal static class DataListFactory
|
internal static class DataListFactory
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ using Microsoft.Extensions.Logging;
|
|||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using EnumsNET;
|
|
||||||
|
|
||||||
namespace AyaNova.DataList
|
namespace AyaNova.DataList
|
||||||
{
|
{
|
||||||
@@ -19,39 +18,7 @@ namespace AyaNova.DataList
|
|||||||
//
|
//
|
||||||
internal static async Task<DataListReturnData> GetResponseAsync(AyContext ct, DataListTableProcessingOptions dataListTableProcessingOptions, IDataListProcessing DataList, AuthorizationRoles userRoles, ILogger log, long userId)
|
internal static async Task<DataListReturnData> GetResponseAsync(AyContext ct, DataListTableProcessingOptions dataListTableProcessingOptions, IDataListProcessing DataList, AuthorizationRoles userRoles, ILogger log, long userId)
|
||||||
{
|
{
|
||||||
|
//#BUILD THE QUERY
|
||||||
// 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<DataListFilterOption> StaticServerFilterOptions = new List<DataListFilterOption>();
|
|
||||||
// if (DataList is IDataListInternalCriteria)
|
|
||||||
// StaticServerFilterOptions = ((IDataListInternalCriteria)DataList).DataListInternalCriteria(userId, userRoles, dataListTableOptions);
|
|
||||||
|
|
||||||
|
|
||||||
// //Get the public field key names in a list from the listview
|
|
||||||
// List<string> 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
|
|
||||||
|
|
||||||
//SELECT CLAUSE
|
//SELECT CLAUSE
|
||||||
var qSelect = DataListSqlSelectBuilder.BuildForDataTableListResponse(DataList.FieldDefinitions, dataListTableProcessingOptions.AllUniqueColumnKeysReferenced);
|
var qSelect = DataListSqlSelectBuilder.BuildForDataTableListResponse(DataList.FieldDefinitions, dataListTableProcessingOptions.AllUniqueColumnKeysReferenced);
|
||||||
@@ -100,17 +67,13 @@ namespace AyaNova.DataList
|
|||||||
while (dr.Read())
|
while (dr.Read())
|
||||||
{
|
{
|
||||||
List<DataListField> row = new List<DataListField>(returnRowColumnCount);
|
List<DataListField> row = new List<DataListField>(returnRowColumnCount);
|
||||||
|
|
||||||
|
|
||||||
//INSERT REMAINING FIELDS FROM TEMPLATE INTO THE RETURN ROWS LIST
|
//INSERT REMAINING FIELDS FROM TEMPLATE INTO THE RETURN ROWS LIST
|
||||||
foreach (string TemplateField in dataListTableProcessingOptions.Columns)
|
foreach (string TemplateField in dataListTableProcessingOptions.Columns)
|
||||||
{
|
{
|
||||||
|
|
||||||
//get the AyaObjectFieldDefinition
|
//get the AyaObjectFieldDefinition
|
||||||
DataListFieldDefinition f = DataList.FieldDefinitions.FirstOrDefault(z => z.FieldKey == TemplateField);
|
DataListFieldDefinition f = DataList.FieldDefinitions.FirstOrDefault(z => z.FieldKey == TemplateField);
|
||||||
if (f.IsCustomField)
|
if (f.IsCustomField)
|
||||||
{
|
{
|
||||||
|
|
||||||
DataListField AyaField = new DataListField();
|
DataListField AyaField = new DataListField();
|
||||||
//could be null
|
//could be null
|
||||||
var rawValue = dr.GetValue(qSelect.map[f.GetSqlValueColumnName()]);
|
var rawValue = dr.GetValue(qSelect.map[f.GetSqlValueColumnName()]);
|
||||||
@@ -123,7 +86,6 @@ namespace AyaNova.DataList
|
|||||||
//convert field name to cust name then get value
|
//convert field name to cust name then get value
|
||||||
var InternalCustomFieldName = FormFieldReference.TranslateLTCustomFieldToInternalCustomFieldName(TemplateField);
|
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
|
//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<object>();
|
|
||||||
JToken o = j[InternalCustomFieldName];
|
JToken o = j[InternalCustomFieldName];
|
||||||
if (o != null)
|
if (o != null)
|
||||||
AyaField.v = o.Value<object>();
|
AyaField.v = o.Value<object>();
|
||||||
@@ -131,29 +93,12 @@ namespace AyaNova.DataList
|
|||||||
AyaField.v = null;
|
AyaField.v = null;
|
||||||
|
|
||||||
row.Add(AyaField);
|
row.Add(AyaField);
|
||||||
}else{
|
}
|
||||||
AyaField.v=null;
|
else
|
||||||
|
{
|
||||||
|
AyaField.v = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
TODO: Custom field handling
|
|
||||||
GetName works just not with multipart identifiers
|
|
||||||
I could force naming by making all fields and AS, or
|
|
||||||
I could map the ordinal when generating the Select fields so that I have a map to refer to here
|
|
||||||
mapping in advance actually makes a lot of sense, then no more of this fragility of going by pointer index and hoping for the best
|
|
||||||
it would just be premapped out.
|
|
||||||
|
|
||||||
dr.GetOrdinal(f.SqlValueColumnName)
|
|
||||||
'dr.GetOrdinal(f.SqlValueColumnName)' threw an exception of type 'System.IndexOutOfRangeException'
|
|
||||||
f.SqlValueColumnName
|
|
||||||
"awidget.customfields"
|
|
||||||
dr.GetName(nCurrentColumnPointer)
|
|
||||||
"customfields"
|
|
||||||
dr.GetOrdinal("customfields");
|
|
||||||
5
|
|
||||||
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -230,72 +175,22 @@ namespace AyaNova.DataList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//BUILD THE COLUMNS RETURN PROPERTY JSON FRAGMENT
|
//BUILD THE COLUMNS RETURN PROPERTY JSON FRAGMENT
|
||||||
Newtonsoft.Json.Linq.JArray ColumnsJSON = null;
|
Newtonsoft.Json.Linq.JArray ColumnsJSON = null;
|
||||||
ColumnsJSON = DataList.GenerateReturnListColumns(dataListTableProcessingOptions.Columns);
|
ColumnsJSON = DataList.GenerateReturnListColumns(dataListTableProcessingOptions.Columns);
|
||||||
|
|
||||||
|
|
||||||
return new DataListReturnData(rows, totalRecordCount, ColumnsJSON, dataListTableProcessingOptions.SortBy, dataListTableProcessingOptions.Filter.Where(z => z.Column.StartsWith("meta") == false).ToList());
|
return new DataListReturnData(rows, totalRecordCount, ColumnsJSON, dataListTableProcessingOptions.SortBy, dataListTableProcessingOptions.Filter.Where(z => z.Column.StartsWith("meta") == false).ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// Get a list of id's of the datalist results for reporting
|
// Get a list of id's of the datalist results for reporting
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
internal static async Task<long[]> GetIdListResponseAsync(AyContext ct, DataListSelectedProcessingOptions dataListSelectionOptions, IDataListProcessing DataList, AuthorizationRoles userRoles, ILogger log, long userId)
|
internal static async Task<long[]> GetIdListResponseAsync(AyContext ct, DataListSelectedProcessingOptions dataListSelectionOptions, IDataListProcessing DataList, AuthorizationRoles userRoles, ILogger log, long userId)
|
||||||
{
|
{
|
||||||
// // var DataList = DataListFactory.GetAyaDataList(dataListSelectionOptions.DataListKey);
|
//#BUILD THE QUERY
|
||||||
// // //was the name not found as a list?
|
|
||||||
// // if (DataList == null)
|
|
||||||
// // throw new System.ArgumentOutOfRangeException($"DataList \"{dataListSelectionOptions.DataListKey}\" specified does not exist");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// //check rights
|
|
||||||
// if (!userRoles.HasAnyFlags(DataList.AllowedRoles))
|
|
||||||
// throw new System.UnauthorizedAccessException("User roles insufficient for this datalist");
|
|
||||||
|
|
||||||
// // //do we need to default the listView?
|
|
||||||
// // if (string.IsNullOrWhiteSpace(listView))
|
|
||||||
// // listView = DataList.DefaultListView;
|
|
||||||
|
|
||||||
// DataList.SetListOptionDefaultsIfNecessary(dataListSelectionOptions);
|
|
||||||
|
|
||||||
// // //parse the list view
|
|
||||||
// // var ListViewArray = JArray.Parse(listView);
|
|
||||||
|
|
||||||
|
|
||||||
// // //Hard coded extra criteria from server end
|
|
||||||
// // if (DataList is IAyaDataListServerCriteria)
|
|
||||||
// // {
|
|
||||||
// // var ServerCriteriaListView = JArray.Parse(((IAyaDataListServerCriteria)DataList).DataListServerCriteria(await ct.User.AsNoTracking().FirstOrDefaultAsync(z => z.Id == userId), ct));
|
|
||||||
// // foreach (JToken jt in ServerCriteriaListView)
|
|
||||||
// // ListViewArray.Add(jt);
|
|
||||||
// // }
|
|
||||||
|
|
||||||
// //STATIC filter options from server
|
|
||||||
// List<DataListFilterOption> StaticServerFilterOptions = null;
|
|
||||||
// if (DataList is IDataListInternalCriteria)
|
|
||||||
// StaticServerFilterOptions = ((IDataListInternalCriteria)DataList).DataListInternalCriteria(userId, userRoles, dataListSelectionOptions);
|
|
||||||
|
|
||||||
// //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)
|
|
||||||
// dataListSelectionOptions.Filter.Add(dfo);
|
|
||||||
|
|
||||||
// // //Hard coded extra criteria from Client end
|
|
||||||
// // //parse and combine any additional listview hard coded from Client UI
|
|
||||||
// // var MetaListViewArray = JArray.Parse(metaListView ?? "[]");
|
|
||||||
// // foreach (JToken jt in MetaListViewArray)
|
|
||||||
// // ListViewArray.Add(jt);
|
|
||||||
|
|
||||||
// // //Get the field key names in a list from the listview
|
|
||||||
// // List<string> ListViewFieldList = DataList.GetFieldListFromListView(ListViewArray);
|
|
||||||
|
|
||||||
//BUILD THE QUERY
|
|
||||||
//SELECT FRAGMENT COLUMNS FROM TEMPLATE
|
//SELECT FRAGMENT COLUMNS FROM TEMPLATE
|
||||||
var qSelect = DataListSqlSelectBuilder.BuildForIdListResponse(DataList.FieldDefinitions, dataListSelectionOptions);
|
var qSelect = DataListSqlSelectBuilder.BuildForIdListResponse(DataList.FieldDefinitions, dataListSelectionOptions);
|
||||||
|
|
||||||
@@ -319,22 +214,6 @@ namespace AyaNova.DataList
|
|||||||
//RETURN OBJECTS
|
//RETURN OBJECTS
|
||||||
var retList = new List<long>();
|
var retList = new List<long>();
|
||||||
|
|
||||||
//GET ID COLUMN ORDINAL
|
|
||||||
int IDColumnOrdinal = 0;
|
|
||||||
|
|
||||||
//NOTE: assuming change of code means id column is *always* the zeroth column
|
|
||||||
|
|
||||||
// foreach (string TemplateField in ListViewFieldList)
|
|
||||||
// {
|
|
||||||
// //get the AyaObjectFieldDefinition
|
|
||||||
// AyaDataListFieldDefinition f = DataList.FieldDefinitions.FirstOrDefault(z => z.FieldKey == TemplateField);
|
|
||||||
// if (f.IsRowId)
|
|
||||||
// {
|
|
||||||
// IDColumnOrdinal = SelectBuild.map[f.SqlIdColumnName];
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
using (var command = ct.Database.GetDbConnection().CreateCommand())
|
using (var command = ct.Database.GetDbConnection().CreateCommand())
|
||||||
{
|
{
|
||||||
await ct.Database.OpenConnectionAsync();
|
await ct.Database.OpenConnectionAsync();
|
||||||
@@ -345,8 +224,9 @@ namespace AyaNova.DataList
|
|||||||
{
|
{
|
||||||
while (dr.Read())
|
while (dr.Read())
|
||||||
{
|
{
|
||||||
if (!dr.IsDBNull(IDColumnOrdinal))
|
//only one column and it's the zeroth id column
|
||||||
retList.Add(dr.GetInt64(IDColumnOrdinal));
|
if (!dr.IsDBNull(0))
|
||||||
|
retList.Add(dr.GetInt64(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
using AyaNova.Biz;
|
using AyaNova.Biz;
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace AyaNova.DataList
|
namespace AyaNova.DataList
|
||||||
{
|
{
|
||||||
|
|
||||||
//This class defines a field used for returning data in list format for UI grid lists and reporting
|
//This class defines a field used for returning data in list format for UI grid lists and reporting
|
||||||
public class DataListFieldDefinition
|
public class DataListFieldDefinition
|
||||||
{
|
{
|
||||||
@@ -51,12 +49,9 @@ namespace AyaNova.DataList
|
|||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string SqlColorColumnName { get; set; }//column to fetch the color if applicable to this field
|
public string SqlColorColumnName { get; set; }//column to fetch the color if applicable to this field
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public DataListFieldDefinition()
|
public DataListFieldDefinition()
|
||||||
{
|
{
|
||||||
//most common defaults
|
//most common defaults
|
||||||
|
|
||||||
IsCustomField = false;
|
IsCustomField = false;
|
||||||
IsFilterable = true;
|
IsFilterable = true;
|
||||||
IsSortable = true;
|
IsSortable = true;
|
||||||
@@ -66,7 +61,6 @@ namespace AyaNova.DataList
|
|||||||
AyaObjectType = (int)AyaType.NoType;
|
AyaObjectType = (int)AyaType.NoType;
|
||||||
SqlAyTypeColumnName = null;//must be null as that is checked against specifically
|
SqlAyTypeColumnName = null;//must be null as that is checked against specifically
|
||||||
SqlColorColumnName = null;//must be null to be ignored properly
|
SqlColorColumnName = null;//must be null to be ignored properly
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Get column to query for display name or use FieldName if there is no difference
|
//Get column to query for display name or use FieldName if there is no difference
|
||||||
|
|||||||
@@ -39,7 +39,5 @@ namespace AyaNova.DataList
|
|||||||
return operators;
|
return operators;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,89 +0,0 @@
|
|||||||
|
|
||||||
//MOVED TO MODELS AS DataListTableOptions AND BROKEN APART
|
|
||||||
|
|
||||||
// using System.ComponentModel.DataAnnotations;
|
|
||||||
// using Microsoft.AspNetCore.Mvc;
|
|
||||||
// using System.Collections.Generic;
|
|
||||||
// using
|
|
||||||
|
|
||||||
// namespace AyaNova.DataList
|
|
||||||
// {
|
|
||||||
|
|
||||||
// public sealed class DataListOptions : DataListBase
|
|
||||||
// {
|
|
||||||
// public const int MaxPageSize = 1000;
|
|
||||||
// public const int DefaultOffset = 0;
|
|
||||||
// public const int DefaultLimit = 25;
|
|
||||||
|
|
||||||
// [FromBody]
|
|
||||||
// public int? Offset { get; set; }
|
|
||||||
|
|
||||||
// [FromBody]
|
|
||||||
// public int? Limit { get; set; }
|
|
||||||
|
|
||||||
// [FromBody, Required]
|
|
||||||
// public string DataListKey { get; set; }
|
|
||||||
|
|
||||||
// [FromBody]
|
|
||||||
// public DataListView View { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
// // [FromBody]
|
|
||||||
// // public List<string> Columns { get; set; }
|
|
||||||
// // [FromBody]
|
|
||||||
// // public Dictionary<string, string> SortBy { get; set; }
|
|
||||||
// // [FromBody]
|
|
||||||
// // public List<DataListFilterOption> Filter { get; set; }
|
|
||||||
// // [FromBody]
|
|
||||||
// // public string ClientCriteria { get; set; }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// public class DataListView
|
|
||||||
// {
|
|
||||||
// /*
|
|
||||||
// OLD EXAMPLE:
|
|
||||||
// {"offset":0,"limit":10,"dataListKey":"CustomerDataList",
|
|
||||||
// "listView":"[
|
|
||||||
// {\"fld\":\"customername\",\"sort\":\"+\",\"filter\":{\"items\":[{\"op\":\"=\",\"value\":\"dfdfdf\"},{\"op\":\"=\",\"value\":\"3333\"}],\"any\":true}},
|
|
||||||
// {\"fld\":\"customerphone1\",\"filter\":{\"items\":[{\"op\":\">\",\"value\":\"44444\"},
|
|
||||||
// {\"op\":\"<\",\"value\":\"7777\"}]}},
|
|
||||||
// {\"fld\":\"customeremail\"}
|
|
||||||
// {\"fld\":\"customerheadoffice\"},
|
|
||||||
// {\"fld\":\"customertags\",\"sort\":\"+\"}]"}
|
|
||||||
|
|
||||||
// NEW:
|
|
||||||
// columns:["PartInventoryTransactionEntryDate","PartPartNumber","PartWarehouseName","PartInventoryTransactionQuantity","PartInventoryTransactionDescription","PartInventoryTransactionSource","PartInventoryBalance"]
|
|
||||||
// sortBy:[{"PartInventoryTransactionEntryDate":"-"}],//All sorted columns here as keyvalue pairs value is a string of "+" for ascending "-" for descending and are IN ORDER of how to be sorted
|
|
||||||
// filter:[{column:"PartPartNumber",any:true/false,items:[{op: "=",value: "400735"}]}],
|
|
||||||
// clientCriteria:"2" //could be anything here that makes sense to the list, in this case an example customer id for customernotedatalist
|
|
||||||
// */
|
|
||||||
// [FromBody]
|
|
||||||
// public List<string> Columns { get; set; }
|
|
||||||
// [FromBody]
|
|
||||||
// public Dictionary<string, string> SortBy { get; set; }
|
|
||||||
// [FromBody]
|
|
||||||
// public List<DataListFilterOption> Filter { get; set; }
|
|
||||||
// [FromBody]
|
|
||||||
// public string ClientCriteria { get; set; }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// public class DataListFilterOption
|
|
||||||
// {
|
|
||||||
// public string Column { get; set; }
|
|
||||||
// public List<DataListColumnFilter> items { get; set; }
|
|
||||||
// public bool Any { get; set; }//means "or" the filter conditions
|
|
||||||
// DataListFilterOption()
|
|
||||||
// {
|
|
||||||
// items = new List<DataListColumnFilter>();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public class DataListColumnFilter
|
|
||||||
// {
|
|
||||||
// public string op { get; set; }
|
|
||||||
// public string value { get; set; }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
@@ -19,23 +19,18 @@ namespace AyaNova.DataList
|
|||||||
public DataListProcessingBase()
|
public DataListProcessingBase()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
NOTE: all sql identifiers need to be explicitly identified as understood by postgres
|
||||||
|
|
||||||
DefaultColumns = new List<string>() { "XXX", "XXXX", "XXXX", "XXXX", "XXXX", "XXX", "XXXX", "XXXX", "XXXX", "XXXX" };
|
DefaultColumns = new List<string>() { "XXX", "XXXX", "XXXX", "XXXX", "XXXX", "XXX", "XXXX", "XXXX", "XXXX", "XXXX" };
|
||||||
DefaultSortBy = new Dictionary<string, string>() { { "XXXX", "+" }, { "XXXX", "-" } };
|
DefaultSortBy = new Dictionary<string, string>() { { "XXXX", "+" }, { "XXXX", "-" } };
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string SQLFrom { get; set; }
|
public string SQLFrom { get; set; }
|
||||||
public List<DataListFieldDefinition> FieldDefinitions { get; set; }
|
public List<DataListFieldDefinition> FieldDefinitions { get; set; }
|
||||||
public AuthorizationRoles AllowedRoles { get; set; }
|
public AuthorizationRoles AllowedRoles { get; set; }
|
||||||
public AyaType DefaultListObjectType { get; set; }
|
public AyaType DefaultListObjectType { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public long CurrentUserId { get; set; }
|
public long CurrentUserId { get; set; }
|
||||||
|
|
||||||
public List<string> DefaultColumns { get; set; }
|
public List<string> DefaultColumns { get; set; }
|
||||||
public Dictionary<string, string> DefaultSortBy { get; set; }
|
public Dictionary<string, string> DefaultSortBy { get; set; }
|
||||||
|
|
||||||
@@ -71,22 +66,6 @@ namespace AyaNova.DataList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// //return array of field keys in list view
|
|
||||||
// public List<string> GetFieldListFromListView(JArray listViewArray)
|
|
||||||
// {
|
|
||||||
// // [{key:"COLUMN UNIQUE KEY ID",sort:"-" or "+",filter:{any:true/false,items:[{FILTER OBJECT SEE BELOW}]} }, {key:"second column unique key"},{...etc...}]
|
|
||||||
// List<string> ret = new List<string>();
|
|
||||||
// for (int i = 0; i < listViewArray.Count; i++)
|
|
||||||
// {
|
|
||||||
// var cm = listViewArray[i];
|
|
||||||
// ret.Add(cm["fld"].Value<string>());
|
|
||||||
// }
|
|
||||||
// return ret;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Newtonsoft.Json.Linq.JArray GenerateReturnListColumns(List<string> columns)
|
public Newtonsoft.Json.Linq.JArray GenerateReturnListColumns(List<string> columns)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -197,14 +176,7 @@ namespace AyaNova.DataList
|
|||||||
using (var ct = AyaNova.Util.ServiceProviderProvider.DBContext)
|
using (var ct = AyaNova.Util.ServiceProviderProvider.DBContext)
|
||||||
{
|
{
|
||||||
var fc = ct.FormCustom.AsNoTracking().SingleOrDefault(z => z.FormKey == ayatypename);
|
var fc = ct.FormCustom.AsNoTracking().SingleOrDefault(z => z.FormKey == ayatypename);
|
||||||
//This is normal and expected in an empty db, removing this block
|
//normal condition
|
||||||
// #if (DEBUG)
|
|
||||||
// if (fc == null)
|
|
||||||
// {
|
|
||||||
// throw new System.ArgumentNullException($"AyaDataList:GetCustomFieldDefinitionsForList, Custom field object type {ayatypename} has no FormCustom defined");
|
|
||||||
// }
|
|
||||||
// #endif
|
|
||||||
//production handling of missing formcustom
|
|
||||||
if (fc == null)
|
if (fc == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -224,47 +196,6 @@ namespace AyaNova.DataList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*{[
|
|
||||||
{
|
|
||||||
"fld": "Notes",
|
|
||||||
"required": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fld": "WidgetCustom1",
|
|
||||||
"required": false,
|
|
||||||
"type": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fld": "WidgetCustom2",
|
|
||||||
"required": true,
|
|
||||||
"type": 4
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fld": "WidgetCustom3",
|
|
||||||
"required": false,
|
|
||||||
"type": 5
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fld": "WidgetCustom4",
|
|
||||||
"required": false,
|
|
||||||
"type": 6
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fld": "WidgetCustom5",
|
|
||||||
"required": false,
|
|
||||||
"type": 8
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fld": "WidgetCustom6",
|
|
||||||
"required": false,
|
|
||||||
"type": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fld": "WidgetCustom7",
|
|
||||||
"required": false,
|
|
||||||
"type": 3
|
|
||||||
}
|
|
||||||
]}*/
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,8 @@ using System.Collections.Generic;
|
|||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
namespace AyaNova.DataList
|
namespace AyaNova.DataList
|
||||||
{
|
{
|
||||||
|
|
||||||
public class DataListReturnData
|
public class DataListReturnData
|
||||||
{
|
{
|
||||||
|
|
||||||
public object Data { get; }
|
public object Data { get; }
|
||||||
public long TotalRecordCount { get; }
|
public long TotalRecordCount { get; }
|
||||||
public object Columns { get; }
|
public object Columns { get; }
|
||||||
@@ -19,7 +17,6 @@ namespace AyaNova.DataList
|
|||||||
Columns = columns;
|
Columns = columns;
|
||||||
SortBy = sortBy;
|
SortBy = sortBy;
|
||||||
Filter = filter;
|
Filter = filter;
|
||||||
|
|
||||||
}
|
}
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,60 +1,36 @@
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using AyaNova.Models;
|
|
||||||
|
|
||||||
namespace AyaNova.DataList
|
namespace AyaNova.DataList
|
||||||
{
|
{
|
||||||
public static class DataListSqlFilterOrderByBuilder
|
public static class DataListSqlFilterOrderByBuilder
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
public static string DataFilterToSQLOrderBy(List<DataListFieldDefinition> objectFieldsList, Models.DataListProcessingBase listOptions)
|
public static string DataFilterToSQLOrderBy(List<DataListFieldDefinition> objectFieldsList, Models.DataListProcessingBase listOptions)
|
||||||
{
|
{
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
//iterate the datafilter and concatenate a sql query from it
|
|
||||||
// [{key:"COLUMN UNIQUE KEY ID",sort:"-" or "+",filter:{any:true/false,items:[{FILTER OBJECT SEE BELOW}]} }, {key:"second column unique key"},{...etc...}]
|
|
||||||
bool SortItemAdded = false;
|
bool SortItemAdded = false;
|
||||||
// for (int i = 0; i < listViewArray.Count; i++)
|
foreach (KeyValuePair<string, string> kvSort in listOptions.SortBy)
|
||||||
foreach(KeyValuePair<string,string> kvSort in listOptions.SortBy)
|
|
||||||
{
|
{
|
||||||
// var cm = listViewArray[i];
|
|
||||||
// //skip it if sort is not defined
|
|
||||||
// if (cm["sort"] == null)
|
|
||||||
// {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
// var fld = cm["fld"].Value<string>();
|
|
||||||
// var dir = cm["sort"].Value<string>();
|
|
||||||
|
|
||||||
//Get the correct sql column name
|
//Get the correct sql column name
|
||||||
DataListFieldDefinition DataListField = objectFieldsList.FirstOrDefault(z => z.FieldKey == kvSort.Key);
|
DataListFieldDefinition DataListField = objectFieldsList.FirstOrDefault(z => z.FieldKey == kvSort.Key);
|
||||||
//No sorting on custom fields!
|
//No sorting on custom fields!
|
||||||
if (DataListField.IsCustomField)
|
if (DataListField.IsCustomField)
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
#if (DEBUG)
|
#if (DEBUG)
|
||||||
//Developers little helper
|
//Developers little helper
|
||||||
if (DataListField == null)
|
if (DataListField == null)
|
||||||
{
|
|
||||||
throw new System.ArgumentNullException($"DEV ERROR in DataListSqlFilterOrderByBuilder.cs: field {kvSort.Key} specified in template was NOT found in ObjectFields list");
|
throw new System.ArgumentNullException($"DEV ERROR in DataListSqlFilterOrderByBuilder.cs: field {kvSort.Key} specified in template was NOT found in ObjectFields list");
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
var SQLValueColumnName = DataListField.GetSqlValueColumnName();
|
var SQLValueColumnName = DataListField.GetSqlValueColumnName();
|
||||||
|
|
||||||
if (SortItemAdded)
|
if (SortItemAdded)
|
||||||
sb.Append(", ");
|
sb.Append(", ");
|
||||||
else
|
else
|
||||||
sb.Append(" ");
|
sb.Append(" ");
|
||||||
sb.Append(SQLValueColumnName);
|
sb.Append(SQLValueColumnName);
|
||||||
sb.Append(" ");
|
sb.Append(" ");
|
||||||
//sb.Append(dir == "+" ? "ASC" : "DESC");
|
|
||||||
sb.Append(kvSort.Value == "+" ? "ASC" : "DESC");
|
sb.Append(kvSort.Value == "+" ? "ASC" : "DESC");
|
||||||
|
|
||||||
SortItemAdded = true;
|
SortItemAdded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,22 +39,13 @@ namespace AyaNova.DataList
|
|||||||
//no sort specified so default it
|
//no sort specified so default it
|
||||||
DataListFieldDefinition rid = objectFieldsList.FirstOrDefault(z => z.IsRowId == true);
|
DataListFieldDefinition rid = objectFieldsList.FirstOrDefault(z => z.IsRowId == true);
|
||||||
if (rid != null)
|
if (rid != null)
|
||||||
{
|
|
||||||
return $"ORDER BY {rid.SqlIdColumnName} DESC";
|
return $"ORDER BY {rid.SqlIdColumnName} DESC";
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
return string.Empty; //no default column so no idea how to sort
|
||||||
//no default column so no idea how to sort
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
return "ORDER BY" + sb.ToString();
|
return "ORDER BY" + sb.ToString();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
}//ens
|
}//ens
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ namespace AyaNova.DataList
|
|||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.Append("SELECT ");
|
sb.Append("SELECT ");
|
||||||
|
|
||||||
//keep track of which custom fields columns were added already
|
//keep track of which custom fields columns were added already
|
||||||
//this ensures that if there is more than one set of custom fields like from two different objects in the list
|
//this ensures that if there is more than one set of custom fields like from two different objects in the list
|
||||||
//only unique ones will be returned by query
|
//only unique ones will be returned by query
|
||||||
@@ -113,167 +112,15 @@ namespace AyaNova.DataList
|
|||||||
|
|
||||||
|
|
||||||
//Build the SELECT portion of a list query but only to return rowid's
|
//Build the SELECT portion of a list query but only to return rowid's
|
||||||
|
|
||||||
internal static string BuildForIdListResponse(List<DataListFieldDefinition> fieldDefinitions, DataListSelectedProcessingOptions dataListSelectionOptions)
|
internal static string BuildForIdListResponse(List<DataListFieldDefinition> fieldDefinitions, DataListSelectedProcessingOptions dataListSelectionOptions)
|
||||||
{
|
{
|
||||||
//BugBug - is not including internalcriteria OR user filtered columns so they don't filter properly
|
|
||||||
//needs to be there and also return correct 0th column for id filtering or make sure it's always the zeroth I guess
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.Append("SELECT ");
|
sb.Append("SELECT ");
|
||||||
//map sql column name to ordinal name
|
//note: only need rowid column for these queries, the where conditions don't rely on any defined column names as they explicitly refer to the exact identifier known to postgres
|
||||||
// Dictionary<string, int> map = new Dictionary<string, int>();
|
|
||||||
|
|
||||||
//FIRST: find the rowid in the objectfields list and insert it
|
|
||||||
//this is now the zeroth column
|
|
||||||
//Note: IsRowId field should *always* exist for any list that is intended to be used in an idlist response
|
//Note: IsRowId field should *always* exist for any list that is intended to be used in an idlist response
|
||||||
var o = fieldDefinitions.FirstOrDefault(z => z.IsRowId == true);
|
var o = fieldDefinitions.FirstOrDefault(z => z.IsRowId == true);
|
||||||
sb.Append(o.SqlIdColumnName);
|
sb.Append(o.SqlIdColumnName);
|
||||||
// map.Add(o.SqlIdColumnName, 0);
|
|
||||||
|
|
||||||
//DO I NEED THIS? NO! You don't need to return columns that are mentioned in WHERE clause unless it's an AS scenario I guess
|
|
||||||
// //Now add any rows found in filter
|
|
||||||
// foreach(var filter in dataListSelectionOptions.Filter){
|
|
||||||
// //add all columns being filtered but not rowId
|
|
||||||
// var fld=fieldDefinitions.FirstOrDefault(z=>z.FieldKey==filter.Column);
|
|
||||||
// if(!fld.IsRowId){
|
|
||||||
// sb.Append($",{fld.SqlIdColumnName}");
|
|
||||||
// //map.Add(fld.SqlIdColumnName);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}//eom
|
}//eom
|
||||||
|
|
||||||
|
|
||||||
// internal static SqlSelectBuilderResult BuildForReportIdListOnly(List<DataListFieldDefinition> objectFieldsList)
|
|
||||||
// {
|
|
||||||
// //BugBug - is not including internalcriteria columns so they don't filter properly
|
|
||||||
// //needs to be there and also return correct 0th column for id filtering or make sure it's always the zeroth I guess
|
|
||||||
|
|
||||||
// StringBuilder sb = new StringBuilder();
|
|
||||||
// sb.Append("SELECT ");
|
|
||||||
// //map sql column name to ordinal name
|
|
||||||
// Dictionary<string, int> map = new Dictionary<string, int>();
|
|
||||||
|
|
||||||
// //find the rowid in the objectfields list and insert it
|
|
||||||
// var o = objectFieldsList.FirstOrDefault(z => z.IsRowId == true);
|
|
||||||
// if (o != null)
|
|
||||||
// {
|
|
||||||
// var idColumnName = o.SqlIdColumnName;
|
|
||||||
// if (!string.IsNullOrWhiteSpace(idColumnName))
|
|
||||||
// {
|
|
||||||
// sb.Append(idColumnName);
|
|
||||||
// map.Add(idColumnName, 0);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return new SqlSelectBuilderResult() { map = map, Select = sb.ToString() };
|
|
||||||
// }//eom
|
|
||||||
|
|
||||||
|
|
||||||
// //Build the SELECT portion of a list query but only to return rowid's
|
|
||||||
// internal static SqlSelectBuilderResult BuildForReportIdListOnly(List<AyaDataListFieldDefinition> objectFieldsList, List<string> listViewFieldList)
|
|
||||||
// {
|
|
||||||
// StringBuilder sb = new StringBuilder();
|
|
||||||
// sb.Append("SELECT ");
|
|
||||||
// //map sql column name to ordinal name
|
|
||||||
// Dictionary<string, int> map = new Dictionary<string, int>();
|
|
||||||
// int nOrdinal = 0;
|
|
||||||
|
|
||||||
// var firstColumnAdded = false;
|
|
||||||
// foreach (string ColumnName in listViewFieldList)
|
|
||||||
// {
|
|
||||||
// AyaDataListFieldDefinition o = objectFieldsList.FirstOrDefault(z => z.FieldKey == ColumnName);
|
|
||||||
// #if (DEBUG)
|
|
||||||
// //Developers little helper
|
|
||||||
// if (o == null)
|
|
||||||
// {
|
|
||||||
// throw new System.ArgumentNullException($"DEV ERROR in DataListSqlSelectBuilder.cs:BuildForReportIdListOnly() field {ColumnName} specified in template was NOT found in ObjectFields list");
|
|
||||||
// }
|
|
||||||
// #endif
|
|
||||||
// if (o != null && o.IsRowId)//only return the rowid column
|
|
||||||
// {//Ignore missing fields in production
|
|
||||||
// AddTheColumn(sb, map, ref nOrdinal, ref firstColumnAdded, o);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// //insert rowid if it wasn't specified already in the list view
|
|
||||||
// //this is legit as some datalists don't have a rowid visible to user e.g. PartInventoryOnHand
|
|
||||||
// if (map.Count == 0)
|
|
||||||
// {
|
|
||||||
// //find the rowid in the objectfields list and insert it since it wasn't in the view already
|
|
||||||
// var o = objectFieldsList.FirstOrDefault(z => z.IsRowId == true);
|
|
||||||
// if (o != null)
|
|
||||||
// {
|
|
||||||
// // if(!string.IsNullOrWhiteSpace(rowIdColumn.SqlIdColumnName)){
|
|
||||||
// // map.Add(rowIdColumn.SqlIdColumnName, nOrdinal++);
|
|
||||||
// // }else{
|
|
||||||
// // map.Add(rowIdColumn.GetSqlValueColumnName(), nOrdinal++);
|
|
||||||
// // }
|
|
||||||
// AddTheColumn(sb, map, ref nOrdinal, ref firstColumnAdded, o);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
// return new SqlSelectBuilderResult() { map = map, Select = sb.ToString() };
|
|
||||||
// }//eof
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// private static void AddTheColumn(StringBuilder sb, Dictionary<string, int> map, ref int nOrdinal, ref bool firstColumnAdded, AyaDataListFieldDefinition o)
|
|
||||||
// {
|
|
||||||
// // var valueColumnName = o.GetSqlValueColumnName();
|
|
||||||
// // if (!map.ContainsKey(valueColumnName))
|
|
||||||
// // {
|
|
||||||
// // if (firstColumnAdded)
|
|
||||||
// // sb.Append(", ");
|
|
||||||
// // sb.Append(valueColumnName);
|
|
||||||
// // firstColumnAdded = true;
|
|
||||||
// // map.Add(valueColumnName, nOrdinal++);
|
|
||||||
// // }
|
|
||||||
|
|
||||||
// // //does it also have an ID column?
|
|
||||||
// // var idColumnName = o.SqlIdColumnName;
|
|
||||||
// // if (!string.IsNullOrWhiteSpace(idColumnName))
|
|
||||||
// // {
|
|
||||||
// // if (!map.ContainsKey(idColumnName))
|
|
||||||
// // {
|
|
||||||
// // if (firstColumnAdded)
|
|
||||||
// // sb.Append(", ");
|
|
||||||
// // sb.Append(idColumnName);
|
|
||||||
// // firstColumnAdded = true;
|
|
||||||
// // map.Add(idColumnName, nOrdinal++);
|
|
||||||
// // }
|
|
||||||
// // }
|
|
||||||
|
|
||||||
// // var valueColumnName = o.GetSqlValueColumnName();
|
|
||||||
// // if (!map.ContainsKey(valueColumnName))
|
|
||||||
// // {
|
|
||||||
// // if (firstColumnAdded)
|
|
||||||
// // sb.Append(", ");
|
|
||||||
// // sb.Append(valueColumnName);
|
|
||||||
// // firstColumnAdded = true;
|
|
||||||
// // map.Add(valueColumnName, nOrdinal++);
|
|
||||||
// // }
|
|
||||||
|
|
||||||
// //does it also have an ID column?
|
|
||||||
// var idColumnName = o.SqlIdColumnName;
|
|
||||||
// if (!string.IsNullOrWhiteSpace(idColumnName))
|
|
||||||
// {
|
|
||||||
// // if (!map.ContainsKey(idColumnName))
|
|
||||||
// // {
|
|
||||||
// // if (firstColumnAdded)
|
|
||||||
// // sb.Append(", ");
|
|
||||||
// sb.Append(idColumnName);
|
|
||||||
// // firstColumnAdded = true;
|
|
||||||
// map.Add(idColumnName, 0);
|
|
||||||
// // }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}//eoc
|
}//eoc
|
||||||
}//ens
|
}//ens
|
||||||
|
|||||||
@@ -3,14 +3,7 @@ using AyaNova.Biz;
|
|||||||
namespace AyaNova.DataList
|
namespace AyaNova.DataList
|
||||||
{
|
{
|
||||||
internal class EventDataList : DataListProcessingBase
|
internal class EventDataList : DataListProcessingBase
|
||||||
{/*
|
{
|
||||||
Select aevent.id, aevent.created, aevent.ayid, aevent.ayatype, aevent.ayevent,
|
|
||||||
aevent.textra, auser.name, auser.id
|
|
||||||
from aevent
|
|
||||||
left join auser on (aevent.userid=auser.id)
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
public EventDataList()
|
public EventDataList()
|
||||||
{
|
{
|
||||||
//NOTE: used this type because it's full BizFull and read only BizLimited only which is appropriate and there is no event type
|
//NOTE: used this type because it's full BizFull and read only BizLimited only which is appropriate and there is no event type
|
||||||
@@ -18,38 +11,6 @@ namespace AyaNova.DataList
|
|||||||
SQLFrom = "from aevent left join auser on (aevent.userid=auser.id)";
|
SQLFrom = "from aevent left join auser on (aevent.userid=auser.id)";
|
||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||||
|
|
||||||
// //Default ListView
|
|
||||||
// dynamic dlistView = new JArray();
|
|
||||||
|
|
||||||
// dynamic cm = new JObject();
|
|
||||||
// cm.fld = "eventcreated";
|
|
||||||
// cm.sort = "-";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "event";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "object";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "AyaType";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "username";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "textra";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
|
|
||||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
|
||||||
|
|
||||||
DefaultColumns = new List<string>() { "eventcreated", "event", "object", "AyaType", "username", "textra" };
|
DefaultColumns = new List<string>() { "eventcreated", "event", "object", "AyaType", "username", "textra" };
|
||||||
DefaultSortBy = new Dictionary<string, string>() { { "eventcreated", "-" } };
|
DefaultSortBy = new Dictionary<string, string>() { { "eventcreated", "-" } };
|
||||||
|
|
||||||
@@ -108,9 +69,6 @@ namespace AyaNova.DataList
|
|||||||
UiFieldDataType = (int)UiFieldDataType.Text,
|
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||||
SqlValueColumnName = "aevent.textra"
|
SqlValueColumnName = "aevent.textra"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
}//eons
|
}//eons
|
||||||
@@ -10,30 +10,9 @@ namespace AyaNova.DataList
|
|||||||
SQLFrom = "from aheadoffice left join acontract on (aheadoffice.contractid=acontract.id)";
|
SQLFrom = "from aheadoffice left join acontract on (aheadoffice.contractid=acontract.id)";
|
||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||||
|
|
||||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
|
||||||
// //Default ListView
|
|
||||||
// dynamic dlistView = new JArray();
|
|
||||||
|
|
||||||
// dynamic cm = new JObject();
|
|
||||||
// cm.fld = "headofficename";
|
|
||||||
// cm.sort = "+";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "headofficephone1";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "headofficeemail";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
|
||||||
|
|
||||||
DefaultColumns = new List<string>() { "headofficename", "headofficephone1", "headofficeemail" };
|
DefaultColumns = new List<string>() { "headofficename", "headofficephone1", "headofficeemail" };
|
||||||
DefaultSortBy = new Dictionary<string, string>() { { "headofficename", "+" } };
|
DefaultSortBy = new Dictionary<string, string>() { { "headofficename", "+" } };
|
||||||
|
|
||||||
|
|
||||||
//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<DataListFieldDefinition>();
|
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
@@ -272,6 +251,5 @@ namespace AyaNova.DataList
|
|||||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "HeadOfficeCustom16", FieldKey = "headofficecustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aheadoffice.customfields" });
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "HeadOfficeCustom16", FieldKey = "headofficecustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aheadoffice.customfields" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
}//eons
|
}//eons
|
||||||
@@ -1,36 +1,21 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using AyaNova.Biz;
|
using AyaNova.Biz;
|
||||||
using AyaNova.Models;
|
|
||||||
namespace AyaNova.DataList
|
namespace AyaNova.DataList
|
||||||
{
|
{
|
||||||
internal interface IDataListProcessing
|
internal interface IDataListProcessing
|
||||||
{
|
{
|
||||||
|
|
||||||
//sql query from fragment with table joins et
|
//sql query from fragment with table joins et
|
||||||
string SQLFrom { get; set; }
|
string SQLFrom { get; set; }
|
||||||
|
|
||||||
//List of fields for this object
|
//List of fields for this object
|
||||||
List<DataListFieldDefinition> FieldDefinitions { get; set; }
|
List<DataListFieldDefinition> FieldDefinitions { get; set; }
|
||||||
|
|
||||||
//allowed roles to access this list
|
//allowed roles to access this list
|
||||||
AuthorizationRoles AllowedRoles { get; set; }
|
AuthorizationRoles AllowedRoles { get; set; }
|
||||||
|
|
||||||
//Default object type to open for rows of this list (use no object if no)
|
//Default object type to open for rows of this list (use no object if no)
|
||||||
AyaType DefaultListObjectType { get; set; }
|
AyaType DefaultListObjectType { get; set; }
|
||||||
|
|
||||||
//Defaults when none is specified (see DataListOptions for formats and notes)
|
//Defaults when none is specified (see DataListOptions for formats and notes)
|
||||||
List<string> DefaultColumns { get; set; }
|
List<string> DefaultColumns { get; set; }
|
||||||
Dictionary<string, string> DefaultSortBy { get; set; }
|
Dictionary<string, string> DefaultSortBy { get; set; }
|
||||||
|
|
||||||
void SetListOptionDefaultsIfNecessary(Models.DataListProcessingBase listOptions);
|
void SetListOptionDefaultsIfNecessary(Models.DataListProcessingBase listOptions);
|
||||||
|
|
||||||
Newtonsoft.Json.Linq.JArray GenerateReturnListColumns(List<string> columns);
|
Newtonsoft.Json.Linq.JArray GenerateReturnListColumns(List<string> columns);
|
||||||
// List<string> GetFieldListFromListView(JArray listViewArray);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -13,38 +13,6 @@ namespace AyaNova.DataList
|
|||||||
SQLFrom = "from auser left join avendor on (auser.vendorid=avendor.id)";
|
SQLFrom = "from auser left join avendor on (auser.vendorid=avendor.id)";
|
||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||||
|
|
||||||
// //Default ListView
|
|
||||||
// dynamic dlistView = new JArray();
|
|
||||||
|
|
||||||
// dynamic cm = new JObject();
|
|
||||||
// cm.fld = "name";
|
|
||||||
// cm.sort = "+";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "employeenumber";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "active";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "usertype";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "lastlogin";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "roles";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
|
||||||
|
|
||||||
DefaultColumns = new List<string>() { "name", "employeenumber", "active", "usertype", "lastlogin", "roles" };
|
DefaultColumns = new List<string>() { "name", "employeenumber", "active", "usertype", "lastlogin", "roles" };
|
||||||
DefaultSortBy = new Dictionary<string, string>() { { "name", "+" } };
|
DefaultSortBy = new Dictionary<string, string>() { { "name", "+" } };
|
||||||
|
|
||||||
@@ -124,8 +92,6 @@ namespace AyaNova.DataList
|
|||||||
SqlValueColumnName = "auser.usertype",
|
SqlValueColumnName = "auser.usertype",
|
||||||
IsMeta = true
|
IsMeta = true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
||||||
|
|||||||
@@ -16,31 +16,9 @@ namespace AyaNova.DataList
|
|||||||
//todo: look at loanitemlist in v7 it surfaces due date, out date etc in the list and should here too once those fields are coded for
|
//todo: look at loanitemlist in v7 it surfaces due date, out date etc in the list and should here too once those fields are coded for
|
||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
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 = "LoanUnitName";
|
|
||||||
// cm.sort = "+";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "LoanUnitSerial";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "Tags";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
|
||||||
|
|
||||||
DefaultColumns = new List<string>() { "LoanUnitName", "LoanUnitSerial", "Tags" };
|
DefaultColumns = new List<string>() { "LoanUnitName", "LoanUnitSerial", "Tags" };
|
||||||
DefaultSortBy = new Dictionary<string, string>() { { "LoanUnitName", "+" } };
|
DefaultSortBy = new Dictionary<string, string>() { { "LoanUnitName", "+" } };
|
||||||
|
|
||||||
|
|
||||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
{
|
{
|
||||||
@@ -85,7 +63,6 @@ namespace AyaNova.DataList
|
|||||||
SqlValueColumnName = "aloanunit.tags"
|
SqlValueColumnName = "aloanunit.tags"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
{
|
{
|
||||||
FieldKey = "LoanUnitCurrentWorkOrderItemLoan",
|
FieldKey = "LoanUnitCurrentWorkOrderItemLoan",
|
||||||
@@ -163,7 +140,6 @@ namespace AyaNova.DataList
|
|||||||
SqlValueColumnName = "shadowunit.serial"
|
SqlValueColumnName = "shadowunit.serial"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "LoanUnitCustom1", FieldKey = "loanunitcustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "LoanUnitCustom1", FieldKey = "loanunitcustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "LoanUnitCustom2", FieldKey = "loanunitcustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "LoanUnitCustom2", FieldKey = "loanunitcustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "LoanUnitCustom3", FieldKey = "loanunitcustom3", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "LoanUnitCustom3", FieldKey = "loanunitcustom3", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
||||||
@@ -182,6 +158,5 @@ namespace AyaNova.DataList
|
|||||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "LoanUnitCustom16", FieldKey = "loanunitcustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "LoanUnitCustom16", FieldKey = "loanunitcustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aloanunit.customfields" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
}//eons
|
}//eons
|
||||||
@@ -12,36 +12,8 @@ namespace AyaNova.DataList
|
|||||||
SQLFrom = "from amemo left join auser on (amemo.fromid=auser.id)";
|
SQLFrom = "from amemo left join auser on (amemo.fromid=auser.id)";
|
||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||||
|
|
||||||
|
|
||||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
|
||||||
// //Default ListView
|
|
||||||
// dynamic dlistView = new JArray();
|
|
||||||
|
|
||||||
|
|
||||||
// dynamic cm = new JObject();
|
|
||||||
// cm.fld = "MemoSubject";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "MemoFromID";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "MemoSent";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "MemoViewed";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
|
||||||
|
|
||||||
DefaultColumns = new List<string>() { "MemoSubject", "MemoFromID", "MemoSent", "MemoViewed" };
|
DefaultColumns = new List<string>() { "MemoSubject", "MemoFromID", "MemoSent", "MemoViewed" };
|
||||||
DefaultSortBy = new Dictionary<string, string>() { { "MemoSent", "-" } };//added but wasnt' in original
|
DefaultSortBy = new Dictionary<string, string>() { { "MemoSent", "-" } };
|
||||||
|
|
||||||
|
|
||||||
//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<DataListFieldDefinition>();
|
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
@@ -147,7 +119,5 @@ namespace AyaNova.DataList
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
}//eons
|
}//eons
|
||||||
@@ -12,37 +12,9 @@ namespace AyaNova.DataList
|
|||||||
SQLFrom = "from auser left join aheadoffice on (auser.headofficeid=aheadoffice.id) left join acustomer on (auser.customerid=acustomer.id)";
|
SQLFrom = "from auser left join aheadoffice on (auser.headofficeid=aheadoffice.id) left join acustomer on (auser.customerid=acustomer.id)";
|
||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||||
|
|
||||||
// //Default ListView
|
|
||||||
// dynamic dlistView = new JArray();
|
|
||||||
|
|
||||||
// dynamic cm = new JObject();
|
|
||||||
// cm.fld = "name";
|
|
||||||
// cm.sort = "+";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "active";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "usercustomer";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "userheadoffice";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "lastlogin";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
|
||||||
|
|
||||||
DefaultColumns = new List<string>() { "name", "active", "usercustomer", "userheadoffice", "lastlogin" };
|
DefaultColumns = new List<string>() { "name", "active", "usercustomer", "userheadoffice", "lastlogin" };
|
||||||
DefaultSortBy = new Dictionary<string, string>() { { "name", "+" } };
|
DefaultSortBy = new Dictionary<string, string>() { { "name", "+" } };
|
||||||
|
|
||||||
|
|
||||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
{
|
{
|
||||||
@@ -63,7 +35,6 @@ namespace AyaNova.DataList
|
|||||||
SqlValueColumnName = "auser.employeenumber"
|
SqlValueColumnName = "auser.employeenumber"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
{
|
{
|
||||||
TKey = "Active",
|
TKey = "Active",
|
||||||
@@ -119,7 +90,7 @@ namespace AyaNova.DataList
|
|||||||
SqlValueColumnName = "acustomer.name"
|
SqlValueColumnName = "acustomer.name"
|
||||||
});
|
});
|
||||||
|
|
||||||
//META COLUMNS
|
//META COLUMNS
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
{
|
{
|
||||||
FieldKey = "metausertype",
|
FieldKey = "metausertype",
|
||||||
@@ -130,12 +101,12 @@ namespace AyaNova.DataList
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles,string clientCriteria)
|
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
||||||
{
|
{
|
||||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||||
|
|
||||||
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metausertype" };
|
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metausertype" };
|
||||||
FilterOption.Any=true;
|
FilterOption.Any = true;
|
||||||
FilterOption.Items.Add(new DataListColumnFilter() { value = ((int)UserType.Customer).ToString(), op = DataListFilterComparisonOperator.Equality });
|
FilterOption.Items.Add(new DataListColumnFilter() { value = ((int)UserType.Customer).ToString(), op = DataListFilterComparisonOperator.Equality });
|
||||||
FilterOption.Items.Add(new DataListColumnFilter() { value = ((int)UserType.HeadOffice).ToString(), op = DataListFilterComparisonOperator.Equality });
|
FilterOption.Items.Add(new DataListColumnFilter() { value = ((int)UserType.HeadOffice).ToString(), op = DataListFilterComparisonOperator.Equality });
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using AyaNova.Biz;
|
using AyaNova.Biz;
|
||||||
namespace AyaNova.DataList
|
namespace AyaNova.DataList
|
||||||
{
|
{
|
||||||
@@ -11,24 +10,8 @@ namespace AyaNova.DataList
|
|||||||
SQLFrom = "from apartassembly";
|
SQLFrom = "from apartassembly";
|
||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
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 = "partassemblyname";
|
|
||||||
// cm.sort = "+";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
|
|
||||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
|
||||||
|
|
||||||
DefaultColumns = new List<string>() { "partassemblyname" };
|
DefaultColumns = new List<string>() { "partassemblyname" };
|
||||||
DefaultSortBy = new Dictionary<string, string>() { { "partassemblyname", "+" } };
|
DefaultSortBy = new Dictionary<string, string>() { { "partassemblyname", "+" } };
|
||||||
|
|
||||||
|
|
||||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
@@ -66,10 +49,6 @@ namespace AyaNova.DataList
|
|||||||
SqlValueColumnName = "apartassembly.tags"
|
SqlValueColumnName = "apartassembly.tags"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-----------
|
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartAssemblyCustom1", FieldKey = "partassemblycustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apartassembly.customfields" });
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartAssemblyCustom1", FieldKey = "partassemblycustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apartassembly.customfields" });
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartAssemblyCustom2", FieldKey = "partassemblycustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apartassembly.customfields" });
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartAssemblyCustom2", FieldKey = "partassemblycustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apartassembly.customfields" });
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartAssemblyCustom3", FieldKey = "partassemblycustom3", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apartassembly.customfields" });
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartAssemblyCustom3", FieldKey = "partassemblycustom3", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apartassembly.customfields" });
|
||||||
|
|||||||
@@ -7,48 +7,14 @@ namespace AyaNova.DataList
|
|||||||
public PartDataList()
|
public PartDataList()
|
||||||
{
|
{
|
||||||
DefaultListObjectType = AyaType.Part;
|
DefaultListObjectType = AyaType.Part;
|
||||||
|
|
||||||
SQLFrom = "from apart "
|
SQLFrom = "from apart "
|
||||||
+ "left join avendor as aman on (apart.manufacturerid=aman.id) "
|
+ "left join avendor as aman on (apart.manufacturerid=aman.id) "
|
||||||
+ "left join avendor as awhole on (apart.wholesalerid=awhole.id) "
|
+ "left join avendor as awhole on (apart.wholesalerid=awhole.id) "
|
||||||
+ "left join avendor as aaltwhole on (apart.alternativewholesalerid=aaltwhole.id)";
|
+ "left join avendor as aaltwhole on (apart.alternativewholesalerid=aaltwhole.id)";
|
||||||
|
|
||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
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 = "PartPartNumber";
|
|
||||||
// cm.sort = "+";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "PartName";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "PartManufacturerID";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "PartWholesalerID";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "Tags";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
|
||||||
|
|
||||||
DefaultColumns = new List<string>() { "PartPartNumber", "PartName", "PartManufacturerID", "PartWholesalerID", "Tags" };
|
DefaultColumns = new List<string>() { "PartPartNumber", "PartName", "PartManufacturerID", "PartWholesalerID", "Tags" };
|
||||||
DefaultSortBy = new Dictionary<string, string>() { { "PartPartNumber", "+" } };
|
DefaultSortBy = new Dictionary<string, string>() { { "PartPartNumber", "+" } };
|
||||||
|
|
||||||
|
|
||||||
//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<DataListFieldDefinition>();
|
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
@@ -70,7 +36,6 @@ namespace AyaNova.DataList
|
|||||||
SqlValueColumnName = "apart.name"
|
SqlValueColumnName = "apart.name"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
{
|
{
|
||||||
TKey = "PartNotes",
|
TKey = "PartNotes",
|
||||||
@@ -111,7 +76,6 @@ namespace AyaNova.DataList
|
|||||||
SqlValueColumnName = "apart.retail"
|
SqlValueColumnName = "apart.retail"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
{
|
{
|
||||||
FieldKey = "PartManufacturerID",
|
FieldKey = "PartManufacturerID",
|
||||||
@@ -182,10 +146,6 @@ namespace AyaNova.DataList
|
|||||||
SqlValueColumnName = "apart.upc"
|
SqlValueColumnName = "apart.upc"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-----------
|
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartCustom1", FieldKey = "partcustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartCustom1", FieldKey = "partcustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartCustom2", FieldKey = "partcustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartCustom2", FieldKey = "partcustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartCustom3", FieldKey = "partcustom3", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartCustom3", FieldKey = "partcustom3", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apart.customfields" });
|
||||||
|
|||||||
@@ -9,55 +9,16 @@ namespace AyaNova.DataList
|
|||||||
{
|
{
|
||||||
public PartInventoryDataList()
|
public PartInventoryDataList()
|
||||||
{
|
{
|
||||||
|
|
||||||
DefaultListObjectType = AyaType.PartInventory;
|
DefaultListObjectType = AyaType.PartInventory;
|
||||||
SQLFrom = "from vpartinventorynow "
|
SQLFrom = "from vpartinventorynow "
|
||||||
+ "left join apart on (vpartinventorynow.partid=apart.id) "
|
+ "left join apart on (vpartinventorynow.partid=apart.id) "
|
||||||
+ "left join apartwarehouse on (vpartinventorynow.partwarehouseid=apartwarehouse.id) ";
|
+ "left join apartwarehouse on (vpartinventorynow.partwarehouseid=apartwarehouse.id) ";
|
||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||||
|
|
||||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
|
||||||
// //Default ListView - show all transactions in order
|
|
||||||
// dynamic dlistView = new JArray();
|
|
||||||
// dynamic cm = null;
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "PartPartNumber";
|
|
||||||
// cm.sort = "+";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "PartWarehouseName";
|
|
||||||
// cm.sort = "+";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "PartInventoryBalance";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// // cm = new JObject();
|
|
||||||
// // cm.fld = "PartInventoryTransactionDescription";
|
|
||||||
// // dlistView.Add(cm);
|
|
||||||
|
|
||||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
|
||||||
|
|
||||||
DefaultColumns = new List<string>() { "PartPartNumber", "PartWarehouseName", "PartInventoryBalance", "PartInventoryTransactionDescription" };
|
DefaultColumns = new List<string>() { "PartPartNumber", "PartWarehouseName", "PartInventoryBalance", "PartInventoryTransactionDescription" };
|
||||||
DefaultSortBy = new Dictionary<string, string>() { { "PartPartNumber", "+" }, { "PartWarehouseName", "+" } };
|
DefaultSortBy = new Dictionary<string, string>() { { "PartPartNumber", "+" }, { "PartWarehouseName", "+" } };
|
||||||
|
|
||||||
|
|
||||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||||
|
|
||||||
// FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
||||||
// {
|
|
||||||
// TKey = "PartInventoryTransactionSource",
|
|
||||||
// FieldKey = "PartInventoryTransactionSource",
|
|
||||||
// UiFieldDataType = (int)UiFieldDataType.Text,
|
|
||||||
// SqlIdColumnName = "vpartinventorynow.sourceid",
|
|
||||||
// SqlValueColumnName = "AYGETNAME(vpartinventorynow.sourceid, vpartinventorynow.sourcetype)",
|
|
||||||
// SqlAyTypeColumnName = "vpartinventorynow.sourcetype"
|
|
||||||
// });
|
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
{
|
{
|
||||||
TKey = "PartPartNumber",
|
TKey = "PartPartNumber",
|
||||||
@@ -90,22 +51,6 @@ namespace AyaNova.DataList
|
|||||||
IsRowId = true
|
IsRowId = true
|
||||||
});
|
});
|
||||||
|
|
||||||
// FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
||||||
// {
|
|
||||||
// TKey = "PartInventoryTransactionEntryDate",
|
|
||||||
// FieldKey = "PartInventoryTransactionEntryDate",
|
|
||||||
// UiFieldDataType = (int)UiFieldDataType.DateTime,
|
|
||||||
// SqlValueColumnName = "vpartinventorynow.entrydate"
|
|
||||||
// });
|
|
||||||
|
|
||||||
// FieldDefinitions.Add(new AyaDataListFieldDefinition
|
|
||||||
// {
|
|
||||||
// TKey = "PartInventoryTransactionQuantity",
|
|
||||||
// FieldKey = "PartInventoryTransactionQuantity",
|
|
||||||
// UiFieldDataType = (int)UiFieldDataType.Decimal,
|
|
||||||
// SqlValueColumnName = "vpartinventorynow.quantity"
|
|
||||||
// });
|
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
{
|
{
|
||||||
TKey = "PartInventoryBalance",
|
TKey = "PartInventoryBalance",
|
||||||
@@ -114,7 +59,6 @@ namespace AyaNova.DataList
|
|||||||
SqlValueColumnName = "vpartinventorynow.balance"
|
SqlValueColumnName = "vpartinventorynow.balance"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//META
|
//META
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,57 +9,17 @@ namespace AyaNova.DataList
|
|||||||
{
|
{
|
||||||
public PartInventoryTransactionsDataList()
|
public PartInventoryTransactionsDataList()
|
||||||
{
|
{
|
||||||
|
|
||||||
DefaultListObjectType = AyaType.PartInventory;
|
DefaultListObjectType = AyaType.PartInventory;
|
||||||
SQLFrom = "from apartinventory "
|
SQLFrom = "from apartinventory "
|
||||||
+ "left join apart on (apartinventory.partid=apart.id) "
|
+ "left join apart on (apartinventory.partid=apart.id) "
|
||||||
+ "left join apartwarehouse on (apartinventory.partwarehouseid=apartwarehouse.id) ";
|
+ "left join apartwarehouse on (apartinventory.partwarehouseid=apartwarehouse.id) ";
|
||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||||
|
|
||||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
|
||||||
// //Default ListView - show all transactions in order
|
|
||||||
// dynamic dlistView = new JArray();
|
|
||||||
// dynamic cm = null;
|
|
||||||
// cm = new JObject();
|
|
||||||
|
|
||||||
// cm.fld = "PartInventoryTransactionEntryDate";
|
|
||||||
// cm.sort = "-";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "PartPartNumber";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "PartWarehouseName";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "PartInventoryTransactionQuantity";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "PartInventoryTransactionDescription";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "PartInventoryTransactionSource";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "PartInventoryBalance";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
|
||||||
|
|
||||||
DefaultColumns = new List<string>() {
|
DefaultColumns = new List<string>() {
|
||||||
"PartInventoryTransactionEntryDate", "PartPartNumber", "PartWarehouseName", "PartInventoryTransactionQuantity",
|
"PartInventoryTransactionEntryDate", "PartPartNumber", "PartWarehouseName", "PartInventoryTransactionQuantity",
|
||||||
"PartInventoryTransactionDescription", "PartInventoryTransactionSource", "PartInventoryBalance"
|
"PartInventoryTransactionDescription", "PartInventoryTransactionSource", "PartInventoryBalance"
|
||||||
};
|
};
|
||||||
DefaultSortBy = new Dictionary<string, string>() { { "PartInventoryTransactionEntryDate", "-" } };
|
DefaultSortBy = new Dictionary<string, string>() { { "PartInventoryTransactionEntryDate", "-" } };
|
||||||
|
|
||||||
|
|
||||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
@@ -147,10 +107,9 @@ namespace AyaNova.DataList
|
|||||||
SqlValueColumnName = "apartwarehouse.name",
|
SqlValueColumnName = "apartwarehouse.name",
|
||||||
IsMeta = true
|
IsMeta = true
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
||||||
{
|
{
|
||||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||||
|
|||||||
@@ -10,31 +10,8 @@ namespace AyaNova.DataList
|
|||||||
SQLFrom = "from apartwarehouse";
|
SQLFrom = "from apartwarehouse";
|
||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
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 = "PartWarehouseName";
|
|
||||||
// cm.sort = "+";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "Active";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "Tags";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
|
||||||
|
|
||||||
DefaultColumns = new List<string>() { "PartWarehouseName", "Active", "Tags" };
|
DefaultColumns = new List<string>() { "PartWarehouseName", "Active", "Tags" };
|
||||||
DefaultSortBy = new Dictionary<string, string>() { { "PartWarehouseName", "+" } };
|
DefaultSortBy = new Dictionary<string, string>() { { "PartWarehouseName", "+" } };
|
||||||
|
|
||||||
|
|
||||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
@@ -72,10 +49,6 @@ namespace AyaNova.DataList
|
|||||||
SqlValueColumnName = "apartwarehouse.tags"
|
SqlValueColumnName = "apartwarehouse.tags"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-----------
|
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartWarehouseCustom1", FieldKey = "partwarehousecustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apartwarehouse.customfields" });
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartWarehouseCustom1", FieldKey = "partwarehousecustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apartwarehouse.customfields" });
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartWarehouseCustom2", FieldKey = "partwarehousecustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apartwarehouse.customfields" });
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartWarehouseCustom2", FieldKey = "partwarehousecustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apartwarehouse.customfields" });
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartWarehouseCustom3", FieldKey = "partwarehousecustom3", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apartwarehouse.customfields" });
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "PartWarehouseCustom3", FieldKey = "partwarehousecustom3", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "apartwarehouse.customfields" });
|
||||||
|
|||||||
@@ -10,48 +10,9 @@ namespace AyaNova.DataList
|
|||||||
SQLFrom = "from aproject left join auser on (aproject.projectoverseerid=auser.id)";
|
SQLFrom = "from aproject left join auser on (aproject.projectoverseerid=auser.id)";
|
||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
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",
|
DefaultColumns = new List<string>() { "projectname", "ProjectProjectOverseerID", "ProjectDateStarted", "ProjectDateCompleted",
|
||||||
"ProjectAccountNumber", "projectactive", "projecttags" };
|
"ProjectAccountNumber", "projectactive", "projecttags" };
|
||||||
DefaultSortBy = new Dictionary<string, string>() { { "projectname", "+" } };
|
DefaultSortBy = new Dictionary<string, string>() { { "projectname", "+" } };
|
||||||
|
|
||||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
@@ -89,9 +50,6 @@ namespace AyaNova.DataList
|
|||||||
SqlValueColumnName = "aproject.tags"
|
SqlValueColumnName = "aproject.tags"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//------------
|
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
{
|
{
|
||||||
TKey = "ProjectAccountNumber",
|
TKey = "ProjectAccountNumber",
|
||||||
@@ -125,7 +83,6 @@ namespace AyaNova.DataList
|
|||||||
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
UiFieldDataType = (int)UiFieldDataType.DateTime,
|
||||||
SqlValueColumnName = "aproject.datecompleted"
|
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 = "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 = "ProjectCustom2", FieldKey = "projectcustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "aproject.customfields" });
|
||||||
|
|||||||
@@ -7,39 +7,12 @@ namespace AyaNova.DataList
|
|||||||
{
|
{
|
||||||
public ReminderDataList()
|
public ReminderDataList()
|
||||||
{
|
{
|
||||||
|
|
||||||
DefaultListObjectType = AyaType.Reminder;
|
DefaultListObjectType = AyaType.Reminder;
|
||||||
SQLFrom = "from areminder";
|
SQLFrom = "from areminder";
|
||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||||
|
|
||||||
|
|
||||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
|
||||||
|
|
||||||
// dynamic dlistView = new JArray();
|
|
||||||
|
|
||||||
// dynamic cm = new JObject();
|
|
||||||
// cm.fld = "ReminderName";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "ReminderNotes";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "ReminderStopDate";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "ReminderStartDate";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
|
||||||
|
|
||||||
DefaultColumns = new List<string>() { "ReminderName", "ReminderNotes", "ReminderStopDate", "ReminderStartDate" };
|
DefaultColumns = new List<string>() { "ReminderName", "ReminderNotes", "ReminderStopDate", "ReminderStartDate" };
|
||||||
DefaultSortBy = new Dictionary<string, string>() { { "ReminderStopDate", "-" } };
|
DefaultSortBy = new Dictionary<string, string>() { { "ReminderStopDate", "-" } };
|
||||||
|
|
||||||
//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<DataListFieldDefinition>();
|
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
@@ -62,7 +35,6 @@ namespace AyaNova.DataList
|
|||||||
SqlValueColumnName = "areminder.notes"
|
SqlValueColumnName = "areminder.notes"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
{
|
{
|
||||||
TKey = "ReminderStartDate",
|
TKey = "ReminderStartDate",
|
||||||
@@ -113,7 +85,6 @@ namespace AyaNova.DataList
|
|||||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ReminderCustom14", FieldKey = "ReminderCustom14", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "areminder.customfields" });
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ReminderCustom14", FieldKey = "ReminderCustom14", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "areminder.customfields" });
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ReminderCustom15", FieldKey = "ReminderCustom15", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "areminder.customfields" });
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ReminderCustom15", FieldKey = "ReminderCustom15", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "areminder.customfields" });
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ReminderCustom16", FieldKey = "ReminderCustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "areminder.customfields" });
|
FieldDefinitions.Add(new DataListFieldDefinition { TKey = "ReminderCustom16", FieldKey = "ReminderCustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "areminder.customfields" });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Ensure only current user can fetch their reminders
|
//Ensure only current user can fetch their reminders
|
||||||
|
|||||||
@@ -4,38 +4,16 @@ namespace AyaNova.DataList
|
|||||||
{
|
{
|
||||||
internal class ReportDataList : DataListProcessingBase
|
internal class ReportDataList : DataListProcessingBase
|
||||||
{
|
{
|
||||||
|
|
||||||
public ReportDataList()
|
public ReportDataList()
|
||||||
{
|
{
|
||||||
DefaultListObjectType = AyaType.Report;
|
DefaultListObjectType = AyaType.Report;
|
||||||
SQLFrom = "from aReport";
|
SQLFrom = "from aReport";
|
||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||||
|
|
||||||
// //Default ListView
|
|
||||||
// dynamic dlistView = new JArray();
|
|
||||||
|
|
||||||
// dynamic cm = new JObject();
|
|
||||||
// cm.fld = "name";
|
|
||||||
// cm.sort = "+";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "objecttype";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "active";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
|
||||||
|
|
||||||
DefaultColumns = new List<string>() { "name", "objecttype", "active" };
|
DefaultColumns = new List<string>() { "name", "objecttype", "active" };
|
||||||
DefaultSortBy = new Dictionary<string, string>() { { "name", "+" } };
|
DefaultSortBy = new Dictionary<string, string>() { { "name", "+" } };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
{
|
{
|
||||||
TKey = "Report",
|
TKey = "Report",
|
||||||
@@ -47,7 +25,6 @@ namespace AyaNova.DataList
|
|||||||
IsRowId = true
|
IsRowId = true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
{
|
{
|
||||||
TKey = "AyaType",
|
TKey = "AyaType",
|
||||||
@@ -57,7 +34,6 @@ namespace AyaNova.DataList
|
|||||||
SqlValueColumnName = "areport.ObjectType"
|
SqlValueColumnName = "areport.ObjectType"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
{
|
{
|
||||||
TKey = "Active",
|
TKey = "Active",
|
||||||
@@ -66,8 +42,6 @@ namespace AyaNova.DataList
|
|||||||
SqlValueColumnName = "aReport.active"
|
SqlValueColumnName = "aReport.active"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}//eoc
|
}//eoc
|
||||||
}//eons
|
}//eons
|
||||||
@@ -15,49 +15,10 @@ namespace AyaNova.DataList
|
|||||||
+ "left join auser uassby on (areview.assignedbyuserid=uassby.id)";
|
+ "left join auser uassby on (areview.assignedbyuserid=uassby.id)";
|
||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
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 = "ReviewCompletedDate";
|
|
||||||
// cm.sort = "-";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "ReviewDueDate";
|
|
||||||
// cm.sort = "+";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "ReviewName";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "Object";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "AyaType";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "ReviewNotes";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "ReviewUserId";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
|
||||||
|
|
||||||
DefaultColumns = new List<string>() { "ReviewCompletedDate", "ReviewDueDate", "ReviewName", "Object", "AyaType", "ReviewNotes", "ReviewUserId" };
|
DefaultColumns = new List<string>() { "ReviewCompletedDate", "ReviewDueDate", "ReviewName", "Object", "AyaType", "ReviewNotes", "ReviewUserId" };
|
||||||
DefaultSortBy = new Dictionary<string, string>() { { "ReviewCompletedDate", "-" }, { "ReviewDueDate", "+" } };
|
DefaultSortBy = new Dictionary<string, string>() { { "ReviewCompletedDate", "-" }, { "ReviewDueDate", "+" } };
|
||||||
|
|
||||||
//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<DataListFieldDefinition>();
|
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
@@ -202,51 +163,8 @@ namespace AyaNova.DataList
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// string IAyaDataListServerCriteria.DataListServerCriteria(long currentUserId, AyaNova.Biz.AuthorizationRoles userRoles, DataListOptions dataListOptions)
|
|
||||||
// {
|
|
||||||
|
|
||||||
// bool HasSupervisorRole =
|
|
||||||
// userRoles.HasFlag(AuthorizationRoles.BizAdminFull) ||
|
|
||||||
// userRoles.HasFlag(AuthorizationRoles.DispatchFull) ||
|
|
||||||
// userRoles.HasFlag(AuthorizationRoles.InventoryFull) ||
|
|
||||||
// userRoles.HasFlag(AuthorizationRoles.SalesFull) ||
|
|
||||||
// userRoles.HasFlag(AuthorizationRoles.AccountingFull);
|
|
||||||
// if (!HasSupervisorRole)
|
|
||||||
// return "[{\"fld\":\"metareviewuser\",\"filter\":{\"items\":[{\"op\":\"=\",\"value\":" + currentUserId.ToString() + "}]}}]";
|
|
||||||
// return "[]";//this means effectively don't process this at all
|
|
||||||
// }
|
|
||||||
|
|
||||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
||||||
{
|
{
|
||||||
//TODO: support this clientcriteria
|
|
||||||
// if (vm.objectId && vm.objectId != 0 && vm.objectType) {
|
|
||||||
// //REMOVE COMMENT BLOCK AFTER TESTING
|
|
||||||
// // //pre-filter
|
|
||||||
// // vm.metaView = JSON.stringify([
|
|
||||||
// // {
|
|
||||||
// // fld: "metareviewobjectid",
|
|
||||||
// // filter: {
|
|
||||||
// // items: [{ op: "=", value: vm.objectId }]
|
|
||||||
// // }
|
|
||||||
// // },
|
|
||||||
// // {
|
|
||||||
// // fld: "AyaType",
|
|
||||||
// // filter: {
|
|
||||||
// // items: [{ op: "=", value: vm.objectType }]
|
|
||||||
// // }
|
|
||||||
// // }
|
|
||||||
// // ]);
|
|
||||||
// // vm.name = await window.$gz.api.fetchBizObjectName(
|
|
||||||
// // vm.objectType,
|
|
||||||
// // vm.objectId
|
|
||||||
// // );
|
|
||||||
// //OBJECTID,AYATYPE
|
|
||||||
// vm.clientCriteria = `${vm.objectId},${vm.objectType}`;
|
|
||||||
// }
|
|
||||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||||
bool HasSupervisorRole =
|
bool HasSupervisorRole =
|
||||||
userRoles.HasFlag(AuthorizationRoles.BizAdminFull)
|
userRoles.HasFlag(AuthorizationRoles.BizAdminFull)
|
||||||
|
|||||||
@@ -13,52 +13,6 @@ namespace AyaNova.DataList
|
|||||||
SQLFrom = "from aservicebank";
|
SQLFrom = "from aservicebank";
|
||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
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 = "ServiceBankCreated";
|
|
||||||
// cm.sort = "-";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "Object";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "ServiceBankCurrency";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "ServiceBankCurrencyBalance";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "ServiceBankIncidents";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "ServiceBankIncidentsBalance";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "ServiceBankHours";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "ServiceBankHoursBalance";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// cm = new JObject();
|
|
||||||
// cm.fld = "ServiceBankDescription";
|
|
||||||
// dlistView.Add(cm);
|
|
||||||
|
|
||||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
|
||||||
|
|
||||||
DefaultColumns = new List<string>() {
|
DefaultColumns = new List<string>() {
|
||||||
"ServiceBankCreated", "Object", "ServiceBankCurrency", "ServiceBankCurrencyBalance", "ServiceBankIncidents",
|
"ServiceBankCreated", "Object", "ServiceBankCurrency", "ServiceBankCurrencyBalance", "ServiceBankIncidents",
|
||||||
"ServiceBankIncidentsBalance", "ServiceBankHours", "ServiceBankHoursBalance", "ServiceBankDescription"
|
"ServiceBankIncidentsBalance", "ServiceBankHours", "ServiceBankHoursBalance", "ServiceBankDescription"
|
||||||
@@ -66,7 +20,6 @@ namespace AyaNova.DataList
|
|||||||
DefaultSortBy = new Dictionary<string, string>() { { "ServiceBankCreated", "-" } };
|
DefaultSortBy = new Dictionary<string, string>() { { "ServiceBankCreated", "-" } };
|
||||||
|
|
||||||
|
|
||||||
//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<DataListFieldDefinition>();
|
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||||
|
|
||||||
FieldDefinitions.Add(new DataListFieldDefinition
|
FieldDefinitions.Add(new DataListFieldDefinition
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace AyaNova.DataList
|
|||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||||
|
|
||||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
//######## DEFAULT VIEW ############
|
||||||
// //Default ListView
|
// //Default ListView
|
||||||
// dynamic dlistView = new JArray();
|
// dynamic dlistView = new JArray();
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace AyaNova.DataList
|
|||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||||
|
|
||||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
//######## DEFAULT VIEW ############
|
||||||
// //Default ListView
|
// //Default ListView
|
||||||
// dynamic dlistView = new JArray();
|
// dynamic dlistView = new JArray();
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace AyaNova.DataList
|
|||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||||
|
|
||||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
//######## DEFAULT VIEW ############
|
||||||
// //Default ListView
|
// //Default ListView
|
||||||
// dynamic dlistView = new JArray();
|
// dynamic dlistView = new JArray();
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace AyaNova.DataList
|
|||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||||
|
|
||||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
//######## DEFAULT VIEW ############
|
||||||
// //Default ListView
|
// //Default ListView
|
||||||
// dynamic dlistView = new JArray();
|
// dynamic dlistView = new JArray();
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace AyaNova.DataList
|
|||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||||
|
|
||||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
//######## DEFAULT VIEW ############
|
||||||
// //Default ListView
|
// //Default ListView
|
||||||
// dynamic dlistView = new JArray();
|
// dynamic dlistView = new JArray();
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace AyaNova.DataList
|
|||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||||
|
|
||||||
// //######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
|
//######## DEFAULT VIEW ############
|
||||||
// //Default ListView
|
// //Default ListView
|
||||||
// dynamic dlistView = new JArray();
|
// dynamic dlistView = new JArray();
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
|
|||||||
@@ -14,17 +14,6 @@ namespace AyaNova.Models
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
OLD EXAMPLE:
|
|
||||||
{"offset":0,"limit":10,"dataListKey":"CustomerDataList",
|
|
||||||
"listView":"[
|
|
||||||
{\"fld\":\"customername\",\"sort\":\"+\",\"filter\":{\"items\":[{\"op\":\"=\",\"value\":\"dfdfdf\"},{\"op\":\"=\",\"value\":\"3333\"}],\"any\":true}},
|
|
||||||
{\"fld\":\"customerphone1\",\"filter\":{\"items\":[{\"op\":\">\",\"value\":\"44444\"},
|
|
||||||
{\"op\":\"<\",\"value\":\"7777\"}]}},
|
|
||||||
{\"fld\":\"customeremail\"}
|
|
||||||
{\"fld\":\"customerheadoffice\"},
|
|
||||||
{\"fld\":\"customertags\",\"sort\":\"+\"}]"}
|
|
||||||
|
|
||||||
NEW:
|
|
||||||
columns:["PartInventoryTransactionEntryDate","PartPartNumber","PartWarehouseName","PartInventoryTransactionQuantity","PartInventoryTransactionDescription","PartInventoryTransactionSource","PartInventoryBalance"]
|
columns:["PartInventoryTransactionEntryDate","PartPartNumber","PartWarehouseName","PartInventoryTransactionQuantity","PartInventoryTransactionDescription","PartInventoryTransactionSource","PartInventoryBalance"]
|
||||||
sortBy:[{"PartInventoryTransactionEntryDate":"-"}],//All sorted columns here as keyvalue pairs value is a string of "+" for ascending "-" for descending and are IN ORDER of how to be sorted
|
sortBy:[{"PartInventoryTransactionEntryDate":"-"}],//All sorted columns here as keyvalue pairs value is a string of "+" for ascending "-" for descending and are IN ORDER of how to be sorted
|
||||||
filter:[{column:"PartPartNumber",any:true/false,items:[{op: "=",value: "400735"}]}],
|
filter:[{column:"PartPartNumber",any:true/false,items:[{op: "=",value: "400735"}]}],
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ using System.Collections.Generic;
|
|||||||
using System;
|
using System;
|
||||||
namespace AyaNova.Models
|
namespace AyaNova.Models
|
||||||
{
|
{
|
||||||
|
|
||||||
//common base class for data table display at client, reporting and mass bulk operations
|
//common base class for data table display at client, reporting and mass bulk operations
|
||||||
public class DataListProcessingBase
|
public class DataListProcessingBase
|
||||||
{
|
{
|
||||||
@@ -18,6 +17,4 @@ namespace AyaNova.Models
|
|||||||
Filter = new List<DataListFilterOption>();
|
Filter = new List<DataListFilterOption>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using AyaNova.DataList;
|
|||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
namespace AyaNova.Models
|
namespace AyaNova.Models
|
||||||
{
|
{
|
||||||
|
|
||||||
public class DataListReportProcessingOptions : DataListSelectedProcessingOptions
|
public class DataListReportProcessingOptions : DataListSelectedProcessingOptions
|
||||||
{
|
{
|
||||||
internal DataListReportProcessingOptions(DataListSelectedRequest request, IDataListProcessing dataList, DataListColumnView savedView, DataListSavedFilter savedFilter, long userId, AuthorizationRoles userRoles) : base(request, dataList, savedView, savedFilter, userId, userRoles)
|
internal DataListReportProcessingOptions(DataListSelectedRequest request, IDataListProcessing dataList, DataListColumnView savedView, DataListSavedFilter savedFilter, long userId, AuthorizationRoles userRoles) : base(request, dataList, savedView, savedFilter, userId, userRoles)
|
||||||
@@ -11,13 +10,6 @@ namespace AyaNova.Models
|
|||||||
}
|
}
|
||||||
|
|
||||||
public long ReportId { get; set; }
|
public long ReportId { get; set; }
|
||||||
public JToken ClientMeta { get; set; }//meta JSON data passed from client, not part of biz object data
|
public JToken ClientMeta { get; set; }//meta JSON data passed from client, not part of biz object data
|
||||||
//public long[] SelectedRowIds { get; set; }
|
|
||||||
// public string DataListKey { get; set; }
|
|
||||||
// public string ListView { get; set; }//optional, if null or empty will use default list view built into DataList
|
|
||||||
// public string MetaView { get; set; }//optional meta list view to integrate into the standard list view. Used by client to add "meta" filter conditions above the user's choices e.g. customer notes customer id
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
namespace AyaNova.Models
|
namespace AyaNova.Models
|
||||||
{
|
{
|
||||||
|
|
||||||
public class DataListReportRequest : DataListSelectedRequest
|
public class DataListReportRequest : DataListSelectedRequest
|
||||||
{
|
{
|
||||||
public long ReportId { get; set; }
|
public long ReportId { get; set; }
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
namespace AyaNova.Models
|
namespace AyaNova.Models
|
||||||
{
|
{
|
||||||
|
|
||||||
//common base class for REQUESTING a datalist from the client
|
//common base class for REQUESTING a datalist from the client
|
||||||
public class DataListRequestBase
|
public class DataListRequestBase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,9 +2,7 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace AyaNova.Models
|
namespace AyaNova.Models
|
||||||
{
|
{
|
||||||
//this is a hiearchical object so saving as a JSON fragment still best option
|
|
||||||
|
|
||||||
public class DataListSavedFilter
|
public class DataListSavedFilter
|
||||||
{
|
{
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
|
|||||||
@@ -11,12 +11,6 @@ namespace AyaNova.Models
|
|||||||
//be used to rehydrate a list of id's
|
//be used to rehydrate a list of id's
|
||||||
public class DataListSelectedProcessingOptions : DataListProcessingBase
|
public class DataListSelectedProcessingOptions : DataListProcessingBase
|
||||||
{
|
{
|
||||||
//public AyaType ObjectType { get; set; }
|
|
||||||
// public long[] SelectedRowIds { get; set; }
|
|
||||||
// public string DataListKey { get; set; }
|
|
||||||
// public string ListView { get; set; }//optional, if null or empty will use default list view built into DataList
|
|
||||||
// public string MetaView { get; set; }//optional meta list view to integrate into the standard list view. Used by client to add "meta" filter conditions above the user's choices e.g. customer notes customer id
|
|
||||||
|
|
||||||
internal DataListSelectedProcessingOptions(
|
internal DataListSelectedProcessingOptions(
|
||||||
DataListSelectedRequest request,
|
DataListSelectedRequest request,
|
||||||
IDataListProcessing dataList,
|
IDataListProcessing dataList,
|
||||||
@@ -71,14 +65,6 @@ namespace AyaNova.Models
|
|||||||
|
|
||||||
DataListSelectedProcessingOptions d = new DataListSelectedProcessingOptions(selectedRequest, DataList, SavedView, SavedFilter, userId, userRoles);
|
DataListSelectedProcessingOptions d = new DataListSelectedProcessingOptions(selectedRequest, DataList, SavedView, SavedFilter, userId, userRoles);
|
||||||
|
|
||||||
//hydrate the saved view and filter
|
|
||||||
// DataListSelectedProcessingOptions dataListSelectedOptions = new DataListSelectedProcessingOptions(selectedRequest, DataList, SavedView, SavedFilter, UserId, UserRoles);
|
|
||||||
// //------------------------
|
|
||||||
|
|
||||||
|
|
||||||
// if (SelectedRowIds.Length == 0)
|
|
||||||
// SelectedRowIds = await AyaNova.DataList.DataListFetcher.GetIdListResponseAsync(ct, this, userRoles, log, userId);
|
|
||||||
|
|
||||||
return await AyaNova.DataList.DataListFetcher.GetIdListResponseAsync(ct, d, DataList, userRoles, log, userId);
|
return await AyaNova.DataList.DataListFetcher.GetIdListResponseAsync(ct, d, DataList, userRoles, log, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace AyaNova.Models
|
|||||||
return Columns.Union(base.Filter.Select(z => z.Column).ToList()).ToList();
|
return Columns.Union(base.Filter.Select(z => z.Column).ToList()).ToList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
namespace AyaNova.Models
|
namespace AyaNova.Models
|
||||||
{
|
{
|
||||||
//Handles posts from client
|
|
||||||
public sealed class DataListTableRequest : DataListRequestBase
|
public sealed class DataListTableRequest : DataListRequestBase
|
||||||
{
|
{
|
||||||
public int? Offset { get; set; }
|
public int? Offset { get; set; }
|
||||||
|
|||||||
Reference in New Issue
Block a user