コード例 #1
0
ファイル: Season.cs プロジェクト: abs508/jHc
        /// <summary>
        /// Update the points earnt for position for the indicated athlete on the indicated date.
        /// </summary>
        /// <param name="key">unique key</param>
        /// <param name="date">date of the event</param>
        /// <param name="points">earned points</param>
        public void UpdatePositionPoints(int key, DateType date, int points)
        {
            IAthleteSeasonDetails athlete = Athletes.Find(a => a.Key == key);

            if (athlete == null)
            {
                return;
            }

            athlete.UpdatePositionPoints(date, points);
        }
コード例 #2
0
ファイル: Season.cs プロジェクト: abs508/jHc
        /// <summary>
        /// Add a new time to the indicated (key) athlete.
        /// </summary>
        /// <param name="key">unique key</param>
        /// <param name="newTime">new time to add</param>
        public void AddNewTime(int key, Appearances newTime)
        {
            IAthleteSeasonDetails athlete = Athletes.Find(a => a.Key == key);

            if (athlete == null)
            {
                return;
            }

            athlete.AddNewTime(newTime);
        }
コード例 #3
0
ファイル: Season.cs プロジェクト: abs508/jHc
        /// <summary>
        /// Get the current handicap for the athlete. The handicap is the rounded one.
        /// </summary>
        /// <param name="key">unique key</param>
        /// <returns>rounded handicap</returns>
        public RaceTimeType GetAthleteHandicap(int key, NormalisationConfigType hcConfiguration)
        {
            if (Athletes != null && Athletes.Count > 0)
            {
                if (Athletes.Exists(athlete => athlete.Key == key))
                {
                    return(Athletes.Find(athlete => athlete.Key == key).GetRoundedHandicap(hcConfiguration));
                }
            }

            return(null);
        }
コード例 #4
0
ファイル: Season.cs プロジェクト: abs508/jHc
        /// <summary>
        /// Add a new time to the indicated (key) athlete.
        /// </summary>
        /// <param name="key">unique key</param>
        /// <param name="points">new points to add</param>
        public void AddNewPoints(
            int key,
            CommonPoints points)
        {
            IAthleteSeasonDetails athlete = Athletes.Find(a => a.Key == key);

            if (athlete == null)
            {
                return;
            }

            athlete.AddNewPoints(points);
            this.AthletesChangedEvent?.Invoke(this, new EventArgs());
        }
コード例 #5
0
ファイル: Season.cs プロジェクト: abs508/jHc
 /// <summary>
 /// Get the current handicap season best
 /// </summary>
 /// <param name="key">unique key</param>
 /// <returns>season best time</returns>
 public TimeType GetSB(int key)
 {
     return(Athletes.Find(athlete => athlete.Key == key)?.SB ?? new TimeType(0, 0));
 }
コード例 #6
0
ファイル: Season.cs プロジェクト: abs508/jHc
 /// <summary>
 /// Get the number of appearances by the athlete in the current season
 /// </summary>
 /// <param name="key">unique key</param>
 /// <returns>number of appearances</returns>
 public int GetAthleteAppearancesCount(int key)
 {
     return(Athletes.Find(athlete => athlete.Key == key)?.NumberOfAppearances ?? 0);
 }