This commit is contained in:
2021-01-27 18:53:13 +00:00
parent c59cc5969c
commit b90ab0b35c
9 changed files with 110 additions and 97 deletions

View File

@@ -1,86 +1,89 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using
namespace AyaNova.DataList
{
//MOVED TO MODELS AS DataListTableOptions AND BROKEN APART
public sealed class DataListOptions : DataListBase
{
public const int MaxPageSize = 1000;
public const int DefaultOffset = 0;
public const int DefaultLimit = 25;
// using System.ComponentModel.DataAnnotations;
// using Microsoft.AspNetCore.Mvc;
// using System.Collections.Generic;
// using
[FromBody]
public int? Offset { get; set; }
// namespace AyaNova.DataList
// {
[FromBody]
public int? Limit { get; set; }
// public sealed class DataListOptions : DataListBase
// {
// public const int MaxPageSize = 1000;
// public const int DefaultOffset = 0;
// public const int DefaultLimit = 25;
[FromBody, Required]
public string DataListKey { get; set; }
// [FromBody]
// public int? Offset { get; set; }
[FromBody]
public DataListView View { 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; }
}
// // [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\":\"+\"}]"}
// 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; }
}
// 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 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; }
}
// public class DataListColumnFilter
// {
// public string op { get; set; }
// public string value { get; set; }
// }
}
// }