Example #1
0
        //remove user by name and password  - syncronized
        public bool RemoveUserByUserNameAndPassword(string username, string password)
        {
            bool  toReturn = false;
            IUser toRemove = userProxy.GetUserByUserName(username);

            lock (padlock)
            {
                try
                {
                    if (toRemove.Password().Equals(password))
                    {
                        userProxy.DeleteUserById(toRemove.Id());
                        toReturn = true;
                    }
                    return(toReturn);
                }
                catch (Exception e)
                {
                    ErrorLog log = new ErrorLog("Error: while trying to remove user with user name: " + username + "and password fail");
                    logControl.AddErrorLog(log);
                    toReturn = false;
                    return(toReturn);
                }
            }
        }