72 lines
3.2 KiB
C#
72 lines
3.2 KiB
C#
using System.Threading.Tasks;
|
|
using AyaNova.Biz;
|
|
namespace AyaNova.Models
|
|
{
|
|
//Used to drive processes that rely on selections made at client from a datalist
|
|
//either a preselected list of id's or a datalist key and listview filter object that can
|
|
//be used to rehydrate a list of id's
|
|
public class DataListSelectedProcessingOptions : DataListProcessingBase
|
|
{
|
|
public AyaType ObjectType { get; set; }
|
|
public long[] SelectedRowIds { get; set; }
|
|
// public string DataListKey { get; set; }
|
|
// public string ListView { get; set; }//optional, if null or empty will use default list view built into DataList
|
|
// public string MetaView { get; set; }//optional meta list view to integrate into the standard list view. Used by client to add "meta" filter conditions above the user's choices e.g. customer notes customer id
|
|
|
|
|
|
public bool IsEmpty
|
|
{
|
|
get
|
|
{
|
|
return SelectedRowIds.LongLength == 0 && string.IsNullOrWhiteSpace(DataListKey);
|
|
}
|
|
}
|
|
|
|
///TODO: recode this to fulfil requirements of datalistfetcher in the same way as
|
|
//DataListTableProcessingOptions constructor
|
|
//clean out datalistfetcher comments and similar afterwards
|
|
public async Task RehydrateIdList(AyContext ct, AuthorizationRoles userRoles, Microsoft.Extensions.Logging.ILogger log, long userId)
|
|
{
|
|
if (SelectedRowIds.Length == 0)
|
|
SelectedRowIds = await AyaNova.DataList.DataListFetcher.GetIdListResponseAsync(ct, this, userRoles, log, userId);
|
|
}
|
|
}
|
|
}
|
|
|
|
/*
|
|
internal DataListTableProcessingOptions(
|
|
DataListTableRequest request,
|
|
IDataListProcessing dataList,
|
|
DataListSavedColumnView savedView,
|
|
DataListSavedFilter savedFilter,
|
|
long userId,
|
|
AuthorizationRoles userRoles)
|
|
{
|
|
//set some values from request
|
|
Limit = request.Limit;
|
|
Offset = request.Offset;
|
|
base.ClientCriteria = request.ClientCriteria;
|
|
base.DataListKey = request.DataListKey;
|
|
|
|
//SET COLUMNS
|
|
Columns = JsonConvert.DeserializeObject<List<string>>(savedView.Columns);
|
|
|
|
//SET SORTBY
|
|
base.SortBy = JsonConvert.DeserializeObject<Dictionary<string, string>>(savedView.Sort);
|
|
|
|
//SET FILTER
|
|
if (request.FilterId != 0 && savedFilter != null)
|
|
base.Filter = JsonConvert.DeserializeObject<List<DataListFilterOption>>(savedFilter.Filter);
|
|
|
|
//ADD STATIC SERVER FILTERS
|
|
List<DataListFilterOption> StaticServerFilterOptions = new List<DataListFilterOption>();
|
|
if (dataList is IDataListInternalCriteria)
|
|
StaticServerFilterOptions = ((IDataListInternalCriteria)dataList).DataListInternalCriteria(userId, userRoles, request.ClientCriteria);
|
|
|
|
//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)
|
|
base.Filter.Add(dfo);
|
|
|
|
}
|
|
*/ |