Ejemplo n.º 1
0
        private void save(string path, bool Compile = false)
        {
            //report.loadFields ( this.tbxFields.Text );
            //report.loadTables ( this.tbxTables.Text );
            report = AReport.LoadTemplate(this.textEditor.Text);
            report.saveTemplate(path);

            if (Compile)
            {
                if (report.Script != null)
                {
                    if (report.Script is CSharpScripting)
                    {
                        CompilerResults cr;
                        CSharpScripting.CompileCode(report.Script.Code, path + "\\" + report.Name + "\\" + report.Name + ".dll", out cr);

                        if (cr.Errors.Count > 0)
                        {
                            foreach (CompilerError err in cr.Errors)
                            {
                                MessageBox.Show(err.ErrorText);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void addTemplatesToDB(AReport report)
        {
            string instructions;

            byte[] template;

            report.saveTemplate(out instructions, out template);

            Template dbTemplate = new Template();

            dbTemplate.Description  = "";
            dbTemplate.TemplateName = report.Name;
            dbTemplate.InsertedDate = DateTime.Now;
            dbTemplate.TemplateFile = template;
            dbTemplate.Instructions = instructions;

            if (!FileIO.FConnFile.GetFileDetails( ).IO.Add <Template> (dbTemplate))
            {
                throw new Exception("Failed to create a new template");
            }
            else
            {
                loadTemplatesFromDatabase( );
            }
        }
Ejemplo n.º 3
0
        private void cbxReportType_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (this.cbxReportType.SelectedItem == null)
            {
                return;
            }

            AReport newReport;

            switch ((ReportType)this.cbxReportType.SelectedItem)
            {
            case ReportType.PDF:
                newReport = new PDFReport();
                break;

            case ReportType.EXCEL:
                newReport = new PDFReport();
                break;

            case ReportType.CSV:
                newReport = new PDFReport();
                break;

            case ReportType.XML:
                newReport = new PDFReport();
                break;

            default:
                throw new ApplicationException("Failed to select a report type");
            }

            newReport.Name = report.Name;

            foreach (Field f in report.fields)
            {
                newReport.fields.Add(f);
            }

            foreach (Table t in report.tables)
            {
                newReport.tables.Add(t);
            }

            //newReport.ExportPath = report.ExportPath;

            //newReport.TemplatePath = report.TemplatePath;

            newReport.Script = report.Script;

            newReport.SampleDataSet = report.SampleDataSet;

            newReport.SetTemplate(report.GetTemplate( ));

            report = newReport;
        }
Ejemplo n.º 4
0
 private void textEditor_LostFocus(object sender, RoutedEventArgs e)
 {
     try
     {
         byte[] temp = report.GetTemplate();
         report = AReport.LoadTemplate(this.textEditor.Text);
         report.SetTemplate(temp);
         loadReport( );
     }
     catch (Exception ex)
     {
         MessageBox.Show(string.Format("Failed to generate report. \n {0}", ex.Message));
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// (Re-)loads templates from the database
        /// </summary>
        public void loadTemplatesFromDatabase( )
        {
            _templates.Clear( );

            foreach (Template t in FileIO.FConnFile.GetFileDetails().IO.GetAll <Template>())
            {
                AReport report = AReport.LoadTemplate(t.Instructions, t.TemplateFile);

                if (report != null)
                {
                    _templates.Add(report);
                }
            }
        }
Ejemplo n.º 6
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            this.cbxReportType.Items.Clear( );
            foreach (ReportType type in Enum.GetValues(typeof(ReportType)))
            {
                this.cbxReportType.Items.Add(type);
            }

            if (report == null)
            {
                State = ReportEditorStates.NewlyCreated;

                report = new PDFReport( );
            }
            setState( );

            loadReport( );
        }
Ejemplo n.º 7
0
        private void editTemplate()
        {
            ReportEditor re = new ReportEditor();

            re.LoadReportFromApplication(AReport.LoadTemplate(this.Template.Instructions, this.Template.TemplateFile));
            re.ShowDialog( );

            //this.Template.Instructions = re.report.rawXML;
            //ReportLibrary.addTemplatesToDB ( re.report );

            if (re.DialogResult == true)
            {
                this.Template.Instructions = re.report.rawXML;
                this.Template.TemplateFile = re.report.GetTemplate();
                Name = re.report.Name;
            }

            saveTemplate( );
        }
Ejemplo n.º 8
0
 public ReportEditor(AReport report) : this()
 {
     this.report = report;
 }
Ejemplo n.º 9
0
 public void LoadReportFromApplication(AReport Report)
 {
     _report = Report;
     State   = ReportEditorStates.OpenedFromApplication;
 }