This commit is contained in:
@@ -39,7 +39,19 @@ This parameter controls the paging offset and is expected to be an integer. If
|
||||
|
||||
This parameter controls the number of items returned starting at the offset provided. The maximum allowed value is 1000, the default value is 25 if no value is specified.
|
||||
|
||||
### DataFilterId - Sorting and Filtering
|
||||
|
||||
### ClientCriteria TODO: section regarding special clientCriteria values for each list
|
||||
|
||||
Notes:
|
||||
|
||||
CustomerNoteDataList - ClientCriteria MUST be provided with CustomerId value
|
||||
|
||||
PartInventoryDataList - ClientCriteria is optional for this list, Format for this list is "PARTID,WAREHOUSEID" where the id is 0 if not filtered or the id to filter
|
||||
|
||||
|
||||
TODO: Replace this section with updated sort / filter and column selection
|
||||
|
||||
### (DEPRECATED TO BE UPDATED) DataFilterId - Sorting and Filtering
|
||||
|
||||
Sorting and filtering are accomplished by providing an Id value in the DataFilterId parameter of a list for a pre-created and saved `DataFilter` object.
|
||||
|
||||
@@ -47,7 +59,7 @@ A DataFilter is created separately before it can be used with a list request via
|
||||
|
||||
A DataFilter object contains properties for filtering and sorting as well as a name used to display for selection in the user interface and properties that control who can select and use the filter (public or just a single User).
|
||||
|
||||
#### DataFilter.sort
|
||||
#### (DEPRECATED TO BE UPDATED) DataFilter.sort
|
||||
|
||||
This parameter controls the sort order of the data returned. It is expected to be a *string* representation of a JSON array of objects that contain two fields a `fld` property that contains the string name of the field to be sorted by and a `dir` property that controls the direction of sorting and is one of two values "+" for Ascending or "-" for Descending. Multiple objects may be specified to sort by multiple columns in order from first to last specified in the array.
|
||||
|
||||
@@ -61,7 +73,7 @@ To determine which field names are valid for a particular list you can make use
|
||||
|
||||
If no sort parameter is provided the default is to sort by Id Descending so the most recently created objects appear first in the list.
|
||||
|
||||
#### DataFilter.filter
|
||||
#### (DEPRECATED TO BE UPDATED) DataFilter.filter
|
||||
|
||||
This parameter filters the data returned. It is expected to be a *string* representation of a JSON array of objects that contain three fields:
|
||||
- `fld` property that contains the string name of the field to be sorted by
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AyaNova.Biz;
|
||||
using AyaNova.Models;
|
||||
|
||||
@@ -114,38 +115,34 @@ namespace AyaNova.DataList
|
||||
});
|
||||
|
||||
}
|
||||
//"clientCriteria":"p:102074,w:*"
|
||||
//"clientCriteria":"102074,0"
|
||||
public List<DataListFilterOption> DataListServerCriteria(long currentUserId, AuthorizationRoles userRoles, DataListBase dataListBase)
|
||||
{
|
||||
List<DataListFilterOption> ret = new List<DataListFilterOption>();
|
||||
//ClientCriteria MUST be CustomerId
|
||||
if (string.IsNullOrWhiteSpace(dataListBase.ClientCriteria))
|
||||
throw new System.ArgumentNullException("CustomerNoteDataList - ClientCriteria is empty, should be Customer ID");
|
||||
|
||||
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metacustomer" };
|
||||
FilterOption.Items.Add(new DataListColumnFilter() { value = dataListBase.ClientCriteria, op = DataListFilterComparisonOperator.Equality });
|
||||
//ClientCriteria is optional for this list
|
||||
//Format for this list is "PARTID,WAREHOUSEID" where the id is 0 if not filtered or the id to filter
|
||||
var crit = (dataListBase.ClientCriteria ?? "").Split(',').Select(z => z.Trim()).ToArray();
|
||||
if (crit.Length > 1)
|
||||
{
|
||||
//Part criteria
|
||||
if (crit[0]!="0")
|
||||
{
|
||||
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "PartPartNumber" };
|
||||
FilterOption.Items.Add(new DataListColumnFilter() { value = crit[0], op = DataListFilterComparisonOperator.Equality });
|
||||
ret.Add(FilterOption);
|
||||
}
|
||||
|
||||
ret.Add(FilterOption);
|
||||
//Warehouse criteria
|
||||
if (crit[1]!="0")
|
||||
{
|
||||
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "PartWarehouseName" };
|
||||
FilterOption.Items.Add(new DataListColumnFilter() { value = crit[1], op = DataListFilterComparisonOperator.Equality });
|
||||
ret.Add(FilterOption);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
metaFilter.push({
|
||||
// fld: "PartPartNumber",
|
||||
// filter: {
|
||||
// items: [{ op: "=", value: vm.$route.params.filter.PartPartNumber }]
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
// if (vm.$route.params.filter.PartWarehouseName != null) {
|
||||
// metaFilter.push({
|
||||
// fld: "PartWarehouseName",
|
||||
// filter: {
|
||||
// items: [
|
||||
// { op: "=", value: vm.$route.params.filter.PartWarehouseName }
|
||||
// ]
|
||||
*/
|
||||
|
||||
}//eoc
|
||||
}//eons
|
||||
Reference in New Issue
Block a user