public PlayerHistoryController(IPlayerHistory playerHistoryService, ISeason seasonService, ApplicationDbContext db, IPlayer playerService, ITeam teamService) { _playerHistoryService = playerHistoryService; _db = db; _playerService = playerService; _teamService = teamService; }
/// <summary> /// Initialises a new instance of the <see cref="SummaryTotalViewModel"/> class. /// </summary> /// <param name="model">Junior handicap model</param> public SummaryTotalViewModel( ISeason model) : base(model.Summary) { this.seasonModel = model; model.SummaryChangedEvent += this.ModelUpdated; }
public override void Grow(ISeason season) { if (season.NameOfSeason == SeasonOfYear.Summer.ToString()) { Height += increase; } }
public void InitializeSportEntities() { var watch = Stopwatch.StartNew(); if (SportEntityFactory == null) { Init(); } var time = watch.Elapsed.TotalMilliseconds; Debug.WriteLine($"Init time: {time}"); Competition = SportEntityFactory.BuildSportEvent <ICompetition>(TestData.EventId, URN.Parse("sr:sport:3"), TestData.Cultures3, TestData.ThrowingStrategy); Debug.WriteLine($"Competition time: {watch.Elapsed.TotalMilliseconds - time}"); time = watch.Elapsed.TotalMilliseconds; Sport = SportEntityFactory.BuildSportAsync(TestData.SportId, TestData.Cultures3, TestData.ThrowingStrategy).Result; Debug.WriteLine($"Sport time: {watch.Elapsed.TotalMilliseconds - time}"); time = watch.Elapsed.TotalMilliseconds; Sports = SportEntityFactory.BuildSportsAsync(TestData.Cultures3, TestData.ThrowingStrategy).Result?.ToList(); Debug.WriteLine($"Sports time: {watch.Elapsed.TotalMilliseconds - time}"); time = watch.Elapsed.TotalMilliseconds; Tournament = SportEntityFactory.BuildSportEvent <ITournament>(TestData.TournamentId, TestData.SportId, TestData.Cultures3, TestData.ThrowingStrategy); Debug.WriteLine($"Tournament time: {watch.Elapsed.TotalMilliseconds - time}"); time = watch.Elapsed.TotalMilliseconds; Season = SportEntityFactory.BuildSportEvent <ISeason>(TestData.SeasonId, TestData.SportId, TestData.Cultures3, TestData.ThrowingStrategy); Debug.WriteLine($"Season time: {watch.Elapsed.TotalMilliseconds - time}"); }
private void grdEpisodes_CurrentCellChanged(object sender, EventArgs e) { int newRowIndex = grdEpisodes.CurrentCellAddress.Y; if (newRowIndex != oldEpisodeRowIndex) { if (oldEpisodeRowIndex != -1) { if (newRowIndex != -1) { // rebind the episode ISeason season = (ISeason)lstSeasons.SelectedItem; season.Episodes[oldEpisodeRowIndex] = episodeDetails.Episode; } } if (newRowIndex != -1) { episodeDetails.Episode = (Episode)grdEpisodes.CurrentRow.DataBoundItem; } else { episodeDetails.Episode = null; } oldEpisodeRowIndex = grdEpisodes.CurrentCellAddress.Y; } }
public ClubHistoryController(IClubHistory historyService, ISeason seasonService, ApplicationDbContext db, ITeam teamService) { _historyService = historyService; _seasonService = seasonService; _db = db; _teamService = teamService; }
/// <inheritdoc/> public void UpdateSeason(ISeason season) { SeasonDto seasonDto = SeasonDto.ToDto(season); this.Context.Entry( this.Context.Seasons .Single(s => s.Id == seasonDto.Id)) .CurrentValues.SetValues(seasonDto); this.Context.SaveChanges(); }
/// <summary> /// Initialises a new instance of the <see cref="PointsTableViewModel"/> class. /// </summary> /// <param name="model">handicap model</param> public PointsTableViewModel( IModel model) { this.model = model; this.seasonModel = this.model.CurrentSeason; this.pointsTable = new ObservableCollection <PointsTableRowViewModel>(); this.seasonModel.AthleteCollectionChangedEvent += this.RegenerateThePointsTable; this.PopulatePointsTable(); }
public override void ChangeColor(ISeason season) { if (season.NameOfSeason == SeasonOfYear.Summer.ToString()) { Color = ColorOfTree.Green.ToString(); } if (season.NameOfSeason == SeasonOfYear.Winter.ToString()) { Color = ColorOfTree.Green.ToString(); } }
/// <summary> /// shows the episode list for the selected season /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lstSeasons_Click(object sender, EventArgs e) { if (lstSeasons.SelectedItem == null) { return; } ISeason season = (ISeason)lstSeasons.SelectedItem; grdEpisodes.DataSource = season.Episodes; oldEpisodeRowIndex = -1; }
public void WriteTo(MediaItem item) { int rowIndex = grdEpisodes.CurrentCellAddress.Y; if (rowIndex != -1) { // rebind the episode ISeason season = (ISeason)lstSeasons.SelectedItem; season.Episodes[rowIndex] = episodeDetails.Episode; } //item.Components["TvShowDetails"] = showDetails; }
/// <inheritdoc /> public void CreateSeason(ISeason season) { SeasonDto seasonDto = SeasonDto.ToDto(season); this.Context.Seasons.Add(seasonDto); int count = this.Context.SaveChanges(); if (count != 1) { throw new ApplicationException($"Unexpectedly created {count} rows"); } }
private void btnDelete_Click(object sender, EventArgs e) { if (lstSeasons.SelectedItem == null) { return; } ISeason season = (ISeason)lstSeasons.SelectedItem; lstSeasons.Items.Remove(season); showDetails.Seasons.Remove(season); grdEpisodes.DataSource = null; }
/// <summary> /// Writes the data of the provided <see cref="ISeason"/> to the <see cref="StringBuilder"/> /// </summary> /// <param name="season">The <see cref="ISeason"/> whose data is to be written</param> /// <returns>A <see cref="StringBuilder"/> containing string representation of the provided season</returns> private StringBuilder WriteSeasonData(ISeason season) { Contract.Requires(season != null); Contract.Ensures(Contract.Result <StringBuilder>() != null); var builder = new StringBuilder(); AddEntityData(season, builder); var sport = _taskProcessor.GetTaskResult(season.GetSportAsync()); var groups = _taskProcessor.GetTaskResult(season.GetGroupsAsync()); var scheduleString = string.Empty; if (_writeNotCacheableData) { var schedule = _taskProcessor.GetTaskResult(season.GetScheduleAsync()); scheduleString = schedule == null ? "null" : string.Join(",", schedule.Select(s => s.Id)); } var groupsStr = groups == null ? "null" : string.Join(",", groups.Select((s, index) => $"{index}-{s.Name}:C{s.Competitors?.Count()}")); var competitors = _taskProcessor.GetTaskResult(season.GetCompetitorsAsync()); var competitorsStr = competitors == null ? "null" : string.Join(",", competitors.Select(s => s.Id)); var year = _taskProcessor.GetTaskResult(season.GetYearAsync()); var seasonCoverage = _taskProcessor.GetTaskResult(season.GetSeasonCoverageAsync()); var round = _taskProcessor.GetTaskResult(season.GetCurrentRoundAsync()); var tour = _taskProcessor.GetTaskResult(season.GetTournamentInfoAsync()); var tourStr = string.Empty; if (tour != null) { tourStr = $"[{WriteTournamentInfoData(tour)}]"; } builder.Append(" Competitors=").Append(competitors?.Count() ?? 0) .Append(" Sport=").Append(sport) .Append(" Schedule=[").Append(scheduleString).Append("]") .Append(" Groups=").Append(groupsStr) .Append(" Competitions=[").Append(scheduleString).Append("]") .Append(" Year=").Append(year) .Append(" SeasonCoverage=").Append(seasonCoverage?.SeasonId) .Append(" Round=").Append(round?.GetName(_culture)) .Append(" Tournament=").Append(tourStr); return(builder); }
/// <summary> /// Initialises a new instance of the <see cref="ISeason"/> class. /// </summary> /// <param name="model">season model</param> public TeamTrophyPointsTableViewModel(ISeason model) { this.model = model; this.pointsTable = new ObservableCollection <TeamTrophyPointsTableRowViewModel>(); this.currentTeamTrophyPointsTableIndex = 0; this.expandedData = false; this.model.ClubsChangedEvent += this.PopulateClubPointsData; this.ExpandCommand = new SimpleCommand( this.UpdateExpandedFlag); this.PopulateClubTable(); }
/// <summary> /// Converts domain object to DTO. /// </summary> /// <param name="season">Season.</param> /// <returns>Season DTO.</returns> public static SeasonDto ToDto(ISeason season) { if (season == null) { throw new ArgumentNullException(nameof(season)); } return(new SeasonDto( id: season.Id, organiserId: season.Organiser.Id, description: season.Description, startDate: season.StartDate, endDate: season.EndDate)); }
/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(IModelElement item) { if ((this._parent.Season == null)) { ISeason seasonCasted = item.As <ISeason>(); if ((seasonCasted != null)) { this._parent.Season = seasonCasted; return; } } IFlowgate flowgateCasted = item.As <IFlowgate>(); if ((flowgateCasted != null)) { this._parent.Flowgate.Add(flowgateCasted); } }
/// <summary> /// Initialises a new instance of the <see cref="ISeason"/> class. /// </summary> /// <param name="model">season model</param> public TeamHarmonyPointsTableViewModel(ISeason model) { this.model = model; this.pointsTable = new ObservableCollection <TeamHarmonyPointsTableRowViewModel>(); this.currentTeamHarmonyPointsTableIndex = 0; this.expandedData = false; //Model.Instance.CurrentSeason.ClubsCallback = // new ClubSeasonDelegate( // PopulateClubPointsData); this.model.ClubsChangedEvent += this.PopulateClubPointsData; this.ExpandCommand = new SimpleCommand( this.UpdateExpandedFlag); this.PopulateClubTable(); }
private void MergeSeasons(ISeason origSeason, ISeason newSeason) { foreach (IEpisode newEp in newSeason.Episodes) { IEpisode originalEp = origSeason[newEp.EpisodeNumber]; if (originalEp == null) { origSeason.Episodes.Add(newEp); } else if (originalEp is Episode) { MergeEpisodes((Episode)originalEp, newEp); } else { // FIXME: what to do here? } } }
/// <summary> /// adds the specified season object to the tvseries object /// </summary> /// <param name="season"></param> private void AddSeason(ISeason newSeason) { // look for existing season and merge foreach (ISeason season in lstSeasons.Items) { if (season.SeasonNumber == newSeason.SeasonNumber) { MergeSeasons(season, newSeason); return; } } // existing season not found. add new one lstSeasons.Items.Add(newSeason); if (newSeason is MediaItem) { showDetails.Children.Add(newSeason); } }
private void btnRename_Click(object sender, EventArgs e) { if (lstSeasons.SelectedItem == null) { MessageBox.Show("Select a season first"); } else { EpisodeRenamer renamer = new EpisodeRenamer(); List <IEpisode> episodes = new List <IEpisode>(); ISeason season = (ISeason)lstSeasons.SelectedItem; foreach (IEpisode ep in season.Episodes) { episodes.Add(ep); } renamer.Title = showDetails.Title; renamer.Episodes = episodes; renamer.ShowDialog(); } }
/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(IModelElement item) { if ((this._parent.DayType == null)) { IDayType dayTypeCasted = item.As <IDayType>(); if ((dayTypeCasted != null)) { this._parent.DayType = dayTypeCasted; return; } } if ((this._parent.Season == null)) { ISeason seasonCasted = item.As <ISeason>(); if ((seasonCasted != null)) { this._parent.Season = seasonCasted; return; } } }
public virtual ISeason this[int seasonNum] { get { foreach (ISeason season in Seasons) { if (season.SeasonNumber == seasonNum) { return(season); } } return(null); } set { ISeason seasonToRemove = this[seasonNum]; if (seasonToRemove != null) { Seasons.Remove(seasonToRemove); } Seasons.Add(value); } }
/// <summary> /// handles the event from the episode import dialog. we go through each of the MediaFileInfo /// objects and if there is no season object already, we add it. we then set the file info /// for the appropriate episode in the season /// </summary> /// <param name="selectedMediaItems"></param> private void importDialog_MediaItemsSelected(List <MediaFile> selectedMediaItems) { foreach (MediaFile mfi in selectedMediaItems) { int episodeNumber = mfi.EpisodeNumber; int seasonNumber = mfi.SeasonNumber; ISeason seasonToAdd = showDetails[seasonNumber]; if (seasonToAdd == null) { seasonToAdd = AddSeason(seasonNumber); } if (seasonToAdd != null) { IEpisode ep = seasonToAdd[episodeNumber]; if (ep != null) { // MessageBox.Show("Setting path for Episode " + ep.EpisodeNumber + ": " + ep.Title + " to " + mfi.FileName); if (ep is Episode) { ((Episode)ep).File = mfi; } } else { ep = new Episode(seasonNumber, episodeNumber, null, mfi.EpisodeTitle, null); if (seasonToAdd is Season) { seasonToAdd.Episodes.Add(ep); } } } else { MessageBox.Show("Unable to determine any details for season " + seasonNumber); } } }
public static void AddSeason(ISeason season) { if (season != null) { if (!string.IsNullOrEmpty(season.SeasonAfter)) { var afterSeason = _seasons.FirstOrDefault(s => s.Name == season.SeasonAfter); if (afterSeason != null) { var indexOfSeason = _seasons.IndexOf(afterSeason); var newIndex = indexOfSeason - 1; if (newIndex < 0) { newIndex = 0; } if (newIndex <= _seasons.Count) { _seasons.Insert(newIndex, season); } else { _seasons.Add(season); } } else { _seasons.Add(season); } } else { _seasons.Add(season); } } }
/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(IModelElement item) { if ((this._parent.Season == null)) { ISeason seasonCasted = item.As <ISeason>(); if ((seasonCasted != null)) { this._parent.Season = seasonCasted; return; } } if ((this._parent.Measurement == null)) { IMeasurement measurementCasted = item.As <IMeasurement>(); if ((measurementCasted != null)) { this._parent.Measurement = measurementCasted; return; } } IErpOrganisation organisationsCasted = item.As <IErpOrganisation>(); if ((organisationsCasted != null)) { this._parent.Organisations.Add(organisationsCasted); } if ((this._parent.Flowgate == null)) { IFlowgate flowgateCasted = item.As <IFlowgate>(); if ((flowgateCasted != null)) { this._parent.Flowgate = flowgateCasted; return; } } }
private void MergeSeasons(ISeason origSeason, ISeason newSeason) { foreach (IEpisode newEp in newSeason.Episodes) { IEpisode originalEp = origSeason[newEp.EpisodeNumber]; if (originalEp == null) origSeason.Episodes.Add(newEp); else if (originalEp is Episode) { MergeEpisodes((Episode)originalEp, newEp); } else { // FIXME: what to do here? } } }
void EndSeason() { previousSeason = CurrentSeason; CurrentSeason = null; }
public Weather(ISeason season) { this.season = season; }
public void setSeason(ISeason season) { this.season = season; }
/// <summary> /// The class construktor /// </summary> /// <param name="season">The season to use in all of the methods</param> public AccountLogic(ISeason season) { this.season = season; }
/// <summary> /// The class construktor /// </summary> /// <param name="season">The season to use in all of the methods</param> public EventLogic(ISeason season) { this.season = season; }
public void SetUp() { seasonStub = new SeasonStub(); accountLogic = new AccountLogic(seasonStub); Maccount = new Account("SeaasonStub person", "u", "p", true); seasonStub.CurrentAccount = Maccount; }
public void SetUp() { season = new Season(); }
public SeasonsController(ISeason seasonService) { _seasonService = seasonService; }
public abstract void ChangeColor(ISeason season);
public void SetSeason(ISeason season) { }
public ManagerHistoryController(IManagerHistory managerHistoryService, ISeason seasonService, ApplicationDbContext db, IManager managerService) { _managerHistoryService = managerHistoryService; _db = db; _managerService = managerService; }
/// <inheritdoc /> public void Seasons(ICaller caller) { using IDealData data = InstanceFactory.GetInstance <IDealData>(); IList <ISeason> existingSeasons = data.ReadAllSeasons(); IList <IOrganiser> existingOrganisers = data.ReadAllOrganisers(); IList <ISeason> seasons = new List <ISeason> { new Season( id: Guid.NewGuid(), organiser: existingOrganisers.Single(o => o.Code == "BRADGATE"), description: "2019/20", startDate: new DateTime(2019, 11, 01), endDate: new DateTime(2020, 10, 31)), new Season( id: Guid.NewGuid(), organiser: existingOrganisers.Single(o => o.Code == "GLENFIELD"), description: "2019/20", startDate: new DateTime(2019, 05, 23), endDate: new DateTime(2020, 05, 20)), new Season( id: Guid.NewGuid(), organiser: existingOrganisers.Single(o => o.Code == "CBC"), description: "2019/20", startDate: new DateTime(2019, 06, 01), endDate: new DateTime(2020, 05, 31)), new Season( id: Guid.NewGuid(), organiser: existingOrganisers.Single(o => o.Code == "CBT"), description: "2019/20", startDate: new DateTime(2019, 06, 01), endDate: new DateTime(2020, 05, 31)), new Season( id: Guid.NewGuid(), organiser: existingOrganisers.Single(o => o.Code == "LCBA"), description: "2019/20", startDate: new DateTime(2019, 06, 01), endDate: new DateTime(2020, 05, 31)) }; foreach (ISeason season in seasons) { ISeason existingSeason = existingSeasons .Where(es => es.Organiser.Code == season.Organiser.Code) .SingleOrDefault(es => es.Description == season.Description); if (existingSeason == null) { data.CreateSeason(season); Console.WriteLine($@"Seeding Season: {season.Organiser.Code} {season.Description}."); } else { if (existingSeason.StartDate == season.StartDate && existingSeason.EndDate == season.EndDate) { continue; } existingSeason.SetDates(season.StartDate, season.EndDate); data.UpdateSeason(existingSeason); Console.WriteLine($@"Updating Season: {season.Organiser.Code} {season.Description}."); } } }
public void SetSeason(ISeason season) { throw new NotImplementedException(); }
public void SetUp() { seasonStub = new SeasonStub(); accountLogic = new AccountLogic(seasonStub); //This user is precreated by default in SeasonStub. Maccount = new Account("SeaasonStub person", "u", "p", true); //Setting CurrentAccount to Maccount enforces that we are logged in as Maccount. seasonStub.CurrentAccount = Maccount; }