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);
        }
        public static int UpdateUserAsync(string taskId, UserInfo user)
        {
            UserAsyncWorker usersWorker = new UserAsyncWorker();

            usersWorker.ThreadUserId = SecurityContext.User.UserId;
            usersWorker.TaskId       = taskId;
            usersWorker.User         = user;
            usersWorker.UpdateUserAsync();
            return(0);
        }