Ejemplo n.º 1
0
        private void toolStripButtonReport_Click(object sender, EventArgs e)
        {
            try
            {
                Document           doc;
                CasePalletAnalysis analysis;
                CasePalletSolution casePalletSol;
                if (!GenerateProject(out doc, out analysis, out casePalletSol))
                {
                    return;
                }
                SelCasePalletSolution selSolution = new SelCasePalletSolution(doc, analysis, casePalletSol);

                // define report
                FormDefineReport formReport = new FormDefineReport();
                formReport.ProjectName = doc.Name;
                if (DialogResult.OK != formReport.ShowDialog())
                {
                    return;
                }

                Reporter.CompanyLogo      = string.Empty;
                Reporter.ImageSizeSetting = Reporter.eImageSize.IMAGESIZE_DEFAULT;
                Reporter reporter;

                ReportData reportData = new ReportData(analysis, selSolution);

                if (formReport.FileExtension == "doc")
                {
                    // create "MS Word" report file
                    reporter = new ReporterMSWord(
                        reportData
                        , Settings.Default.ReportTemplatePath
                        , formReport.FilePath
                        , new Margins());
                }
                else if (formReport.FileExtension == "html")
                {
                    // create "html" report file
                    reporter = new ReporterHtml(
                        reportData
                        , Settings.Default.ReportTemplatePath
                        , formReport.FilePath);
                }
                else
                {
                    return;
                }

                // open file
                if (formReport.OpenGeneratedFile)
                {
                    Process.Start(new ProcessStartInfo(formReport.FilePath));
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());
            }
        }
        private void ToolsGenerateReport(object sender, EventArgs e)
        {
            try
            {
                FormDefineReport formReport = new FormDefineReport();
                formReport.ProjectName = _analysis.Name;
                if (DialogResult.OK != formReport.ShowDialog())
                {
                    return;
                }
                // selected solution
                SelCasePalletSolution selSolution = new SelCasePalletSolution(null, _analysis, CurrentSolution);
                ReportData            reportData  = new ReportData(_analysis, selSolution);

                Reporter.CompanyLogo      = string.Empty;
                Reporter.ImageSizeSetting = Reporter.eImageSize.IMAGESIZE_DEFAULT;
                Reporter reporter;
                if (formReport.FileExtension == "doc")
                {
                    // create "MS Word" report file
                    reporter = new ReporterMSWord(
                        reportData
                        , Settings.Default.ReportTemplatePath
                        , formReport.FilePath
                        , new Margins());
                }
                else if (formReport.FileExtension == "html")
                {
                    // create "html" report file
                    reporter = new ReporterHtml(
                        reportData
                        , Settings.Default.ReportTemplatePath
                        , formReport.FilePath);
                }
                else
                {
                    return;
                }

                // open file
                if (formReport.OpenGeneratedFile)
                {
                    Process.Start(new ProcessStartInfo(formReport.FilePath));
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());
            }
        }
        private void ToolsGenerateReport(object sender, EventArgs e)
        {
            try
            {
                FormDefineReport formReport = new FormDefineReport();
                formReport.ProjectName = _analysis.Name;
                if (DialogResult.OK != formReport.ShowDialog())
                    return;
                // selected solution
                SelBoxCaseSolution selSolution = new SelBoxCaseSolution(_doc, _analysis, CurrentSolution);
                ReportData reportData = new ReportData(_analysis, selSolution);

                Reporter.CompanyLogo = string.Empty;
                Reporter.ImageSizeSetting = Reporter.eImageSize.IMAGESIZE_DEFAULT;
                Reporter reporter;
                if (formReport.FileExtension == "doc")
                {
                    // create "MS Word" report file
                    reporter = new ReporterMSWord(
                        reportData
                        , Settings.Default.ReportTemplatePath
                        , formReport.FilePath
                        , new Margins());
                }
                else if (formReport.FileExtension == "html")
                {
                    // create "html" report file
                    reporter = new ReporterHtml(
                        reportData
                        , Settings.Default.ReportTemplatePath
                        , formReport.FilePath);
                }
                else
                    return;

                // open file
                if (formReport.OpenGeneratedFile)
                    Process.Start(new ProcessStartInfo(formReport.FilePath));
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());
            }
        }
        private void toolStripButtonReport_Click(object sender, EventArgs e)
        {
            try
            {
                Document doc;
                CasePalletAnalysis analysis;
                CasePalletSolution casePalletSol;
                if (!GenerateProject(out doc, out analysis, out casePalletSol))
                    return;
                SelCasePalletSolution selSolution = new SelCasePalletSolution(doc, analysis, casePalletSol);

                // define report
                FormDefineReport formReport = new FormDefineReport();
                formReport.ProjectName = doc.Name;
                if (DialogResult.OK != formReport.ShowDialog())
                    return;

                Reporter.CompanyLogo = string.Empty;
                Reporter.ImageSizeSetting = Reporter.eImageSize.IMAGESIZE_DEFAULT;
                Reporter reporter;

                ReportData reportData = new ReportData(analysis, selSolution);

                if (formReport.FileExtension == "doc")
                {
                    // create "MS Word" report file
                    reporter = new ReporterMSWord(
                        reportData
                        , Settings.Default.ReportTemplatePath
                        , formReport.FilePath
                        , new Margins());
                }
                else if (formReport.FileExtension == "html")
                {
                    // create "html" report file
                    reporter = new ReporterHtml(
                        reportData
                        , Settings.Default.ReportTemplatePath
                        , formReport.FilePath);
                }
                else
                    return;

                // open file
                if (formReport.OpenGeneratedFile)
                    Process.Start(new ProcessStartInfo(formReport.FilePath));
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString()); 
            }
        }