Example #1
0
        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
            {
            }
        }
Example #2
0
 public void setCurrentClub(string id, string name)
 {
     _currentClub = new TMClub(id, name);
 }
Example #3
0
 public void SetInterestedClub(TMClub club)
 {
     _interestedClub = club;
 }
Example #4
0
        public void AddLoan(String dateStr, TMClub club)
        {
            var date = DateTime.ParseExact(dateStr, DateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None);

            _loanDictionary.Add(date, club);
        }