This commit is contained in:
@@ -82,15 +82,15 @@ namespace AyaNova.DataList
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, Models.DataListProcessingBase dataListBase)
|
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
||||||
{
|
{
|
||||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||||
//ClientCriteria MUST be CustomerId
|
//ClientCriteria MUST be CustomerId
|
||||||
if (string.IsNullOrWhiteSpace(dataListBase.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 = dataListBase.ClientCriteria, op = DataListFilterComparisonOperator.Equality });
|
FilterOption.Items.Add(new DataListColumnFilter() { value = clientCriteria, op = DataListFilterComparisonOperator.Equality });
|
||||||
|
|
||||||
ret.Add(FilterOption);
|
ret.Add(FilterOption);
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -6,6 +6,6 @@ namespace AyaNova.DataList
|
|||||||
//Additional criteria for security or other reasons
|
//Additional criteria for security or other reasons
|
||||||
//hard coded into some lists (e.g. MemoDataList so users can't get other people's memos)
|
//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)
|
//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.DataListProcessingBase dataListBase);
|
System.Collections.Generic.List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AyaNova.Biz.AuthorizationRoles userRoles, string clientCriteria);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -115,7 +115,7 @@ namespace AyaNova.DataList
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, Models.DataListProcessingBase dataListBase)
|
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
||||||
{
|
{
|
||||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||||
|
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ namespace AyaNova.DataList
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, Models.DataListProcessingBase dataListBase)
|
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
||||||
{
|
{
|
||||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||||
|
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ namespace AyaNova.DataList
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, Models.DataListProcessingBase dataListBase)
|
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles,string clientCriteria)
|
||||||
{
|
{
|
||||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||||
|
|
||||||
|
|||||||
@@ -116,14 +116,14 @@ namespace AyaNova.DataList
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, Models.DataListProcessingBase dataListBase)
|
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
||||||
{
|
{
|
||||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||||
|
|
||||||
//ClientCriteria is optional for this list
|
//ClientCriteria is optional for this list
|
||||||
//Format for this list is "PARTID,WAREHOUSENAME" where the id is 0 if not filtered or the id to filter
|
//Format for this list is "PARTID,WAREHOUSENAME" where the id is 0 if not filtered or the id to filter
|
||||||
//and bizarrely the warehousename is text or empty if not filtered
|
//and bizarrely the warehousename is text or empty if not filtered
|
||||||
var crit = (dataListBase.ClientCriteria ?? "").Split(',').Select(z => z.Trim()).ToArray();
|
var crit = (clientCriteria ?? "").Split(',').Select(z => z.Trim()).ToArray();
|
||||||
if (crit.Length > 1)
|
if (crit.Length > 1)
|
||||||
{
|
{
|
||||||
//Part criteria
|
//Part criteria
|
||||||
|
|||||||
@@ -130,14 +130,14 @@ namespace AyaNova.DataList
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, Models.DataListProcessingBase dataListBase)
|
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
||||||
{
|
{
|
||||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||||
|
|
||||||
//ClientCriteria is optional for this list
|
//ClientCriteria is optional for this list
|
||||||
//Format for this list is "PARTID,WAREHOUSENAME" where the id is 0 if not filtered or the id to filter
|
//Format for this list is "PARTID,WAREHOUSENAME" where the id is 0 if not filtered or the id to filter
|
||||||
//and bizarrely the warehousename is text or empty if not filtered
|
//and bizarrely the warehousename is text or empty if not filtered
|
||||||
var crit = (dataListBase.ClientCriteria ?? "").Split(',').Select(z => z.Trim()).ToArray();
|
var crit = (clientCriteria ?? "").Split(',').Select(z => z.Trim()).ToArray();
|
||||||
if (crit.Length > 1)
|
if (crit.Length > 1)
|
||||||
{
|
{
|
||||||
//Part criteria
|
//Part criteria
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace AyaNova.DataList
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Ensure only current user can fetch their reminders
|
//Ensure only current user can fetch their reminders
|
||||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, Models.DataListProcessingBase dataListBase)
|
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
||||||
{
|
{
|
||||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||||
|
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ namespace AyaNova.DataList
|
|||||||
// return "[]";//this means effectively don't process this at all
|
// return "[]";//this means effectively don't process this at all
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, Models.DataListProcessingBase dataListBase)
|
public List<DataListFilterOption> DataListInternalCriteria(long currentUserId, AuthorizationRoles userRoles, string clientCriteria)
|
||||||
{
|
{
|
||||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||||
bool HasSupervisorRole =
|
bool HasSupervisorRole =
|
||||||
|
|||||||
@@ -42,24 +42,24 @@ namespace AyaNova.Models
|
|||||||
//SERVER FILTER PROCESSING HERE CODE SEE DATALISTFETCHER
|
//SERVER FILTER PROCESSING HERE CODE SEE DATALISTFETCHER
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List<DataListFilterOption> StaticServerFilterOptions = new List<DataListFilterOption>();
|
||||||
|
if (dataList is IDataListInternalCriteria)
|
||||||
|
StaticServerFilterOptions = ((IDataListInternalCriteria)dataList).DataListInternalCriteria(userId, userRoles, request.ClientCriteria);
|
||||||
/*
|
/*
|
||||||
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 public field key names in a list from the listview
|
//Get the combination of all unique fields from both StaticServerFilterOptions and listOptions
|
||||||
// List<string> PublicListViewFieldList = listOptions.Columns;
|
//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();
|
||||||
|
|
||||||
//Get the combination of all unique fields from both StaticServerFilterOptions and listOptions
|
//Add the internal filters into the listoptions existing filters
|
||||||
//NOTE: this assumes no list options filter colums that don't exist in listoptions.columns
|
//NOTE: There is currently no overlap between internal filtered columns and filters coming from the client
|
||||||
var AllUniqueFieldKeysRequiredForQuery = dataListTableOptions.Columns.Union(StaticServerFilterOptions.Select(z => z.Column).ToList()).ToList();
|
foreach (DataListFilterOption dfo in StaticServerFilterOptions)
|
||||||
|
dataListTableOptions.Filter.Add(dfo);
|
||||||
//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);
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user