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


C# RepositoryFactory.GetNationalCup方法代码示例

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


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

示例1: CreateSchedule

        public CompetitionSchedule CreateSchedule(List<Team> teams, Season season, MatchDateManager matchDateManager)
        {
            //Draws the first round.
             //Gets the schedule for all rounds, where only the first round has a HomeTeam and AwayTeam.
             //Determines match dates with the DateMatchManager.
             //Creates SeasonCompetition, Rounds etc.

             var competitionSchedule = new CompetitionSchedule();

             // Create a cup season competition.
             SeasonCompetition cupSeasonCompetition;

             using (var competitionRepository = new RepositoryFactory().CreateCompetitionRepository())
             {
            var cup = competitionRepository.GetNationalCup();
            cupSeasonCompetition = new SeasonCompetition
            {
               Competition = cup,
               Season = season
            };
             }

             competitionSchedule.SeasonCompetitions.Add(cupSeasonCompetition);

             var cupSchedule = new KnockoutTournamentManager().GetSchedule(teams);

             foreach (var round in cupSchedule)
             {
            var cupRound = new Round
            {
               Id = IdGenerator.GetId(),
               Name = GetCupRoundName(cupSchedule.Count, round.Key),
               SeasonCompetition = cupSeasonCompetition,
               Order = round.Key,
               CompetitionName = "Cup",
               CompetitionType = CompetitionType.NationalCup
            };
            competitionSchedule.Rounds.Add(cupRound);

            foreach (var match in round.Value)
            {
               match.Season = season;
               match.Round = cupRound;
               match.Date = matchDateManager.GetNextMatchDate(CompetitionType.NationalCup, round.Key);
               match.DrawPermitted = false;

               competitionSchedule.Matches.Add(match);
            }
             }

             // Add the teams to the cup of this season.
             foreach (var team in teams)
             {
            var seasonCompetitionTeam = new SeasonCompetitionTeam
            {
               SeasonCompetition = cupSeasonCompetition,
               Team = team
            };
            competitionSchedule.SeasonCompetitionTeams.Add(seasonCompetitionTeam);
             }

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


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