Esempio n. 1
0
/// <summary>
        ///
        /// </summary>
        /// <param name="databaseHelper"></param>
        /// <param name="Username"></param>
        public void DeleteUser(DAODatabaseHelper databaseHelper, string Username)
        {
            System.Data.Common.DbCommand TempCommand_2 = databaseHelper.CreateCommand();
            TempCommand_2.CommandText = String.Format("DROP USER {0}", Username);
            TempCommand_2.CommandType = System.Data.CommandType.Text;
            TempCommand_2.Transaction = TransactionManager.GetTransaction(databaseHelper.Connection);
            DbCommand command = TempCommand_2;

            command.ExecuteNonQuery();
            TempCommand_2             = databaseHelper.CreateCommand();
            TempCommand_2.CommandText = String.Format("DROP Login {0}", Username);
            command = TempCommand_2;
            command.ExecuteNonQuery();
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="databaseHelper"></param>
        /// <param name="OldGroup"></param>
        /// <param name="NewGroup"></param>
        /// <param name="user"></param>
        public void UpdateRole(DAODatabaseHelper databaseHelper, string OldGroup, string NewGroup, string user)
        {
            System.Data.Common.DbCommand TempCommand_2 = databaseHelper.CreateCommand();
            TempCommand_2.CommandText = String.Format("exec sp_droprolemember '{0}', '{1}'", OldGroup, user);
            TempCommand_2.CommandType = System.Data.CommandType.Text;
            TempCommand_2.Transaction = TransactionManager.GetTransaction(databaseHelper.Connection);
            DbCommand command = TempCommand_2;

            command.ExecuteNonQuery();
            TempCommand_2             = databaseHelper.CreateCommand();
            TempCommand_2.CommandText = String.Format("exec sp_addrolemember '{0}', '{1}'", NewGroup, user);
            command = TempCommand_2;
            command.ExecuteNonQuery();
        }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="databaseHelper"></param>
        /// <param name="user"></param>
        /// <param name="oldPassword"></param>
        /// <param name="newPassword"></param>
        public void NewPassword(DAODatabaseHelper databaseHelper, string user, string oldPassword, string newPassword)
        {
            this.BeginTransaction();
            System.Data.Common.DbCommand TempCommand_2 = databaseHelper.CreateCommand();
            TempCommand_2.CommandText = String.Format("ALTER LOGIN [{0}] WITH PASSWORD=N'{1}'", user, newPassword);
            TempCommand_2.CommandType = System.Data.CommandType.Text;
            TempCommand_2.Transaction = TransactionManager.GetTransaction(databaseHelper.Connection);
            DbCommand command = TempCommand_2;

            command.ExecuteNonQuery();
            this.CommitTransaction();
        }
Esempio n. 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="databaseHelper"></param>
        /// <param name="Username"></param>
        /// <param name="Password"></param>
        /// <param name="UserRole"></param>
        public void CreateUser(DAODatabaseHelper databaseHelper, string Username, string Password, string UserRole)
        {
            this.BeginTransaction();
            System.Data.Common.DbCommand TempCommand_2 = databaseHelper.CreateCommand();
            TempCommand_2.CommandText = "sp_addnewuser";
            TempCommand_2.CommandType = System.Data.CommandType.StoredProcedure;
            TempCommand_2.Transaction = TransactionManager.GetTransaction(databaseHelper.Connection);
            DbCommand command = TempCommand_2;

            ADORecordSetHelper.commandParameterBinding(command, "Username").Value = Username;
            ADORecordSetHelper.commandParameterBinding(command, "Password").Value = Password;
            ADORecordSetHelper.commandParameterBinding(command, "UserRole").Value = UserRole;
            command.ExecuteNonQuery();
            this.CommitTransaction();
        }