public DashboardReports.DominoDiskAvgXtraRpt GetRpt() { string srvName = ""; bool isSummary = false; bool exactmatch = false; string srvType = ""; try { report = new DashboardReports.DominoDiskAvgXtraRpt(); report.Parameters["ServerName"].Value = srvName; report.Parameters["ServerNameSQL"].Value = srvName; report.Parameters["DaysRem"].Value = -1; report.Parameters["ExactMatch"].Value = exactmatch; report.Parameters["IsSummary"].Value = isSummary; report.Parameters["ServerType"].Value = srvType; report.Parameters["ServerTypeSQL"].Value = srvType; report.SetReport(report); //XRChart CurrentDiskSpaceChart = new XRChart(); //CurrentDiskSpaceChart = (XRChart)report.FindControl("CurrentDiskSpaceChart",true); //report.SetGraphForDiskSpace(srvName,report,CurrentDiskSpaceChart); } catch (Exception ex) { WriteServiceHistoryEntry(DateTime.Now.ToString() + " The following error has occurred in GetRpt: " + ex.Message); } return(report); }
protected void ResetButton_Click(object sender, EventArgs e) { //this.ServerListFilterComboBox.SelectedIndex = -1; this.ServerFilterTextBox.Text = ""; this.NumberDaysTextBox.Text = ""; this.ServerListFilterListBox.UnselectAll(); //2/2/2015 NS added for VSPLUS-1370 this.ServerTypeFilterListBox.UnselectAll(); fillcombo(""); DashboardReports.DominoDiskAvgXtraRpt report = new DashboardReports.DominoDiskAvgXtraRpt(); report.Parameters["ServerName"].Value = ""; report.Parameters["ServerNameSQL"].Value = ""; report.Parameters["DaysRem"].Value = ""; report.Parameters["ServerType"].Value = ""; report.Parameters["ServerTypeSQL"].Value = ""; report.CreateDocument(); ASPxDocumentViewer1.Report = report; ASPxDocumentViewer1.DataBind(); }
public void SendReport(int ReportID, string Subject, string Body, string SendTo, string CopyTo, string BlindCopyTo, string FileFormat) { DevExpress.XtraReports.UI.XtraReport report = null; string myEmailAddress = ""; string mypwd = ""; string[] mailparams = new string[5]; Settings[] settingsObject = new Settings[5]; Settings[] rtsettingsObject = new Settings[5]; //try //{ switch (ReportID) { case ResponseTimes: report = new DashboardReports.ResponseTimeXtraRpt(); report = (DashboardReports.ResponseTimeXtraRpt)VSWebUI.DashboardReports.ResponseTimeRpt.Ins.GetRpt(); break; case DailyMailVolume: report = new DashboardReports.DailyMailVolumeXtraRpt(); report = (DashboardReports.DailyMailVolumeXtraRpt)VSWebUI.DashboardReports.DailyMailVolumeRpt.Ins.GetRpt(); break; case DominoDiskTrend: report = new DashboardReports.DominoDiskAvgXtraRpt(); report = (DashboardReports.DominoDiskAvgXtraRpt)VSWebUI.DashboardReports.DominoDiskTrendRpt.Ins.GetRpt(); break; } if (report != null) { // Create a new memory stream and export the report into it as PDF. MemoryStream mem = new MemoryStream(); //WriteServiceHistoryEntry(DateTime.Now.ToString() + " report size: " + report.PageSize); //try //{ switch (FileFormat.ToLower()) { case "pdf": report.ExportToPdf(mem); break; case "xls": report.ExportToXls(mem); break; case "xlsx": report.ExportToXlsx(mem); break; case "csv": report.ExportToText(mem); break; } //} //catch (Exception ex) //{ // WriteServiceHistoryEntry(DateTime.Now.ToString() + " report not exported: " + ex.Message); //} // Create a new attachment and put the PDF report into it. mem.Seek(0, System.IO.SeekOrigin.Begin); Attachment att = new Attachment(mem, "VSReport." + FileFormat.ToLower(), "application/" + FileFormat.ToLower()); // Create a new message and attach the PDF report to it. MailMessage mail = new MailMessage(); mail.Attachments.Add(att); // Specify sender and recipient options for the e-mail message. for (int i = 0; i < 5; ++i) { settingsObject[i] = new Settings(); } for (int i = 0; i < 5; ++i) { rtsettingsObject[i] = new Settings(); } settingsObject[0].sname = "PrimaryHostName"; settingsObject[1].sname = "primaryUserID"; settingsObject[2].sname = "primarypwd"; settingsObject[3].sname = "primaryport"; settingsObject[4].sname = "primarySSL"; mailparams[0] = "smtp.gmail.com"; mailparams[1] = ConfigurationSettings.AppSettings["AdminMailID"]; //"*****@*****.**"; mailparams[2] = ConfigurationSettings.AppSettings["Password"]; //"vitalsigns2012"; mailparams[3] = "587"; mailparams[4] = "true"; for (int i = 0; i < 5; i++) { try { rtsettingsObject[i] = VSWebBL.SettingBL.SettingsBL.Ins.GetData(settingsObject[i]); if (rtsettingsObject[i].svalue == "" || rtsettingsObject[i].svalue == null) { //do nothing //WriteServiceHistoryEntry(DateTime.Now.ToString() + " " + settingsObject[i].sname + " is empty"); } else { mailparams[i] = rtsettingsObject[i].svalue; //WriteServiceHistoryEntry(DateTime.Now.ToString() + " " + settingsObject[i].sname + " " + mailparams[i]); } } catch (Exception) { throw; } } mail.From = new MailAddress(mailparams[1], "VitalSigns"); report.ExportOptions.Email.RecipientAddress = SendTo; //report.ExportOptions.Email.RecipientName = SendTo; report.ExportOptions.Email.Subject = Subject; mail.To.Add(new MailAddress(report.ExportOptions.Email.RecipientAddress)); if (CopyTo != "") { mail.CC.Add(new MailAddress(CopyTo)); } if (BlindCopyTo != "") { mail.Bcc.Add(new MailAddress(BlindCopyTo)); } // Specify other e-mail options. mail.Subject = report.ExportOptions.Email.Subject; mail.Body = Body; // Send the e-mail message via the specified SMTP server. myEmailAddress = mailparams[1]; //"*****@*****.**"; mypwd = mailparams[2]; //"vitalsigns2012"; SmtpClient smtp = new SmtpClient(mailparams[0], Convert.ToInt32(mailparams[3])) { Credentials = new System.Net.NetworkCredential(myEmailAddress, mypwd), EnableSsl = true }; smtp.Send(mail); // Close the memory stream. mem.Close(); } //} //catch (Exception ex) //{ // WriteServiceHistoryEntry(DateTime.Now.ToString() + " The following error has occurred in SendReport: " + ex.Message); //} }
public void SetGraphForDiskSpace(string serverName, DashboardReports.DominoDiskAvgXtraRpt report, XRChart CurrentDiskSpaceChart, string serverType) { bool isSummary; //XRChart CurrentDiskSpaceChart = (XRChart)report.FindControl("CurrentDiskSpaceChart", true); CurrentDiskSpaceChart.Series.Clear(); //DataTable dt = VSWebBL.ReportsBL.ReportsBL.Ins.DominoDiskSpaceBL(serverName); dt = (DataTable)report.DataSource; CurrentDiskSpaceChart.DataSource = dt; isSummary = (bool)report.Parameters["IsSummary"].Value; double[] double1 = new double[dt.Rows.Count]; double[] double2 = new double[dt.Rows.Count]; string diskName = ""; string srvName = ""; Series series = null; if (!isSummary) { for (int i = 0; i < dt.Rows.Count; i++) { diskName = dt.Rows[i]["DiskName"].ToString(); srvName = dt.Rows[i]["ServerName"].ToString(); //if (diskName == xrTableCell1.Text && srvName == xrLabel18.Text) if (diskName == ((XRTableCell)report.FindControl("xrTableCell1", true)).Text && srvName == ((XRLabel)report.FindControl("xrLabel18", true)).Text) { if (series != null) { CurrentDiskSpaceChart.Series.Add(series); } series = new Series(dt.Rows[i]["DiskName"].ToString(), ViewType.Pie); string val1 = dt.Rows[i]["PercentFree"].ToString(); string val2 = dt.Rows[i]["PercentUsed"].ToString(); if (val1 != "" && val2 != "") { double1[i] = Convert.ToDouble(dt.Rows[i]["PercentFree"].ToString()); double2[i] = Convert.ToDouble(dt.Rows[i]["PercentUsed"].ToString()); series.Points.Add(new SeriesPoint("Percent Free", double1[i])); series.Points.Add(new SeriesPoint("Percent Used", double2[i])); series.ShowInLegend = true; series.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; PieSeriesLabel seriesLabel = (PieSeriesLabel)series.Label; seriesLabel.Position = PieSeriesLabelPosition.Radial; seriesLabel.BackColor = System.Drawing.Color.Transparent; seriesLabel.TextColor = System.Drawing.Color.Black; } } } } else { for (int i = 0; i < dt.Rows.Count; i++) { srvName = report.Parameters["ServerName"].Value.ToString(); if (series != null) { CurrentDiskSpaceChart.Series.Add(series); } series = new Series("All Disks", ViewType.Pie); string val1 = dt.Rows[i]["PercentFree"].ToString(); string val2 = dt.Rows[i]["PercentUsed"].ToString(); if (val1 != "" && val2 != "") { double1[i] = Convert.ToDouble(dt.Rows[i]["PercentFree"].ToString()); double2[i] = Convert.ToDouble(dt.Rows[i]["PercentUsed"].ToString()); series.Points.Add(new SeriesPoint("Percent Free", double1[i])); series.Points.Add(new SeriesPoint("Percent Used", double2[i])); series.ShowInLegend = true; series.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; PieSeriesLabel seriesLabel = (PieSeriesLabel)series.Label; seriesLabel.Position = PieSeriesLabelPosition.Radial; seriesLabel.BackColor = System.Drawing.Color.Transparent; seriesLabel.TextColor = System.Drawing.Color.Black; } } } if (series != null) { CurrentDiskSpaceChart.Series.Add(series); } for (int c = 0; c < CurrentDiskSpaceChart.Series.Count; c++) { if (c == 0) { PiePointOptions seriesPointOptions = (PiePointOptions)series.LegendPointOptions; series.LegendPointOptions.PointView = PointView.Argument; CurrentDiskSpaceChart.Series[0].LegendPointOptions.PointView = PointView.Argument; CurrentDiskSpaceChart.Series[0].ShowInLegend = true; CurrentDiskSpaceChart.Legend.Visible = true; } else { CurrentDiskSpaceChart.Series[c].ShowInLegend = false; } } }
public void SetReport(DashboardReports.DominoDiskAvgXtraRpt report) { double[] daysrem; double dcon = 0; string diskName = ""; string serverName = ""; string srvName = ""; string sName = ""; bool exactmatch; bool isSummary; string serverType = ""; string serverTypeSQL = ""; try { // this.ServerName.Value = "'azphxdom1/RPRWyatt','azphxdom2/RPRWyatt'"; serverName = report.Parameters["ServerNameSQL"].Value.ToString(); srvName = report.Parameters["ServerName"].Value.ToString(); sName = srvName; exactmatch = (bool)report.Parameters["ExactMatch"].Value; if (srvName == "" || exactmatch) { sName = serverName; } isSummary = (bool)report.Parameters["IsSummary"].Value; serverType = report.Parameters["ServerType"].Value.ToString(); serverTypeSQL = report.Parameters["ServerTypeSQL"].Value.ToString(); dt = VSWebBL.ReportsBL.ReportsBL.Ins.DominoDiskSpaceBL(sName, exactmatch, isSummary, serverTypeSQL); dt.Columns.Add("DiskConsumption", typeof(double)); dt.Columns.Add("DaysRemain", typeof(string)); dt.Columns.Add("ImgURL", typeof(string)); dt.Columns.Add("FontColor", typeof(System.Drawing.Color)); daysrem = new double[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { if (!isSummary) { diskName = dt.Rows[i]["DiskName"].ToString(); srvName = dt.Rows[i]["ServerName"].ToString(); } else { diskName = ""; srvName = report.Parameters["ServerName"].Value.ToString(); } dcon = VSWebBL.ReportsBL.ReportsBL.Ins.GetDominoDiskConsumption(serverType, srvName, diskName, exactmatch, isSummary); if (dcon <= 0) { daysrem[i] = -1; dt.Rows[i]["DaysRemain"] = "INF"; dt.Rows[i]["ImgURL"] = "~/images/up_g.gif"; dt.Rows[i]["FontColor"] = System.Drawing.Color.Green; } else { daysrem[i] = Math.Round(Convert.ToDouble(dt.Rows[i]["DiskFree"].ToString()) * 1024 / dcon, 0); dt.Rows[i]["DaysRemain"] = Math.Round(Convert.ToDouble(dt.Rows[i]["DiskFree"].ToString()) * 1024 / dcon, 0).ToString(); dt.Rows[i]["ImgURL"] = "~/images/down_r.gif"; dt.Rows[i]["FontColor"] = System.Drawing.Color.Red; } dt.Rows[i]["DiskConsumption"] = Math.Abs(dcon); } //WriteServiceHistoryEntry(DateTime.Now.ToString() + " here #1"); if (report.Parameters["DaysRem"].Value.ToString() != "") { if (Convert.ToInt32(report.Parameters["DaysRem"].Value.ToString()) > -1) { DataRow row; for (int i = dt.Rows.Count - 1; i >= 0; i--) { if (daysrem[i] > Convert.ToInt32(report.Parameters["DaysRem"].Value.ToString()) || daysrem[i] == -1) { row = dt.Rows[i]; row.Delete(); } } } } dt.AcceptChanges(); report.DataSource = dt; if (!isSummary) { ((XRTableCell)report.FindControl("xrTableCell1", true)).DataBindings.Add("Text", dt, "DiskName"); ((XRLabel)report.FindControl("xrLabel2", true)).DataBindings.Add("Text", dt, "DiskName"); ((XRLabel)report.FindControl("xrLabel18", true)).DataBindings.Add("Text", dt, "ServerName"); //WriteServiceHistoryEntry(DateTime.Now.ToString() + " here #2"); } else { ((XRLabel)report.FindControl("xrLabel22", true)).Text += " Summary"; if (exactmatch) { ((XRLabel)report.FindControl("xrLabel18", true)).Text = srvName; } else { ((XRLabel)report.FindControl("xrLabel18", true)).Text = "Server name contains '" + srvName + "'"; } if (srvName == "" && (serverType == "" || serverType == "''" || serverType == "'All'")) { ((XRLabel)report.FindControl("xrLabel18", true)).Text = "All Servers"; } else if (srvName == "" && !(serverType == "" || serverType == "''" || serverType == "'All'")) { ((XRLabel)report.FindControl("xrLabel18", true)).Text = "All " + serverType + " Servers"; } ((XRLabel)report.FindControl("xrLabel3", true)).Text = "Overall"; ((XRLabel)report.FindControl("xrLabel2", true)).Text = " Summary"; ((XRLabel)report.FindControl("xrLabel4", true)).Visible = false; } ((XRLabel)report.FindControl("xrLabel6", true)).DataBindings.Add("Text", dt, "DiskFree"); ((XRLabel)report.FindControl("xrLabel8", true)).DataBindings.Add("Text", dt, "DiskSize"); ((XRLabel)report.FindControl("xrLabel14", true)).DataBindings.Add("Text", dt, "PercentFree"); ((XRLabel)report.FindControl("xrLabel11", true)).DataBindings.Add("Text", dt, "DiskConsumption"); ((XRLabel)report.FindControl("xrLabel11", true)).DataBindings.Add("ForeColor", dt, "FontColor"); ((XRLabel)report.FindControl("xrLabel15", true)).DataBindings.Add("ForeColor", dt, "FontColor"); ((XRPictureBox)report.FindControl("AvgIndicatorPic", true)).DataBindings.Add("ImageUrl", dt, "ImgURL"); ((XRLabel)report.FindControl("xrLabel16", true)).DataBindings.Add("Text", dt, "DaysRemain"); //WriteServiceHistoryEntry(DateTime.Now.ToString() + " here #3"); } catch (Exception ex) { WriteServiceHistoryEntry(DateTime.Now.ToString() + " The following error has occurred in SetReport: " + ex.Message); } }
public void SetGraphForDiskSpace(DashboardReports.DominoDiskAvgXtraRpt report, DataTable dt, bool isSummary, XRChart CurrentDiskSpaceChart) { //2/24/2014 NS added try { CurrentDiskSpaceChart.Series.Clear(); CurrentDiskSpaceChart.DataSource = dt; double[] double1 = new double[dt.Rows.Count]; double[] double2 = new double[dt.Rows.Count]; string diskName = ""; string srvName = ""; Series series = null; if (!isSummary) { for (int i = 0; i < dt.Rows.Count; i++) { diskName = dt.Rows[i]["DiskName"].ToString(); srvName = dt.Rows[i]["ServerName"].ToString(); //if (diskName == report.FindControl("xrTableCell1", true).Text && srvName == report.FindControl("xrLabel18", true).Text) //{ if (series != null) { CurrentDiskSpaceChart.Series.Add(series); } series = new Series(dt.Rows[i]["DiskName"].ToString(), ViewType.Pie); string val1 = dt.Rows[i]["PercentFree"].ToString(); string val2 = dt.Rows[i]["PercentUsed"].ToString(); if (val1 != "" && val2 != "") { double1[i] = Convert.ToDouble(dt.Rows[i]["PercentFree"].ToString()); double2[i] = Convert.ToDouble(dt.Rows[i]["PercentUsed"].ToString()); series.Points.Add(new SeriesPoint("Percent Free", double1[i])); series.Points.Add(new SeriesPoint("Percent Used", double2[i])); series.ShowInLegend = true; series.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; PieSeriesLabel seriesLabel = (PieSeriesLabel)series.Label; seriesLabel.Position = PieSeriesLabelPosition.Radial; seriesLabel.BackColor = System.Drawing.Color.Transparent; seriesLabel.TextColor = System.Drawing.Color.Black; //PieSeriesView seriesView = (PieSeriesView)series.View; //seriesView.Titles.Add(new SeriesTitle()); //seriesView.Titles[0].Dock = ChartTitleDockStyle.Bottom; //seriesView.Titles[0].Text = series.Name.ToString(); //seriesView.Titles[0].Visible = true; //seriesView.Titles[0].WordWrap = true; } //} } } else { for (int i = 0; i < dt.Rows.Count; i++) { srvName = report.Parameters["ServerName"].Value.ToString(); if (series != null) { CurrentDiskSpaceChart.Series.Add(series); } series = new Series("All Disks", ViewType.Pie); string val1 = dt.Rows[i]["PercentFree"].ToString(); string val2 = dt.Rows[i]["PercentUsed"].ToString(); if (val1 != "" && val2 != "") { double1[i] = Convert.ToDouble(dt.Rows[i]["PercentFree"].ToString()); double2[i] = Convert.ToDouble(dt.Rows[i]["PercentUsed"].ToString()); series.Points.Add(new SeriesPoint("Percent Free", double1[i])); series.Points.Add(new SeriesPoint("Percent Used", double2[i])); series.ShowInLegend = true; series.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; PieSeriesLabel seriesLabel = (PieSeriesLabel)series.Label; seriesLabel.Position = PieSeriesLabelPosition.Radial; seriesLabel.BackColor = System.Drawing.Color.Transparent; seriesLabel.TextColor = System.Drawing.Color.Black; } } } if (series != null) { CurrentDiskSpaceChart.Series.Add(series); } for (int c = 0; c < CurrentDiskSpaceChart.Series.Count; c++) { if (c == 0) { PiePointOptions seriesPointOptions = (PiePointOptions)series.LegendPointOptions; series.LegendPointOptions.PointView = PointView.Argument; CurrentDiskSpaceChart.Series[0].LegendPointOptions.PointView = PointView.Argument; CurrentDiskSpaceChart.Series[0].ShowInLegend = true; CurrentDiskSpaceChart.Legend.Visible = true; } else { CurrentDiskSpaceChart.Series[c].ShowInLegend = false; } } } catch (Exception ex) { WriteServiceHistoryEntry(DateTime.Now.ToString() + " The following error has occurred in SetGraph: " + ex.Message); } }
public void Report() { int daysrem = -1; string selectedServer = ""; exactmatch = false; /* * if (this.ServerListFilterComboBox.SelectedIndex >= 0) * { * selectedServer = this.ServerListFilterComboBox.SelectedItem.Value.ToString(); * } */ if (this.ServerFilterTextBox.Text != "") { selectedServer = this.ServerFilterTextBox.Text; } if (this.ServerListFilterListBox.SelectedItems.Count > 0) { selectedServer = ""; for (int i = 0; i < this.ServerListFilterListBox.SelectedItems.Count; i++) { selectedServer += "'" + this.ServerListFilterListBox.SelectedItems[i].Text + "'" + ","; } exactmatch = true; try { selectedServer = selectedServer.Substring(0, selectedServer.Length - 1); } catch { selectedServer = ""; // throw ex; exactmatch = false; } finally { } } //2/2/2015 NS added for VSPLUS-1370 if (this.ServerTypeFilterListBox.SelectedItems.Count > 0) { selectedType = ""; selectedTypeSQL = ""; for (int i = 0; i < this.ServerTypeFilterListBox.SelectedItems.Count; i++) { selectedType += this.ServerTypeFilterListBox.SelectedItems[i].Text + ","; selectedTypeSQL += "'" + this.ServerTypeFilterListBox.SelectedItems[i].Text + "'" + ","; } try { selectedType = selectedType.Substring(0, selectedType.Length - 1); selectedTypeSQL = selectedTypeSQL.Substring(0, selectedTypeSQL.Length - 1); } catch { selectedType = ""; // throw ex; selectedTypeSQL = ""; } finally { } } if (this.NumberDaysTextBox.Text.ToString() != "") { daysrem = Convert.ToInt32(this.NumberDaysTextBox.Value.ToString()); } DashboardReports.DominoDiskAvgXtraRpt report = new DashboardReports.DominoDiskAvgXtraRpt(); report.Parameters["ServerName"].Value = selectedServer; report.Parameters["ServerNameSQL"].Value = selectedServer; report.Parameters["DaysRem"].Value = daysrem; report.Parameters["ExactMatch"].Value = exactmatch; //2/2/2015 NS added for VSPLUS-1370 report.Parameters["ServerType"].Value = selectedType; report.Parameters["ServerTypeSQL"].Value = selectedTypeSQL; report.CreateDocument(); ASPxDocumentViewer1.Report = report; ASPxDocumentViewer1.DataBind(); }