Esempio n. 1
0
        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());
        }
Esempio n. 2
0
        private static IList <IFilterDescriptor> ParseSimpleFilters(string filterInput)
        {
            CustomDataSourceRequestFilter filters = JsonConvert.DeserializeObject <CustomDataSourceRequestFilter>(filterInput);

            return(FilterDescriptorFactory.Create(FilterFormat(filters)));
        }