Ejemplo n.º 1
0
        static List <Order> ExtractChartOrders(MappingContext <List <Order> > ctx)
        {
            var qd = DynamicQueryManager.Current.QueryDescription(
                Finder.ResolveQueryName(ctx.Controller.ControllerContext.HttpContext.Request.Params["webQueryName"]));

            ChartRequest chartRequest = (ChartRequest)ctx.Parent.UntypedValue;

            return(FindOptionsModelBinder.ExtractOrderOptions(ctx.Controller.ControllerContext.HttpContext, qd, canAggregate: true /*chartRequest.GroupResults*/)
                   .Select(fo => fo.ToOrder()).ToList());
        }
Ejemplo n.º 2
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,
            });
        }
Ejemplo n.º 3
0
        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()));
        }