Esempio n. 1
0
        public static int DeleteUser(string taskId, int userId)
        {
            // check account
            int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo);

            if (accountCheck < 0)
            {
                return(accountCheck);
            }

            // check if user has child accounts
            if (GetUsers(userId, false).Count > 0)
            {
                return(BusinessErrorCodes.ERROR_USER_HAS_USERS);
            }

            UserAsyncWorker userWorker = new UserAsyncWorker();

            userWorker.ThreadUserId = SecurityContext.User.UserId;
            userWorker.UserId       = userId;
            userWorker.TaskId       = taskId;
            userWorker.DeleteUserAsync();

            return(0);
        }
Esempio n. 2
0
        public static int DeleteUser(string taskId, int userId)
        {
            // check account
            int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo);
            if (accountCheck < 0) return accountCheck;

            // check if user has child accounts
            if (GetUsers(userId, false).Count > 0)
                return BusinessErrorCodes.ERROR_USER_HAS_USERS;

            UserAsyncWorker userWorker = new UserAsyncWorker();
            userWorker.ThreadUserId = SecurityContext.User.UserId;
            userWorker.UserId = userId;
			userWorker.TaskId = taskId;
            userWorker.DeleteUserAsync();

            return 0;
        }