This commit is contained in:
@@ -82,7 +82,7 @@ namespace AyaNova.DataList
|
||||
}
|
||||
|
||||
|
||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, Models.DataListBase dataListBase)
|
||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, Models.DataListProcessingBase dataListBase)
|
||||
{
|
||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||
//ClientCriteria MUST be CustomerId
|
||||
|
||||
@@ -11,10 +11,10 @@ namespace AyaNova.DataList
|
||||
//Instantiate list object specified
|
||||
//this is safe as it's only attempting to load assemblies in the AyaNova.DataList namespace so can't attempt to instantiate some random object or nefarious object
|
||||
//returns null if doesn't exist
|
||||
internal static IDataList GetAyaDataList(string ListKey)
|
||||
internal static IDataListProcessing GetAyaDataList(string ListKey)
|
||||
{
|
||||
System.Reflection.Assembly ass = System.Reflection.Assembly.GetEntryAssembly();
|
||||
return ass.CreateInstance($"AyaNova.DataList.{ListKey}") as IDataList;
|
||||
return ass.CreateInstance($"AyaNova.DataList.{ListKey}") as IDataListProcessing;
|
||||
}
|
||||
|
||||
//List all the datalist types available
|
||||
@@ -27,7 +27,7 @@ namespace AyaNova.DataList
|
||||
|
||||
foreach (System.Reflection.TypeInfo ti in ass.DefinedTypes)
|
||||
{
|
||||
if (!ti.IsAbstract && ti.ImplementedInterfaces.Contains(typeof(IDataList)))
|
||||
if (!ti.IsAbstract && ti.ImplementedInterfaces.Contains(typeof(IDataListProcessing)))
|
||||
{
|
||||
ret.Add(ti.Name);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ namespace AyaNova.DataList
|
||||
if (!userRoles.HasAnyFlags(DataList.AllowedRoles))
|
||||
throw new System.UnauthorizedAccessException("User roles insufficient for this datalist");
|
||||
|
||||
|
||||
//turn the DataListTableRequest into a
|
||||
|
||||
DataList.SetListOptionDefaultsIfNecessary(dataListTableOptions);
|
||||
|
||||
|
||||
@@ -258,7 +261,7 @@ namespace AyaNova.DataList
|
||||
// if (string.IsNullOrWhiteSpace(listView))
|
||||
// listView = DataList.DefaultListView;
|
||||
|
||||
DataList.SetListOptionDefaultsIfNecessary(dataListSelectionOptions);
|
||||
DataList.ProcessRequest(dataListSelectionOptions);
|
||||
|
||||
// //parse the list view
|
||||
// var ListViewArray = JArray.Parse(listView);
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace AyaNova.DataList
|
||||
/// <summary>
|
||||
/// DataList object base class
|
||||
/// </summary>
|
||||
internal abstract class DataListProcessingBase : IDataList
|
||||
internal abstract class DataListProcessingBase : IDataListProcessing
|
||||
{
|
||||
//CoreBizObject add here
|
||||
//well, not here exactly but add a new DATALIST class if it will be displayed as a list anywhere in the UI or reported on
|
||||
@@ -40,7 +40,7 @@ namespace AyaNova.DataList
|
||||
public Dictionary<string, string> DefaultSortBy { get; set; }
|
||||
|
||||
//set defaults if not provided in listOptions
|
||||
public void SetListOptionDefaultsIfNecessary(DataListBase listOptions)
|
||||
public void ProcessRequest(Models.DataListProcessingBase listOptions)
|
||||
{
|
||||
//columns, filter and sortby could all be null
|
||||
if (listOptions.Filter == null)
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace AyaNova.DataList
|
||||
{
|
||||
public static class DataListSqlFilterCriteriaBuilder
|
||||
{
|
||||
public static string DataFilterToSQLCriteria(List<DataListFieldDefinition> objectFieldsList, Models.DataListBase listOptions)
|
||||
public static string DataFilterToSQLCriteria(List<DataListFieldDefinition> objectFieldsList, Models.DataListProcessingBase listOptions)
|
||||
{
|
||||
|
||||
if (listOptions.Filter == null || listOptions.Filter.Count == 0)
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace AyaNova.DataList
|
||||
{
|
||||
|
||||
|
||||
public static string DataFilterToSQLOrderBy(List<DataListFieldDefinition> objectFieldsList, Models.DataListBase listOptions)
|
||||
public static string DataFilterToSQLOrderBy(List<DataListFieldDefinition> objectFieldsList, Models.DataListProcessingBase listOptions)
|
||||
{
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
@@ -6,6 +6,6 @@ namespace AyaNova.DataList
|
||||
//Additional criteria for security or other reasons
|
||||
//hard coded into some lists (e.g. MemoDataList so users can't get other people's memos)
|
||||
//clientCriteria is additional criteria provided by client to list to process as it sees fit (e.g. CustomerNoteDataList requires customer id from client)
|
||||
System.Collections.Generic.List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AyaNova.Biz.AuthorizationRoles userRoles, Models.DataListBase dataListBase);
|
||||
System.Collections.Generic.List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AyaNova.Biz.AuthorizationRoles userRoles, Models.DataListProcessingBase dataListBase);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ using AyaNova.Biz;
|
||||
using AyaNova.Models;
|
||||
namespace AyaNova.DataList
|
||||
{
|
||||
internal interface IDataList
|
||||
internal interface IDataListProcessing
|
||||
{
|
||||
|
||||
//sql query from fragment with table joins et
|
||||
@@ -23,7 +23,7 @@ namespace AyaNova.DataList
|
||||
List<string> DefaultColumns { get; set; }
|
||||
Dictionary<string, string> DefaultSortBy { get; set; }
|
||||
|
||||
void SetListOptionDefaultsIfNecessary(Models.DataListBase listOptions);
|
||||
void ProcessRequest(Models.DataListProcessingBase listOptions);
|
||||
|
||||
Newtonsoft.Json.Linq.JArray GenerateReturnListColumns(List<string> columns);
|
||||
// List<string> GetFieldListFromListView(JArray listViewArray);
|
||||
@@ -115,7 +115,7 @@ namespace AyaNova.DataList
|
||||
});
|
||||
}
|
||||
|
||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, Models.DataListBase dataListBase)
|
||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, Models.DataListProcessingBase dataListBase)
|
||||
{
|
||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace AyaNova.DataList
|
||||
|
||||
}
|
||||
|
||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, Models.DataListBase dataListBase)
|
||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, Models.DataListProcessingBase dataListBase)
|
||||
{
|
||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace AyaNova.DataList
|
||||
});
|
||||
}
|
||||
|
||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, Models.DataListBase dataListBase)
|
||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, Models.DataListProcessingBase dataListBase)
|
||||
{
|
||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace AyaNova.DataList
|
||||
|
||||
}
|
||||
|
||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, Models.DataListBase dataListBase)
|
||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, Models.DataListProcessingBase dataListBase)
|
||||
{
|
||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace AyaNova.DataList
|
||||
}
|
||||
|
||||
|
||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, Models.DataListBase dataListBase)
|
||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, Models.DataListProcessingBase dataListBase)
|
||||
{
|
||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace AyaNova.DataList
|
||||
}
|
||||
|
||||
//Ensure only current user can fetch their reminders
|
||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, Models.DataListBase dataListBase)
|
||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, Models.DataListProcessingBase dataListBase)
|
||||
{
|
||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||
|
||||
|
||||
@@ -207,7 +207,7 @@ namespace AyaNova.DataList
|
||||
// return "[]";//this means effectively don't process this at all
|
||||
// }
|
||||
|
||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, Models.DataListBase dataListBase)
|
||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, Models.DataListProcessingBase dataListBase)
|
||||
{
|
||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||
bool HasSupervisorRole =
|
||||
|
||||
9
server/AyaNova/models/DataListColumnFilter.cs
Normal file
9
server/AyaNova/models/DataListColumnFilter.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
namespace AyaNova.Models
|
||||
{
|
||||
public class DataListColumnFilter
|
||||
{
|
||||
public string op { get; set; }
|
||||
public string value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -2,20 +2,7 @@ using System.Collections.Generic;
|
||||
namespace AyaNova.Models
|
||||
{
|
||||
|
||||
//common base class for data table display at client, reporting and mass bulk operations
|
||||
public class DataListBase
|
||||
{
|
||||
public string DataListKey { get; set; }
|
||||
public Dictionary<string, string> SortBy { get; set; }
|
||||
public List<DataListFilterOption> Filter { get; set; }
|
||||
public string ClientCriteria { get; set; }
|
||||
|
||||
public DataListBase()
|
||||
{
|
||||
SortBy = new Dictionary<string, string>();
|
||||
Filter = new List<DataListFilterOption>();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
OLD EXAMPLE:
|
||||
@@ -52,9 +39,4 @@ namespace AyaNova.Models
|
||||
}
|
||||
}
|
||||
|
||||
public class DataListColumnFilter
|
||||
{
|
||||
public string op { get; set; }
|
||||
public string value { get; set; }
|
||||
}
|
||||
}
|
||||
21
server/AyaNova/models/DataListProcessingBase.cs
Normal file
21
server/AyaNova/models/DataListProcessingBase.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.Collections.Generic;
|
||||
namespace AyaNova.Models
|
||||
{
|
||||
|
||||
//common base class for data table display at client, reporting and mass bulk operations
|
||||
public class DataListProcessingBase
|
||||
{
|
||||
public string DataListKey { get; set; }
|
||||
public Dictionary<string, string> SortBy { get; set; }
|
||||
public List<DataListFilterOption> Filter { get; set; }
|
||||
public string ClientCriteria { get; set; }
|
||||
|
||||
public DataListProcessingBase()
|
||||
{
|
||||
SortBy = new Dictionary<string, string>();
|
||||
Filter = new List<DataListFilterOption>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -3,7 +3,7 @@ namespace AyaNova.Models
|
||||
{
|
||||
//Request version of selection request used by report and bulk ops
|
||||
//handles posts from client
|
||||
public class DataListSelectedRequest : DataListBase
|
||||
public class DataListSelectedRequest : DataListProcessingBase
|
||||
{
|
||||
public AyaType ObjectType { get; set; }
|
||||
public long[] SelectedRowIds { get; set; }
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace AyaNova.Models
|
||||
//Used to drive processes that rely on selections made at client from a datalist
|
||||
//either a preselected list of id's or a datalist key and listview filter object that can
|
||||
//be used to rehydrate a list of id's
|
||||
public class DataListSelectionOptions : DataListBase
|
||||
public class DataListSelectionOptions : DataListProcessingBase
|
||||
{
|
||||
public AyaType ObjectType { get; set; }
|
||||
public long[] SelectedRowIds { get; set; }
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace AyaNova.Models
|
||||
{
|
||||
public sealed class DataListTableOptions : DataListBase
|
||||
public sealed class DataListTableOptions : DataListProcessingBase
|
||||
{
|
||||
public List<string> Columns { get; set; }
|
||||
public const int MaxPageSize = 1000;
|
||||
|
||||
Reference in New Issue
Block a user