コード例 #1
0
ファイル: TMRumorSource.cs プロジェクト: AndrewHK/IDP
        public void DetermineCurrentClub(TMClub defaultClub)
        {
            var       playerTransfers = _player.GetTransferDictionary();
            const int minDayDiff      = 10;

            /* Loop on the SORTED dictionary till it finds a date that is after the given rumor source date,
             * if no transfers (like in /emmanual-sunday/profil/spieler/156476) return
             * Get the club related to the date BEFORE the one it found
             * If nothing before, current club is null
             * If nothing after, current club is last club
             */
            if (playerTransfers.Count <= 0)
            {
                _currentClub = defaultClub;
                return;
            }
            var prevKey     = DateTime.MinValue;
            var prevprevKey = DateTime.MinValue;

            try
            {
                foreach (var kvp in playerTransfers)
                {
                    if (kvp.Key.Date.CompareTo(_rumorSourceDate.Date) >= 0)
                    {
                        var daysDiff = (_rumorSourceDate - prevKey).TotalDays;

                        if (daysDiff >= minDayDiff)
                        {
                            _currentClub     = playerTransfers[prevKey];
                            _currentClubDate = prevKey;
                        }
                        else
                        {
                            _currentClub     = playerTransfers[prevprevKey];
                            _currentClubDate = prevprevKey;
                        }


                        return;
                    }
                    prevprevKey = prevKey;
                    prevKey     = kvp.Key;
                }
                _currentClub     = playerTransfers[prevKey];
                _currentClubDate = prevKey;
            }
            catch
            {
            }
        }
コード例 #2
0
ファイル: TMRumor.cs プロジェクト: AndrewHK/IDP
 public void setCurrentClub(string id, string name)
 {
     _currentClub = new TMClub(id, name);
 }
コード例 #3
0
ファイル: TMRumorSource.cs プロジェクト: AndrewHK/IDP
 public void SetInterestedClub(TMClub club)
 {
     _interestedClub = club;
 }
コード例 #4
0
ファイル: TMPlayer.cs プロジェクト: AndrewHK/IDP
        public void AddLoan(String dateStr, TMClub club)
        {
            var date = DateTime.ParseExact(dateStr, DateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None);

            _loanDictionary.Add(date, club);
        }