Ejemplo n.º 1
0
        protected void FormOkButton_Click(object sender, EventArgs e)
        {
            //5/1/2014 NS modified for VSPLUS-427
            bool proceed = true;
            //5/12/2014 NS added for VSPLUS-615
            string errtext = "";
            int    gbc     = 0;

            //5/12/2014 NS modified for VSPLUS-615
            //if (SelCriteriaRadioButtonList.SelectedIndex == 1)
            if (SelCriteriaRadioButtonList.SelectedItem.Value.ToString() == "1")
            {
                List <object> fieldValues = DiskGridView.GetSelectedFieldValues(new string[] { "DiskName", "Threshold", "ThresholdType" });
                if (fieldValues.Count == 0)
                {
                    proceed = false;
                    isValid = false;
                    errtext = "You have enabled a 'Selected Disks' option on the Disk Settings tab but selected no disks " +
                              "in the grid or some of the selected disks do not have a threshold or threshold type value. <br />" +
                              "Please correct the disk settings in order to save your changes.";
                }
                else
                {
                    foreach (object[] item in fieldValues)
                    {
                        if (item[1].ToString() == "" || item[2].ToString() == "")
                        {
                            proceed = false;
                            isValid = false;
                            errtext = "You have enabled a 'Selected Disks' option on the Disk Settings tab but selected no disks " +
                                      "in the grid or some of the selected disks do not have a threshold or threshold type value. <br />" +
                                      "Please correct the disk settings in order to save your changes.";
                        }
                    }
                }
            }
            //5/12/2014 NS added for VSPLUS-615
            if (SelCriteriaRadioButtonList.SelectedItem.Value.ToString() == "3")
            {
                if (GBTextBox.Text == "")
                {
                    proceed = false;
                    isValid = false;
                    errtext = "You have enabled an 'All Disks - By GB' option on the Disk Settings tab but entered no threshold value. " +
                              "You must enter a numeric threshold value in order to save your changes.";
                }
                else if (!int.TryParse(GBTextBox.Text, out gbc))
                {
                    proceed = false;
                    isValid = false;
                    errtext = "You have enabled an 'All Disks - By GB' option on the Disk Settings tab but entered an invalid threshold value. " +
                              "You must enter a numeric threshold value in order to save your changes.";
                }
            }
            if (proceed)
            {
                try
                {
                    UpdateServersData();
                }
                catch (Exception ex)
                {
                    //6/27/2014 NS added for VSPLUS-634
                    Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                    throw ex;
                }
                finally { }
            }
            else
            {
                errorDiv.Style.Value = "display: block;";
                //10/3/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>";
            }
        }
Ejemplo n.º 2
0
        private bool UpdateDiskSettings()
        {
            bool ReturnValue = false;

            try
            {
                DataTable dt = new DataTable();
                dt.Columns.Add("ServerName");
                dt.Columns.Add("DiskName");
                dt.Columns.Add("Threshold");
                //5/1/2014 NS added for VSPLUS-602
                dt.Columns.Add("ThresholdType");

                dt.Columns.Add("ServerID");

                //5/1/2014 NS modified for VSPLUS-602
                List <object> fieldValues = DiskGridView.GetSelectedFieldValues(new string[] { "DiskName", "Threshold", "ThresholdType" });
                //if (DiskGridView.VisibleRowCount == fieldValues.Count)
                //12/17/2013 NS modified
                //5/12/2014 NS modified for VSPLUS-615
                if (SelCriteriaRadioButtonList.SelectedItem.Value.ToString() == "0")
                //if(rdbSelAll.Checked)
                {
                    DataRow row = dt.Rows.Add();
                    row["ServerName"] = NameTextBox.Text;
                    //5/12/2014 NS modified for VSPLUS-615
                    //row["DiskName"] = "0";
                    //row["Threshold"] = "0";
                    row["DiskName"]  = "AllDisks";
                    row["Threshold"] = (Convert.ToInt32(AdvDiskSpaceThTrackBar.Value)).ToString();
                    //5/1/2014 NS added for VSPLUS-602
                    row["ThresholdType"] = "Percent";
                    row["ServerID"]      = lblServerId.Text;
                }
                else if (SelCriteriaRadioButtonList.SelectedItem.Value.ToString() == "1")
                //else if(rdbSelFew.Checked)
                {
                    foreach (object[] item in fieldValues)
                    {
                        DataRow row = dt.Rows.Add();
                        row["ServerName"] = NameTextBox.Text;
                        row["DiskName"]   = item[0].ToString();
                        row["Threshold"]  = (item[1].ToString() != "" ? item[1].ToString() : (Convert.ToInt32(AdvDiskSpaceThTrackBar.Value)).ToString());
                        //5/1/2014 NS added for VSPLUS-602
                        row["ThresholdType"] = item[2].ToString();
                        row["ServerID"]      = lblServerId.Text;
                    }
                }
                else if (SelCriteriaRadioButtonList.SelectedItem.Value.ToString() == "2")
                //else if (rdbNoAlerts.Checked)
                {
                    DataRow row = dt.Rows.Add();
                    row["ServerName"] = NameTextBox.Text;
                    row["DiskName"]   = "NoAlerts";
                    row["Threshold"]  = "0";
                    //5/1/2014 NS added for VSPLUS-602
                    row["ThresholdType"] = "Percent";
                    row["ServerID"]      = lblServerId.Text;
                }
                //5/12/2014 NS added for VSPLUS-615
                else if (SelCriteriaRadioButtonList.SelectedItem.Value.ToString() == "3")
                {
                    DataRow row = dt.Rows.Add();
                    row["ServerName"]    = NameTextBox.Text;
                    row["DiskName"]      = "AllDisks";
                    row["Threshold"]     = GBTextBox.Text;
                    row["ThresholdType"] = "GB";
                    row["ServerID"]      = lblServerId.Text;
                }

                //Mukund, 14Apr14 , included if condition to avoid error deleting blank records
                if (dt.Rows.Count > 0)
                {
                    ReturnValue = VSWebBL.ConfiguratorBL.DominoPropertiesBL.Ins.InsertSrvDiskSettingsData(dt);
                }
            }
            catch (Exception ex)
            {
                //6/27/2014 NS added for VSPLUS-634
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                throw ex;
            }
            return(ReturnValue);
        }