public PlayerHistoryController(IPlayerHistory playerHistoryService, ISeason seasonService, ApplicationDbContext db, IPlayer playerService, ITeam teamService)
 {
     _playerHistoryService = playerHistoryService;
     _db            = db;
     _playerService = playerService;
     _teamService   = teamService;
 }
Exemplo n.º 2
0
 /// <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;
 }
Exemplo n.º 3
0
 public override void Grow(ISeason season)
 {
     if (season.NameOfSeason == SeasonOfYear.Summer.ToString())
     {
         Height += increase;
     }
 }
Exemplo n.º 4
0
        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}");
        }
Exemplo n.º 5
0
        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;
            }
        }
Exemplo n.º 6
0
 public ClubHistoryController(IClubHistory historyService, ISeason seasonService, ApplicationDbContext db, ITeam teamService)
 {
     _historyService = historyService;
     _seasonService  = seasonService;
     _db             = db;
     _teamService    = teamService;
 }
Exemplo n.º 7
0
        /// <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();
        }
Exemplo n.º 8
0
        /// <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();
        }
Exemplo n.º 9
0
 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();
     }
 }
Exemplo n.º 10
0
        /// <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;
        }
Exemplo n.º 11
0
        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;
        }
Exemplo n.º 12
0
        /// <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");
            }
        }
Exemplo n.º 13
0
        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;
        }
Exemplo n.º 14
0
        /// <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);
        }
Exemplo n.º 15
0
        /// <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();
        }
Exemplo n.º 16
0
        /// <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));
        }
Exemplo n.º 17
0
            /// <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);
                }
            }
Exemplo n.º 18
0
        /// <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();
        }
Exemplo n.º 19
0
 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?
         }
     }
 }
Exemplo n.º 20
0
        /// <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);
            }
        }
Exemplo n.º 21
0
        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();
            }
        }
Exemplo n.º 22
0
 /// <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;
         }
     }
 }
Exemplo n.º 23
0
 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);
     }
 }
Exemplo n.º 24
0
        /// <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);
                }
            }
        }
Exemplo n.º 25
0
        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);
                }
            }
        }
Exemplo n.º 26
0
            /// <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;
                    }
                }
            }
Exemplo n.º 27
0
 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?
         }
     }
 }
Exemplo n.º 28
0
        /// <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);
            }
        }
Exemplo n.º 29
0
 void EndSeason()
 {
     previousSeason = CurrentSeason;
     CurrentSeason  = null;
 }
Exemplo n.º 30
0
 public Weather(ISeason season)
 {
     this.season = season;
 }
Exemplo n.º 31
0
 public void setSeason(ISeason season)
 {
     this.season = season;
 }
Exemplo n.º 32
0
 /// <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;
 }
Exemplo n.º 33
0
 /// <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;
 }
Exemplo n.º 34
0
 public void SetUp()
 {
     seasonStub = new SeasonStub();
     accountLogic = new AccountLogic(seasonStub);
     Maccount = new Account("SeaasonStub person", "u", "p", true);
     seasonStub.CurrentAccount = Maccount;
 }
Exemplo n.º 35
0
 public void SetUp()
 {
     season = new Season();
 }
Exemplo n.º 36
0
 public SeasonsController(ISeason seasonService)
 {
     _seasonService = seasonService;
 }
Exemplo n.º 37
0
 public abstract void ChangeColor(ISeason season);
Exemplo n.º 38
0
 public void SetSeason(ISeason season)
 {
 }
Exemplo n.º 39
0
 public ManagerHistoryController(IManagerHistory managerHistoryService, ISeason seasonService, ApplicationDbContext db, IManager managerService)
 {
     _managerHistoryService = managerHistoryService;
     _db             = db;
     _managerService = managerService;
 }
Exemplo n.º 40
0
        /// <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}.");
                }
            }
        }
Exemplo n.º 41
0
 public void SetSeason(ISeason season)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 42
0
 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;
 }