Files
raven/server/AyaNova/models/DataListBase.cs
2021-01-29 17:11:59 +00:00

61 lines
2.8 KiB
C#

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:
{"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
columns are represented in a higher level object DataListTableOptions
sort and filter are in here
columns and sort are a singleton per datalistkey,userid persisted automatically (no alternative "views" just one of these). User can set them or reset them to default.
filter is different: user can persist a filter by name for future selection, sharing with others (public). The default filter is no filter.
*/
public class DataListFilterOption
{
public string Column { get; set; }
public List<DataListColumnFilter> Items { get; set; }
public bool Any { get; set; }//means "or" the filter conditions
public DataListFilterOption()
{
Items = new List<DataListColumnFilter>();
Any = false;
}
}
public class DataListColumnFilter
{
public string op { get; set; }
public string value { get; set; }
}
}