Пример #1
0
 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 { }
 }
Пример #2
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();
        }
Пример #3
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 { }
        }
Пример #4
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 { }
        }