Beispiel #1
0
        static async Task <ResultTable> ExecuteChartAsync <T>(ChartRequest request, DynamicQueryCore <T> dq, CancellationToken token)
        {
            List <Column> columns = request.Columns.Where(c => c.Token != null).Select(t => t.CreateColumn()).ToList();

            var multiplications = request.Multiplications;;

            using (ExecutionMode.UserInterface())
            {
                if (!request.GroupResults)
                {
                    return(await dq.ExecuteQueryAsync(new QueryRequest
                    {
                        QueryName = request.QueryName,
                        Columns = columns,
                        Filters = request.Filters,
                        Orders = request.Orders,
                        Pagination = new Pagination.All(),
                    }, token));
                }
                else
                {
                    return(await dq.ExecuteQueryGroupAsync(new QueryGroupRequest
                    {
                        QueryName = request.QueryName,
                        Columns = columns,
                        Filters = request.Filters,
                        Orders = request.Orders
                    }, token));
                }
            }
        }
Beispiel #2
0
 static async Task <ResultTable> ExecuteChartAsync <T>(ChartRequestModel request, DynamicQueryCore <T> dq, CancellationToken token)
 {
     using (ExecutionMode.UserInterface())
     {
         return(await dq.ExecuteQueryAsync(new QueryRequest
         {
             GroupResults = request.HasAggregates(),
             QueryName = request.QueryName,
             Columns = request.GetQueryColumns(),
             Filters = request.Filters,
             Orders = request.GetQueryOrders(),
             Pagination = new Pagination.All(),
         }, token));
     }
 }
Beispiel #3
0
        static async Task <ResultTable> ExecuteChartAsync <T>(ChartRequestModel request, DynamicQueryCore <T> dq, CancellationToken token)
        {
            using (ExecutionMode.UserInterface())
            {
                var result = await dq.ExecuteQueryAsync(new QueryRequest
                {
                    GroupResults = request.HasAggregates(),
                    QueryName    = request.QueryName,
                    Columns      = request.GetQueryColumns(),
                    Filters      = request.Filters,
                    Orders       = request.GetQueryOrders(),
                    Pagination   = request.MaxRows.HasValue ? new Pagination.Firsts(request.MaxRows.Value + 1) : new Pagination.All(),
                }, token);


                if (request.MaxRows.HasValue && result.Rows.Length == request.MaxRows.Value)
                {
                    throw new InvalidOperationException($"The chart request for ${request.QueryName} exceeded the max rows ({request.MaxRows})");
                }

                return(result);
            }
        }