Example #1
0
        private void SaveNwLtncyServerGrid()
        {
            bool Update = false;

            try
            {
                DataTable nwlatencyDataTable = new DataTable();
                if (Session["NetworkLatency"] != null && Session["NetworkLatency"] != "")
                {
                    nwlatencyDataTable = (DataTable)Session["NetworkLatency"];
                }
                List <object> fieldValues = NetworkLatencyTestgrd.GetSelectedFieldValues(new string[] { "LatencyYellowThreshold", "LatencyRedThreshold", "Enabled" });


                if (fieldValues.Count > 0)
                {
                    //10/21/2015 NS modified for VSPLUS-2223
                    VSWebBL.ConfiguratorBL.NetworkLatencyBL.Ins.DeleteNetworkLatencyServers(ServerKey.ToString());
                    for (int i = 0; i < nwlatencyDataTable.Rows.Count; i++)
                    {
                        //ProfilesDataTable.Rows[0]["isSelected"] = "True";
                        id     = Convert.ToInt32(nwlatencyDataTable.Rows[i]["ID"]);
                        Update = VSWebBL.ConfiguratorBL.NetworkLatencyBL.Ins.Updatelatency(CollectDataForProfiles(nwlatencyDataTable.Rows[i]), nwlatencyDataTable.Rows[i]["ID"].ToString(), testtxtname.Text);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                throw ex;
            }
            finally { }
        }
Example #2
0
        protected int GetFilteredRowCountWithoutPage()
        {
            int selectedRowsOnPage = 0;

            foreach (var key in NetworkLatencyTestgrd.GetCurrentPageRowValues("ID"))
            {
                if (NetworkLatencyTestgrd.Selection.IsRowSelectedByKey(key))
                {
                    selectedRowsOnPage++;
                }
            }
            return(NetworkLatencyTestgrd.Selection.FilteredCount - selectedRowsOnPage);
        }
        private void FillNwlatencyServerGrid(string servertype)
        {
            try
            {
                DataTable      networklatencyDataTable = new DataTable();
                NetworkLatency NetworkLatencyObject    = new NetworkLatency();
                networklatencyDataTable = VSWebBL.ConfiguratorBL.NetworkLatencyBL.Ins.Getvalue();

                if ((scantext.Text == null) || (scantext.Text == ""))
                {
                    scantext.Text = "8";
                }
                else
                {
                    scantext.Text = networklatencyDataTable.Rows[0]["ScanInterval"].ToString();
                }
                if ((testduration.Text == null) || (testduration.Text == ""))
                {
                    testduration.Text = "5";
                }
                else
                {
                    testduration.Text = networklatencyDataTable.Rows[0]["TestDuration"].ToString();
                }



                groupname.Text = networklatencyDataTable.Rows[0]["TestDuration"].ToString();



                nwDataTable = VSWebBL.ConfiguratorBL.NetworkLatencyBL.Ins.GetAllData1(ServerTypeComboBox.SelectedItem.Text);
                // for(int i=0;i>d)
                //{
                //ID
                //insert in to network table
                //}
                DataColumn[] columns = new DataColumn[1];
                columns[0]                       = nwDataTable.Columns["ServerID"];
                nwDataTable.PrimaryKey           = columns;
                Session["NetworkLatency"]        = nwDataTable;
                NetworkLatencyTestgrd.DataSource = nwDataTable;
                NetworkLatencyTestgrd.DataBind();
            }
            catch (Exception ex)
            {
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                throw ex;
            }
            finally { }
        }
 private void FillNwLtncyServerGridfromSession()
 {
     try
     {
         DataTable nwlatencyDataTable = new DataTable();
         if (Session["NetworkLatency"] != null && Session["NetworkLatency"] != "")
         {
             nwlatencyDataTable = (DataTable)Session["NetworkLatency"];//VSWebBL.ConfiguratorBL.ExchangePropertiesBL.Ins.GetAllData();
         }
         if (nwlatencyDataTable.Rows.Count > 0)
         {
             GridViewDataColumn column5 = NetworkLatencyTestgrd.Columns["LatencyYellowThreshold"] as GridViewDataColumn;
             GridViewDataColumn column6 = NetworkLatencyTestgrd.Columns["LatencyRedThreshold"] as GridViewDataColumn;
             int startIndex             = NetworkLatencyTestgrd.PageIndex * NetworkLatencyTestgrd.SettingsPager.PageSize;
             int endIndex = Math.Min(NetworkLatencyTestgrd.VisibleRowCount, startIndex + NetworkLatencyTestgrd.SettingsPager.PageSize);
             for (int i = startIndex; i < endIndex; i++)
             {
                 ASPxTextBox txtValue  = (ASPxTextBox)NetworkLatencyTestgrd.FindRowCellTemplateControl(i, column5, "txtyellowthreshValue");
                 ASPxTextBox txtValue2 = (ASPxTextBox)NetworkLatencyTestgrd.FindRowCellTemplateControl(i, column6, "txtredthreshValue");
                 nwlatencyDataTable.Rows[i]["LatencyYellowThreshold"] = txtValue.Text;
                 nwlatencyDataTable.Rows[i]["LatencyRedThreshold"]    = txtValue2.Text;
                 if (NetworkLatencyTestgrd.Selection.IsRowSelected(i))
                 {
                     checkedvalue = Convert.ToBoolean(nwlatencyDataTable.Rows[i]["Enabled"] = "true");
                 }
                 else
                 {
                     nwlatencyDataTable.Rows[i]["Enabled"] = "false";
                     checkedvalue = Convert.ToBoolean(nwlatencyDataTable.Rows[i]["Enabled"] = "false");
                 }
                 id = Convert.ToInt32(NetworkLatencyTestgrd.GetRowValues(i, "ID"));
                 yellowthershold = Convert.ToInt32(txtValue.Text);
                 latency         = Convert.ToInt32(txtValue2.Text);
                 object dt = VSWebBL.ConfiguratorBL.NetworkLatencyBL.Ins.updateEnableLatencyTest(id, yellowthershold, latency, checkedvalue);
             }
         }
         NetworkLatencyTestgrd.DataSource = nwlatencyDataTable;
         NetworkLatencyTestgrd.DataBind();
     }
     catch (Exception ex)
     {
         Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
         throw ex;
     }
     finally { }
 }
Example #5
0
        private bool UpdateThresholds()
        {
            string    errtext       = "";
            bool      success       = true;
            DataTable pagedatatable = new DataTable();

            pagedatatable = (DataTable)Session["NetworkLatency"];
            //pagedatatable.Reset();
            if (pagedatatable.Rows.Count > 0)
            {
                List <object> fieldValues = ThresholdGridView.GetSelectedFieldValues(new string[] { "ID" });
                if (fieldValues.Count != 0)
                {
                    DataTable dt = new DataTable();
                    DataRow[] foundrows;
                    foreach (int item in fieldValues)
                    {
                        foundrows = pagedatatable.Select("ID=" + item.ToString());
                        if (foundrows.Length > 0)
                        {
                            foundrows[0]["LatencyYellowThreshold"] = txtyellothld.Text;
                            foundrows[0]["LatencyRedThreshold"]    = txtredthreshold.Text;
                        }
                    }
                    pagedatatable.AcceptChanges();
                    NetworkLatencyTestgrd.DataSource = pagedatatable;
                    NetworkLatencyTestgrd.DataBind();
                    errorDiv2.Style.Value  = "display: none";
                    successDiv.Style.Value = "display: block";
                }
                else
                {
                    errorDiv2.Style.Value  = "display: block";
                    successDiv.Style.Value = "display: none";
                    errtext             = "Please select at least one server.";
                    errorDiv2.InnerHtml = errtext + "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>";
                    success             = false;
                }
            }
            return(success);
        }
Example #6
0
        protected void chkRow_CheckedChanged1(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();
            DataTable nwlatencyDataTable = new DataTable();
            int       ids = 0;
            //string value = "";
            bool flag = false;

            nwlatencyDataTable = (DataTable)Session["NetworkLatency"];
            int startIndex = NetworkLatencyTestgrd.PageIndex * NetworkLatencyTestgrd.SettingsPager.PageSize;
            int endIndex   = Math.Min(NetworkLatencyTestgrd.VisibleRowCount, startIndex + NetworkLatencyTestgrd.SettingsPager.PageSize);

            if (nwlatencyDataTable.Rows.Count > 0)
            {
                for (int i = startIndex; i < endIndex; i++)
                {
                    GridViewDataColumn Ischeck   = NetworkLatencyTestgrd.Columns[0] as GridViewDataColumn;
                    CheckBox           chkSelect = NetworkLatencyTestgrd.FindRowCellTemplateControl(i, Ischeck, "chkRow") as CheckBox;

                    if (chkSelect != null)
                    {
                        bool Isselect = chkSelect.Checked;

                        if (chkSelect.Checked)
                        {
                            nwlatencyDataTable = (DataTable)Session["NetworkLatency"];

                            string yellow = txtyellothld.Text;
                            string red    = txtredthreshold.Text;

                            if (Session["NetworkLatency"] != null && Session["NetworkLatency"] != "")
                            {
                                nwlatencyDataTable = (DataTable)Session["NetworkLatency"];
                            }

                            //FillNwLtncyServerGridfromSessionnew();
                            ids = Convert.ToInt32(NetworkLatencyTestgrd.GetRowValues(i, "ID"));

                            nwlatencyDataTable = (DataTable)Session["NetworkLatency"];
                            var rowsToUpdate = nwlatencyDataTable.AsEnumerable().Where(r => r.Field <int>("ID") == ids);

                            foreach (var row in rowsToUpdate)
                            {
                                row.SetField("LatencyYellowThreshold", yellow);
                                row.SetField("LatencyRedThreshold", red);
                            }

                            nwlatencyDataTable.Rows[i]["Isselected"] = Isselect;
                        }

                        nwlatencyDataTable.Rows[i]["Isselected"] = Isselect;


                        nwlatencyDataTable.AcceptChanges();
                        Session["NetworkLatency"] = nwlatencyDataTable;
                    }
                }
            }
            NetworkLatencyTestgrd.DataSource = (DataTable)Session["NetworkLatency"];
            NetworkLatencyTestgrd.DataBind();
        }
Example #7
0
        private void FillNwLtncyServerGridfromSessionnew()
        {
            try
            {
                DataTable nwlatencyDataTable = new DataTable();
                if (Session["NetworkLatency"] != null && Session["NetworkLatency"] != "")
                {
                    nwlatencyDataTable = (DataTable)Session["NetworkLatency"];
                }
                if (nwlatencyDataTable.Rows.Count > 0)
                {
                    GridViewDataColumn column3 = NetworkLatencyTestgrd.Columns["LatencyYellowThreshold"] as GridViewDataColumn;
                    GridViewDataColumn column4 = NetworkLatencyTestgrd.Columns["LatencyRedThreshold"] as GridViewDataColumn;
                    int startIndex             = NetworkLatencyTestgrd.PageIndex * NetworkLatencyTestgrd.SettingsPager.PageSize;
                    int endIndex = Math.Min(NetworkLatencyTestgrd.VisibleRowCount, startIndex + NetworkLatencyTestgrd.SettingsPager.PageSize);

                    for (int i = startIndex; i < endIndex; i++)
                    {
                        ASPxTextBox txtValue  = (ASPxTextBox)NetworkLatencyTestgrd.FindRowCellTemplateControl(i, column3, "txtyellowthreshValue");
                        ASPxTextBox txtValue2 = (ASPxTextBox)NetworkLatencyTestgrd.FindRowCellTemplateControl(i, column4, "txtredthreshValue");
                        string      yellow    = txtyellothld.Text;
                        string      red       = txtredthreshold.Text;
                        if (txtValue != null)
                        {
                            nwlatencyDataTable.Rows[i]["LatencyYellowThreshold"] = txtyellothld.Text;
                        }

                        if (txtValue2 != null)
                        {
                            nwlatencyDataTable.Rows[i]["LatencyRedThreshold"] = txtredthreshold.Text;
                        }
                        //if (txtValue != null)
                        //{
                        //    nwlatencyDataTable.Rows[i]["LatencyYellowThreshold"] = (txtValue.Text == "" ? "0" : txtValue.Text);
                        //    if ((txtValue.Text != null) && (txtValue.Text != ""))
                        //    {
                        //        nwlatencyDataTable.Rows[i]["LatencyYellowThreshold"] = txtValue.Text;
                        //    }
                        //    else
                        //    {

                        //        txtValue.Text = "30";
                        //        //int Result = 0;
                        //        //int.TryParse(txtValue.Text, out Result);
                        //        //txtValue.Text = Result.ToString();
                        //    }

                        //}
                        //if (txtValue2 != null)
                        //{
                        //    nwlatencyDataTable.Rows[i]["LatencyRedThreshold"] = (txtValue2.Text == "" ? "0" : txtValue2.Text);

                        //    if ((txtValue2.Text != null) && (txtValue2.Text != ""))
                        //    {
                        //        nwlatencyDataTable.Rows[i]["LatencyRedThreshold"] = txtValue2.Text;
                        //    }
                        //    else
                        //    {

                        //        txtValue2.Text = "40";
                        //        //int s = 0;
                        //        //int.TryParse(txtValue2.Text, out s);
                        //        //txtValue2.Text = s.ToString();
                        //    }
                        //}
                        if (NetworkLatencyTestgrd.Selection.IsRowSelected(i))
                        {
                            checkedvalue = Convert.ToBoolean(nwlatencyDataTable.Rows[i]["Enabled"] = "true");
                        }
                        else
                        {
                            nwlatencyDataTable.Rows[i]["Enabled"] = "false";
                            checkedvalue = Convert.ToBoolean(nwlatencyDataTable.Rows[i]["Enabled"] = "false");
                        }
                    }
                }
                NetworkLatencyTestgrd.DataSource = nwlatencyDataTable;
                NetworkLatencyTestgrd.DataBind();
            }
            catch (Exception ex)
            {
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                throw ex;
            }
            finally { }
        }
Example #8
0
        //private void FillServerTypeComboBox()
        //{
        //    DataTable ServerDataTable = VSWebBL.SecurityBL.ServerTypesBL.Ins.GetSpecificServerTypes();
        //    //DataTable ServerDataTable = VSWebBL.SecurityBL.AdminTabBL.Ins.GetNavigatorChildsByRefName("ServersDevices");
        //    servertypecombo.DataSource = ServerDataTable;
        //    servertypecombo.TextField = "ServerType";
        //    servertypecombo.ValueField = "ServerType";
        //    servertypecombo.DataBind();
        //}
        private DataTable FillNwlatencyServerGrid()
        {
            try
            {
                //10/21/2015 NS added for VSPLUS-2223
                DataTable      selectedserversDT       = new DataTable();
                DataTable      networklatencyDataTable = new DataTable();
                NetworkLatency NetworkLatencyObject    = new NetworkLatency();
                networklatencyDataTable = VSWebBL.ConfiguratorBL.NetworkLatencyBL.Ins.Getvalue1(ServerKey);
                if (networklatencyDataTable.Rows.Count > 0)
                {
                    txtscaninterval.Text = networklatencyDataTable.Rows[0]["ScanInterval"].ToString();


                    txtduration.Text = networklatencyDataTable.Rows[0]["TestDuration"].ToString();


                    testtxtname.Text           = networklatencyDataTable.Rows[0]["TestName"].ToString();
                    SrvAtrScanCheckBox.Checked = (networklatencyDataTable.Rows[0]["Enable"].ToString() == "True" ? true : false);
                }

                if ((txtscaninterval.Text == null) || (txtscaninterval.Text == ""))
                {
                    txtscaninterval.Text = "8";
                }
                if ((txtduration.Text == null) || (txtduration.Text == ""))
                {
                    txtduration.Text = "5";
                }
                string Page    = "NetworkLatencyTestServers.aspx";
                string Control = "NetworkLatencyTestgrd";
                nwDataTable = VSWebBL.ConfiguratorBL.NetworkLatencyBL.Ins.GetAllData2(ServerKey, Page, Control);
                //7/16/2015 NS commented out for VSPLUS-1511
                //DataColumn[] columns = new DataColumn[1];
                //columns[0] = nwDataTable.Columns["ID"];
                //nwDataTable.PrimaryKey = columns;

                //nwDataTable.PrimaryKey = new DataColumn[] { nwDataTable.Columns["ID"] };
                nwDataTable.Columns.Add("Isselected", typeof(System.Boolean));
                //10/21/2015 NS added for VSPLUS-2223
                NetworkLatencyTestgrd.DataSource = nwDataTable;
                selectedserversDT = VSWebBL.ConfiguratorBL.NetworkLatencyBL.Ins.GetSelectedServers(ServerKey, Page, Control);
                if (selectedserversDT.Rows.Count > 0)
                {
                    DataRow[] foundRows;
                    for (int i = 0; i < selectedserversDT.Rows.Count; i++)
                    {
                        foundRows = nwDataTable.Select("ID=" + selectedserversDT.Rows[i]["ID"].ToString() + " AND ServerTypeId=" + selectedserversDT.Rows[i]["ServerTypeId"].ToString());
                        if (foundRows.Length > 0)
                        {
                            foundRows[0]["Enabled"] = true;
                            foundRows[0]["LatencyYellowThreshold"] = Convert.ToInt32(selectedserversDT.Rows[i]["LatencyYellowThreshold"].ToString());
                            foundRows[0]["LatencyRedThreshold"]    = Convert.ToInt32(selectedserversDT.Rows[i]["LatencyRedThreshold"].ToString());
                        }
                    }
                    nwDataTable.AcceptChanges();
                }
                Session["NetworkLatency"]        = nwDataTable;
                NetworkLatencyTestgrd.DataSource = nwDataTable;
                NetworkLatencyTestgrd.DataBind();
                return(nwDataTable);
            }
            catch (Exception ex)
            {
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                throw ex;
            }

            finally { }
        }
Example #9
0
        protected void FormOkButton_Click(object sender, EventArgs e)
        {
            try
            {
                //5/1/2014 NS modified for VSPLUS-427
                bool proceed = true;
                bool Update  = false;

                //5/12/2014 NS added for VSPLUS-615
                string errtext = "";
                int    gbc     = 0;
                if (proceed)
                {
                    try
                    {
                        for (int i = 0; i < NetworkLatencyTestgrd.VisibleRowCount; i++)
                        {
                            GridViewDataColumn Ischeck   = NetworkLatencyTestgrd.Columns[0] as GridViewDataColumn;
                            CheckBox           chkSelect = NetworkLatencyTestgrd.FindRowCellTemplateControl(i, Ischeck, "chkRow") as CheckBox;
                            if (chkSelect != null)
                            {
                                if (chkSelect.Checked)
                                {
                                    UpdatenlData();
                                    if (Errormsg == false)
                                    {
                                        SaveNwLtncyServerGridnew();
                                    }
                                }
                            }
                        }
                        DataTable     ExchangeSettingsDataTable = (DataTable)Session["NetworkLatency"];
                        List <object> LatencyYellowThreshold    = NetworkLatencyTestgrd.GetSelectedFieldValues(new string[] { "LatencyYellowThreshold" });

                        if (LatencyYellowThreshold.Count != 0)
                        {
                            UpdatenlData();
                            if (Errormsg == false)
                            {
                                SaveNwLtncyServerGrid();

                                // FillNwlatencyServerGrid();


                                successDiv.Style.Value = "display: block";
                                errorDiv.Style.Value   = "display: none";
                                errtext = "Selected fields were successfully saved.";
                                successDiv.InnerHtml = errtext + "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>";
                            }
                        }
                        else
                        {
                            successDiv.Style.Value = "display: none";
                            errorDiv2.Style.Value  = "display: none";
                            errorDiv.Style.Value   = "display: block";
                            errtext            = "Please select at least one server.";
                            errorDiv.InnerHtml = errtext + "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>";
                        }
                        if (Errormsg == false)
                        {
                            if (LatencyYellowThreshold.Count != 0)
                            {
                                if (ServerKey == 0)
                                {
                                    Response.Redirect("NetworkLatencyServers.aspx", false);                                    //Mukund, 05Aug14, VSPLUS-844:Page redirect on callback
                                    Context.ApplicationInstance.CompleteRequest();
                                }
                                else
                                {
                                    //  FillNwlatencyServerGrid();
                                    Response.Redirect("NetworkLatencyServers.aspx", false);                                    //Mukund, 05Aug14, VSPLUS-844:Page redirect on callback
                                    Context.ApplicationInstance.CompleteRequest();
                                }
                            }

                            else
                            {
                                successDiv.Style.Value = "display: none";
                                errorDiv2.Style.Value  = "display: none";
                                errorDiv.Style.Value   = "display: block";
                                errtext            = "Please select at least one server.";
                                errorDiv.InnerHtml = errtext + "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>";
                            }
                        }                        //}

                        //if (ServerKey == 0)
                        //{
                        //    Response.Redirect("NetworkLatencyServers.aspx", false);//Mukund, 05Aug14, VSPLUS-844:Page redirect on callback
                        //    Context.ApplicationInstance.CompleteRequest();
                        //}
                        //else
                        //{
                        //    //FillNwlatencyServerGrid();
                        //    Response.Redirect("NetworkLatencyServers.aspx", false);//Mukund, 05Aug14, VSPLUS-844:Page redirect on callback
                        //    Context.ApplicationInstance.CompleteRequest();
                        //}
                    }
                    catch (Exception ex)
                    {
                        //6/27/2014 NS added for VSPLUS-634
                        Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                        throw ex;
                    }
                    finally { }
                }
                else
                {
                    errorDiv2.Style.Value = "display: none";
                    errorDiv.Style.Value  = "display: block;";
                    //10/6/2014 NS modified for VSPLUS-990
                    errorDiv.InnerHtml = errtext +
                                         "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>";
                }
            }
            catch (Exception ex)
            {
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                throw ex;
            }
            finally { }
        }