Exemple #1
0
        public LyncServers CollectDataforLyncServers()
        {
            LyncServers lyncobj = new LyncServers();

            try
            {
                lyncobj.Enabled              = EnabledCheckBox.Checked;
                lyncobj.CPUThreshold         = int.Parse(AdvCPUThTrackBar.Value.ToString());
                lyncobj.MemoryThreshold      = int.Parse(AdvMemoryThTrackBar.Value.ToString());
                lyncobj.Category             = CategoryTextBox.Text;
                lyncobj.OffHoursScanInterval = (OffscanTextBox.Text == "" ? 0 : Convert.ToInt32(OffscanTextBox.Text));
                lyncobj.ScanInterval         = (ScanIntvlTextBox.Text == "" ? 0 : Convert.ToInt32(ScanIntvlTextBox.Text));
                lyncobj.ResponseThreshold    = (ResponseTextBox.Text == "" ? 0 : Convert.ToInt32(ResponseTextBox.Text));
                lyncobj.RetryInterval        = (RetryTextBox.Text == "" ? 0 : Convert.ToInt32(RetryTextBox.Text));
                lyncobj.FailureThreshold     = (ConsFailuresBefAlertTextBox.Text == "" ? 0 : Convert.ToInt32(ConsFailuresBefAlertTextBox.Text));
                lyncobj.ServerID             = Convert.ToInt32(lblServerId.Text);
                lyncobj.CredentialsID        = (CredentialsComboBox.Text == "" ? 0 : Convert.ToInt32(CredentialsComboBox.Value));
            }
            catch (Exception ex)
            {
                //6/27/2014 NS added for VSPLUS-634
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                throw ex;
            }
            return(lyncobj);
        }
Exemple #2
0
        public Object UpdateData(LyncServers ServerObject)
        {
            Object Update;

            try
            {
                DataTable dt = GetData(ServerObject.ServerID);
                if (dt.Rows.Count > 0)
                {
                    string SqlQuery = "UPDATE LyncServers SET Enabled='" + ServerObject.Enabled.ToString() +
                                      "',ScanInterval=" + ServerObject.ScanInterval + ",RetryInterval=" + ServerObject.RetryInterval +
                                      ",OffHoursScanInterval=" + ServerObject.OffHoursScanInterval + ",Category='" + ServerObject.Category +
                                      "',CPUThreshold=" + ServerObject.CPUThreshold + ",MemoryThreshold=" + ServerObject.MemoryThreshold +
                                      ",ResponseThreshold=" + ServerObject.ResponseThreshold +
                                      ",FailureThreshold=" + ServerObject.FailureThreshold + ",CredentialsId =" + ServerObject.CredentialsID +
                                      " where ServerId=" + ServerObject.ServerID + "";

                    Update = objAdaptor.ExecuteNonQuery(SqlQuery);
                }
                else
                {
                    Update = InsertData(ServerObject);
                }
            }
            catch
            {
                Update = false;
            }
            finally
            {
            }
            return(Update);
        }
Exemple #3
0
 public Object UpdateData(LyncServers ServerObject)
 {
     try
     {
         return(VSWebDAL.ConfiguratorDAL.LyncDAL.Ins.UpdateData(ServerObject));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #4
0
        public bool InsertData(LyncServers ServerObject)
        {
            bool Insert = false;

            try
            {
                string SqlQuery = "INSERT INTO [LyncServers] (ServerID,Category,ScanInterval,RetryInterval," +
                                  "OffHoursScanInterval,ResponseThreshold,FailureThreshold,MemoryThreshold,CPUThreshold,CredentialsID,Enabled) " +
                                  " VALUES(" + ServerObject.ServerID + ",'" + ServerObject.Category + "'," +
                                  ServerObject.ScanInterval + "," + ServerObject.RetryInterval + "," + ServerObject.OffHoursScanInterval + "," +
                                  ServerObject.ResponseThreshold + "," + ServerObject.FailureThreshold + "," + ServerObject.MemoryThreshold + "," +
                                  ServerObject.CPUThreshold + "," + ServerObject.CredentialsID + ",'" + ServerObject.Enabled + "')";

                Insert = objAdaptor.ExecuteNonQuery(SqlQuery);
            }
            catch
            {
                Insert = false;
            }
            finally
            {
            }
            return(Insert);
        }