private void buttonGenerateReport_Click(object sender, EventArgs e) { var window = new CreateReportForm { Owner = this }; DialogResult result = window.ShowDialog(); if (result != DialogResult.OK || window.SelectedReportType == null) { return; } var dataTable = SqlHelpers.GetDataTable(CBuilder.QueryTransformer.ResultAST.GetSQL(SqlGenerationOptions), SqlQuery); switch (window.SelectedReportType) { case ReportType.ActiveReports14: CreateActiveReport(dataTable); break; case ReportType.Stimulsoft: CreateStimulsoftReport(dataTable); break; case ReportType.FastReport: CreateFastReport(dataTable); break; default: throw new ArgumentOutOfRangeException(); } }
private void CheckParameters() { if (SqlHelpers.CheckParameters(_sqlContext.MetadataProvider, _sqlContext.SyntaxProvider, SqlQuery.QueryParameters)) { HideParametersErrorPanel(); } else { var acceptableFormats = SqlHelpers.GetAcceptableParametersFormats(_sqlContext.MetadataProvider, _sqlContext.SyntaxProvider); ShowParametersErrorPanel(acceptableFormats); } }
private void buttonExportExcel_Click(object sender, EventArgs e) { var dt = SqlHelpers.GetDataTable(CBuilder.QueryTransformer.ResultAST.GetSQL(SqlGenerationOptions), SqlQuery); var saveDialog = new SaveFileDialog { AddExtension = true, DefaultExt = "xlsx", FileName = "Export.xlsx" }; if (saveDialog.ShowDialog(this) != DialogResult.OK) { return; } ExportHelpers.ExportToExcel(dt, saveDialog.FileName); }
private void buttonExportCsv_Click(object sender, EventArgs e) { var saveDialog = new SaveFileDialog { AddExtension = true, DefaultExt = "csv", FileName = "Data.csv" }; var result = saveDialog.ShowDialog(this); if (result != DialogResult.OK) { return; } var dt = SqlHelpers.GetDataTable(CBuilder.QueryTransformer.ResultAST.GetSQL(SqlGenerationOptions), SqlQuery); ExportHelpers.ExportToCSV(dt, saveDialog.FileName); }