Esempio n. 1
0
        public Object UpdateTestsData(O365Server O365ServerObject)
        {
            Object Update;

            try
            {
                //11/19/2013 NS modified
                //string SqlQuery = "UPDATE URLs SET Name='" + URLObject.Name + "',Category='" + URLObject.Category + "',ScanInterval=" + URLObject.ScanInterval +
                //",ResponseThreshold=" + URLObject.ResponseThreshold + ",Enabled='" + URLObject.Enabled + "',OffHoursScanInterval=" + URLObject.OffHoursScanInterval +
                //",RetryInterval=" + URLObject.RetryInterval +",SearchString='" + URLObject.SearchString +"',UserName='******',PW='" + URLObject.PW+
                //"',LocationId=" + URLObject.LocationId + ",ServerTypeId=" + URLObject.ServerTypeId + ",FailureThreshold=" + URLObject.FailureThreshold + " WHERE [TheURL]='" + URLObject.TheURL + "'";
                string SqlQuery = "UPDATE O365Server SET Name='" + O365ServerObject.Name + "',Url='" + O365ServerObject.URL + "',Category='" + O365ServerObject.Category + "',ScanInterval=" + O365ServerObject.ScanInterval +
                                  ",ResponseThreshold=" + O365ServerObject.ResponseThreshold + ",Enabled='" + O365ServerObject.Enabled + "',OffHoursScanInterval=" + O365ServerObject.OffHoursScanInterval +
                                  ",RetryInterval=" + O365ServerObject.RetryInterval + ",SearchString='" + O365ServerObject.SearchStringNotFound + "',AlertStringFound='" + O365ServerObject.SearchStringFound + "',UserName='******',PW='" + O365ServerObject.PW +
                                  "',Location='" + O365ServerObject.Location + "',ServerTypeId=" + O365ServerObject.ServerTypeId + ",FailureThreshold=" + O365ServerObject.FailureThreshold +
                                  " WHERE [ID]=" + O365ServerObject.ID;
                Update = objAdaptor.ExecuteNonQuery(SqlQuery);
            }
            catch
            {
                Update = false;
            }



            return(Update);
        }
Esempio n. 2
0
        /// <summary>
        /// Insert data into URLs table
        /// </summary>
        /// <param name="DSObject">URLs object</param>
        /// <returns></returns>

        public bool InsertData(O365Server O365ServerObject)
        {
            bool Insert = false;

            try
            {
                string SqlQuery = "INSERT INTO O365Server (URL,Name,Category,ScanInterval,OffHoursScanInterval,Enabled" +
                                  ",ResponseThreshold,RetryInterval,SearchString,AlertStringFound,UserName,PW,Location,ServerTypeId,FailureThreshold,Imageurl,[Mode],[ServerName],[CredentialsId],Costperuser)" +
                                  "VALUES('" + O365ServerObject.URL + "','" + O365ServerObject.Name + "','" + O365ServerObject.Category + "'," + O365ServerObject.ScanInterval +
                                  "," + O365ServerObject.OffHoursScanInterval + ",'" + O365ServerObject.Enabled + "'," + O365ServerObject.ResponseThreshold + "," + O365ServerObject.RetryInterval +
                                  ",'" + O365ServerObject.SearchStringNotFound + "','" + O365ServerObject.SearchStringFound + "','" + O365ServerObject.UserName + "','" + O365ServerObject.PW + "'," +
                                  O365ServerObject.LocationId + "," + O365ServerObject.ServerTypeId + "," + O365ServerObject.FailureThreshold + ",'" + O365ServerObject.imageurl + "','" + O365ServerObject.mode + "','" + O365ServerObject.servername + "','" + O365ServerObject.CredentialsId + "','" + O365ServerObject.Costperuser + "')";



                Insert = objAdaptor.ExecuteNonQuery(SqlQuery);
            }
            catch
            {
                Insert = false;
            }
            finally
            {
            }
            return(Insert);
        }
Esempio n. 3
0
 /// <summary>
 /// Call to Get Data from URLs based on Primary key
 /// </summary>
 /// <param name="URLsObject">URLsObject object</param>
 /// <returns></returns>
 public O365Server GetData(O365Server O365ServerObject)
 {
     try
     {
         return(VSWebDAL.ConfiguratorDAL.O365ServerDAL.Ins.GetData(O365ServerObject));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 4
0
 public DataTable GetIPAddress(O365Server UrlObj, string mode)
 {
     try
     {
         return(VSWebDAL.ConfiguratorDAL.O365ServerDAL.Ins.GetIPAddress(UrlObj, mode));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 5
0
        /// <param name="URLsObject"></param>
        /// <returns></returns>
        public Object ValidateUpdate(O365Server O365ServerObject)
        {
            Object ReturnValue = "";

            try
            {
                if (O365ServerObject.Name == null || O365ServerObject.Name == "")
                {
                    return("ER#Please enter a value in the Name field.");
                }

                if (O365ServerObject.Category == null || O365ServerObject.Category == " ")
                {
                    return("ER#Please enter a value in the Category field.");
                }

                if (O365ServerObject.ResponseThreshold == null)
                {
                    return("ER#Please enter a value in the Response Threshold field.");
                }
                if (O365ServerObject.ScanInterval.ToString() == "")
                {
                    return("ER#Please enter a value in the Scan Interval field.");
                }

                if (O365ServerObject.OffHoursScanInterval.ToString() == " ")
                {
                    return("ER#Please enter a value in the Off-Hours Scan Interval field.");
                }
                if (O365ServerObject.RetryInterval.ToString() == "")
                {
                    return("ER#Please enter a value in the Retry Interval field.");
                }
                //if (O365ServerObject.URL == "" || O365ServerObject.URL == null || O365ServerObject.URL == "http://")
                //{
                //    return "ER#Please enter a value in the Address field, such as 'http://www.IBM.com'.";
                //}

                //if ((O365ServerObject.RetryInterval) > (O365ServerObject.ScanInterval))
                //{

                //    return "ER#Please enter a value in the Retry Interval field that is less than the Scan Interval value.";
                //}
            }
            catch (Exception ex)
            { throw ex; }
            finally
            { }
            return("");
        }
Esempio n. 6
0
        public Object UpdateTestsData(O365Server O365ServerObject)
        {
            Object ReturnValue = ValidateUpdate(O365ServerObject);

            try
            {
                if (ReturnValue.ToString() == "")
                {
                    return(VSWebDAL.ConfiguratorDAL.O365ServerDAL.Ins.UpdateTestsData(O365ServerObject));
                }
                else
                {
                    return(ReturnValue);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 7
0
        protected void O365ServerGridView_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            O365Server O365ServerObject = new O365Server();

            //11/19/2013 NS modified
            //URLObject.TheURL = (e.Keys[0]).ToString();
            O365ServerObject.ID = (e.Keys[0]).ToString();
            DataTable o365data = VSWebBL.ConfiguratorBL.O365ServerBL.Ins.Get((e.Keys[0]).ToString());
            string    name     = o365data.Rows[0]["Name"].ToString();

            O365ServerObject.Name = name;
            //Delete row from DB
            Object ReturnValue = VSWebBL.ConfiguratorBL.O365ServerBL.Ins.DeleteData(O365ServerObject);

            //Update Grid after inserting new row, refresh grid as in page load
            ASPxGridView gridView = (ASPxGridView)sender;

            gridView.CancelEdit();
            e.Cancel = true;
            FillO365ServerGrid();
        }
Esempio n. 8
0
        //delete Data from URLs Table

        public Object DeleteData(O365Server O365ServerObject)
        {
            Object Update;

            try
            {
                //11/19/2013 NS modified
                //string SqlQuery = "Delete URLs Where TheURL='" + URLObject.TheURL+"'";
                string SqlQuery = "Delete O365Server  Where O365Server.ID=" + O365ServerObject.ID + " ; Delete Status  where Status.Name='" + O365ServerObject.Name + "' and Status.Type='Office365' ";

                Update = objAdaptor.ExecuteNonQuery(SqlQuery);
            }
            catch
            {
                Update = false;
            }
            finally
            {
            }
            return(Update);
        }
Esempio n. 9
0
        public DataTable GetIPAddress(O365Server UrlObj, string mode)
        {
            DataTable UrlTable = new DataTable();

            try
            {
                if (mode == "Insert")
                {
                    string sqlQuery = "Select * from O365Server where NAME='" + UrlObj.Name + "'";
                    UrlTable = objAdaptor.FetchData(sqlQuery);
                }
                else
                {
                    string sqlQuery = "Select * from O365Server where  ID<>" + UrlObj.ID + " AND NAME='" + UrlObj.Name + "' ";
                    UrlTable = objAdaptor.FetchData(sqlQuery);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(UrlTable);
        }
Esempio n. 10
0
        /// <summary>
        /// Get Data from O365Server based on Key
        /// </summary>
        public O365Server GetData(O365Server URLObject)
        {
            DataTable  O365ServerDataTable = new DataTable();
            O365Server ReturnObject        = new O365Server();

            try
            {
                string SqlQuery = "Select * from O365Server where ID=" + URLObject.ID;
                O365ServerDataTable = objAdaptor.FetchData(SqlQuery);
                //populate & return data object
                //11/19/2013 NS added
                ReturnObject.ID   = O365ServerDataTable.Rows[0]["ID"].ToString();
                ReturnObject.Name = O365ServerDataTable.Rows[0]["Name"].ToString();
                if (O365ServerDataTable.Rows[0]["ScanInterval"].ToString() != "")
                {
                    ReturnObject.ScanInterval = int.Parse(O365ServerDataTable.Rows[0]["ScanInterval"].ToString());
                }
                if (O365ServerDataTable.Rows[0]["OffHoursScanInterval"].ToString() != "")
                {
                    ReturnObject.OffHoursScanInterval = int.Parse(O365ServerDataTable.Rows[0]["OffHoursScanInterval"].ToString());
                }
                ReturnObject.Category = O365ServerDataTable.Rows[0]["Category"].ToString();
                if (O365ServerDataTable.Rows[0]["Enabled"].ToString() != "")
                {
                    ReturnObject.Enabled = bool.Parse(O365ServerDataTable.Rows[0]["Enabled"].ToString());
                }

                if (O365ServerDataTable.Rows[0]["RetryInterval"].ToString() != "")
                {
                    ReturnObject.RetryInterval = int.Parse(O365ServerDataTable.Rows[0]["RetryInterval"].ToString());
                }
                if (O365ServerDataTable.Rows[0]["ResponseThreshold"].ToString() != "")
                {
                    ReturnObject.ResponseThreshold = int.Parse(O365ServerDataTable.Rows[0]["ResponseThreshold"].ToString());
                }
                ReturnObject.URL = O365ServerDataTable.Rows[0]["URL"].ToString();
                ReturnObject.SearchStringNotFound = O365ServerDataTable.Rows[0]["SearchString"].ToString();
                ReturnObject.UserName             = O365ServerDataTable.Rows[0]["UserName"].ToString();
                ReturnObject.PW       = O365ServerDataTable.Rows[0]["PW"].ToString();
                ReturnObject.Location = O365ServerDataTable.Rows[0]["Location"].ToString();
                ReturnObject.imageurl = O365ServerDataTable.Rows[0]["imageurl"].ToString();
                if (O365ServerDataTable.Rows[0]["FailureThreshold"].ToString() != null)
                {
                    ReturnObject.FailureThreshold = Convert.ToInt32(O365ServerDataTable.Rows[0]["FailureThreshold"]);
                }
                ReturnObject.mode       = O365ServerDataTable.Rows[0]["Mode"].ToString();
                ReturnObject.servername = O365ServerDataTable.Rows[0]["ServerName"].ToString();
                if (O365ServerDataTable.Rows[0]["Costperuser"].ToString() != null)
                {
                    ReturnObject.Costperuser = O365ServerDataTable.Rows[0]["Costperuser"].ToString();
                }

                if (O365ServerDataTable.Rows[0]["CredentialsId"].ToString() == "")
                {
                    ReturnObject.CredentialsId = -1;
                }
                else
                {
                    ReturnObject.CredentialsId = int.Parse(O365ServerDataTable.Rows[0]["CredentialsId"].ToString());
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
            }
            return(ReturnObject);
        }