コード例 #1
0
 /// <summary>
 /// Checks whether provided event is expected according to this itinerary specification.
 /// </summary>
 /// <param name="event">A handling event.</param>
 /// <returns>True, if it is expected. Otherwise - false. If itinerary is empty, returns false.</returns>
 public virtual bool IsExpected(HandlingEvent @event)
 {
     if (IsEmpty)
     {
         return(false);
     }
     if (@event.EventType == HandlingEventType.Receive)
     {
         Leg firstLeg = Legs.First();
         return(firstLeg.LoadLocation == @event.Location);
     }
     if (@event.EventType == HandlingEventType.Claim)
     {
         Leg lastLeg = Legs.Last();
         return(lastLeg.UnloadLocation == @event.Location);
     }
     if (@event.EventType == HandlingEventType.Load)
     {
         return(Legs.Any(x => x.LoadLocation == @event.Location));
     }
     if (@event.EventType == HandlingEventType.Unload)
     {
         return(Legs.Any(x => x.UnloadLocation == @event.Location));
     }
     //@event.EventType == HandlingEventType.Customs
     return(true);
 }