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); } } } } } }
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( ); } }
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; }
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)); } }
/// <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); } } }
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( ); }
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( ); }
public ReportEditor(AReport report) : this() { this.report = report; }
public void LoadReportFromApplication(AReport Report) { _report = Report; State = ReportEditorStates.OpenedFromApplication; }