Пример #1
0
 /// <summary>
 /// Initializes a new instance of the Shopping class.
 /// </summary>
 /// <param name="client">Client.</param>
 public Shopping(Amadeus client)
 {
     this.client             = client;
     this.flightDates        = new FlightDates(client);
     this.flightDestinations = new FlightDestinations(client);
     this.flightOffers       = new FlightOffers(client);
     this.hotelOffers        = new HotelOffers(client);
     this.hotelOffersByHotel = new HotelOffersByHotel(client);
 }
Пример #2
0
        public FlightDates GetActualFlightDates(FlightDates flightDates)
        {
            if (string.IsNullOrWhiteSpace(flightDates.StartDate))
            {
                flightDates.StartDate = GetTodaysDate();
            }

            if (string.IsNullOrWhiteSpace(flightDates.EndDate))
            {
                flightDates.EndDate = GetFutureDate(flightDates.StartDate, 3);
            }
            else if (flightDates.EndDate.Contains("+"))
            {
                var relative = flightDates.EndDate.TrimStart('+').Split(' ');
                flightDates.EndDate = GetFutureDate(flightDates.StartDate, int.Parse(relative[0]), relative[1]);
            }

            return(flightDates);
        }
        private void SetDetailTabDataForAg(DetailTabData detailTabData)
        {
            SetReactCheckBoxState(_chkIsAutoGeneratedName, detailTabData.AutoGenerateName);

            if (!detailTabData.AutoGenerateName)
            {
                ClearInputAndTypeValue(_txtPlacementName, detailTabData.Name);
            }

            var flightDates = new FlightDates
            {
                StartDate = detailTabData.StartDate,
                EndDate   = detailTabData.EndDate
            };

            flightDates = GetActualFlightDates(flightDates);

            EnterDate(_txtStartDate, flightDates.StartDate);
            EnterDate(_txtEndDate, flightDates.EndDate);

            if (ConvertToPurchaseTypeEnum(detailTabData.PurchaseType) == PurchaseType.CPD)
            {
                try
                {
                    Wait.Until(driver => _txtGoal.GetAttribute("value").Replace(",", string.Empty).Contains(detailTabData.Goal));
                }
                catch
                {
                    Assert.Fail($"CPD Goal mismatch.\nExpected: {detailTabData.Goal}\nActual: {_txtGoal.GetAttribute("value").Replace(", ", string.Empty)}");
                }
            }

            if (!string.IsNullOrEmpty(detailTabData.TargetingType))
            {
                ScrollAndClickElement(_ddlTargetingType);
                SelectSingleValueFromReactDropdownByText(_ddlTargetingType, detailTabData.TargetingType);
                ScrollAndClickElement(_ddlTargetingOptions);
                Wait.Until(d => !IsElementPresent(By.XPath("//div[contains(@class,'select-component targeting-options select-component--is-disabled')]")));
                SelectMultipleValuesFromReactDropdownByText(_ddlTargetingOptions, detailTabData.TargetingOptions);
            }

            ValidateAutoCalculatedField(detailTabData);
        }
Пример #4
0
        public override void ExamineFlight(ExaminerFlightRow cfr)
        {
            if (cfr == null)
            {
                throw new ArgumentNullException("cfr");
            }
            DateTime dtFlight = cfr.dtFlight.Date;

            if (AutoDateRange)
            {
                StartDate = StartDate.EarlierDate(dtFlight);
                EndDate   = EndDate.LaterDate(dtFlight);
            }

            // ignore anything not in a real aircraft or outside of our date range
            if (!cfr.fIsRealAircraft || dtFlight.CompareTo(StartDate) < 0 || dtFlight.CompareTo(EndDate) > 0)
            {
                return;
            }

            miFlightCount.AddEvent(1);

            string szDateKey = dtFlight.YMDString();

            // Initialize the current streak, if needed
            if (FirstDayOfCurrentStreak == null || LastDayOfCurrentStreak == null)
            {
                FirstDayOfCurrentStreak = LastDayOfCurrentStreak = dtFlight;
            }

            // Extend the current streak if this flight is either on the first date or on a day before the first date; if it isn't one of those, then end the current streak
            if (dtFlight.CompareTo(FirstDayOfCurrentStreak.Value.Date) == 0 || dtFlight.CompareTo(FirstDayOfCurrentStreak.Value.AddDays(-1).Date) == 0)
            {
                FirstDayOfCurrentStreak = dtFlight;
            }
            else
            {
                FirstDayOfCurrentStreak = LastDayOfCurrentStreak = dtFlight;
            }

            int cDaysCurrentStreak = CurrentFlyingDayStreak;

            if (cDaysCurrentStreak > 1 && cDaysCurrentStreak > FlyingDayStreak)
            {
                FirstFlyingDayOfStreak = FirstDayOfCurrentStreak;
                LastFlyingDayOfStreak  = LastDayOfCurrentStreak;
            }

            // Distinct flights on dates
            if (FlightDates.ContainsKey(szDateKey))
            {
                FlightDates[szDateKey] = FlightDates[szDateKey] + 1;
            }
            else
            {
                FlightDates[szDateKey] = 1;
            }

            if (FlightDates[szDateKey] > MaxFlightsPerDay)
            {
                int cFlights = FlightDates[szDateKey];
                MaxFlightsPerDay                     = cFlights;
                miMostFlightsInDay.Progress          = cFlights;
                miMostFlightsInDay.MatchingEventText = String.Format(CultureInfo.InvariantCulture, Resources.Achievements.RecentAchievementMostFlightsInDay, cFlights, cfr.dtFlight);
                miMostFlightsInDay.Query             = new FlightQuery(Username)
                {
                    DateRange = FlightQuery.DateRanges.Custom, DateMin = cfr.dtFlight, DateMax = cfr.dtFlight
                };
            }

            // Longest flight
            if (cfr.Total > LongestFlightLength)
            {
                LongestFlightLength               = cfr.Total;
                miLongestFlight.Progress          = 1;
                miLongestFlight.MatchingEventID   = cfr.flightID;
                miLongestFlight.MatchingEventText = String.Format(CultureInfo.CurrentCulture, Resources.Achievements.RecentAchievementsLongestFlight, cfr.Total, dtFlight);
            }

            // Distinct aircraft/models
            DistinctAircraft.Add(cfr.idAircraft);
            DistinctModels.Add(cfr.idModel);
            DistinctICAO.Add(cfr.szFamily);

            // Furthest Flight & airport computations.
            AirportList al = AirportListOfRoutes.CloneSubset(cfr.Route, true);

            double distance = al.DistanceForRoute();

            if (distance > FurthestFlightDistance)
            {
                FurthestFlightDistance             = distance;
                miFurthestFlight.Progress          = 1;
                miFurthestFlight.MatchingEventID   = cfr.flightID;
                miFurthestFlight.MatchingEventText = String.Format(CultureInfo.CurrentCulture, Resources.Achievements.RecentAchievementsFurthestFlight, distance, dtFlight);
            }

            int cUniqueAirports           = 0;
            HashSet <string> hsThisFlight = new HashSet <string>();

            foreach (airport ap in al.UniqueAirports)
            {
                // Dedupe as we go based on latitude/longitude, ignoring non-ports.
                // We don't actually need the facility name here - so we can just round off the latitude/longitude and distinguish by type code.
                // Note: this can differ slightly from Visited Airports counts because for achievements, we're ignoring flights in training devices; visited airports doesn't ignore them.
                if (ap.IsPort)
                {
                    string szHash = ap.GeoHashKey;
                    if (!Airports.Contains(szHash))
                    {
                        Airports.Add(ap.GeoHashKey);
                        cUniqueAirports++;
                    }
                    hsThisFlight.Add(szHash);
                }
            }

            int cAirportsThisFlight = hsThisFlight.Count;

            if (cAirportsThisFlight > MostAirportsFlightCount)
            {
                MostAirportsFlightCount = cAirportsThisFlight;
                miMostAirportsFlight.MatchingEventID   = cfr.flightID;
                miMostAirportsFlight.Progress          = 1;
                miMostAirportsFlight.MatchingEventText = String.Format(CultureInfo.CurrentCulture, Resources.Achievements.RecentAchievementsAirportsOnFlight, cAirportsThisFlight, dtFlight.ToShortDateString());
                miMostAirportsFlight.Query             = new FlightQuery(Username)
                {
                    DateRange = FlightQuery.DateRanges.Custom, DateMax = dtFlight, DateMin = dtFlight
                };
            }
        }
Пример #5
0
        public int FlightCountOnDate(DateTime dt)
        {
            int cFlights;

            return(FlightDates.TryGetValue(dt.YMDString(), out cFlights) ? cFlights : 0);
        }
        public override void ExamineFlight(ExaminerFlightRow cfr)
        {
            if (cfr == null)
            {
                throw new ArgumentNullException("cfr");
            }
            DateTime dtFlight = cfr.dtFlight.Date;

            // ignore anything not in a real aircraft or outside of our date range
            if (!cfr.fIsRealAircraft || dtFlight.CompareTo(StartDate) < 0 || dtFlight.CompareTo(EndDate) > 0)
            {
                return;
            }

            string szDateKey = dtFlight.YMDString();

            // Initialize the current streak, if needed
            if (FirstDayOfCurrentStreak == null || LastDayOfCurrentStreak == null)
            {
                FirstDayOfCurrentStreak = LastDayOfCurrentStreak = dtFlight;
            }

            // Extend the current streak if this flight is either on the first date or on a day before the first date; if it isn't one of those, then end the current streak
            if (dtFlight.CompareTo(FirstDayOfCurrentStreak.Value.Date) == 0 || dtFlight.CompareTo(FirstDayOfCurrentStreak.Value.AddDays(-1).Date) == 0)
            {
                FirstDayOfCurrentStreak = dtFlight;
            }
            else
            {
                FirstDayOfCurrentStreak = LastDayOfCurrentStreak = dtFlight;
            }

            int cDaysCurrentStreak = CurrentFlyingDayStreak;

            if (cDaysCurrentStreak > 1 && cDaysCurrentStreak > FlyingDayStreak)
            {
                FirstFlyingDayOfStreak = FirstDayOfCurrentStreak;
                LastFlyingDayOfStreak  = LastDayOfCurrentStreak;
            }

            // Distinct flights on dates
            if (FlightDates.ContainsKey(szDateKey))
            {
                FlightDates[szDateKey] = FlightDates[szDateKey] + 1;
            }
            else
            {
                FlightDates[szDateKey] = 1;
            }

            if (FlightDates[szDateKey] > MaxFlightsPerDay)
            {
                int cFlights = FlightDates[szDateKey];
                MaxFlightsPerDay                     = cFlights;
                miMostFlightsInDay.Progress          = cFlights;
                miMostFlightsInDay.MatchingEventText = String.Format(CultureInfo.InvariantCulture, Resources.Achievements.RecentAchievementMostFlightsInDay, cFlights, cfr.dtFlight);
                miMostFlightsInDay.Query             = new FlightQuery(Username)
                {
                    DateRange = FlightQuery.DateRanges.Custom, DateMin = cfr.dtFlight, DateMax = cfr.dtFlight
                };
            }

            // Longest flight
            if (cfr.Total > LongestFlightLength)
            {
                LongestFlightLength               = cfr.Total;
                miLongestFlight.Progress          = 1;
                miLongestFlight.MatchingEventID   = cfr.flightID;
                miLongestFlight.MatchingEventText = String.Format(CultureInfo.CurrentCulture, Resources.Achievements.RecentAchievementsLongestFlight, cfr.Total, dtFlight);
            }

            // Distinct aircraft/models
            DistinctAircraft.Add(cfr.idAircraft);
            DistinctModels.Add(cfr.idModel);
            DistinctICAO.Add(cfr.szFamily);

            // Furthest Flight & airport computations.
            AirportList al = AirportListOfRoutes.CloneSubset(cfr.Route);

            double distance = al.DistanceForRoute();

            if (distance > FurthestFlightDistance)
            {
                FurthestFlightDistance             = distance;
                miFurthestFlight.Progress          = 1;
                miFurthestFlight.MatchingEventID   = cfr.flightID;
                miFurthestFlight.MatchingEventText = String.Format(CultureInfo.CurrentCulture, Resources.Achievements.RecentAchievementsFurthestFlight, distance, dtFlight);
            }

            int cUniqueAirports = al.UniqueAirports.Count();

            foreach (airport ap in al.UniqueAirports)
            {
                if (ap.IsPort)
                {
                    // Dedupe as we go - do the K-hack check; if the K version is in the AirportListOfRoutes, use that.  I.e., just pre-pend a "K" to ANY three-letter airport code.
                    if (ap.Code.Length == 3)
                    {
                        Airports.Add("K" + ap.Code);
                    }
                    else
                    {
                        Airports.Add(ap.Code);
                    }
                }
            }

            if (cUniqueAirports > MostAirportsFlightCount)
            {
                MostAirportsFlightCount                = cUniqueAirports;
                miMostAirportsFlight.Progress          = 1;
                miMostAirportsFlight.MatchingEventText = String.Format(CultureInfo.CurrentCulture, Resources.Achievements.RecentAchievementsAirportsOnFlight, cUniqueAirports, dtFlight.ToShortDateString());
                miMostAirportsFlight.Query             = new FlightQuery(Username)
                {
                    DateRange = FlightQuery.DateRanges.Custom, DateMax = dtFlight, DateMin = dtFlight
                };
            }
        }
Пример #7
0
        public void TestGetMethods()
        {
            var _client = new Mock <Amadeus>();
            var _params = Params.with("airline", "1X");

            // Prepare a plural response
            JArray jsonArray = new JArray();

            jsonArray.Add(new JObject());
            jsonArray.Add(new JObject());
            var _multiResponse = new Mock <Response>();

            _multiResponse.Setup(m => m.parsed).Returns(true);
            _multiResponse.Setup(m => m.data).Returns(jsonArray);
            _multiResponse.Setup(m => m.dataString).Returns(jsonArray.ToString());

            // Prepare a single response
            JObject jsonObject = new JObject();

            jsonObject.Add("foo", "bar");
            var _singleResponse = new Mock <Response>();

            _singleResponse.Setup(m => m.parsed).Returns(true);
            _singleResponse.Setup(m => m.data).Returns(jsonObject);
            _singleResponse.Setup(m => m.dataString).Returns(jsonObject.ToString());

            try
            {
                // Testing CheckinLinks
                _client.Setup(m => m.get("/v2/reference-data/urls/checkin-links", null)).Returns(_multiResponse.Object);
                _client.Setup(m => m.get("/v2/reference-data/urls/checkin-links", _params)).Returns(_multiResponse.Object);
                CheckinLinks checkinLinks = new CheckinLinks(_client.Object);
                Assert.IsNotNull(checkinLinks);
                Assert.IsNotNull(checkinLinks.get(_params));
                Assert.IsTrue(checkinLinks.get().Length == 2);

                // Testing location search
                _client.Setup(m => m.get("/v1/reference-data/locations", null)).Returns(_multiResponse.Object);
                _client.Setup(m => m.get("/v1/reference-data/locations", _params)).Returns(_multiResponse.Object);
                Locations locations = new Locations(_client.Object);
                Assert.IsNotNull(locations);
                Assert.IsNotNull(locations.get(_params));
                Assert.IsTrue(locations.get().Length == 2);

                // Testing airport search
                _client.Setup(m => m.get("/v1/reference-data/locations/airports", null)).Returns(_multiResponse.Object);
                _client.Setup(m => m.get("/v1/reference-data/locations/airports", _params)).Returns(_multiResponse.Object);
                Airports airports = new Airports(_client.Object);
                Assert.IsNotNull(airports);
                Assert.IsNotNull(airports.get(_params));
                Assert.IsTrue(airports.get().Length == 2);

                // Testing fetching a single location
                _client.Setup(m => m.get("/v1/reference-data/locations/ALHR", null)).Returns(_singleResponse.Object);
                _client.Setup(m => m.get("/v1/reference-data/locations/ALHR", _params)).Returns(_singleResponse.Object);
                Location location = new Location(_client.Object, "ALHR");
                Assert.IsNotNull(location);
                Assert.IsNotNull(location.get(_params));

                // Testing airlines search
                _client.Setup(m => m.get("/v1/reference-data/airlines", null)).Returns(_multiResponse.Object);
                _client.Setup(m => m.get("/v1/reference-data/airlines", _params)).Returns(_multiResponse.Object);
                Airlines airlines = new Airlines(_client.Object);
                Assert.IsNotNull(airlines);
                Assert.IsNotNull(airlines.get(_params));
                Assert.IsTrue(airlines.get().Length == 2);

                // Testing traveled stats
                _client.Setup(m => m.get("/v1/travel/analytics/air-traffic/traveled", null)).Returns(_multiResponse.Object);
                _client.Setup(m => m.get("/v1/travel/analytics/air-traffic/traveled", _params)).Returns(_multiResponse.Object);
                Traveled traveled = new Traveled(_client.Object);
                Assert.IsNotNull(traveled);
                Assert.IsNotNull(traveled.get(_params));
                Assert.IsTrue(traveled.get().Length == 2);

                // Testing booked stats
                _client.Setup(m => m.get("/v1/travel/analytics/air-traffic/booked", null)).Returns(_multiResponse.Object);
                _client.Setup(m => m.get("/v1/travel/analytics/air-traffic/booked", _params)).Returns(_multiResponse.Object);
                Booked booked = new Booked(_client.Object);
                Assert.IsNotNull(booked);
                Assert.IsNotNull(booked.get(_params));
                Assert.IsTrue(booked.get().Length == 2);

                // Testing busiest traveling period
                _client.Setup(m => m.get("/v1/travel/analytics/air-traffic/busiest-period", null)).Returns(_multiResponse.Object);
                _client.Setup(m => m.get("/v1/travel/analytics/air-traffic/busiest-period", _params)).Returns(_multiResponse.Object);
                BusiestPeriod busiestPeriod = new BusiestPeriod(_client.Object);
                Assert.IsNotNull(busiestPeriod);
                Assert.IsNotNull(busiestPeriod.get(_params));
                Assert.IsTrue(busiestPeriod.get().Length == 2);

                // Testing most searched destinations
                _client.Setup(m => m.get("/v1/travel/analytics/air-traffic/searched", null)).Returns(_multiResponse.Object);
                _client.Setup(m => m.get("/v1/travel/analytics/air-traffic/searched", _params)).Returns(_multiResponse.Object);
                Searched searched = new Searched(_client.Object);
                Assert.IsNotNull(searched);
                Assert.IsNotNull(searched.get(_params));
                Assert.IsTrue(searched.get().Length == 2);

                // Testing searched stats
                _client.Setup(m => m.get("/v1/travel/analytics/air-traffic/searched/by-destination", null)).Returns(_singleResponse.Object);
                _client.Setup(m => m.get("/v1/travel/analytics/air-traffic/searched/by-destination", _params)).Returns(_singleResponse.Object);
                SearchedByDestination searchesByDestination = new SearchedByDestination(_client.Object);
                Assert.IsNotNull(searchesByDestination);
                Assert.IsNotNull(searchesByDestination.get(_params));

                // Testing most searched destinations
                _client.Setup(m => m.get("/v1/shopping/flight-dates", null)).Returns(_multiResponse.Object);
                _client.Setup(m => m.get("/v1/shopping/flight-dates", _params)).Returns(_multiResponse.Object);
                FlightDates flightDates = new FlightDates(_client.Object);
                Assert.IsNotNull(flightDates);
                Assert.IsNotNull(flightDates.get(_params));
                Assert.IsTrue(flightDates.get().Length == 2);

                // Testing flight destination search
                _client.Setup(m => m.get("/v1/shopping/flight-destinations", null)).Returns(_multiResponse.Object);
                _client.Setup(m => m.get("/v1/shopping/flight-destinations", _params)).Returns(_multiResponse.Object);
                FlightDestinations flightDestinations = new FlightDestinations(_client.Object);
                Assert.IsNotNull(flightDestinations);
                Assert.IsNotNull(flightDestinations.get(_params));
                Assert.IsTrue(flightDestinations.get().Length == 2);

                // Testing flight offer search
                _client.Setup(m => m.get("/v1/shopping/flight-offers", null)).Returns(_multiResponse.Object);
                _client.Setup(m => m.get("/v1/shopping/flight-offers", _params)).Returns(_multiResponse.Object);
                FlightOffers flightOffers = new FlightOffers(_client.Object);
                Assert.IsNotNull(flightOffers);
                Assert.IsNotNull(flightOffers.get(_params));
                Assert.IsTrue(flightOffers.get().Length == 2);

                // Testing hotel offer search
                _client.Setup(m => m.get("/v2/shopping/hotel-offers", null)).Returns(_multiResponse.Object);
                _client.Setup(m => m.get("/v2/shopping/hotel-offers", _params)).Returns(_multiResponse.Object);
                HotelOffers hotelOffers = new HotelOffers(_client.Object);
                Assert.IsNotNull(hotelOffers);
                Assert.IsNotNull(hotelOffers.get(_params));
                Assert.IsTrue(hotelOffers.get().Length == 2);

                // Testing hotel offer search for a hotel
                _client.Setup(m => m.get("/v2/shopping/hotel-offers/by-hotel", null)).Returns(_multiResponse.Object);
                _client.Setup(m => m.get("/v2/shopping/hotel-offers/by-hotel", _params)).Returns(_multiResponse.Object);
                HotelOffersByHotel hotelOffersByHotel = new HotelOffersByHotel(_client.Object);
                Assert.IsNotNull(hotelOffersByHotel);
                Assert.IsNotNull(hotelOffersByHotel.get(_params));
                Assert.IsTrue(hotelOffersByHotel.get().Length == 2);

                // Test fetching a specific offer
                _client.Setup(m => m.get("/v2/shopping/hotel-offers/XXX", null)).Returns(_singleResponse.Object);
                _client.Setup(m => m.get("/v2/shopping/hotel-offers/XXX", _params)).Returns(_singleResponse.Object);
                HotelOffer hotelOffer = new HotelOffer(_client.Object, "XXX");
                Assert.IsNotNull(hotelOffer);
                Assert.IsNotNull(hotelOffer.get(_params));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                Assert.Fail();
            }
        }
        public override void ExamineFlight(ExaminerFlightRow cfr)
        {
            if (cfr == null)
            {
                throw new ArgumentNullException(nameof(cfr));
            }
            DateTime dtFlight = cfr.dtFlight.Date;

            if (AutoDateRange)
            {
                StartDate = StartDate.EarlierDate(dtFlight);
                EndDate   = EndDate.LaterDate(dtFlight);
            }

            // ignore anything not in a real aircraft or outside of our date range
            if (!cfr.fIsRealAircraft || dtFlight.CompareTo(StartDate) < 0 || dtFlight.CompareTo(EndDate) > 0)
            {
                return;
            }

            miFlightCount.AddEvent(1);

            string szDateKey = dtFlight.YMDString();

            // Initialize the current streak, if needed
            if (FirstDayOfCurrentStreak == null || LastDayOfCurrentStreak == null)
            {
                FirstDayOfCurrentStreak = LastDayOfCurrentStreak = dtFlight;
            }

            // Extend the current streak if this flight is either on the first date or on a day before the first date; if it isn't one of those, then end the current streak
            FirstDayOfCurrentStreak = dtFlight.CompareTo(FirstDayOfCurrentStreak.Value.Date) == 0 || dtFlight.CompareTo(FirstDayOfCurrentStreak.Value.AddDays(-1).Date) == 0
                ? (DateTime?)dtFlight
                : (LastDayOfCurrentStreak = dtFlight);

            int cDaysCurrentStreak = CurrentFlyingDayStreak;

            if (cDaysCurrentStreak > 1 && cDaysCurrentStreak > FlyingDayStreak)
            {
                FirstFlyingDayOfStreak = FirstDayOfCurrentStreak;
                LastFlyingDayOfStreak  = LastDayOfCurrentStreak;
            }

            // Distinct flights on dates
            FlightDates[szDateKey] = FlightDates.ContainsKey(szDateKey) ? FlightDates[szDateKey] + 1 : 1;

            if (FlightDates[szDateKey] > MaxFlightsPerDay)
            {
                int cFlights = FlightDates[szDateKey];
                MaxFlightsPerDay                     = cFlights;
                miMostFlightsInDay.Progress          = cFlights;
                miMostFlightsInDay.MatchingEventText = String.Format(CultureInfo.CurrentCulture, Resources.Achievements.RecentAchievementMostFlightsInDay, cFlights, cfr.dtFlight);
                miMostFlightsInDay.Query             = new FlightQuery(Username)
                {
                    DateRange = FlightQuery.DateRanges.Custom, DateMin = cfr.dtFlight, DateMax = cfr.dtFlight
                };
            }

            FlightLandings[szDateKey] = FlightLandings.ContainsKey(szDateKey) ? FlightLandings[szDateKey] + cfr.cLandingsThisFlight : cfr.cLandingsThisFlight;

            if (FlightLandings[szDateKey] > MaxLandingsPerDay)
            {
                int cLandings = FlightLandings[szDateKey];
                MaxLandingsPerDay                     = cLandings;
                miMostLandingsInDay.Progress          = cLandings;
                miMostLandingsInDay.MatchingEventText = String.Format(CultureInfo.CurrentCulture, Resources.Achievements.RecentAchievementMostLandingsInDay, cLandings, cfr.dtFlight);
                miMostLandingsInDay.Query             = new FlightQuery(Username)
                {
                    DateRange = FlightQuery.DateRanges.Custom, DateMin = cfr.dtFlight, DateMax = cfr.dtFlight
                };
            }

            // Longest flight
            if (cfr.Total > LongestFlightLength)
            {
                LongestFlightLength               = cfr.Total;
                miLongestFlight.Progress          = 1;
                miLongestFlight.MatchingEventID   = cfr.flightID;
                miLongestFlight.MatchingEventText = String.Format(CultureInfo.CurrentCulture, Resources.Achievements.RecentAchievementsLongestFlight, cfr.Total, dtFlight);
            }

            // Distinct aircraft/models
            DistinctAircraft.Add(cfr.idAircraft);
            DistinctModels.Add(cfr.idModel);
            DistinctICAO.Add(cfr.szFamily);

            // Furthest Flight & airport computations.
            AirportList al = AirportListOfRoutes.CloneSubset(cfr.Route, true);

            double distance = al.DistanceForRoute();

            if (distance > FurthestFlightDistance)
            {
                FurthestFlightDistance             = distance;
                miFurthestFlight.Progress          = 1;
                miFurthestFlight.MatchingEventID   = cfr.flightID;
                miFurthestFlight.MatchingEventText = String.Format(CultureInfo.CurrentCulture, Resources.Achievements.RecentAchievementsFurthestFlight, distance, dtFlight);
            }

            int cAirportsThisFlight = MatchAirports(al.UniqueAirports);

            if (cAirportsThisFlight > MostAirportsFlightCount)
            {
                MostAirportsFlightCount = cAirportsThisFlight;
                miMostAirportsFlight.MatchingEventID   = cfr.flightID;
                miMostAirportsFlight.Progress          = 1;
                miMostAirportsFlight.MatchingEventText = String.Format(CultureInfo.CurrentCulture, Resources.Achievements.RecentAchievementsAirportsOnFlight, cAirportsThisFlight, dtFlight.ToShortDateString());
                miMostAirportsFlight.Query             = new FlightQuery(Username)
                {
                    DateRange = FlightQuery.DateRanges.Custom, DateMax = dtFlight, DateMin = dtFlight
                };
            }

            fs100.ExamineFlight(cfr);
            fs1000.ExamineFlight(cfr);
        }