Exemple #1
0
        public void ViewReport()
        {
            XtraReportBASELINE_ITEMS baselineReport  = new XtraReportBASELINE_ITEMS();
            PROJECT_REPORT           dbProjectReport = loaderCollection.GetObject <PROJECT_REPORT>();

            if (dbProjectReport != null)
            {
                string reportString = dbProjectReport.REPORT.ToString();
                using (StreamWriter sw = new StreamWriter(new MemoryStream()))
                {
                    sw.Write(reportString);
                    sw.Flush();
                    baselineReport.LoadLayout(sw.BaseStream);
                }
            }

            //make sure disciplines are all populated
            PopulateNavigationalProperties();
            baselineReport.AssignProperties(loadPROJECT, loadBASELINE, MainViewModel.Entities);
            DocumentPreviewWindow previewWindow = new DocumentPreviewWindow();

            previewWindow.PreviewControl.DocumentSource = baselineReport;
            previewWindow.WindowStartupLocation         = WindowStartupLocation.CenterScreen;
            previewWindow.WindowState        = WindowState.Maximized;
            baselineReport.RequestParameters = false;
            baselineReport.CreateDocument(true);
            previewWindow.ShowDialog();
        }
        private void SaveReport()
        {
            if (currentREPORT == null)
            {
                return;
            }

            // Save the report to a stream.
            MemoryStream ms = new MemoryStream();

            currentREPORT.SaveLayout(ms);

            // Prepare the stream for reading.
            ms.Position = 0;
            // Insert the report to a database.
            using (StreamReader sr = new StreamReader(ms))
            {
                // Read the report from the stream to a string variable.
                string reportString = sr.ReadToEnd();
                if (currentPROJECT_REPORT == null)
                {
                    currentPROJECT_REPORT = new PROJECT_REPORT();
                    currentPROJECT_REPORT.GUID_PROJECT = currentPROJECT.GUID;
                    currentPROJECT_REPORT.REPORT_TYPE  = currentReportType.ToString();
                    currentPROJECT_REPORT.REPORT       = reportString;
                }
                else
                {
                    currentPROJECT_REPORT.REPORT = reportString;
                }

                collectionViewModel.Save(currentPROJECT_REPORT);
            }
        }
Exemple #3
0
        public void ViewReport()
        {
            XtraReportPROGRESS_ITEMS progressReport  = new XtraReportPROGRESS_ITEMS();
            PROJECT_REPORT           dbProjectReport = loaderCollection.GetObject <PROJECT_REPORT>();

            if (dbProjectReport != null)
            {
                string reportString = dbProjectReport.REPORT.ToString();
                using (StreamWriter sw = new StreamWriter(new MemoryStream()))
                {
                    sw.Write(reportString);
                    sw.Flush();
                    progressReport.LoadLayout(sw.BaseStream);
                }
            }

            PROJECTSummaryBuilder projectSummaryBuilder = new PROJECTSummaryBuilder(currentPROJECTSummary);

            CalculateStatsForReport(projectSummaryBuilder);
            progressReport.AssignProperties(currentPROJECTSummary, loadPROGRESS.PROJECT.NAME);
            DocumentPreviewWindow previewWindow = new DocumentPreviewWindow();

            previewWindow.PreviewControl.DocumentSource = progressReport;
            previewWindow.WindowStartupLocation         = WindowStartupLocation.CenterScreen;
            previewWindow.WindowState        = WindowState.Maximized;
            progressReport.RequestParameters = false;
            progressReport.CreateDocument(true);
            previewWindow.ShowDialog();
        }
        private void REPORTDesigner_Load(object sender, EventArgs e)
        {
            if (collectionViewModel.Entities.Count > 0)
            {
                currentPROJECT_REPORT = collectionViewModel.Entities.First();
                if (currentPROJECT_REPORT != null)
                {
                    using (StreamWriter sw = new StreamWriter(new MemoryStream()))
                    {
                        sw.Write(currentPROJECT_REPORT.REPORT);
                        sw.Flush();
                        currentREPORT = XtraReport.FromStream(sw.BaseStream, true);

                        reportDesigner1.OpenReport(currentREPORT);
                        return;
                    }
                }
            }

            if (currentReportType == ReportType.Progress_Report)
            {
                currentREPORT = new XtraReportPROGRESS_ITEMS();
                reportDesigner1.OpenReport(currentREPORT);
            }
            else if (currentReportType == ReportType.Baseline_Report)
            {
                currentREPORT = new XtraReportBASELINE_ITEMS();
                reportDesigner1.OpenReport(currentREPORT);
            }
        }