コード例 #1
0
        /// <summary>
        /// 查询分组表
        /// </summary>
        /// <param name="ReportSource"></param>
        /// <param name="ReportTemplate"></param>
        /// <param name="Parameters"></param>
        private JsonResult QueryGroupTable(ReportSource ReportSource, ReportTemplate ReportTemplate, ReportTemplateParameter[] Parameters)
        {
            Analytics.AnalyticalQuery Query = this.Engine.BPAQuery.GetAnalyticalQuery(this.Engine, ReportSource);
            DataTable dataTable             = Query.QueryGroupTable(ReportSource.ExecuteTableName, ReportSource.Columns, ReportTemplate, Parameters);

            object QueryResult;

            if (string.IsNullOrWhiteSpace(ReportTemplate.ColumnTitle))
            {//没有列标题
                QueryResult = QueryNoneColumnTitle(ReportTemplate, dataTable, ReportSource.Columns);
            }
            else
            {     //有行标题
                if (string.IsNullOrWhiteSpace(ReportTemplate.RowTitle))
                { //没有配置行标题的
                    QueryResult = QueryNoneRowTitle(ReportTemplate, dataTable, ReportSource.Columns);
                }
                else
                {//有配置行标题
                    QueryResult = QueryExistRowTitle(ReportTemplate, dataTable, ReportSource.Columns);
                }
            }

            return(Json(QueryResult, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public JsonResult ExportEchartsReport(string filterDatas, string reportTemplateSetting)
        {
            return(ExecuteFunctionRun(() =>
            {
                ReportTemplate ReportTemplate = JsonConvert.DeserializeObject <ReportTemplate>(reportTemplateSetting);
                ReportTemplateParameter[] FilterDatas = JsonConvert.DeserializeObject <ReportTemplateParameter[]>(filterDatas);
                ReportSource ReportSource = this.Engine.Analyzer.GetReportSourceByCode(ReportTemplate.SourceCode);

                Analytics.AnalyticalQuery Query = this.Engine.BPAQuery.GetAnalyticalQuery(this.Engine, ReportSource);
                DataTable dataTable = Query.QueryGroupTable(ReportSource.ExecuteTableName, ReportSource.Columns, ReportTemplate, FilterDatas);

                string FileUrl = string.Empty;
                if (string.IsNullOrWhiteSpace(ReportTemplate.RowTitle))
                {//没有配置行标题的
                    FileUrl = ExportEchartsReportWithoutRowTitle(ReportTemplate, dataTable, ReportSource.Columns);
                }
                else
                {//有配置行标题
                    if (string.IsNullOrWhiteSpace(ReportTemplate.ColumnTitle))
                    {
                        FileUrl = ExportEchartsReportWithoutColumnTitle(ReportTemplate, dataTable, ReportSource.Columns);
                    }
                    else
                    {
                        FileUrl = ExportEchartsReportQueryExistRowTitle(ReportTemplate, dataTable, ReportSource.Columns);
                    }
                }
                var result = new { FileUrl = FileUrl };
                return Json(result, JsonRequestBehavior.AllowGet);;
            }));
        }