示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dt = new DataTable();
                dt = (DataTable)Session["ImportedServers"];
                SrvCheckBoxList.DataSource = dt;
                SrvCheckBoxList.TextField  = "ServerName";
                SrvCheckBoxList.ValueField = "ServerName";
                SrvCheckBoxList.DataBind();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    SrvLabel.Text += dt.Rows[i]["ServerName"].ToString() + ", ";
                }
                SrvLabel.Text = SrvLabel.Text.Substring(0, SrvLabel.Text.Length - 2);

                DataTable ServerTasksDT = new DataTable();
                ServerTasksDT = VSWebBL.ConfiguratorBL.DominoServerTasksBL.Ins.GetAllData();
                if (ServerTasksDT.Rows.Count > 0)
                {
                    SrvTaskCheckBoxList.DataSource = ServerTasksDT;
                    SrvTaskCheckBoxList.TextField  = "TaskName";
                    SrvTaskCheckBoxList.ValueField = "TaskName";
                    SrvTaskCheckBoxList.DataBind();
                    SrvTaskIDCheckBoxList.DataSource = ServerTasksDT;
                    SrvTaskIDCheckBoxList.TextField  = "TaskID";
                    SrvTaskIDCheckBoxList.ValueField = "TaskID";
                    SrvTaskIDCheckBoxList.DataBind();
                }
            }
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["ServerType"] != null)
            {
                ServerType = Request.QueryString["ServerType"].ToString();
            }
            if (ServerType == "DAG")
            {
                FillExchangeServersComboBox();
                CredentialsComboBox.Visible    = false;
                AdvDiskSpaceThTrackBar.Visible = false;
                AdvCPUThTrackBar.Visible       = false;
                AdvMemoryThTrackBar.Visible    = false;
                LblCPUTH.Visible       = false;
                LBLMemTh.Visible       = false;
                LblDiskTh.Visible      = false;
                LblCredentials.Visible = false;
                DiskLabel.Visible      = false;
                CpuLabel.Visible       = false;
                MemLabel.Visible       = false;
            }
            else
            {
                PrimaryExchangeServerComboBox.Visible   = false;
                SecondaryExchangeServerComboBox.Visible = false;
                CopyQThresholdTetBox.Visible            = false;
                ReplyQthresholdTextbox.Visible          = false;
            }

            //5/2/2014 NS added for VSPLUS-589
            DataTable dtattr   = new DataTable();
            string    attrname = "";
            string    attrval  = "";

            dtattr = VSWebBL.SecurityBL.ProfilesMasterBL.Ins.GetAllDataByServerType("Exchange", "", "ProfileName");
            //Request.QueryString["ProfileName"].ToString()
            if (dtattr.Rows.Count > 0)
            {
                for (int i = 0; i < dtattr.Rows.Count; i++)
                {
                    attrname = dtattr.Rows[i]["AttributeName"].ToString();
                    attrval  = dtattr.Rows[i]["DefaultValue"].ToString();
                    switch (attrname)
                    {
                    case "Scan Interval":
                        SrvAtrScanIntvlTextBox.Text = attrval;
                        break;

                    case "Off Hours Scan Interval":
                        SrvAtrOffScanIntvlTextBox.Text = attrval;
                        break;

                    case "Retry Interval":
                        SrvAtrRetryIntvlTextBox.Text = attrval;
                        break;

                    case "Response Time Threshold":
                        SrvAtrResponseThTextBox.Text = attrval;
                        break;

                    case "Failure Threshold":
                        SrvAtrFailBefAlertTextBox.Text = attrval;
                        break;

                    case "Disk Space Threshold":
                        AdvDiskSpaceThTrackBar.Position = Convert.ToInt32(Convert.ToDecimal(attrval) * 100);
                        DiskLabel.Text = AdvDiskSpaceThTrackBar.Value.ToString() + "%";
                        break;

                    case "Memory Threshold":
                        //5/23/2014 NS modified for VSPLUS-649
                        //AdvMemoryThTrackBar.Position = Convert.ToInt32(attrval);
                        AdvMemoryThTrackBar.Position = Convert.ToInt32(Convert.ToDecimal(attrval) * 100);
                        MemLabel.Text = AdvMemoryThTrackBar.Value.ToString() + "%";
                        break;

                    case "CPU Threshold":
                        //5/23/2014 NS modified for VSPLUS-649
                        //AdvCPUThTrackBar.Position = Convert.ToInt32(attrval);
                        AdvCPUThTrackBar.Position = Convert.ToInt32(Convert.ToDecimal(attrval) * 100);
                        CpuLabel.Text             = AdvCPUThTrackBar.Value.ToString() + "%";
                        break;
                    }
                }
            }



            //10/3/2013 NS modified to avoid server name duplication
            if (!IsPostBack)
            {
                FillCredentialsComboBox();
                DataTable dt = new DataTable();
                dt = (DataTable)Session["ImportedServers"];
                SrvCheckBoxList.DataSource = dt;
                SrvCheckBoxList.TextField  = "ServerName";
                SrvCheckBoxList.ValueField = "ServerName";
                SrvCheckBoxList.DataBind();

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    SrvLabel.Text += dt.Rows[i]["ServerName"].ToString() + ", ";
                }
                SrvLabel.Text = SrvLabel.Text.Substring(0, SrvLabel.Text.Length - 2);
            }
        }
示例#3
0
        protected void AssignButton_Click(object sender, EventArgs e)
        {
            Object    ReturnValue;
            Servers   ServersObject;
            DataTable dtsrv  = new DataTable();
            DataTable dtdisk = new DataTable();

            dtdisk.Columns.Add("ServerName");
            dtdisk.Columns.Add("DiskName");
            dtdisk.Columns.Add("Threshold");
            dtdisk.Columns.Add("ThresholdType");
            //3/4/2014 NS added for VSPLUS-431
            Object ReturnValueDisk;

            ExchangeServers ExchangeServersObjectRet = new ExchangeServers();
            ExchangeServers ExchangeServersObject    = new ExchangeServers();

            if (AdvDiskSpaceThTrackBar.Value.ToString() != null)
            {
                ExchangeServersObject.DiskSpaceThreshold = float.Parse(AdvDiskSpaceThTrackBar.Value.ToString());
            }
            if (AdvMemoryThTrackBar.Value.ToString() != null)
            {
                ExchangeServersObject.Memory_Threshold = float.Parse(AdvMemoryThTrackBar.Value.ToString());
            }
            if (AdvCPUThTrackBar.Value.ToString() != null)
            {
                ExchangeServersObject.CPU_Threshold = float.Parse(AdvCPUThTrackBar.Value.ToString());
            }

            if (SrvAtrScanIntvlTextBox.Text != null && SrvAtrScanIntvlTextBox.Text != "")
            {
                ExchangeServersObject.ScanInterval = int.Parse(SrvAtrScanIntvlTextBox.Text);
            }
            if (SrvAtrOffScanIntvlTextBox.Text != null && SrvAtrOffScanIntvlTextBox.Text != "")
            {
                ExchangeServersObject.OffHoursScanInterval = int.Parse(SrvAtrOffScanIntvlTextBox.Text);
            }
            if (SrvAtrRetryIntvlTextBox.Text != null && SrvAtrRetryIntvlTextBox.Text != "")
            {
                ExchangeServersObject.RetryInterval = int.Parse(SrvAtrRetryIntvlTextBox.Text);
            }
            if (SrvAtrResponseThTextBox.Text != null && SrvAtrResponseThTextBox.Text != "")
            {
                ExchangeServersObject.ResponseThreshold = int.Parse(SrvAtrResponseThTextBox.Text);
            }
            if (SrvAtrFailBefAlertTextBox.Text != null && SrvAtrFailBefAlertTextBox.Text != "")
            {
                ExchangeServersObject.FailureThreshold = int.Parse(SrvAtrFailBefAlertTextBox.Text);
            }
            ExchangeServersObject.CredentialsID = (CredentialsComboBox.Text == "" ? 0 : Convert.ToInt32(CredentialsComboBox.Value));
            if (ServerType == "DAG")
            {
                ExchangeServersObject.DAGPrimaryServerId = (PrimaryExchangeServerComboBox.Text == "" ? 0 : Convert.ToInt32(PrimaryExchangeServerComboBox.Value));
                ExchangeServersObject.DAGBackUpServerID  = (SecondaryExchangeServerComboBox.Text == "" ? 0 : Convert.ToInt32(SecondaryExchangeServerComboBox.Value));
                ExchangeServersObject.DAGCopyQTh         = int.Parse(CopyQThresholdTetBox.Text);
                ExchangeServersObject.DAGResponseQTh     = int.Parse(ReplyQthresholdTextbox.Text);
            }
            SrvCheckBoxList.SelectAll();
            if (SrvCheckBoxList.SelectedItems.Count > 0)
            {
                dtsrv.Columns.Add("ID");
                dtsrv.Columns.Add("ServerName");
                dtsrv.Columns.Add("IPAddress");
                dtsrv.Columns.Add("Description");
                dtsrv.Columns.Add("ServerType");
                dtsrv.Columns.Add("Location");
                dtsrv.Columns.Add("LocationID");
                dtsrv.Columns.Add("PrimaryServerId");
                dtsrv.Columns.Add("BackupServerId");
                for (int i = 0; i < SrvCheckBoxList.SelectedItems.Count; i++)
                {
                    DataRow dr = dtsrv.NewRow();
                    dr["ID"]          = "";
                    dr["ServerName"]  = SrvCheckBoxList.SelectedItems[i].ToString();
                    dr["IPAddress"]   = "";
                    dr["Description"] = "Production";
                    if (ServerType == "DAG")
                    {
                        dr["ServerType"]      = "Database Availability Group";
                        dr["PrimaryServerId"] = "Exchange";
                        dr["BackupServerId"]  = "Exchange";
                    }
                    else
                    {
                        dr["ServerType"] = "Exchange";
                    }
                    dr["Location"]   = "";
                    dr["LocationID"] = 0;
                    ServersObject    = CollectDataForServers("Insert", dr);
                    DataTable dt = VSWebBL.SecurityBL.ServersBL.Ins.GetDataByName(ServersObject);
                    if (dt.Rows.Count > 0)
                    {
                        ExchangeServersObject.Key = int.Parse(dt.Rows[0]["ID"].ToString());
                    }
                    ExchangeServersObject.Category = dr["Description"].ToString();
                    ExchangeServersObject.Enabled  = true;
                    ExchangeServersObjectRet       = VSWebBL.ConfiguratorBL.ExchangePropertiesBL.Ins.GetData(ExchangeServersObject);
                    if (ServerType == "DAG")
                    {
                        ReturnValue = VSWebBL.ConfiguratorBL.ExchangePropertiesBL.Ins.UpdateDAGData(ExchangeServersObject);
                    }
                    else
                    {
                        ReturnValue = VSWebBL.ConfiguratorBL.ExchangePropertiesBL.Ins.UpdateData(ExchangeServersObject);
                    }
                    //3/4/2014 NS added for VSPLUS-431
                    if (ServerType != "DAG")
                    {
                        DataRow row = dtdisk.Rows.Add();
                        row["ServerName"]    = SrvCheckBoxList.SelectedItems[i].ToString();
                        row["DiskName"]      = "AllDisks";
                        row["Threshold"]     = "10";
                        row["ThresholdType"] = "Percent";
                    }
                }
                if (ServerType != "DAG")
                {
                    ReturnValueDisk = VSWebBL.ConfiguratorBL.ExchangePropertiesBL.Ins.InsertDiskSettingsData(dtdisk);
                }

                Response.Redirect("~/Security/ImportExchangeServers4.aspx", false);//Mukund, 05Aug14, VSPLUS-844:Page redirect on callback
                Context.ApplicationInstance.CompleteRequest();
            }
        }
示例#4
0
 protected void DeselectAllButton_Click(object sender, EventArgs e)
 {
     SrvCheckBoxList.UnselectAll();
 }
示例#5
0
        protected void AssignButton_Click(object sender, EventArgs e)
        {
            //try
            //{
            Object             ReturnValue;
            Servers            ServersObject;
            DominoServerTasks  DSTaskObject;
            ServerTaskSettings STSettings;
            DataTable          dt;
            DataTable          dt2;
            DataTable          dtsrv     = new DataTable();
            DataTable          dtsrvtask = new DataTable();
            string             serverid  = "";
            string             taskid    = "";

            if (SrvTaskCheckBoxList.SelectedItems.Count > 0)
            {
                dtsrvtask.Columns.Add("TaskID");
                dtsrvtask.Columns.Add("TaskName");
                dtsrvtask.Columns.Add("ServerID");
                dtsrvtask.Columns.Add("Enabled");
                dtsrvtask.Columns.Add("SendLoadCommand");
                dtsrvtask.Columns.Add("SendRestartCommand");
                dtsrvtask.Columns.Add("SendExitCommand");
                dtsrvtask.Columns.Add("RestartOffHours");
                dtsrv.Columns.Add("ID");
                dtsrv.Columns.Add("ServerName");
                dtsrv.Columns.Add("IPAddress");
                dtsrv.Columns.Add("Description");
                dtsrv.Columns.Add("ServerType");
                dtsrv.Columns.Add("Location");
                dtsrv.Columns.Add("LocationID");
                for (int j = 0; j < SrvTaskCheckBoxList.Items.Count; j++)
                {
                    if (SrvTaskCheckBoxList.Items[j].Selected)
                    {
                        SrvCheckBoxList.SelectAll();
                        if (SrvCheckBoxList.SelectedItems.Count > 0)
                        {
                            for (int i = 0; i < SrvCheckBoxList.SelectedItems.Count; i++)
                            {
                                DataRow drtask = dtsrvtask.NewRow();
                                drtask["TaskID"]             = SrvTaskIDCheckBoxList.Items[j].Text;
                                drtask["TaskName"]           = SrvTaskCheckBoxList.Items[j].Text;
                                drtask["ServerID"]           = "";
                                drtask["Enabled"]            = "true";
                                drtask["SendLoadCommand"]    = "false";
                                drtask["SendRestartCommand"] = "false";
                                drtask["SendExitCommand"]    = "false";
                                drtask["RestartOffHours"]    = "false";
                                DataRow dr = dtsrv.NewRow();
                                dr["ID"]              = "";
                                dr["ServerName"]      = SrvCheckBoxList.SelectedItems[i].ToString();
                                dr["IPAddress"]       = "";
                                dr["Description"]     = "Production";
                                dr["ServerType"]      = "Domino";
                                dr["Location"]        = "";
                                dr["LocationID"]      = 0;
                                DSTaskObject          = new DominoServerTasks();
                                DSTaskObject.TaskName = SrvTaskCheckBoxList.Items[j].Text;
                                try
                                {
                                    DSTaskObjectRet = VSWebBL.ConfiguratorBL.DominoServerTasksBL.Ins.GetDataForTaskName(DSTaskObject);
                                }
                                catch (Exception ex)
                                {
                                    throw ex;
                                }
                                ServersObject = CollectDataForServers("Insert", dr);
                                try
                                {
                                    dt = VSWebBL.SecurityBL.ServersBL.Ins.GetDataByName(ServersObject);
                                }
                                catch (Exception ex)
                                {
                                    throw ex;
                                }
                                if (dt.Rows.Count > 0)
                                {
                                    drtask["ServerID"] = dt.Rows[0]["ID"].ToString();
                                    serverid           = dt.Rows[0]["ID"].ToString();
                                    taskid             = SrvTaskIDCheckBoxList.Items[j].Text;
                                    try
                                    {
                                        dt2 = VSWebBL.ConfiguratorBL.ServerTaskSettingsBL.Ins.SelectData(serverid, taskid);
                                    }
                                    catch (Exception ex)
                                    {
                                        throw ex;
                                    }
                                    if (dt2.Rows.Count == 0)
                                    {
                                        STSettings = CollectDataForServerTaskSettings("Insert", drtask);
                                        try
                                        {
                                            ReturnValue = VSWebBL.ConfiguratorBL.ServerTaskSettingsBL.Ins.InsertData(STSettings);
                                        }
                                        catch (Exception ex)
                                        {
                                            Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                                            throw ex;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            //10/3/2013 NS moved the code below outside of the task selection check to allow to proceed to the next page without any selection
            SrvTaskCheckBoxList.UnselectAll();
            SrvCheckBoxList.UnselectAll();
            Response.Redirect("~/Security/ImportServers4.aspx", false);    //Mukund, 05Aug14, VSPLUS-844:Page redirect on callback
            Context.ApplicationInstance.CompleteRequest();
            //}
            //catch (Exception ex)
            //{
            //    throw ex;
            //}
        }
示例#6
0
        public void LoadDominoServers()
        {
            Domino.NotesDbDirectory dir;
            Domino.NotesDatabase    db;
            Domino.NotesView        view;
            Domino.NotesDocument    doc;
            Domino.NotesName        sname;
            Domino.NotesItem        item;
            Domino.NotesItem        item2;
            byte[] MyPass;
            string MyDominoPassword; //should be string
            string MyObjPwd;

            string[] MyObjPwdArr;
            //1/8/2014 NS added
            DataTable importedDT;
            //12/24/2013 NS added - store the value of the Domino Server field in the Settings table Primary Server column
            bool updatedsrv = false;

            updatedsrv = VSWebBL.SettingBL.SettingsBL.Ins.UpdateSvalue("Primary Server", DomServerTextBox.Text, VSWeb.Constants.Constants.SysString);
            //object MyObjPwd;
            //12/20/2013 NS added
            errorDiv.Style.Value = "display: none;";
            //8/12/2014 NS added for VSPLUS-861
            errorinfoDiv.Style.Value = "display: none";
            DataTable LocationsDataTable = new DataTable();

            LocationsDataTable = VSWebBL.SecurityBL.LocationsBL.Ins.GetAllData();
            if (LocationsDataTable.Rows.Count > 0)
            {
                LocComboBox.DataSource = LocationsDataTable;
                LocComboBox.TextField  = "Location";
                LocComboBox.ValueField = "Location";
                LocComboBox.DataBind();
                LocIDComboBox.DataSource = LocationsDataTable;
                LocIDComboBox.TextField  = "ID";
                LocIDComboBox.ValueField = "ID";
                LocIDComboBox.DataBind();
                VSFramework.TripleDES mySecrets = new VSFramework.TripleDES();
                try
                {
                    MyObjPwd = VSWebBL.SettingBL.SettingsBL.Ins.Getvalue("Password");
                    //3/25/2014 NS modified for VSPLUS-494
                    if (MyObjPwd != "")
                    {
                        MyObjPwdArr = MyObjPwd.Split(',');
                        MyPass      = new byte[MyObjPwdArr.Length];
                        for (int i = 0; i < MyObjPwdArr.Length; i++)
                        {
                            MyPass[i] = Byte.Parse(MyObjPwdArr[i]);
                        }
                    }
                    else
                    {
                        //10/6/2014 NS modified for VSPLUS-990
                        errorDiv.InnerHtml = "The following error has occurred: Notes password may not be empty. Please update the password under Stored Passwords & Options\\IBM Domino Settings." +
                                             "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>";
                        errorDiv.Style.Value = "display: block";
                        MyPass = null;
                    }
                }
                catch (Exception ex)
                {
                    //12/20/2013 NS added
                    //10/6/2014 NS modified for VSPLUS-990
                    errorDiv.InnerHtml = "The following error has occurred: " + ex.Message +
                                         "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>";
                    errorDiv.Style.Value = "display: block";
                    //8/12/2014 NS added for VSPLUS-861
                    errorinfoDiv.Style.Value = "display: block";
                    MyPass = null;
                    //5/15/2014 NS added for VSPLUS-634
                    Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                    throw ex;
                }

                try
                {
                    if (MyPass != null)
                    {
                        MyDominoPassword = mySecrets.Decrypt(MyPass);
                    }
                    else
                    {
                        MyDominoPassword = null;
                    }
                }
                catch (Exception ex)
                {
                    //12/20/2013 NS added
                    //10/6/2014 NS modified for VSPLUS-990
                    errorDiv.InnerHtml = "The following error has occurred: " + ex.Message +
                                         "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>";
                    errorDiv.Style.Value = "display: block";
                    //8/12/2014 NS added for VSPLUS-861
                    errorinfoDiv.Style.Value = "display: block";
                    MyDominoPassword         = "";
                    //5/15/2014 NS added for VSPLUS-634
                    Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                    throw ex;
                }
                //3/25/2014 NS modified for VSPLUS-494
                if (MyDominoPassword != null)
                {
                    try
                    {
                        Domino.NotesSession NotesSessionObject = new Domino.NotesSession();
                        NotesSessionObject.Initialize(MyDominoPassword);
                        dir = NotesSessionObject.GetDbDirectory(DomServerTextBox.Text);
                        //db = dir.GetFirstDatabase(Domino.DB_TYPES.NOTES_DATABASE);
                        db   = dir.OpenDatabase("names.nsf");
                        view = db.GetView("($Servers)");
                        doc  = view.GetFirstDocument();
                        DataTable dt = new DataTable();
                        DataRow   dr = dt.NewRow();
                        //1/8/2014 NS added
                        DataRow[] foundRows;
                        dt.Columns.Add("ServerName", typeof(string));
                        dt.Columns.Add("IPAddress", typeof(string));
                        //1/8/2014 NS added - get a list of all servers already imported. Display only the ones that have not yet been imported.
                        importedDT = VSWebBL.ConfiguratorBL.AlertsBL.Ins.GetServer();
                        while (doc != null)
                        {
                            item             = doc.GetFirstItem("ServerName");
                            sname            = NotesSessionObject.CreateName(item.Text);
                            dr["ServerName"] = sname.Abbreviated;
                            //1/8/2014 NS added
                            foundRows = importedDT.Select("ServerName = '" + sname.Abbreviated + "'");
                            if (foundRows.Length == 0)
                            {
                                //5/16/2013 NS modified
                                //item = doc.GetFirstItem("NetAddresses");
                                item            = doc.GetFirstItem("SMTPFullHostDomain");
                                dr["IPAddress"] = item.Text;
                                //2/5/2016 NS modified for VSPLUS-2068
                                if (item == null || item.Text == null || item.Text == "")
                                {
                                    //1/26/2016 NS modified for VSPLUS-2068
                                    item2           = doc.GetFirstItem("NetAddresses");
                                    dr["IPAddress"] = item2.Text;
                                    if (item2 == null || item2.Text == null || item2.Text == "")
                                    {
                                        dr["IPAddress"] = "dummyaddress.yourdomain.com";
                                    }
                                }
                                dt.Rows.Add(dr);
                                dr = dt.NewRow();
                            }
                            doc = view.GetNextDocument(doc);
                        }
                        //1/8/2014 NS modified
                        if (dt.Rows.Count > 0)
                        {
                            //1/8/2014 NS added
                            infoDiv.Style.Value        = "display: block";
                            SrvCheckBoxList.DataSource = dt;
                            SrvCheckBoxList.TextField  = "ServerName";
                            SrvCheckBoxList.ValueField = "ServerName";
                            SrvCheckBoxList.DataBind();
                            IPCheckBoxList.DataSource = dt;
                            IPCheckBoxList.TextField  = "IPAddress";
                            IPCheckBoxList.ValueField = "IPAddress";
                            IPCheckBoxList.DataBind();
                            //12/20/2013 NS added
                            ASPxRoundPanel1.Visible = true;
                        }
                        else
                        {
                            //10/6/2014 NS modified for VSPLUS-990
                            errorDiv.InnerHtml = "There are no new servers in the address book that have not already been imported into VitalSigns." +
                                                 "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>";
                            errorDiv.Style.Value = "display: block";
                        }
                    }
                    catch (Exception ex)
                    {
                        //12/20/2013 NS added
                        //10/6/2014 NS modified for VSPLUS-990
                        errorDiv.InnerHtml = "The following error has occurred: " + ex.Message +
                                             "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>";
                        errorDiv.Style.Value = "display: block";
                        //8/12/2014 NS added for VSPLUS-861
                        errorinfoDiv.Style.Value = "display: block";
                        db   = null;
                        dir  = null;
                        view = null;
                        doc  = null;
                        //5/15/2014 NS added for VSPLUS-634
                        Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                    }
                }
            }
            //5/13/2014 NS added for VSPLUS-183
            else
            {
                //10/6/2014 NS modified for VSPLUS-990
                errorDiv.InnerHtml = "All imported servers must be assigned to a location. There were no locations found. Please create at least one location entry using the 'Setup & Security - Maintain Server Locations' menu option." +
                                     "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>";
                errorDiv.Style.Value = "display: block";
            }
        }
示例#7
0
        string SavePostedFile(UploadedFile uploadedFile)
        {
            string logPath = "";

            //Mukund VSPLUS-1035, Changed path to save CSV from Settings default to VSWeb- LogFiles
            //if (!uploadedFile.IsValid)
            //   logPath = VSWebBL.SettingBL.SettingsBL.Ins.Getvalue("Log Files Path");
            //if (logPath == "")
            //{
            //    logPath = AppDomain.CurrentDomain.BaseDirectory.ToString();
            //}
            fileupld.SaveAs(Server.MapPath("~/LogFiles/" + uploadedFile.FileName));
            // fileupld.SaveAs(logPath + uploadedFile.FileName);
            //string fileName1 = Path.Combine(MapPath("~/log_files/") + uploadedFile.FileName);
            string fileName1 = Server.MapPath("~/LogFiles/" + uploadedFile.FileName);// Path.Combine(logPath + uploadedFile.FileName);
            //string filename2 = Path.GetFileName(uploadedFile.FileName);
            string fileExtension = Path.GetExtension(uploadedFile.FileName);

            //uploadedFile.SaveAs(Server.MapPath("~/log_files/" + filename2));
            //using (Image original = Image.FromStream(uploadedFile.FileContent))
            //using (Image thumbnail = PhotoUtils.Inscribe(original, 100))
            //{
            //    PhotoUtils.SaveToJpeg(thumbnail, fileName);
            //}
            if (fileExtension == ".csv")
            {
                // oledbcon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\"";
                oledbcon.ConnectionString = ("Provider=Microsoft.Jet.OleDb.4.0; Data Source = " + System.IO.Path.GetDirectoryName(filename) + "; Extended Properties = \"Text;HDR=YES;FMT=Delimited\"");


                string     fileName = fileName1;
                DataTable  dt       = new DataTable();
                DataRow    dr;
                DataColumn column;
                string     s;
                column            = new DataColumn();
                column.DataType   = System.Type.GetType("System.String");
                column.ColumnName = "ServerName";
                dt.Columns.Add(column);
                column            = new DataColumn();
                column.DataType   = System.Type.GetType("System.String");
                column.ColumnName = "IPAddress";
                dt.Columns.Add(column);
                logPath = fileName;
                //ASPxLabel6.Text = "File uploaded successfully.";
                try
                {
                    DataTable LocationsDataTable = new DataTable();
                    LocationsDataTable = VSWebBL.SecurityBL.LocationsBL.Ins.GetAllData();
                    if (LocationsDataTable.Rows.Count > 0)
                    {
                        LocComboBox.DataSource = LocationsDataTable;
                        LocComboBox.TextField  = "Location";
                        LocComboBox.ValueField = "Location";
                        LocComboBox.DataBind();
                        LocIDComboBox.DataSource = LocationsDataTable;
                        LocIDComboBox.TextField  = "ID";
                        LocIDComboBox.ValueField = "ID";
                        LocIDComboBox.DataBind();
                    }
                    using (StreamReader sr = new StreamReader(logPath))
                    {
                        while (!sr.EndOfStream)
                        {
                            s  = sr.ReadLine();
                            dr = dt.NewRow();
                            //2/11/2016 Durga Added for VSPLUS 2432
                            DataTable serversdt = VSWebBL.SecurityBL.ServersBL.Ins.GetServerDetailsByName(s.ToString());
                            if (serversdt.Rows.Count == 0)
                            {
                                dr["IPAddress"]  = "dummyaddress.yourdomain.com";
                                dr["ServerName"] = s.ToString();
                                dt.Rows.Add(dr);
                            }
                        }

                        if (dt.Rows.Count > 0)
                        {
                            infoDiv.Style.Value        = "display: block";
                            SrvCheckBoxList.DataSource = dt;
                            SrvCheckBoxList.TextField  = "ServerName";
                            SrvCheckBoxList.ValueField = "ServerName";
                            SrvCheckBoxList.DataBind();
                            IPCheckBoxList.DataSource = dt;
                            IPCheckBoxList.TextField  = "IPAddress";
                            IPCheckBoxList.ValueField = "IPAddress";
                            IPCheckBoxList.DataBind();
                            //12/20/2013 NS added
                            ASPxRoundPanel1.Visible = true;
                        }
                        else
                        {
                            //10/6/2014 NS modified for VSPLUS-990
                            errorDiv.InnerHtml = "There are no new servers in the address book that have not already been imported into VitalSigns." +
                                                 "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>";
                            errorDiv.Style.Value = "display: block";
                        }
                        sr.Close();
                    }
                }
                catch (Exception ex)
                {
                    logPath  = System.Web.HttpContext.Current.Server.MapPath("~");
                    logPath += "\\" + fileName;
                    try
                    {
                        using (StreamReader sr = new StreamReader(logPath))
                        {
                            while (!sr.EndOfStream)
                            {
                                s  = sr.ReadLine();
                                dr = dt.NewRow();
                                dr["ServerName"] = s.ToString();
                                dr["IPAddress"]  = "dummyaddress.yourdomain.com";
                                dt.Rows.Add(dr);
                            }
                            if (dt.Rows.Count > 0)
                            {
                                infoDiv.Style.Value        = "display: block";
                                SrvCheckBoxList.DataSource = dt;
                                SrvCheckBoxList.TextField  = "ServerName";
                                SrvCheckBoxList.ValueField = "ServerName";
                                SrvCheckBoxList.DataBind();
                                IPCheckBoxList.DataSource = dt;
                                IPCheckBoxList.TextField  = "IPAddress";
                                IPCheckBoxList.ValueField = "IPAddress";
                                IPCheckBoxList.DataBind();
                                //12/20/2013 NS added
                                ASPxRoundPanel1.Visible = true;
                            }
                            else
                            {
                                //10/6/2014 NS modified for VSPLUS-990
                                errorDiv.InnerHtml = "There are no new servers in the address book that have not already been imported into VitalSigns." +
                                                     "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>";
                                errorDiv.Style.Value = "display: block";
                            }
                            sr.Close();
                        }
                    }
                    catch
                    {
                        //6/27/2014 NS added for VSPLUS-634
                        Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                    }
                }
            }

            return(fileName1);
        }
示例#8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //5/2/2014 NS added for VSPLUS-589
            DataTable dtattr   = new DataTable();
            string    attrname = "";
            string    attrval  = "";

            //10/14/2014 NS modified for VSPLUS-995
            if (!IsPostBack)
            {
                string profilename = Request.QueryString["Profilename"].ToString();
                dtattr = VSWebBL.SecurityBL.ProfilesMasterBL.Ins.GetAllDataByServerType("Domino", "", profilename);
                //Request.QueryString["ProfileName"].ToString()
                if (dtattr.Rows.Count > 0)
                {
                    for (int i = 0; i < dtattr.Rows.Count; i++)
                    {
                        attrname = dtattr.Rows[i]["AttributeName"].ToString();
                        attrval  = dtattr.Rows[i]["DefaultValue"].ToString();
                        switch (attrname)
                        {
                        case "Scan Interval":
                            SrvAtrScanIntvlTextBox.Text = attrval;
                            break;

                        case "Off Hours Scan Interval":
                            SrvAtrOffScanIntvlTextBox.Text = attrval;
                            break;

                        case "Retry Interval":
                            SrvAtrRetryIntvlTextBox.Text = attrval;
                            break;

                        case "Response Time Threshold":
                            SrvAtrResponseThTextBox.Text = attrval;
                            break;

                        case "Failure Threshold":
                            SrvAtrFailBefAlertTextBox.Text = attrval;
                            break;

                        case "Cluster Replication Delays Threshold":
                            AdvClusterRepTextBox.Text = attrval;
                            break;

                        case "Pending Mail Threshold":
                            SrvAtrPendingMailThTextBox.Text = attrval;
                            break;

                        case "Dead Mail Threshold":
                            SrvAtrDeadMailThTextBox.Text = attrval;
                            break;

                        case "Held Mail Threshold":
                            SrvAtrHeldMailThTextBox.Text = attrval;
                            break;

                        case "Scan DB Health":
                            if (attrval == "1")
                            {
                                SrvAtrDBHealthCheckBox.Checked = true;
                            }
                            break;

                        case "BES Server":
                            if (attrval == "1")
                            {
                                AdvMonitorBESNtwrkQCheckBox.Checked = true;
                            }
                            break;

                        case "Disk Space Threshold":
                            AdvDiskSpaceThTrackBar.Position = Convert.ToInt32(Convert.ToDecimal(attrval) * 100);
                            DiskLabel.Text = AdvDiskSpaceThTrackBar.Value.ToString() + "%";
                            break;

                        case "Memory Threshold":
                            //5/23/2014 NS modified for VSPLUS-649
                            //AdvMemoryThTrackBar.Position = Convert.ToInt32(attrval);
                            AdvMemoryThTrackBar.Position = Convert.ToInt32(Convert.ToDecimal(attrval) * 100);
                            MemLabel.Text = AdvMemoryThTrackBar.Value.ToString() + "%";
                            break;

                        case "CPU Threshold":
                            //5/23/2014 NS modified for VSPLUS-649
                            //AdvCPUThTrackBar.Position = Convert.ToInt32(attrval);
                            AdvCPUThTrackBar.Position = Convert.ToInt32(Convert.ToDecimal(attrval) * 100);
                            CpuLabel.Text             = AdvCPUThTrackBar.Value.ToString() + "%";
                            break;
                        }
                    }
                }
            }


            //10/3/2013 NS modified to avoid server name duplication
            if (!IsPostBack)
            {
                DataTable dt = new DataTable();
                dt = (DataTable)Session["ImportedServers"];
                SrvCheckBoxList.DataSource = dt;
                SrvCheckBoxList.TextField  = "ServerName";
                SrvCheckBoxList.ValueField = "ServerName";
                SrvCheckBoxList.DataBind();

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    SrvLabel.Text += dt.Rows[i]["ServerName"].ToString() + ", ";
                }
                SrvLabel.Text = SrvLabel.Text.Substring(0, SrvLabel.Text.Length - 2);
            }
        }
示例#9
0
        protected void AssignButton_Click(object sender, EventArgs e)
        {
            Object    ReturnValue;
            Servers   ServersObject;
            DataTable dtsrv  = new DataTable();
            DataTable dtdisk = new DataTable();

            dtdisk.Columns.Add("ServerName");
            dtdisk.Columns.Add("DiskName");
            dtdisk.Columns.Add("Threshold");
            //dtdisk.Columns.Add("ThresholdType");
            //dtdisk.Columns.Add("DiskInfo");
            //3/4/2014 NS added for VSPLUS-431
            Object ReturnValueDisk;

            DominoServers DominoServersObjectRet = new DominoServers();
            DominoServers DominoServersObject    = new DominoServers();

            if (AdvDiskSpaceThTrackBar.Value.ToString() != null)
            {
                DominoServersObject.DiskSpaceThreshold = float.Parse(AdvDiskSpaceThTrackBar.Value.ToString()) / 100;
            }
            if (AdvMemoryThTrackBar.Value.ToString() != null)
            {
                DominoServersObject.Memory_Threshold = float.Parse(AdvMemoryThTrackBar.Value.ToString()) / 100;
            }
            if (AdvCPUThTrackBar.Value.ToString() != null)
            {
                DominoServersObject.CPU_Threshold = float.Parse(AdvCPUThTrackBar.Value.ToString()) / 100;
            }
            DominoServersObject.ScanDBHealth = SrvAtrDBHealthCheckBox.Checked;
            DominoServersObject.BES_Server   = AdvMonitorBESNtwrkQCheckBox.Checked;
            if (SrvAtrPendingMailThTextBox.Text != null && SrvAtrPendingMailThTextBox.Text != "")
            {
                DominoServersObject.PendingThreshold = int.Parse(SrvAtrPendingMailThTextBox.Text);
            }
            if (SrvAtrDeadMailThTextBox.Text != null && SrvAtrDeadMailThTextBox.Text != "")
            {
                //5/15/2013 NS modified
                DominoServersObject.DeadMailDeleteThreshold = 0;
                DominoServersObject.DeadThreshold           = int.Parse(SrvAtrDeadMailThTextBox.Text);
            }
            if (SrvAtrHeldMailThTextBox.Text != null && SrvAtrHeldMailThTextBox.Text != "")
            {
                DominoServersObject.HeldThreshold = int.Parse(SrvAtrHeldMailThTextBox.Text);
            }
            if (SrvAtrScanIntvlTextBox.Text != null && SrvAtrScanIntvlTextBox.Text != "")
            {
                DominoServersObject.ScanInterval = int.Parse(SrvAtrScanIntvlTextBox.Text);
            }
            if (SrvAtrOffScanIntvlTextBox.Text != null && SrvAtrOffScanIntvlTextBox.Text != "")
            {
                DominoServersObject.OffHoursScanInterval = int.Parse(SrvAtrOffScanIntvlTextBox.Text);
            }
            if (SrvAtrRetryIntvlTextBox.Text != null && SrvAtrRetryIntvlTextBox.Text != "")
            {
                DominoServersObject.RetryInterval = int.Parse(SrvAtrRetryIntvlTextBox.Text);
            }
            if (SrvAtrResponseThTextBox.Text != null && SrvAtrResponseThTextBox.Text != "")
            {
                DominoServersObject.ResponseThreshold = int.Parse(SrvAtrResponseThTextBox.Text);
            }
            if (SrvAtrFailBefAlertTextBox.Text != null && SrvAtrFailBefAlertTextBox.Text != "")
            {
                DominoServersObject.FailureThreshold = int.Parse(SrvAtrFailBefAlertTextBox.Text);
            }
            if (AdvClusterRepTextBox.Text != null && AdvClusterRepTextBox.Text != "")
            {
                DominoServersObject.Cluster_Rep_Delays_Threshold = float.Parse(AdvClusterRepTextBox.Text.ToString());
            }
            SrvCheckBoxList.SelectAll();
            if (SrvCheckBoxList.SelectedItems.Count > 0)
            {
                dtsrv.Columns.Add("ID");
                dtsrv.Columns.Add("ServerName");
                dtsrv.Columns.Add("IPAddress");
                dtsrv.Columns.Add("Description");
                dtsrv.Columns.Add("ServerType");
                dtsrv.Columns.Add("Location");
                dtsrv.Columns.Add("LocationID");
                for (int i = 0; i < SrvCheckBoxList.SelectedItems.Count; i++)
                {
                    DataRow dr = dtsrv.NewRow();
                    dr["ID"]          = "";
                    dr["ServerName"]  = SrvCheckBoxList.SelectedItems[i].ToString();
                    dr["IPAddress"]   = "";
                    dr["Description"] = "Production";
                    dr["ServerType"]  = "Domino";
                    dr["Location"]    = "";
                    dr["LocationID"]  = 0;
                    ServersObject     = CollectDataForServers("Insert", dr);
                    DataTable dt = VSWebBL.SecurityBL.ServersBL.Ins.GetDataByName(ServersObject);
                    if (dt.Rows.Count > 0)
                    {
                        DominoServersObject.Key = int.Parse(dt.Rows[0]["ID"].ToString());
                    }
                    DominoServersObject.Category = dr["Description"].ToString();
                    DominoServersObject.Enabled  = true;
                    DominoServersObjectRet       = VSWebBL.ConfiguratorBL.DominoPropertiesBL.Ins.GetData(DominoServersObject);
                    //7/24/2015 NS added for VSPLUS-2013
                    DominoServersObject.ScanTravelerServer = true;
                    DominoServersObject.ScanServlet        = true;
                    ReturnValue = VSWebBL.ConfiguratorBL.DominoPropertiesBL.Ins.UpdateData(DominoServersObject);
                    //Clearing the previous added rows
                    //(22/4/16 sowmya added for VSPLUS-2821)
                    dtdisk.Rows.Clear();
                    //3/4/2014 NS added for VSPLUS-431
                    DataRow row = dtdisk.Rows.Add();
                    row["ServerName"] = SrvCheckBoxList.SelectedItems[i].ToString();
                    //2/11/2016 Durga Added for VSPLUS 2432
                    row["DiskName"]  = "NoAlerts";
                    row["Threshold"] = "0";

                    ReturnValueDisk = VSWebBL.ConfiguratorBL.DominoPropertiesBL.Ins.InsertDiskSettingsData(dtdisk);
                }
                Response.Redirect("~/Security/ImportServers3.aspx", false);//Mukund, 05Aug14, VSPLUS-844:Page redirect on callback
                Context.ApplicationInstance.CompleteRequest();
            }
        }
示例#10
0
        public void LoadExchangeDAG()
        {
            if (ExchangeServerTextBox.Text.ToLower().Contains("http://") == false && ExchangeServerTextBox.Text.ToLower().Contains("https://") == false)
            {
                errorDiv.InnerHtml   = "Not a Valid Exchange Server Address!. Server Address shoud be in the form of 'https://myexchange.com'";
                errorDiv.Style.Value = "display: block";
                return;
            }

            DataTable dt       = new DataTable();
            string    strError = "";
            string    UserName = "";
            string    Password = "";

            if (CredentialsComboBox.Text != "")
            {
                ArrayList Cred = getCredentials();
                if (Cred.Count > 1)
                {
                    UserName = Cred[0].ToString();
                    Password = Cred[1].ToString();

                    if (UserName == "" || Password == "")
                    {
                        errorDiv.InnerHtml   = "User Id or Password not set for the selected Credentials";
                        errorDiv.Style.Value = "display: block";
                        return;
                    }
                }
            }
            else
            {
                UserName = UserIdtextBox.Text;                // "jnittech\\administrator";
                Password = PasswordTextbox.Text;              // "Pa$$w0rd";
                if (UserName == "" || Password == "")
                {
                    errorDiv.InnerHtml   = "Please Enter the User Id and Password.";
                    errorDiv.Style.Value = "display: block";
                    return;
                }
            }
            Uid = UserName;
            Pwd = Password;


            string IPAddress = ExchangeServerTextBox.Text;            // "https://jnittech-exchg1.jnittech.com";
            //ViewState["Pwd"] = Password;
            //ViewState.Add("Pwd", Password);
            bool updatedsrv = VSWebBL.SettingBL.SettingsBL.Ins.UpdateSvalue("Primary Exchange Server", ExchangeServerTextBox.Text, VSWeb.Constants.Constants.SysString);

            System.Uri uri = new Uri(IPAddress + "/powershell?serializationLevel=Full");
            System.Security.SecureString securePassword = String2SecureString(Password);
            PSCredential creds      = new PSCredential(UserName, securePassword);
            Runspace     runspace   = RunspaceFactory.CreateRunspace();
            PowerShell   powershell = PowerShell.Create();

            PSCommand command = new PSCommand();

            command.AddCommand("New-PSSession");
            command.AddParameter("ConfigurationName", "Microsoft.Exchange");
            command.AddParameter("ConnectionUri", uri);
            command.AddParameter("Credential", creds);
            command.AddParameter("Authentication", "Default");
            System.Collections.ObjectModel.Collection <PSObject> results = new System.Collections.ObjectModel.Collection <PSObject>();

            PSSessionOption sessionOption = new PSSessionOption();

            sessionOption.SkipCACheck         = true;
            sessionOption.SkipCNCheck         = true;
            sessionOption.SkipRevocationCheck = true;

            command.AddParameter("SessionOption", sessionOption);
            powershell.AddScript(@"set-executionpolicy unrestricted");
            powershell.Commands = command;

            try
            {
                using (runspace)
                {
                    runspace.Open();
                    powershell.Runspace = runspace;
                    System.Collections.ObjectModel.Collection <PSSession> result = powershell.Invoke <PSSession>();

                    //foreach (ErrorRecord current in powershell.Streams.Error)
                    //{
                    //    strError += "Exception Importing Servers: " + current.Exception.ToString() + ",\r\nInner Exception: " + current.Exception.InnerException;
                    //    errorDiv.InnerHtml = strError;
                    //    errorDiv.Style.Value = "display: block";
                    //    return;
                    //}

                    if (result.Count == 0)
                    {
                        //errorDiv.InnerHtml = "Unexpected number of Remote Runspace connections returned.";
                        //errorDiv.Style.Value = "display: block";
                        //return;
                        foreach (ErrorRecord current in powershell.Streams.Error)
                        {
                            strError            += "Exception Importing Servers: " + current.Exception.ToString() + ",\r\nInner Exception: " + current.Exception.InnerException;
                            errorDiv.InnerHtml   = strError;
                            errorDiv.Style.Value = "display: block";
                            return;
                        }
                    }
                    PSSession pssession = (PSSession)result[0];
                    command = new PSCommand();
                    command.AddCommand("Set-Variable");
                    command.AddParameter("Name", "ra");
                    command.AddParameter("Value", result[0]);
                    powershell.Commands = command;;
                    powershell.Invoke();


                    command = new PSCommand();
                    command.AddScript("Import-PSSession -Session $ra -CommandName Get-DatabaseAvailabilityGroup, Test-ReplicationHealth, Get-MailboxDatabase, Get-MailboxDatabaseCopyStatus");
                    powershell.Commands = command;
                    powershell.Invoke();

                    powershell.Streams.Error.Clear();

                    String str = "Get-DatabaseAvailabilityGroup | Select-Object -Property Name,WitnessServer";
                    powershell.AddScript(str);

                    results = powershell.Invoke();

                    dt.Columns.Add("DAGName", typeof(string));
                    dt.Columns.Add("WitnessServer", typeof(string));
                    if (results.Count > 0)
                    {
                        foreach (PSObject ps in results)
                        {
                            string Fqdn = ps.Properties["Name"].Value.ToString();
                            string name = ps.Properties["Name"].Value.ToString();
                            //load exchange servers
                            errorDiv.Style.Value     = "display: none;";
                            errorinfoDiv.Style.Value = "display: none";
                            DataTable LocationsDataTable = new DataTable();
                            LocationsDataTable = VSWebBL.SecurityBL.LocationsBL.Ins.GetAllData();
                            if (LocationsDataTable.Rows.Count > 0)
                            {
                                LocComboBox.DataSource = LocationsDataTable;
                                LocComboBox.TextField  = "Location";
                                LocComboBox.ValueField = "Location";
                                LocComboBox.DataBind();
                                LocIDComboBox.DataSource = LocationsDataTable;
                                LocIDComboBox.TextField  = "ID";
                                LocIDComboBox.ValueField = "ID";
                                LocIDComboBox.DataBind();

                                try
                                {
                                    DataRow[] foundRows;

                                    DataTable importedDT;
                                    importedDT = VSWebBL.ConfiguratorBL.AlertsBL.Ins.GetServer();
                                    foundRows  = importedDT.Select("ServerName = '" + name + "'");
                                    if (foundRows.Length == 0)
                                    {
                                        DataRow dr = dt.NewRow();
                                        dr["DAGName"]       = name;
                                        dr["WitnessServer"] = name;
                                        dt.Rows.Add(dr);
                                        dr = dt.NewRow();
                                    }
                                }
                                catch (Exception ex)
                                {
                                    errorDiv.InnerHtml       = "The following error has occurred: " + ex.Message;
                                    errorDiv.Style.Value     = "display: block";
                                    errorinfoDiv.Style.Value = "display: block";
                                    Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                                    return;
                                }
                            }
                            else
                            {
                                errorDiv.InnerHtml   = "All imported servers must be assigned to a location. There were no locations found. Please create at least one location entry using the 'Setup & Security - Maintain Server Locations' menu option.";
                                errorDiv.Style.Value = "display: block";
                                return;
                            }
                        }
                        results.Clear();
                        result.Clear();
                        if (dt.Rows.Count > 0)
                        {
                            infoDiv.Style.Value        = "display: block";
                            SrvCheckBoxList.DataSource = dt;
                            SrvCheckBoxList.TextField  = "DAGName";
                            SrvCheckBoxList.ValueField = "DAGName";
                            SrvCheckBoxList.DataBind();
                            IPCheckBoxList.DataSource = dt;
                            IPCheckBoxList.TextField  = "DAGName";
                            IPCheckBoxList.ValueField = "DAGName";
                            IPCheckBoxList.DataBind();
                            ASPxRoundPanel1.Visible = true;
                        }
                        else
                        {
                            errorDiv.InnerHtml   = "There are no new servers in the address book that have not already been imported into VitalSigns.";
                            errorDiv.Style.Value = "display: block";
                            return;
                        }
                        if (pssession != null)
                        {
                            Command cmd = new Command("remove-pssession");
                            cmd.Parameters.Add("id", pssession.Id);
                            powershell.Commands.Clear();
                            powershell.Commands.AddCommand(cmd);
                            powershell.Invoke();
                        }
                        if (runspace != null)
                        {
                            if (runspace.RunspaceStateInfo.State == RunspaceState.Opened)
                            {
                                runspace.Close();
                                runspace.Dispose();
                                powershell.Dispose();
                            }
                        }
                    }
                    else
                    {
                        errorDiv.InnerHtml   = "No Servers Found!.";
                        errorDiv.Style.Value = "display: block";
                        return;
                    }
                }
                GC.Collect();
            }
            catch (Exception ex)
            {
                errorDiv.InnerHtml   = ex.Message.ToString();
                errorDiv.Style.Value = "display: block";
                return;
            }
        }
示例#11
0
        protected void AssignButton_Click(object sender, EventArgs e)
        {
            Object    ReturnValue;
            Servers   ServersObject;
            DataTable dtsrv  = new DataTable();
            DataTable dtdisk = new DataTable();

            dtdisk.Columns.Add("ServerName");
            dtdisk.Columns.Add("DiskName");
            dtdisk.Columns.Add("Threshold");
            //3/4/2014 NS added for VSPLUS-431
            Object             ReturnValueDisk;
            WebSpherePropertie websphere = new WebSpherePropertie();
            WebSpherePropertie DominoServersObjectRet = new WebSpherePropertie();

            //  DominoServers DominoServersObjectRet = new DominoServers();
            //  DominoServers DominoServersObject = new DominoServers();
            //if (AdvDiskSpaceThTrackBar.Value.ToString() != null)
            //{
            //    DominoServersObject.DiskSpaceThreshold = float.Parse(AdvDiskSpaceThTrackBar.Value.ToString()) / 100;
            //}
            if (AdvMemoryThTrackBar.Value.ToString() != null)
            {
                websphere.Memory_Threshold = int.Parse(AdvMemoryThTrackBar.Value.ToString());
            }
            if (AdvCPUThTrackBar.Value.ToString() != null)
            {
                websphere.CPU_Threshold = int.Parse(AdvCPUThTrackBar.Value.ToString());
            }
            //DominoServersObject.ScanDBHealth = SrvAtrDBHealthCheckBox.Checked;
            //DominoServersObject.BES_Server = AdvMonitorBESNtwrkQCheckBox.Checked;
            //if (SrvAtrPendingMailThTextBox.Text != null && SrvAtrPendingMailThTextBox.Text != "")
            //{
            //    DominoServersObject.PendingThreshold = int.Parse(SrvAtrPendingMailThTextBox.Text);
            //}
            //if (SrvAtrDeadMailThTextBox.Text != null && SrvAtrDeadMailThTextBox.Text != "")
            //{
            //    //5/15/2013 NS modified
            //    DominoServersObject.DeadMailDeleteThreshold = 0;
            //    DominoServersObject.DeadThreshold = int.Parse(SrvAtrDeadMailThTextBox.Text);
            //}
            //if (SrvAtrHeldMailThTextBox.Text != null && SrvAtrHeldMailThTextBox.Text != "")
            //{
            //    DominoServersObject.HeldThreshold = int.Parse(SrvAtrHeldMailThTextBox.Text);
            //}
            if (SrvAtrScanIntvlTextBox.Text != null && SrvAtrScanIntvlTextBox.Text != "")
            {
                websphere.ScanInterval = int.Parse(SrvAtrScanIntvlTextBox.Text);
            }
            if (SrvAtrOffScanIntvlTextBox.Text != null && SrvAtrOffScanIntvlTextBox.Text != "")
            {
                websphere.OffHoursScanInterval = int.Parse(SrvAtrOffScanIntvlTextBox.Text);
            }
            if (SrvAtrRetryIntvlTextBox.Text != null && SrvAtrRetryIntvlTextBox.Text != "")
            {
                websphere.RetryInterval = int.Parse(SrvAtrRetryIntvlTextBox.Text);
            }
            if (SrvAtrResponseThTextBox.Text != null && SrvAtrResponseThTextBox.Text != "")
            {
                websphere.ResponseThreshold = int.Parse(SrvAtrResponseThTextBox.Text);
            }
            if (SrvAtrFailBefAlertTextBox.Text != null && SrvAtrFailBefAlertTextBox.Text != "")
            {
                websphere.FailureThreshold = int.Parse(SrvAtrFailBefAlertTextBox.Text);
            }

            if (ThreadPollTextbox.Text != null && ThreadPollTextbox.Text != "")
            {
                websphere.AvgThreadPool = int.Parse(ThreadPollTextbox.Text);
            }
            if (HeapCurrentTextBox.Text != null && HeapCurrentTextBox.Text != "")
            {
                websphere.CurrentHeap = HeapCurrentTextBox.Text;
            }
            if (UpTimeTextBox.Text != null && UpTimeTextBox.Text != "")
            {
                websphere.Uptime = int.Parse(UpTimeTextBox.Text);
            }
            if (DumpGeneratorTextBox.Text != null && DumpGeneratorTextBox.Text != "")
            {
                websphere.DumpGenerated = DumpGeneratorTextBox.Text;
            }
            if (ThreadCountTextBox.Text != null && ThreadCountTextBox.Text != "")
            {
                websphere.ActiveThreadCount = int.Parse(ThreadCountTextBox.Text);
            }
            if (MaximunHeapTextBox.Text != null && MaximunHeapTextBox.Text != "")
            {
                websphere.MaxHeap = MaximunHeapTextBox.Text;
            }
            if (HungThradTextBox.Text != null && HungThradTextBox.Text != "")
            {
                websphere.HungThreadCount = int.Parse(HungThradTextBox.Text);
            }

            //if (AdvClusterRepTextBox.Text != null && AdvClusterRepTextBox.Text != "")
            //{
            //    DominoServersObject.Cluster_Rep_Delays_Threshold = float.Parse(AdvClusterRepTextBox.Text.ToString());
            //}
            SrvCheckBoxList.SelectAll();
            if (SrvCheckBoxList.SelectedItems.Count > 0)
            {
                dtsrv.Columns.Add("ID");
                dtsrv.Columns.Add("ServerName");
                dtsrv.Columns.Add("IPAddress");
                dtsrv.Columns.Add("Description");
                dtsrv.Columns.Add("ServerType");
                dtsrv.Columns.Add("Location");
                dtsrv.Columns.Add("LocationID");
                for (int i = 0; i < SrvCheckBoxList.SelectedItems.Count; i++)
                {
                    DataRow dr = dtsrv.NewRow();
                    dr["ID"]          = "";
                    dr["ServerName"]  = SrvCheckBoxList.SelectedItems[i].ToString();
                    dr["IPAddress"]   = "";
                    dr["Description"] = "Production";
                    dr["ServerType"]  = "WebSphere";
                    dr["Location"]    = "";
                    dr["LocationID"]  = 0;
                    ServersObject     = CollectDataForServers("Insert", dr);
                    DataTable dt = VSWebBL.SecurityBL.ServersBL.Ins.GetDataByName(ServersObject);
                    if (dt.Rows.Count > 0)
                    {
                        websphere.ServerID = int.Parse(dt.Rows[0]["ID"].ToString());
                    }
                    websphere.Category     = dr["Description"].ToString();
                    websphere.Enabled      = true;
                    DominoServersObjectRet = VSWebBL.ConfiguratorBL.WebSpherepropertiesBL.Ins.GetData(websphere);
                    ReturnValue            = VSWebBL.ConfiguratorBL.WebSpherepropertiesBL.Ins.UpdatesData(websphere);


                    //DataTable      dt1 = VSWebBL.SecurityBL.ServersBL.Ins.GetAllDataByName(ServersObject);
                    //     if (dt1.Rows.Count > 0)
                    //     {

                    //         //DescTextBox.Text = dt.Rows[0]["Description"].ToString();

                    //         SrvAtrRetryIntvlTextBox.Text = dt1.Rows[0]["RetryInterval"].ToString();
                    //         SrvAtrResponseThTextBox.Text = dt1.Rows[0]["ResponseTime"].ToString();
                    //         SrvAtrOffScanIntvlTextBox.Text = dt1.Rows[0]["OffHourInterval"].ToString();
                    //         AdvCPUThTrackBar.Value = dt1.Rows[0]["CPU_Threshold"].ToString();

                    //         AdvMemoryThTrackBar.Value = dt1.Rows[0]["MemThreshold"].ToString();


                    //         SrvAtrScanIntvlTextBox.Text = dt1.Rows[0]["ScanInterval"].ToString();
                    //         SrvAtrFailBefAlertTextBox.Text = dt1.Rows[0]["ConsFailuresBefAlert"].ToString();


                    //     }
                    // DataTable    dt2 = VSWebBL.ConfiguratorBL.WebSpherepropertiesBL.Ins.GetAllDataByNames(websphere);
                    // if (dt2.Rows.Count > 0)
                    //     {
                    //         ThreadPollTextbox.Text = dt2.Rows[0]["AvgThreadPool"].ToString();
                    //         ThreadCountTextBox.Text = dt2.Rows[0]["ActiveThreadCount"].ToString();
                    //         HeapCurrentTextBox.Text = dt2.Rows[0]["CurrentHeap"].ToString();
                    //         MaximunHeapTextBox.Text = dt2.Rows[0]["MaxHeap"].ToString();
                    //         UpTimeTextBox.Text = dt2.Rows[0]["Uptime"].ToString();
                    //         HungThradTextBox.Text = dt2.Rows[0]["HungThreadCount"].ToString();
                    //         DumpGeneratorTextBox.Text = dt2.Rows[0]["DumpGenerated"].ToString();
                    //     }
                    //     Object result = VSWebBL.SecurityBL.ServersBL.Ins.UpdateAttributesData(CollectDataforMSServers());
                    //     Object result1 = VSWebBL.ConfiguratorBL.WebSpherepropertiesBL.Ins.UpdateData(CollectDataforWebSphereServices());
                    //3/4/2014 NS added for VSPLUS-431
                    //DataRow row = dtdisk.Rows.Add();
                    //row["ServerName"] = SrvCheckBoxList.SelectedItems[i].ToString();
                    //row["DiskName"] = "0";
                    //row["Threshold"] = "0";
                    //ReturnValueDisk = VSWebBL.ConfiguratorBL.DominoPropertiesBL.Ins.InsertDiskSettingsData(dtdisk);
                }
                Response.Redirect("~/Security/WebsphereCellGrid.aspx", false);//Mukund, 05Aug14, VSPLUS-844:Page redirect on callback
                Context.ApplicationInstance.CompleteRequest();
            }
        }