Exemplo n.º 1
0
        public int UpdateDominoServerTasks(int TaskID, int ServerID, int Enabled, int SendLoadCommand, int SendRestartCommand, int RestartOffHours, int SendExitCommand)
        {
            int Update = 0;

            try
            {
                if (Enabled == 0)
                {
                    string SqlQuery1 = "Delete from ServerTaskSettings WHERE TaskId = " + TaskID + " AND ServerID = " + ServerID;
                    Update = objAdaptor.ExecuteNonQueryRetRows(SqlQuery1);
                }
                else
                {
                    string SqlQuery = "SELECT * FROM ServerTaskSettings where TaskId = " + TaskID + " AND ServerID = " + ServerID;
                    if (objAdaptor.FetchData(SqlQuery).Rows.Count > 0)
                    {
                        string SqlQuery1 = "Update ServerTaskSettings SET Enabled = " + Enabled + ",SendLoadCommand = " + SendLoadCommand + ",SendRestartCommand = " + SendRestartCommand + ",RestartOffHours = " + RestartOffHours + ",SendExitCommand = " + SendExitCommand + " WHERE TaskId = " + TaskID + " AND ServerID = " + ServerID;
                        Update = objAdaptor.ExecuteNonQueryRetRows(SqlQuery1);
                    }
                    else
                    {
                        string SqlQuery1 = "INSERT INTO ServerTaskSettings (TaskID,ServerID,Enabled,SendLoadCommand,SendRestartCommand,RestartOffHours,SendExitCommand) VALUES (" + TaskID + "," + ServerID + "," + Enabled + "," + SendLoadCommand + "," + SendRestartCommand + "," + RestartOffHours + "," + SendExitCommand + ")";
                        Update = objAdaptor.ExecuteNonQueryRetRows(SqlQuery1);
                    }
                }
            }
            catch
            {
                Update = 0;
            }
            finally
            {
            }
            return(Update);
        }
Exemplo n.º 2
0
        public bool InsertData1(WebsphereCell STSettingsObject, int key)
        {
            int    cellid;
            int    Insert    = 0;
            bool   retInsert = false;
            string Cellname  = STSettingsObject.CellName;

            //DataTable dt = new DataTable();
            //string sqlqury = "select * from WebsphereCell where CellName= '" + STSettingsObject.CellName + "'";
            //dt = objAdaptor.FetchData(sqlqury);
            try
            {
                //    if (dt.Rows.Count > 0)
                //    {
                //cellid = Convert.ToInt32(dt.Rows[0]["CellID"]);
                if (STSettingsObject.CellID != null && STSettingsObject.CellID != 0)
                {
                    string SqlQuery2 = "UPDATE WebsphereCell set Name='" + STSettingsObject.Name + "',HostName='" + STSettingsObject.HostName + "',ConnectionType='" + STSettingsObject.ConnectionType +
                                       "',PortNo='" + STSettingsObject.PortNo + "',GlobalSecurity='" + STSettingsObject.GlobalSecurity + "',CredentialsID=" + STSettingsObject.CredentialsID + ",Realm='" + STSettingsObject.Realm.ToString() + "' where CellID=" + Convert.ToInt32(STSettingsObject.CellID.ToString()) + "";

                    //"' where CellID=" + dt.Rows[0]["cellid"] + "";
                    Insert = objAdaptor.ExecuteNonQueryRetRows(SqlQuery2);
                }
                //    }
            }
            catch
            {
                Insert = 0;
            }
            if (Insert == 0)
            {
                try
                {
                    if (STSettingsObject.CellID == 0)
                    {
                        string SqlQuery;

                        SqlQuery = "INSERT INTO WebsphereCell(Name,HostName,ConnectionType,PortNo,GlobalSecurity,CredentialsID,Realm,IBMConnectionSID) VALUES('"
                                   + STSettingsObject.Name + "','" + STSettingsObject.HostName + "','" + STSettingsObject.ConnectionType + "'," + STSettingsObject.PortNo +
                                   ",'" + STSettingsObject.GlobalSecurity + "'," + STSettingsObject.CredentialsID + ",'" + STSettingsObject.Realm + "'," + key + ")";

                        Insert = objAdaptor.ExecuteNonQueryRetRows(SqlQuery);
                    }
                }
                catch
                {
                    Insert = 0;
                }
            }
            if (Insert == 1)
            {
                retInsert = true;
            }
            return(retInsert);
        }
Exemplo n.º 3
0
        public int UpdateProfileDetails(List <UserProfileDetailed> list)
        {
            int Update = 0;

            try
            {
                string SqlQuery = "delete UserProfileDetailed where UserProfileMasterID=" + list[0].UserProfileMasterID;
                Update = objAdaptor.ExecuteNonQueryRetRows(SqlQuery);

                for (int i = 0; i < list.Count; i++)
                {
                    SqlQuery = "INSERT INTO UserProfileDetailed(UserProfileMasterID,ProfilesMasterID,Value) values(" + list[i].UserProfileMasterID + "," + list[i].ProfilesMasterID + ",'" + list[i].Value + "')";
                    Update   = objAdaptor.ExecuteNonQueryRetRows(SqlQuery);
                }
            }
            catch
            {
                Update = 0;
            }

            return(Update);
        }
Exemplo n.º 4
0
        public void UpdateUserPreferences(string PreferenceName, string PreferenceValue, int UserID)
        {
            if (PreferenceName == "FilterBy")
            {
                PreferenceValue = PreferenceValue.Replace("'", "''");
            }
            //2/14/2013 NS modified
            int mode = 0;

            try
            {
                int    count = 0;
                string Query = "SELECT Count(*) FROM UserPreferences WHERE PreferenceName = '" + PreferenceName + "' and UserID =" + UserID;
                count = objAdaptor.ExecuteScalar(Query);
                string SqlQuery = "";
                if (count == 0)
                {
                    SqlQuery = "INSERT INTO UserPreferences VALUES('" + PreferenceName + "','" + PreferenceValue + "'," + UserID + ")";
                }
                else
                {
                    SqlQuery = "UPDATE UserPreferences SET PreferenceValue='" + PreferenceValue + "' WHERE PreferenceName = '" + PreferenceName + "' and UserID =" + UserID;
                }

                mode = objAdaptor.ExecuteNonQueryRetRows(SqlQuery);
                //SqlQuery = "SELECT * FROM UserPreferences WHERE UserID =" + UserID;
                //return objAdaptor.FetchData(SqlQuery);
            }



            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 5
0
        public bool InsertLicense(License keyvalue)
        {
            DataTable licensekey = new DataTable();
            bool      UpdateRet  = false;
            int       mode       = 0;

            try
            {
                int count = 0;
                /* 4/27/2015 NS modified for VSPLUS-1700 */

                /*
                 * string Query = "SELECT Count(*) FROM License WHERE LicenseKey = '" + keyvalue.LicenseKey + "'";
                 * count = objAdaptor.ExecuteScalar(Query);
                 * string SqlQuery = "";
                 * if (count == 0)
                 * {
                 *  SqlQuery = "INSERT INTO License([LicenseKey],[Units],[InstallType],[CompanyName],[LicenseType],[ExpirationDate]) VALUES('" + keyvalue.LicenseKey + "'," +
                 *  " " + keyvalue.Units + ",'" + keyvalue.InstallType + "','" + keyvalue.CompanyName + "','" + keyvalue.LicenseType + "','" + keyvalue.ExpirationDate + "')";
                 * }
                 * else
                 * {
                 *  SqlQuery = "UPDATE License SET LicenseKey='" + keyvalue.LicenseKey + "',Units=" + keyvalue.Units + ",InstallType='" + keyvalue.InstallType + "',CompanyName='" + keyvalue.CompanyName + "'," +
                 *      "LicenseType='" + keyvalue.LicenseType + "',ExpirationDate='" + keyvalue.ExpirationDate + "'";
                 * }
                 */
                string Query = "SELECT Count(*) FROM License";
                count = objAdaptor.ExecuteScalar(Query);
                string SqlQuery = "";
                if (count != 0)
                {
                    SqlQuery = "DELETE FROM License";
                    objAdaptor.ExecuteNonQuery(SqlQuery);
                }
                SqlQuery = "INSERT INTO License([LicenseKey],[Units],[InstallType],[CompanyName],[LicenseType],[ExpirationDate]) VALUES('" + keyvalue.LicenseKey + "'," +
                           " " + keyvalue.Units + ",'" + keyvalue.InstallType + "','" + keyvalue.CompanyName + "','" + keyvalue.LicenseType + "','" + keyvalue.ExpirationDate + "')";
                mode = objAdaptor.ExecuteNonQueryRetRows(SqlQuery);
                if (mode == 1)
                {
                    licensekey = objAdaptor.FetchLicense("PR_EncDecLicense", false);
                    UpdateRet  = true;
                }
            }
            catch
            {
            }
            return(UpdateRet);
        }
Exemplo n.º 6
0
        public bool InsertData1(WebsphereCell STSettingsObject)
        {
            int    cellid;
            int    Insert    = 0;
            bool   retInsert = false;
            string Cellname  = STSettingsObject.CellName;

            try
            {
                if (STSettingsObject.CellID != null)
                {
                    string SqlUpdate = "";
                    string SqlInsert = "";

                    if (STSettingsObject.CredentialsID != 0)
                    {
                        SqlUpdate = "UPDATE WebsphereCell set Name='" + STSettingsObject.Name + "',HostName='" + STSettingsObject.HostName + "',ConnectionType='" + STSettingsObject.ConnectionType +
                                    "',PortNo='" + STSettingsObject.PortNo + "',Credentialsid='" + STSettingsObject.CredentialsID + "',GlobalSecurity='" + STSettingsObject.GlobalSecurity + "',Realm='" + STSettingsObject.Realm + "'  where CellID=" + STSettingsObject.CellID.ToString() + "";

                        SqlInsert = "INSERT INTO WebsphereCell(Name,HostName,ConnectionType,PortNo,GlobalSecurity,Credentialsid,Realm) VALUES('"
                                    + STSettingsObject.Name + "','" + STSettingsObject.HostName + "','" + STSettingsObject.ConnectionType + "'," + STSettingsObject.PortNo +
                                    ",'" + STSettingsObject.GlobalSecurity + "','" + STSettingsObject.CredentialsID + "','" + STSettingsObject.Realm + "')";
                    }
                    else
                    {
                        SqlUpdate = "UPDATE WebsphereCell set Name='" + STSettingsObject.Name + "',HostName='" + STSettingsObject.HostName + "',ConnectionType='" + STSettingsObject.ConnectionType +
                                    "',PortNo='" + STSettingsObject.PortNo + "',GlobalSecurity='" + STSettingsObject.GlobalSecurity + "',Realm='" + STSettingsObject.Realm + "'  where CellID=" + STSettingsObject.CellID.ToString() + "";

                        SqlInsert = "INSERT INTO WebsphereCell(Name,HostName,ConnectionType,PortNo,GlobalSecurity,Realm) VALUES('"
                                    + STSettingsObject.Name + "','" + STSettingsObject.HostName + "','" + STSettingsObject.ConnectionType + "'," + STSettingsObject.PortNo +
                                    ",'" + STSettingsObject.GlobalSecurity + "','" + STSettingsObject.Realm + "')";
                    }

                    string sql = "IF EXISTS(SELECT * FROM WebsphereCell WHERE CellID=" + STSettingsObject.CellID.ToString() + ") BEGIN " +
                                 SqlUpdate + "; END ELSE BEGIN " + SqlInsert + "; END";

                    if (objAdaptor.ExecuteNonQueryRetRows(sql) > 0)
                    {
                        retInsert = true;
                    }
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
            return(retInsert);
        }
Exemplo n.º 7
0
        public int UpdateEXGServiceSettings(int Enabled, string DisplayName, string ServiceName, string ServerType, int SVRId)
        {
            int Update = 0;

            try
            {
                string SQLQuery = "Update WindowsServices Set Monitored = '" + Enabled + "' Where DisplayName = '" + DisplayName + "' and Service_Name = '" + ServiceName + "' and ServerTypeID = (Select ID from ServerTypes where ServerType = '" + ServerType + "') and ServerName = (Select ServerName from Servers where ID = '" + SVRId + "') ";
                Update = objAdaptor.ExecuteNonQueryRetRows(SQLQuery);
                //string SqlQuery = "SELECT * FROM ServerServices where ServerId = " + serverID + " AND SVRId = " + SVRId;
                //if (objAdaptor.FetchData(SqlQuery).Rows.Count > 0)
                //{
                //    string SqlQuery1 = "Delete from ServerServices WHERE ServerId = " + serverID + " AND SVRId = " + SVRId;
                //    Update = objAdaptor.ExecuteNonQueryRetRows(SqlQuery1);
                //}
            }
            catch
            {
                Update = 0;
            }
            finally
            {
            }
            return(Update);
        }
Exemplo n.º 8
0
        public bool UpdateScanvalue(string sname, string svalue, string stype)
        {
            //26/11/2014 Sowjanya modified
            bool UpdateRet = false;
            int  mode      = 0;

            try
            {
                if (sname != null && sname != "")
                {
                    int    count = 0;
                    string Query = "SELECT Count(*) FROM ScanSettings WHERE sname = '" + sname + "' and svalue='" + svalue + "'";
                    count = objAdaptor.ExecuteScalar(Query);
                    string SqlQuery = "";
                    if (count == 0)
                    {
                        SqlQuery = "INSERT INTO ScanSettings(sname,svalue,stype) VALUES('" + sname + "','" + svalue + "','" + stype + "')";
                        mode     = objAdaptor.ExecuteNonQueryRetRows(SqlQuery);
                    }
                    else
                    {
                        //SqlQuery = "UPDATE Settings SET svalue='" + svalue + "',stype ='" + stype + "' WHERE sname = '" + sname + "'";
                    }


                    if (mode == 1)
                    {
                        UpdateRet = true;
                    }
                }
            }
            catch
            {
            }
            return(UpdateRet);
        }
Exemplo n.º 9
0
        public object updatenwEnableLatencyTest(int id, int nlid, int latencyred, int yellowthershold, bool checkedvalue, string testname)
        {
            //ExchangeServers - ServerId, LatencyEnable, Red,Yellow
            bool UpdateRet = false;
            int  Update    = 0;

            try
            {
                DataTable   dt             = new DataTable();
                ServerTypes STypebject     = new ServerTypes();
                ServerTypes RetnSTypebject = new ServerTypes();

                // RetnSTypebject = VSWebDAL.SecurityDAL.ServerTypesDAL.Ins.GetDataForServerType(STypebject);
                //  StObject.ServerTypeId = RetnSTypebject.ID;
                if (id != 0)
                {
                    string SqlQuery = "";
                    //if (StObject.RoleType == null)
                    //{
                    //    StObject.RoleType = "";
                    //}
                    SqlQuery = "select * from NetworkLatencyServers where ServerID='" + id + "' ";
                    dt       = objAdaptor.FetchData(SqlQuery);
                    if (dt.Rows.Count > 0)
                    {
                        SqlQuery = "update NetworkLatencyServers set LatencyYellowThreshold=" + yellowthershold + ", LatencyRedThreshold=" + latencyred + ",Enabled='" + checkedvalue + "'  where ServerID=" + id;

                        Update = objAdaptor.ExecuteNonQueryRetRows(SqlQuery);
                    }
                }
                //foreach (ExchangeSettings fieldValue in fieldValues)
                //{

                //}
            }
            catch
            {
                Update = 0;
            }
            if (Update == 0)
            {
                try
                {
                    string    SqlQuery       = "";
                    DataTable networklatency = new DataTable();
                    string    sqlQuery;
                    sqlQuery       = "select [NetworkLatencyId] from [NetworkLatency] where [TestName]='" + testname + "'";
                    networklatency = objAdaptor.FetchData(sqlQuery);

                    if (networklatency.Rows.Count > 0)
                    {
                        SqlQuery = "Insert into NetworkLatencyServers(ServerID,NetworkLatencyId,LatencyYellowThreshold , LatencyRedThreshold , Enabled) values" +
                                   //"ActiveSyncCredentialsId) values" +
                                   "(" + id + ", " + Convert.ToInt32(networklatency.Rows[0]["NetworkLatencyId"]) + ",'" +
                                   yellowthershold + "','" + latencyred + "','" + checkedvalue + "')";
                        Update = objAdaptor.ExecuteNonQueryRetRows(SqlQuery);
                    }
                }
                catch
                {
                    Update = 0;
                }
            }
            if (Update == 1)
            {
                UpdateRet = true;
            }
            return(UpdateRet);
        }
Exemplo n.º 10
0
        public bool UpdateProfilesunselect(bool isSelected, string strsname)
        {
            bool UpdateRet = false;
            int  Update    = 0;

            try
            {
                ServerTypes STypebject     = new ServerTypes();
                ServerTypes RetnSTypebject = new ServerTypes();

                string SqlQuery = "UPDATE ProfilesMaster set isSelected='" + isSelected + "' where ID='" + strsname + "'";
                Update = objAdaptor.ExecuteNonQueryRetRows(SqlQuery);
            }

            catch
            {
            }

            return(UpdateRet);
        }