public List <IGame> GetActiveGamesByUserName(string userName) { List <IGame> toReturn = null; if (userName.Equals("") || userName.Equals(" ")) { ErrorLog log = new ErrorLog("Error: while trying get user active games - username: "******" empty"); _logControl.AddErrorLog(log); return(toReturn); } if (_systemControl.IsUsernameFree(userName)) { ErrorLog log = new ErrorLog("Error: while trying get user active games - username: "******" dose not exist!"); _logControl.AddErrorLog(log); return(toReturn); } IUser user = _systemControl.GetIUSerByUsername(userName); if (user == null) { return(toReturn); } toReturn = _gameCenter.GetActiveGamesByUserName(user); return(toReturn); }
//remove user from user list byID - syncronized public bool RemoveUserById(int id) { lock (padlock) { bool toReturn = false; if (!IsValidInputNotSmallerZero(id)) { return(toReturn); } IUser original = GetUserWithId(id); if (original == null) { return(toReturn); } try { userProxy.DeleteUserById(id); toReturn = true; } catch (Exception e) { ErrorLog log = new ErrorLog("Error: while truing to remove user with id: " + id); logControl.AddErrorLog(log); toReturn = false; return(toReturn); } return(toReturn); } }