Пример #1
0
        public CftReport GetCftReport(int reportId = 0, int clientId = 0, bool withData = true)
        {
            var cftReport = new CftReport();

            if (reportId > 0)
            {
                var reportTemplate = _reportFactory.GetReportTemplate(reportId);
                if (withData)
                {
                    string source;
                    var    reportDataTable = _reportFactory.ExecuteReportQuery(reportTemplate, out source, clientId);



                    cftReport = GetGoogleReport(reportTemplate, reportDataTable);


                    cftReport.Filters = (from reportField in reportTemplate.ReportFields where reportField.Filter != null && (bool)reportField.Filter select new Filter()
                    {
                        FieldId = reportField.FieldId.Value, Name = reportField.DisplayName
                    }).ToArray();


                    switch (source)
                    {
                    case "Acturis":
                        cftReport.ClientList = _acturisFactory.GetClientList().ToArray();
                        break;

                    default:
                    case "CFT":

                        cftReport.ClientList = _reportFactory.GetClientList().ToArray();
                        break;
                    }
                }

                Array.Resize(ref cftReport.Colours, 5);
                cftReport.Name      = reportTemplate.Name;
                cftReport.ReportId  = reportTemplate.ReportID;
                cftReport.ChartType = reportTemplate.ReportType;



                cftReport.Colours[0]  = reportTemplate.Colour1 ?? "#ffffff";
                cftReport.Colours[1]  = reportTemplate.Colour2 ?? "#ffffff";
                cftReport.Colours[2]  = reportTemplate.Colour3 ?? "#ffffff";
                cftReport.Colours[3]  = reportTemplate.Colour4 ?? "#ffffff";
                cftReport.Colours[4]  = reportTemplate.Colour5 ?? "#ffffff";
                cftReport.HAxis       = reportTemplate.HAxis ?? "";
                cftReport.HAxisColour = reportTemplate.HAxisColour ?? "";

                cftReport.VAxis       = reportTemplate.VAxis ?? "";
                cftReport.VAxisColour = reportTemplate.VAxisColour ?? "";

                cftReport.ZAxis       = reportTemplate.ZAxis ?? "";
                cftReport.ZAxisColour = reportTemplate.ZAxisColour ?? "";
                cftReport.Description = reportTemplate.Description;
            }

            return(cftReport);
        }