private bool AutoExecuteReport(VisualizerControlBase ctlVisualizer, ReportInfo report, ref DataTable results, bool fromCache) { try { results = ReportsController.ExecuteReport( report, string.Concat(ReportsController.CACHEKEY_Reports, Convert.ToString(this.ModuleId)), report.CacheDuration <= 0, this, ref fromCache); } catch (DataSourceException ex) { // Display the error message to host users only if (this.UserInfo.IsSuperUser) { Skin.AddModuleMessage(this, string.Format(Localization.GetString("HostExecuteError.Message", this.LocalResourceFile), ex.LocalizedMessage), ModuleMessage.ModuleMessageType.RedError); } else if (this.IsEditable) { Skin.AddModuleMessage(this, Localization.GetString("AdminExecuteError.Message", this.LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); } Services.Exceptions.Exceptions.LogException(ex); ctlVisualizer.Visible = false; return(false); } return(true); }
protected void btnTestQuery_Click(object sender, EventArgs e) { this.rowXmlSource.Visible = false; this.rowResults.Visible = false; try { // Update data source settings this.UpdateDataSourceSettings(); // Execute the DataSource var results = ReportsController.ExecuteReport(this.Report, null, true, this); // Format a success message this.lblQueryResults.Text = string.Format(Localization.GetString("TestDSSuccess.Message", this.LocalResourceFile), results.Rows.Count); this.lblQueryResults.CssClass = "NormalBold"; this.imgQueryResults.ImageUrl = "~/images/green-ok.gif"; } catch (DataSourceException ex) { // Format an error message this.lblQueryResults.Text = string.Format(Localization.GetString("TestDSFail.Message", this.LocalResourceFile), ex.LocalizedMessage); this.lblQueryResults.CssClass = "NormalRed"; this.imgQueryResults.ImageUrl = "~/images/red-error.gif"; } // Display the results/error message this.rowResults.Visible = true; }
protected void btnShowXml_Click(object sender, EventArgs e) { this.rowXmlSource.Visible = false; this.rowResults.Visible = false; try { // Update data source settings this.UpdateDataSourceSettings(); // Execute the DataSource var results = ReportsController.ExecuteReport(this.Report, null, true, this); // Serialize the results to Xml var writer = new StringWriter(); results.WriteXml(writer); this.txtXmlSource.Text = writer.ToString(); this.rowXmlSource.Visible = true; } catch (DataSourceException ex) { // Format an error message this.lblQueryResults.Text = string.Format(Localization.GetString("TestDSFail.Message", this.LocalResourceFile), ex.LocalizedMessage); this.lblQueryResults.CssClass = "NormalRed"; this.imgQueryResults.ImageUrl = "~/images/red-error.gif"; this.rowResults.Visible = true; this.rowXmlSource.Visible = false; } }
protected void ExportExcelButton_Click(object sender, EventArgs e) { DataTable results = null; results = ReportsController.ExecuteReport(Report, String.Concat(ReportsConstants.CACHEKEY_Reports, ModuleId), true, this); Session["report_export"] = results; Response.Redirect("~/desktopmodules/reports/excel.aspx"); }