Exemplo n.º 1
0
        private FilterOption GetSubgroupFilter(ChartColumnEmbedded chartToken, string key)
        {
            if (chartToken == null || chartToken.Token.Token is AggregateToken)
            {
                return(null);
            }

            var token = chartToken.Token;

            string str = Request.Params.AllKeys.Contains(key)  ? Request.Params[key] : null;

            var value = str == null || str == "null" ? null :
                        FindOptionsModelBinder.Convert(FindOptionsModelBinder.DecodeValue(str), token.Token.Type);

            return(new FilterOption
            {
                ColumnName = token.Token.FullKey(),
                Token = token.Token,
                Operation = FilterOperation.EqualTo,
                Value = value,
            });
        }
        public ContentResult AddFilter(string webQueryName, string tokenName, int index, string prefix, string value)
        {
            object queryName = Finder.ResolveQueryName(webQueryName);

            FilterOption fo = new FilterOption(tokenName, null);

            QueryDescription qd = DynamicQueryManager.Current.QueryDescription(queryName);

            fo.Token = QueryUtils.Parse(tokenName, qd, SubTokensOptions.CanAnyAll | SubTokensOptions.CanElement);

            fo.Operation = QueryUtils.GetFilterOperations(QueryUtils.GetFilterType(fo.Token.Type)).FirstEx();

            try
            {
                fo.Value = FindOptionsModelBinder.Convert(value, fo.Token.Type);
            }
            catch (Exception)
            {
                //Cell Value must be custom and cannot be parsed automatically: Leave value to null
            }

            return(Content(FilterBuilderHelper.NewFilter(CreateHtmlHelper(this), fo, new Context(null, prefix), index).ToHtmlString()));
        }