Ejemplo n.º 1
0
        // TODO move login to game.. to resuse rule across games

        /*       public void restart()
         *     {
         *         if (game.restart == true)
         *         {
         *             Game newGame = new Game();
         *             newGame.DateInserted = new DateTime();
         *             newGame.DateUpdated = new DateTime();
         *             newGame.GameCode = game.GameCode;
         *             newGame.GameTypeID = game.GameTypeID;
         *             newGame.GameName = game.GameName;
         *             newGame.NumberOfWinners = game.NumberOfWinners;
         *             newGame.NextGameID = game.NextGameID;
         *             newGame.MemberSubscriptionType = game.MemberSubscriptionType;
         *             newGame.Global = game.Global;
         *             newGame.restart = false;
         *             GameDao gameDao = new GameDao(db);
         *             gameDao.save(newGame);
         *
         *             ICollection<GameRule> newGameRules = add3Mins(game.GameRules.ToList(), newGame.GameID);
         *             GameRuleDao gameRuleDao = new GameRuleDao(db);
         *             gameRuleDao.save(newGameRules);
         *
         *             newGame.MemberInGames = gameDao.findLosers(game.GameID);
         *             game.NextGameID = newGame.GameID;
         *             db.SaveChanges();
         *
         *             reschedule5MinDeal(gameDao, newGame.NextGameID);
         *         }
         *     }
         */

        private void reschedule5MinDeal(GameDao gameDao, int?gameID)
        {
            if (gameID != null)
            {
                Game fiveMinGame = gameDao.findGame(gameID);
                foreach (GameRule gameRule in fiveMinGame.GameRules)
                {
                    gameRule.ExcecuteTime.AddMinutes(3);
                }
                gameDao.save();
            }
        }
Ejemplo n.º 2
0
        public void paymentFailed(int GameID)
        {
            GameDao gameDao = new GameDao(db);
            Game    game    = gameDao.findGame(GameID);

            game.NumberOfWinners++;
            gameDao.save();
            if (getMaxTransactionTime(game.GameID) == 0)   //is this the last payment failure
            {
                RestartGameRule restartRule = new RestartGameRule(game, db);
                //    restartRule.restart();
            }
        }