本文整理汇总了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;
}