From b16fc01b928c8b9ec1889fc7fd8d09b5156520d0 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 28 Jan 2021 17:48:05 +0000 Subject: [PATCH] --- docs/8.0/ayanova/docs/api-request-format.md | 18 +++++-- .../AyaNova/DataList/PartInventoryDataList.cs | 47 +++++++++---------- 2 files changed, 37 insertions(+), 28 deletions(-) diff --git a/docs/8.0/ayanova/docs/api-request-format.md b/docs/8.0/ayanova/docs/api-request-format.md index 6aa15f46..d050950d 100644 --- a/docs/8.0/ayanova/docs/api-request-format.md +++ b/docs/8.0/ayanova/docs/api-request-format.md @@ -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 diff --git a/server/AyaNova/DataList/PartInventoryDataList.cs b/server/AyaNova/DataList/PartInventoryDataList.cs index 4dbc98b2..7fbbc970 100644 --- a/server/AyaNova/DataList/PartInventoryDataList.cs +++ b/server/AyaNova/DataList/PartInventoryDataList.cs @@ -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 DataListServerCriteria(long currentUserId, AuthorizationRoles userRoles, DataListBase dataListBase) { List ret = new List(); - //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 \ No newline at end of file