Get() public method

public Get ( ) : Report
return Frapid.Reports.Engine.Model.Report
コード例 #1
0
ファイル: ReportController.cs プロジェクト: frapid/frapid
        public ActionResult Index(string path)
        {
            string query = this.Request?.Url?.Query.Or("");
            string sourcePath = "/dashboard/reports/source/" + path + query;

            var locator = new ReportLocator();
            path = locator.GetPathToDisk(this.Tenant, path);

            var parameters = ParameterHelper.GetParameters(this.Request?.QueryString);
            var parser = new ReportParser(path, this.Tenant, parameters);
            var report = parser.Get();

            var dbParams = new List<DataSourceParameter>();

            foreach (var dataSource in report.DataSources)
            {
                foreach (var parameter in dataSource.Parameters)
                {
                    if (dbParams.Any(x => x.Name.ToLower() == parameter.Name.Replace("@", "").ToLower()))
                    {
                        continue;
                    }

                    if (parameter.HasMetaValue)
                    {
                        continue;
                    }

                    parameter.Name = parameter.Name.Replace("@", "");
                    var fromQueryString = report.Parameters.FirstOrDefault(x => x.Name.ToLower().Equals(parameter.Name.ToLower()));

                    if (fromQueryString != null)
                    {
                        parameter.DefaultValue = DataSourceParameterHelper.CastValue(fromQueryString.Value, parameter.Type);
                    }

                    if (string.IsNullOrWhiteSpace(parameter.FieldLabel))
                    {
                        parameter.FieldLabel = parameter.Name;
                    }

                    dbParams.Add(parameter);
                }
            }


            var model = new ParameterMeta
            {
                ReportSourcePath = sourcePath,
                Parameters = dbParams,
                ReportTitle = report.Title
            };

            return this.View("~/Areas/Frapid.Reports/Views/Index.cshtml", model);
        }
コード例 #2
0
ファイル: Generator.cs プロジェクト: frapid/frapid
        public Generator(string tenant, string path, List<Parameter> parameters)
        {
            this.Parameters = parameters;

            var locator = new ReportLocator();
            this.Path = locator.GetPathToDisk(tenant, path);

            var parser = new ReportParser(this.Path, tenant, parameters);
            this.Report = parser.Get();

            foreach (var dataSource in this.Report.DataSources)
            {
                dataSource.Data = this.GetDataSource(this.Report, dataSource);
            }
        }
コード例 #3
0
        public Generator(string tenant, string path, List <Parameter> parameters)
        {
            this.Parameters = parameters;

            var locator = new ReportLocator();

            this.Path = locator.GetPathToDisk(tenant, path);

            var parser = new ReportParser(this.Path, tenant, parameters);

            this.Report = parser.Get();

            foreach (var dataSource in this.Report.DataSources)
            {
                dataSource.Data = this.GetDataSource(this.Report, dataSource);
            }
        }