public DashboardReports.CostPerUserServedchartRpt GetRpt() { report = new DashboardReports.CostPerUserServedchartRpt(); DataTable dt = new DataTable(); string typeval = ""; typeval = "Domino"; dt = VSWebBL.ReportsBL.ReportsBL.Ins.GetResponseTimes(typeval); if (dt.Rows.Count > 0) { report.BuildChart(0, dt.Rows.Count, dt, (XRChart)report.FindControl("xrChart1", true)); } return(report); }
protected void EmailRptButton_Click(object sender, EventArgs e) { try { DashboardReports.CostPerUserServedchartRpt report = new DashboardReports.CostPerUserServedchartRpt(); report = (DashboardReports.CostPerUserServedchartRpt)ASPxDocumentViewer1.Report; MemoryStream mem = new MemoryStream(); report.ExportToPdf(mem); mem.Seek(0, System.IO.SeekOrigin.Begin); Attachment att = new Attachment(mem, "TestReport.pdf", "application/pdf"); MailMessage mail = new MailMessage(); mail.Attachments.Add(att); mail.From = new MailAddress("*****@*****.**", "VitalSigns"); report.ExportOptions.Email.RecipientAddress = "*****@*****.**"; report.ExportOptions.Email.RecipientName = "Natallya Shkarayeva"; report.ExportOptions.Email.Subject = "Response Time report (VS)"; mail.To.Add(new MailAddress(report.ExportOptions.Email.RecipientAddress, report.ExportOptions.Email.RecipientName)); mail.Subject = report.ExportOptions.Email.Subject; mail.Body = "This is a test scheduled report from VS."; string myEmailAddress = ConfigurationSettings.AppSettings["AdminMailID"]; string mypwd = ConfigurationSettings.AppSettings["Password"]; myEmailAddress = "*****@*****.**"; mypwd = "vitalsigns2012"; SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587) { Credentials = new System.Net.NetworkCredential(myEmailAddress, mypwd), EnableSsl = true }; smtp.Send(mail); mem.Close(); } catch (Exception ex) { throw ex; } }
public void FillReport() { DashboardReports.CostPerUserServedchartRpt rpt = new DashboardReports.CostPerUserServedchartRpt(); string selectedServer = ""; if (this.TypeComboBox.SelectedIndex >= 0) { selectedServer = this.TypeComboBox.SelectedItem.Value.ToString(); } rpt.Parameters["ServerType"].Value = selectedServer; rpt.Parameters["ServerName"].Value = SearchTextBox.Text; rpt.Parameters["UserType"].Value = UserTypeComboBox.Text; rpt.CreateDocument(); ASPxDocumentViewer1.Report = rpt; ASPxDocumentViewer1.DataBind(); }