コード例 #1
0
        private TextProtocolViewModel GetTextProtocol(Game game)
        {
            IGameProtocolManager protocolManager = ProtocolGameManagerFactory.Create(game.Id);

            ITextProtocolBuilder textProtocolBuilderReal = TextProtocolBuilderFactory.Create(protocolManager);
            ITextProtocolBuilder textProtocolBuilderFake = TextProtocolBuilderFactory.Create(new GameNoteBuilder(game));

            ITextProtocolBuilder textProtocolBuilderHome = textProtocolBuilderFake.IsAvailableHome
                                                            ? textProtocolBuilderFake
                                                            : textProtocolBuilderReal;

            ITextProtocolBuilder textProtocolBuilderAway = textProtocolBuilderFake.IsAvailableAway
                                                            ? textProtocolBuilderFake
                                                            : textProtocolBuilderReal;

            var textProtocol = new TextProtocolViewModel();

            textProtocol.home.main    = textProtocolBuilderHome.GetMainSquad(Side.Home);
            textProtocol.home.reserve = textProtocolBuilderHome.GetReserve(Side.Home);
            textProtocol.home.goals   = textProtocolBuilderHome.GetGoals(Side.Home);
            textProtocol.home.yellows = textProtocolBuilderHome.GetYellows(Side.Home);
            textProtocol.home.reds    = textProtocolBuilderHome.GetReds(Side.Home);
            textProtocol.home.others  = textProtocolBuilderHome.GetOthers(Side.Home);

            textProtocol.away.main    = textProtocolBuilderAway.GetMainSquad(Side.Away);
            textProtocol.away.reserve = textProtocolBuilderAway.GetReserve(Side.Away);
            textProtocol.away.goals   = textProtocolBuilderAway.GetGoals(Side.Away);
            textProtocol.away.yellows = textProtocolBuilderAway.GetYellows(Side.Away);
            textProtocol.away.reds    = textProtocolBuilderAway.GetReds(Side.Away);
            textProtocol.away.others  = textProtocolBuilderAway.GetOthers(Side.Away);

            return(textProtocol);
        }
コード例 #2
0
        private ProtocolGameViewModel GetDefaultProtocol(Game game)
        {
            IGameProtocolManager protocolManager = ProtocolGameManagerFactory.Create(game.Id);

            var modelBuilder = new ProtocolViewModelBuilder(protocolManager);

            return(modelBuilder.ViewModel);
        }
コード例 #3
0
        public TextProtocolBuilder(IGameProtocolManager protocolManager)
        {
            Guard.CheckNull(protocolManager, nameof(protocolManager));

            this.protocolManager = protocolManager;

            IGameFormatManager gameFormatManager = MainCfg.ServiceProvider.GetService <IGameFormatManager>();;

            protocolModelUtils = new ProtocolModelUtils(gameFormatManager);
        }
コード例 #4
0
        public ProtocolViewModelBuilder(IGameProtocolManager protocolManager)
        {
            Guard.CheckNull(protocolManager, nameof(protocolManager));
            Guard.CheckNull(protocolManager.Game, "protocolManager.Game");

            this.protocolManager = protocolManager;
            gameNoteBuilder      = new GameNoteBuilder(this.protocolManager.Game);

            homePersons = personBll.GetTeamPersons(GetTeamId(Side.Home), protocolManager.Game.GameDate).ToViewModel();
            awayPersons = personBll.GetTeamPersons(GetTeamId(Side.Away), protocolManager.Game.GameDate).ToViewModel();
        }
コード例 #5
0
 public static ITextProtocolBuilder Create(IGameProtocolManager protocolManager)
 {
     return(new TextProtocolBuilder(protocolManager));
 }