private ForwardingEvent GetForwardingEventFrom(SroEvent @event) { var _event = new ForwardingEvent() { Dates = new ShipmentEventDates(), Locations = new ForwardedToLocations() }; _event.PackageHasArrived = GetIsPackageArrivedFrom(@event); _event.BoundryMessage = GetBoundryMessageFrom(@event); _event.Dates.OccurredAt = SroResponseJsonAdapter.GetDateTimeFrom(@event); _event.Locations.ForwardedFrom = SroResponseJsonAdapter.GetLocationFrom(@event); _event.Locations.ForwardedTo = GetForwardedToLocationFrom(@event); _event.ArrivedAt = GetArrivalDateTimeFrom(_event.Locations.ForwardedTo); return(_event); }
private DateTime GetArrivalDateTimeFrom(Location location) { var date = new DateTime(); var events = Json.evento; for (var i = events.Count - 1; i >= 0; i--) { var @event = events[i]; var eventLocation = SroResponseJsonAdapter.GetLocationFrom(@event); var locationsMatch = LocationEntity.CompareLocationsBool(eventLocation, location); if (locationsMatch) { date = SroResponseJsonAdapter.GetDateTimeFrom(@event); } } return(date); }