Ejemplo n.º 1
0
        public void NavigateToNext()
        {
            var readManager = new GameDateTimeReadManager(RepositoryFactory);

            var now = readManager.GetNow();

            if (now.ManagerPlaysMatch || now.Matches != GameDateTimeEventStatus.ToDo)
            {
                GoToNext();
            }
            else
            {
                var matchService = new ServiceFactory().CreateMatchService(GameInfo);

                // Keep on playing matches until a current GameDateTime indicates the manager plays a match.
                while (!now.ManagerPlaysMatch && now.Matches == GameDateTimeEventStatus.ToDo)
                {
                    using (var transactionManager = RepositoryFactory.CreateTransactionManager())
                    {
                        matchService.PlayMatchDay(now.DateTime, transactionManager);
                        transactionManager.Save();
                    }

                    GoToNext();
                    now = readManager.GetNow();
                }
            }
        }
Ejemplo n.º 2
0
        public GameDateTime GetNow()
        {
            var manager = new GameDateTimeReadManager(RepositoryFactory);

            return(manager.GetNow());
        }