Ejemplo n.º 1
0
        public DashboardReports.ServerAvailabilityXtraRpt GetRpt()
        {
            string date;
            string srvName    = "";
            bool   exactmatch = false;
            string srvType    = "";

            date = DateTime.Now.ToString();
            DateTime dt = Convert.ToDateTime(date);

            dt.AddDays(-1);
            try
            {
                report = new DashboardReports.ServerAvailabilityXtraRpt();
                report.Parameters["DateM"].Value = dt.Month;
                report.Parameters["DateY"].Value = dt.Year;
                report.Parameters["DateD"].Value = dt.Day;
                System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo();
                string strMonthName = mfi.GetMonthName(dt.Month).ToString() + ", " + dt.Year.ToString();
                report.Parameters["MonthYear"].Value     = strMonthName;
                report.Parameters["ServerName"].Value    = srvName;
                report.Parameters["ServerNameSQL"].Value = srvName;
                report.Parameters["ExactMatch"].Value    = exactmatch;
                report.Parameters["DownMin"].Value       = "";
                report.Parameters["ServerType"].Value    = srvType;
                report.Parameters["ServerTypeSQL"].Value = srvType;
                report.SetReport(report);
            }
            catch (Exception ex)
            {
                WriteServiceHistoryEntry(DateTime.Now.ToString() + " The following error has occurred in GetRpt: " + ex.Message);
            }
            return(report);
        }
Ejemplo n.º 2
0
        public void SetReport(DashboardReports.ServerAvailabilityXtraRpt report)
        {
            string serverName = "";
            string srvName    = "";
            string sName      = "";
            //12/24/2013 NS added
            string downMin = "";
            bool   exactmatch;

            serverName = this.ServerNameSQL.Value.ToString();
            srvName    = this.ServerName.Value.ToString();
            exactmatch = (bool)this.ExactMatch.Value;
            //12/24/2013 NS added
            downMin = this.DownMin.Value.ToString();
            sName   = srvName;
            if (srvName == "" || exactmatch)
            {
                sName = serverName;
            }
            xrChart1.Series.Clear();
            DataTable dt = new DataTable();

            //12/24/2013 NS modified - added down minutes
            dt = VSWebBL.ReportsBL.ReportsBL.Ins.ServerAvailabilityRptBL(int.Parse(this.DateM.Value.ToString()), int.Parse(this.DateY.Value.ToString()),
                                                                         sName, exactmatch, downMin, this.ServerTypeSQL.Value.ToString(), int.Parse(this.DateD.Value.ToString()));
            //1/26/2016 NS modified for VSPLUS-2486
            if (dt.Rows.Count > 0)
            {
                Series series1 = new Series("DownMinutes", ViewType.StackedBar);

                series1.ArgumentDataMember = dt.Columns["DeviceName"].ToString();
                series1.ValueDataMembers.AddRange(dt.Columns["DownMinutes"].ToString());
                series1.ShowInLegend = true;
                series1.LegendText   = "Down Minutes";

                xrChart1.Series.AddRange(new Series[] { series1 });
                //xrChart1.Legend.Visible = true;
                (series1.View as StackedBarSeriesView).Transparency = 160;
                XYDiagram seriesXY = (XYDiagram)xrChart1.Diagram;
                seriesXY.AxisX.Label.ResolveOverlappingOptions.AllowRotate = true;
                seriesXY.AxisX.Label.ResolveOverlappingOptions.AllowHide   = false;
                seriesXY.AxisY.Title.Text    = "Down Minutes per Month";
                seriesXY.AxisX.Title.Text    = "Server Name";
                seriesXY.AxisY.Title.Visible = true;
                seriesXY.AxisX.Title.Visible = true;
                xrChart1.DataSource          = dt;

                this.DataSource = dt;
                this.DataMember = "Table";
                xrTableCell1.DataBindings.Add("Text", dt, "DeviceName");
                xrTableCell2.DataBindings.Add("Text", dt, "DownMinutes");
                xrTableCell3.DataBindings.Add("Text", dt, "UpMinutes");
            }
            MonthYearLabel.Text = "Report for " + this.MonthYear.Value.ToString();
        }
Ejemplo n.º 3
0
 protected void ResetButton_Click(object sender, EventArgs e)
 {
     this.ServerFilterTextBox.Text  = "";
     this.ServerFilterTextBox.Value = "";
     //1/30/2015 NS added for VSPLUS-1370
     this.ServerTypeFilterListBox.UnselectAll();
     this.ServerListFilterListBox.UnselectAll();
     //12/24/2013 NS added
     this.DownFilterTextBox.Text  = "";
     this.DownFilterTextBox.Value = "";
     fillcombo("");
     DashboardReports.ServerAvailabilityXtraRpt report = new DashboardReports.ServerAvailabilityXtraRpt();
     report.Parameters["ServerName"].Value = "";
     //12/24/2013 NS added
     report.Parameters["DownMin"].Value = "";
     //1/30/2015 NS added for VSPLUS-1370
     report.Parameters["ServerType"].Value    = "";
     report.Parameters["ServerTypeSQL"].Value = "";
     report.CreateDocument();
     ASPxDocumentViewer1.Report = report;
     ASPxDocumentViewer1.DataBind();
 }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            /*select devicename,SUM(statvalue) downminutes,
             * ((dbo.CalcNumDaysinMonth(GETDATE()))*24*60)-SUM(statvalue) upminutestotal,
             * MonthNumber,YearNumber from dbo.DeviceUpTimeStats
             * where StatName='HourlyDownTimeMinutes'
             * group by DeviceName,MonthNumber,YearNumber
             * order by YearNumber desc, MonthNumber desc, DeviceName
             */
            string selectedServer     = "";
            string selectedServerList = "";
            string date;
            //12/24/2013 NS added
            string downMin = "";

            exactmatch = false;
            //1/30/2015 NS added for VSPLUS-1370
            string selectedType     = "";
            string selectedTypeList = "";

            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 + ",";
                    selectedServerList += "'" + this.ServerListFilterListBox.SelectedItems[i].Text + "'" + ",";
                }
                exactmatch = true;
                try
                {
                    selectedServer     = selectedServer.Substring(0, selectedServer.Length - 1);
                    selectedServerList = selectedServerList.Substring(0, selectedServerList.Length - 1);
                }
                catch
                {
                    selectedServer     = ""; // throw ex;
                    selectedServerList = "";
                    exactmatch         = false;
                }
                finally { }
            }
            //12/24/2013 NS added
            downMin = DownFilterTextBox.Text;
            //10/23/2013 NS modified - added jQuery month/year control

            /*
             * if (this.DateParamEdit.Text == "")
             * {
             *  date = DateTime.Now.ToString();
             *  this.DateParamEdit.Date = Convert.ToDateTime(date);
             * }
             * else
             * {
             *  date = this.DateParamEdit.Value.ToString();
             * }
             */
            if (startDate.Value.ToString() == "")
            {
                date = DateTime.Now.ToString();
            }
            else
            {
                date = startDate.Value.ToString();
            }
            //1/30/2015 NS added for VSPLUS-1370
            if (this.ServerTypeFilterListBox.SelectedItems.Count > 0)
            {
                selectedType = "";
                for (int i = 0; i < this.ServerTypeFilterListBox.SelectedItems.Count; i++)
                {
                    selectedType     += this.ServerTypeFilterListBox.SelectedItems[i].Text + ",";
                    selectedTypeList += "'" + this.ServerTypeFilterListBox.SelectedItems[i].Text + "'" + ",";
                }
                try
                {
                    selectedType     = selectedType.Substring(0, selectedType.Length - 1);
                    selectedTypeList = selectedTypeList.Substring(0, selectedTypeList.Length - 1);
                }
                catch
                {
                    selectedType     = ""; // throw ex;
                    selectedTypeList = "";
                }
                finally { }
            }
            DateTime dt = Convert.ToDateTime(date);

            DashboardReports.ServerAvailabilityXtraRpt report = new DashboardReports.ServerAvailabilityXtraRpt();
            report.Parameters["DateM"].Value = dt.Month;
            report.Parameters["DateY"].Value = dt.Year;
            report.Parameters["DateD"].Value = dt.Day;
            System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo();
            string strMonthName = mfi.GetMonthName(dt.Month).ToString() + ", " + dt.Year.ToString();

            report.Parameters["MonthYear"].Value     = strMonthName;
            report.Parameters["ServerName"].Value    = selectedServer;
            report.Parameters["ServerNameSQL"].Value = selectedServerList;
            report.Parameters["ExactMatch"].Value    = exactmatch;
            //12/24/2013 NS added
            report.Parameters["DownMin"].Value = downMin;
            //1/30/2015 NS added for VSPLUS-1370
            report.Parameters["ServerType"].Value    = selectedType;
            report.Parameters["ServerTypeSQL"].Value = selectedTypeList;
            report.PageColor = Color.Transparent;
            report.CreateDocument();
            ASPxDocumentViewer1.Report = report;
            ASPxDocumentViewer1.DataBind();
            if (!IsPostBack)
            {
                fillcombo("");
                fillservertypelist();
            }
            else
            {
                fillcombo(selectedTypeList);
            }
        }
Ejemplo n.º 5
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            string selectedServer     = "";
            string selectedServerList = "";
            string date;
            //12/24/2013 NS added
            string downMin = "";
            //1/30/2015 NS added for VSPLUS-1370
            string selectedType     = "";
            string selectedTypeList = "";

            exactmatch = false;
            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 + ",";
                    selectedServerList += "'" + this.ServerListFilterListBox.SelectedItems[i].Text + "'" + ",";
                }
                exactmatch = true;
                try
                {
                    selectedServer     = selectedServer.Substring(0, selectedServer.Length - 1);
                    selectedServerList = selectedServerList.Substring(0, selectedServerList.Length - 1);
                }
                catch
                {
                    selectedServer     = ""; // throw ex;
                    selectedServerList = "";
                    exactmatch         = false;
                }
                finally { }
            }
            //12/24/2013 NS added
            downMin = DownFilterTextBox.Text;
            //10/23/2013 NS modified - added jQuery month/year control

            /*
             * if (this.DateParamEdit.Text == "")
             * {
             *  date = DateTime.Now.ToString();
             *  this.DateParamEdit.Date = Convert.ToDateTime(date);
             * }
             * else
             * {
             *  date = this.DateParamEdit.Value.ToString();
             * }
             */
            if (startDate.Value.ToString() == "")
            {
                date = DateTime.Now.ToString();
            }
            else
            {
                date = startDate.Value.ToString();
            }
            //1/30/2015 NS added for VSPLUS-1370
            if (this.ServerTypeFilterListBox.SelectedItems.Count > 0)
            {
                selectedType = "";
                for (int i = 0; i < this.ServerTypeFilterListBox.SelectedItems.Count; i++)
                {
                    selectedType     += this.ServerTypeFilterListBox.SelectedItems[i].Text + ",";
                    selectedTypeList += "'" + this.ServerTypeFilterListBox.SelectedItems[i].Text + "'" + ",";
                }
                try
                {
                    selectedType     = selectedType.Substring(0, selectedType.Length - 1);
                    selectedTypeList = selectedTypeList.Substring(0, selectedTypeList.Length - 1);
                }
                catch
                {
                    selectedType     = ""; // throw ex;
                    selectedTypeList = "";
                }
                finally { }
            }
            DateTime dt = Convert.ToDateTime(date);

            DashboardReports.ServerAvailabilityXtraRpt report = new DashboardReports.ServerAvailabilityXtraRpt();
            report.Parameters["DateM"].Value = dt.Month;
            report.Parameters["DateY"].Value = dt.Year;
            report.Parameters["DateD"].Value = dt.Day;
            System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo();
            string strMonthName = mfi.GetMonthName(dt.Month).ToString() + ", " + dt.Year.ToString();

            report.Parameters["MonthYear"].Value     = strMonthName;
            report.Parameters["ServerName"].Value    = selectedServer;
            report.Parameters["ServerNameSQL"].Value = selectedServerList;
            report.Parameters["ExactMatch"].Value    = exactmatch;
            //12/24/2013 NS added
            report.Parameters["DownMin"].Value = downMin;
            //1/30/2015 NS added for VSPLUS-1370
            report.Parameters["ServerType"].Value    = selectedType;
            report.Parameters["ServerTypeSQL"].Value = selectedTypeList;
            report.CreateDocument();
            ASPxDocumentViewer1.Report = report;
            ASPxDocumentViewer1.DataBind();
        }
Ejemplo n.º 6
0
        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[6];
            Settings[] settingsObject   = new Settings[6];
            Settings[] rtsettingsObject = new Settings[6];
            //try
            //{
            //12/9/2015 NS modified for VSPLUS-2395
            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;

            case DiskHealthLoc:
                report = new DashboardReports.DominoDiskHealthLocXtraRpt();
                report = (DashboardReports.DominoDiskHealthLocXtraRpt)VSWebUI.DashboardReports.DominoDiskHealthLocRpt.Ins.GetRpt();
                break;

            case DominoServerHealth:
                report = new DashboardReports.DominoServerHealthXtraRpt();
                report = (DashboardReports.DominoServerHealthXtraRpt)VSWebUI.DashboardReports.DominoServerHealthRpt.Ins.GetRpt();
                break;

            case ServerDiskFreeSpace:
                report = new DashboardReports.SrvDiskFreeSpaceTrendXtraRpt();
                report = (DashboardReports.SrvDiskFreeSpaceTrendXtraRpt)VSWebUI.DashboardReports.SrvDiskFreeSpaceTrendRpt.Ins.GetRpt();
                break;

            case MonthlyServerDownTime:
                report = new DashboardReports.ServerAvailabilityXtraRpt();
                report = (DashboardReports.ServerAvailabilityXtraRpt)VSWebUI.DashboardReports.ServerAvailabilityRpt.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 < 6; ++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";
                settingsObject[5].sname = "primaryFrom";
                mailparams[0]           = "smtp.gmail.com";
                mailparams[1]           = ConfigurationSettings.AppSettings["AdminMailID"]; //"*****@*****.**";
                mailparams[2]           = ConfigurationSettings.AppSettings["Password"];    //"vitalsigns2012";
                mailparams[3]           = "587";
                mailparams[4]           = "true";
                mailparams[5]           = "VS Plus";
                for (int i = 0; i < 6; 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], mailparams[5]);
                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   = Convert.ToBoolean(mailparams[4].ToString())
                };
                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);
            //}
        }