예제 #1
0
파일: User.cs 프로젝트: shoferb/OYAOB
        public bool SetPoints(int amount)
        {
            if (amount > 0)
            {
                points += amount;
                userDataProxy.EditUserPoints(id, points);
                return(true);
            }

            return(false);
        }
예제 #2
0
        //for test only
        //use-case: user can edit is points
        public bool EditUserPoints(int userId, int newPoints)
        {
            bool  toReturn = false;
            IUser user     = _sc.GetUserWithId(userId);

            if (user == null)
            {
                return(toReturn);
            }
            toReturn = user.EditUserPoints(newPoints);
            if (toReturn)
            {
                _userDataProxy.EditUserPoints(userId, newPoints);
            }
            return(toReturn);
        }
예제 #3
0
파일: Player.cs 프로젝트: shoferb/OYAOB
        //get amout won, inc winCounter + update point + check if the user is now the highest player
        public bool Win(int amount)
        {
            bool toReturn;

            try
            {
                user.IncWinNum();
                user.UpdateHighestCashInGame(amount);
                user.UpdateTotalProfit(amount);
                TotalChip += amount;
                int newPoint = GetNewPoint();
                user.EditUserPoints(newPoint);
                UserDataProxy p = new UserDataProxy();
                this.user.EditUserPoints(newPoint);
                p.EditUserPoints(user.Id(), newPoint);
                toReturn = true;
            }
            catch (Exception e)
            {
                toReturn = false;
            }
            return(toReturn);
        }