Beispiel #1
0
 public void FillThresholdGridfromSession()
 {
     if (Session["NetworkLatency"] != null || Session["NetworkLatency"] != "")
     {
         DataTable dt = (DataTable)Session["NetworkLatency"];
         ThresholdGridView.DataSource = dt;
         ThresholdGridView.DataBind();
     }
 }
Beispiel #2
0
        protected void btnupdate_Click(object sender, EventArgs e)
        {
            DataTable dt = (DataTable)Session["NetworkLatency"];

            ThresholdGridView.DataSource = dt;
            ThresholdGridView.DataBind();
            ThresholdPopupControl.ShowOnPageLoad = true;

            /*
             *          int ids;
             *          //string value = "";
             *          bool flag = false;
             *          string errtext = "";
             *
             *          DataTable pagedatatable = new DataTable();
             *
             *          pagedatatable = (DataTable)Session["NetworkLatency"];
             *          //pagedatatable.Reset();
             *          if (pagedatatable.Rows.Count > 0)
             *          {
             *                  DataRow[] foundRows = pagedatatable.Select("Isselected='true'");
             *  List<object> LatencyYellowThreshold = NetworkLatencyTestgrd.GetSelectedFieldValues(new string[] { "LatencyYellowThreshold" });
             *  //if (foundRows.Length > 0)
             *                  if (LatencyYellowThreshold.Count != 0)
             *                  {
             *      GridViewDataColumn column1 = NetworkLatencyTestgrd.Columns["LatencyYellowThreshold"] as GridViewDataColumn;
             *      GridViewDataColumn column2 = NetworkLatencyTestgrd.Columns["LatencyRedThreshold"] as GridViewDataColumn;
             *                          DataTable dt = new DataTable();
             *      for (int i = 0; i < NetworkLatencyTestgrd.VisibleRowCount; i++)
             *      {
             *          if (NetworkLatencyTestgrd.Selection.IsRowSelected(i))
             *          {
             *              ASPxTextBox txtThresholdYellow = (ASPxTextBox)NetworkLatencyTestgrd.FindRowCellTemplateControl(i, column1, "txtyellowthreshValue");
             *              ASPxTextBox txtThresholdRed = (ASPxTextBox)NetworkLatencyTestgrd.FindRowCellTemplateControl(i, column2, "txtredthreshValue");
             *
             *              pagedatatable.Rows[i]["LatencyYellowThreshold"] = txtyellothld.Text;
             *              pagedatatable.Rows[i]["LatencyRedThreshold"] = txtredthreshold.Text;
             *          }
             *      }
             *      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>";
             *                  }
             *
             *          }
             */
        }
Beispiel #3
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);
        }