当前位置: 首页>>代码示例>>C#>>正文


C# RepositoryFactory.GetNationalSuperCup方法代码示例

本文整理汇总了C#中RepositoryFactory.GetNationalSuperCup方法的典型用法代码示例。如果您正苦于以下问题:C# RepositoryFactory.GetNationalSuperCup方法的具体用法?C# RepositoryFactory.GetNationalSuperCup怎么用?C# RepositoryFactory.GetNationalSuperCup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RepositoryFactory的用法示例。


在下文中一共展示了RepositoryFactory.GetNationalSuperCup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateSchedule

        public CompetitionSchedule CreateSchedule(Team team1, Team team2, Season season, MatchDateManager matchDateManager)
        {
            var competitionSchedule = new CompetitionSchedule();

             using (var competitionRepository = new RepositoryFactory().CreateCompetitionRepository())
             {
            // Create a super cup season competition and round and save it to the database.
            var superCupCompetition = competitionRepository.GetNationalSuperCup();
            var superCupSeasonCompetition = new SeasonCompetition
            {
               Competition = superCupCompetition,
               Season = season
            };
            competitionSchedule.SeasonCompetitions.Add(superCupSeasonCompetition);

            const int roundNr = 0;
            var superCupRound = new Round
            {
               Id = IdGenerator.GetId(),
               Name = "Super Cup Final",
               SeasonCompetition = superCupSeasonCompetition,
               Order = roundNr,
               CompetitionName = "Super Cup",
               CompetitionType = CompetitionType.NationalSuperCup
            };
            competitionSchedule.Rounds.Add(superCupRound);

            // Create the super cup match and save it to the database.
            var teams1 = new List<Team> { team1 };
            var teams2 = new List<Team> { team2 };
            var singleRoundTournamentManager = new SingleRoundTournamentManager();
            var match = singleRoundTournamentManager.GetMatches(teams1, teams2).Single();

            match.Season = season;
            match.Round = superCupRound;
            match.Date = matchDateManager.GetNextMatchDate(CompetitionType.NationalSuperCup, roundNr);
            match.DrawPermitted = false;

            competitionSchedule.Matches.Add(match);

            // Add both teams to the super cup competition of this season.
            var seasonCompetitionTeam1 = new SeasonCompetitionTeam
            {
               Team = team1,
               SeasonCompetition = superCupSeasonCompetition
            };
            var seasonCompetitionTeam2 = new SeasonCompetitionTeam
            {
               Team = team2,
               SeasonCompetition = superCupSeasonCompetition
            };
            competitionSchedule.SeasonCompetitionTeams.Add(seasonCompetitionTeam1);
            competitionSchedule.SeasonCompetitionTeams.Add(seasonCompetitionTeam2);
             }

             return competitionSchedule;
        }
开发者ID:bouwe77,项目名称:fmg,代码行数:57,代码来源:NationalSuperCupManager.cs


注:本文中的RepositoryFactory.GetNationalSuperCup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。