private static string FilterFormat(CustomDataSourceRequestFilter filtersParser) { var filterResult = new StringBuilder(); if (filtersParser != null && filtersParser.Filters != null) { var balance = filtersParser.Filters.Count; foreach (var item in filtersParser.Filters) { filterResult.Append($"{item.Field}~{item.Operator}~'{item.Value}'"); balance--; if (balance > 0) { filterResult.Append($"~{filtersParser.Logic}~"); } } } return(filterResult.ToString()); }
private static IList <IFilterDescriptor> ParseSimpleFilters(string filterInput) { CustomDataSourceRequestFilter filters = JsonConvert.DeserializeObject <CustomDataSourceRequestFilter>(filterInput); return(FilterDescriptorFactory.Create(FilterFormat(filters))); }