public async Task <ITeamResultEngine> GetEngine(IResultsEngineRequest request) { this._unitOfWork.GuardCheckInTransaction(); await this._competitionRepository.GetForUpdate(request.CompetitionID); Entities.Competition competition = await this._competitionRepository.GetWithStages(request.CompetitionID); CompetitionStage stage = this.GetStage(competition, request.CompetitionStageLoadMode, request.CompetitionStageValue); TeamFixture fixture = await this._fixtureRepository.GetTeamFixtureFull(request.FixtureID); if (fixture.CompetitionRound.Competition.ID != competition.ID) { throw new ArgumentException("Incorrect competition/fixture ID combination", nameof(request)); } ITeamFixtureModel teamFixtureModel = this._serviceProvider.GetService <ITeamFixtureModel>(); ITeamResultEngineContext context = this._serviceProvider.GetService <ITeamResultEngineContext>(); await context.Initialise(competition, stage, fixture.CompetitionRound.CompetitionEvent, fixture.CompetitionRound, teamFixtureModel); var engine = this._serviceProvider.GetService <ITeamResultEngine>(); engine.SetContext(context); await teamFixtureModel.Initialise(fixture, context); return(engine); }
public async Task Initialise(Entities.Competition competition, CompetitionStage stage, CompetitionEvent competitionEvent, CompetitionRound round, ITeamFixtureModel teamFixture) { this.Competition = competition; this.CompetitionStage = stage; this.CompetitionEvent = competitionEvent; this.CompetitionRound = round; this.Fixture = teamFixture; }
public void Initialise(Entities.Competition competition, CompetitionStage stage, CompetitionEvent competitionEvent, CompetitionRound round, IPlayerFixtureModel playerFixture) { this.Competition = competition; this.CompetitionStage = stage; this.CompetitionEvent = competitionEvent; this.CompetitionRound = round; this.PlayerFixture = playerFixture; }
public static CompetitionStageDto AssembleDto(this CompetitionStage competitionStage) { return(new CompetitionStageDto { ID = competitionStage.ID, Name = competitionStage.Name, Sequence = competitionStage.Sequence, CompetitionStageFormatID = competitionStage.CompetitionStageFormatID }); }
private async Task <Knockout> CreateKnockout(CompetitionStage stage, KnockoutEventTemplate knockoutEventTemplate) { var knockout = Knockout.Create(stage); knockout.MatchFormat = new MatchFormat { ID = (short)knockoutEventTemplate.MatchFormatID }; knockout.MatchCalculationEngineID = knockoutEventTemplate.MatchCalculationEngine; knockout.FixtureCalculationEngineID = knockoutEventTemplate.FixtureCalculationEngine; knockout.KnockoutCalculationEngineID = knockoutEventTemplate.KnockoutCalculationEngine; await this._competitionEventRepository.Save(knockout); return(knockout); }
private async Task Load(AddPlayerFixtureCommand command) { await this._competitionRepository.GetForUpdate(command.Competition.CompetitionID); this._competition = await this._competitionRepository.GetWithStages(command.Competition.CompetitionID); this._competitionStage = this._competition.GetStage(command.Competition.CompetitionStageLookupMode, command.Competition.CompetitionStageValue); this._competitionEvent = await this._competitionEventRepository.Get(command.CompetitionEventID); var rounds = await this._playerCompetitionRoundRepository.GetAll(this._competitionEvent.ID); await this.LoadRound(command, rounds); await this.LoadEntrants(command); await this.PendingFixtures(command); }
public async Task <IPlayerResultEngine> GetEngine(IResultsEngineRequest request) { await this._competitionRepository.GetForUpdate(request.CompetitionID); Entities.Competition competition = await this._competitionRepository.GetWithStages(request.CompetitionID); CompetitionStage stage = this.GetStage(competition, request.CompetitionStageLoadMode, request.CompetitionStageValue); PlayerFixture fixture = await this._playerFixtureRepository.GetFull(request.FixtureID); IPlayerFixtureModel playerFixtureModel = this._serviceProvider.GetService <IPlayerFixtureModel>(); IPlayerResultEngineContext context = this._serviceProvider.GetService <IPlayerResultEngineContext>(); context.Initialise(competition, stage, fixture.CompetitionRound.CompetitionEvent, fixture.CompetitionRound, playerFixtureModel); var engine = this._serviceProvider.GetService <IPlayerResultEngine>(); engine.SetContext(context); await playerFixtureModel.Initialise(fixture, context); return(engine); }