Ejemplo n.º 1
0
        public override void makeCompleted()
        {
            if (game.NextGameID != null)
            {
                Game newGame = db.Games.Find(game.NextGameID);
                if (newGame != null)
                {
                    GameDao gameDao = new GameDao(db);
                    IEnumerable <MembersWhoPlayed> nonWinnersQ = gameDao.findMembersWhoPlayed(game.GameID);

                    List <MemberInGame> nonWinners = new List <MemberInGame>();

                    foreach (MembersWhoPlayed nonWinner in nonWinnersQ)
                    {
                        MemberInGame memberingame = new MemberInGame();
                        memberingame.GameID       = newGame.GameID;
                        memberingame.MemberID     = nonWinner.MemberID;
                        memberingame.DateInserted = DateTime.Now;
                        memberingame.DateUpdated  = DateTime.Now;
                        memberingame.USR          = "******";
                        //   memberingame.WinIndicator = false;
                        memberingame.PaymentIndicator = false;
                        nonWinners.Add(memberingame);
                    }
                    newGame.MemberInGames = nonWinners;

                    db.SaveChanges();
                    FFFGame mygame = new FFFGame(db, scheduler, newGame);

                    //  mygame.makeActive();
                    mygame.makeActive();
                }
            }
            base.makeCompleted();
        }