Ejemplo n.º 1
0
 public LegDTO ToDTO(Leg leg)
 {
    return new LegDTO(leg.Voyage.Number.NumberString,
                      leg.Voyage.Id,
                      leg.LoadLocation.UnLocode.CodeString,
                      leg.UnloadLocation.UnLocode.CodeString,
                      leg.LoadDate,
                      leg.UnloadDate);
 }
Ejemplo n.º 2
0
        private HandlingActivity CalculateNextExpectedActivity(RouteSpecification routeSpecification, Itinerary itinerary)
        {
            if (!OnTrack)
            {
                return(null);
            }

            if (LastEvent == null)
            {
                return(new HandlingActivity(HandlingEventType.Receive, routeSpecification.Origin));
            }

            switch (LastEvent.EventType)
            {
            case HandlingEventType.Load:

                Leg lastLeg = itinerary.Legs.FirstOrDefault(x => x.LoadLocation == LastEvent.Location);
                return(lastLeg != null ? new HandlingActivity(HandlingEventType.Unload, lastLeg.UnloadLocation) : null);

            case HandlingEventType.Unload:
                IEnumerator <Leg> enumerator = itinerary.Legs.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    if (enumerator.Current.UnloadLocation == LastEvent.Location)
                    {
                        Leg currentLeg = enumerator.Current;
                        return(enumerator.MoveNext() ? new HandlingActivity(HandlingEventType.Load, enumerator.Current.LoadLocation) : new HandlingActivity(HandlingEventType.Claim, currentLeg.UnloadLocation));
                    }
                }
                return(null);

            case HandlingEventType.Receive:
                Leg firstLeg = itinerary.Legs.First();
                return(new HandlingActivity(HandlingEventType.Load, firstLeg.LoadLocation));

            default:
                return(null);
            }
        }