예제 #1
0
 /// <summary>
 /// Creates new event.
 /// </summary>
 /// <param name="eventType"></param>
 /// <param name="location"></param>
 /// <param name="registrationDate"></param>
 /// <param name="completionDate"></param>
 public HandlingEvent(HandlingEventType eventType, UnLocode location, DateTime registrationDate, DateTime completionDate)
 {
    _eventType = eventType;
    _completionDate = completionDate;
    _registrationDate = registrationDate;         
    _location = location;         
 }
예제 #2
0
 /// <summary>
 /// Creates new leg instance.
 /// </summary>
 /// <param name="loadLocation">Location where cargo is supposed to be loaded.</param>
 /// <param name="loadDate">Date and time when cargo is supposed to be loaded</param>
 /// <param name="unloadLocation">Location where cargo is supposed to be unloaded.</param>
 /// <param name="unloadDate">Date and time when cargo is supposed to be unloaded.</param>
 public Leg(UnLocode loadLocation, DateTime loadDate, UnLocode unloadLocation, DateTime unloadDate)
 {
    _loadLocation = loadLocation;
    _unloadDate = unloadDate;
    _unloadLocation = unloadLocation;
    _loadDate = loadDate;
 }
예제 #3
0
 /// <summary>
 /// Creates new leg instance.
 /// </summary>
 /// <param name="loadLocation">Location where cargo is supposed to be loaded.</param>
 /// <param name="loadDate">Date and time when cargo is supposed to be loaded</param>
 /// <param name="unloadLocation">Location where cargo is supposed to be unloaded.</param>
 /// <param name="unloadDate">Date and time when cargo is supposed to be unloaded.</param>
 public Leg(UnLocode loadLocation, DateTime loadDate, UnLocode unloadLocation, DateTime unloadDate)
 {
    LoadLocation = loadLocation;
    UnloadDate = unloadDate;
    UnloadLocation = unloadLocation;
    LoadDate = loadDate;
 }
예제 #4
0
 public void ChangeDestination(TrackingId trackingId, UnLocode destinationUnLocode)
 {         
    Location destination = _locationRepository.Find(destinationUnLocode);
    
    Cargo cargo = _cargoRepository.Find(trackingId);
    cargo.SpecifyNewRoute(destination);
 }
예제 #5
0
      public void ChangeDestination(TrackingId trackingId, UnLocode destinationUnLocode)
      {
         Cargo cargo = _cargoRepository.Find(trackingId);
         Location destination = _locationRepository.Find(destinationUnLocode);

         RouteSpecification routeSpecification = new RouteSpecification(cargo.RouteSpecification.Origin, destination, cargo.RouteSpecification.ArrivalDeadline);
         cargo.SpecifyNewRoute(routeSpecification);
      }
예제 #6
0
 public HandlingActivity(HandlingEventType eventType, UnLocode location)
 {
    if (location == null)
    {
       throw new ArgumentNullException("location");
    }
    EventType = eventType;
    Location = location;
 }
예제 #7
0
      /// <summary>
      /// Specifies a new route for this cargo.
      /// </summary>
      /// <param name="destination">New destination.</param>
      public virtual void SpecifyNewRoute(UnLocode destination)
      {
         if (destination == null)
         {
            throw new ArgumentNullException("destination");
         }
         var routeSpecification = new RouteSpecification(RouteSpecification.Origin, destination,
                                                                        RouteSpecification.ArrivalDeadline);

         Publish(this, new CargoDestinationChangedEvent(routeSpecification,
                                                DeliveryStatus.Derive(routeSpecification, Itinerary)));         
      }
예제 #8
0
      public TrackingId BookNewCargo(UnLocode originUnLocode, UnLocode destinationUnLocode, DateTime arrivalDeadline)
      {
         Location origin = _locationRepository.Find(originUnLocode);
         Location destination = _locationRepository.Find(destinationUnLocode);

         RouteSpecification routeSpecification = new RouteSpecification(origin, destination, arrivalDeadline);
         TrackingId trackingId = _cargoRepository.NextTrackingId();
         Cargo cargo = new Cargo(trackingId, routeSpecification);

         _cargoRepository.Store(cargo);
         return trackingId;
      }
예제 #9
0
      public RouteSpecification(UnLocode origin, UnLocode destination, DateTime arrivalDeadline)
      {
         if (origin == null)
         {
            throw new ArgumentNullException("origin");
         }
         if (destination == null)
         {
            throw new ArgumentNullException("destination");
         }
         if (origin == destination)
         {
            throw new ArgumentException("Origin and destination can't be the same.");
         }

         Origin = origin;
         ArrivalDeadline = arrivalDeadline;
         Destination = destination;
      }
예제 #10
0
 /// <summary>
 /// Creates new location.
 /// </summary>
 /// <param name="locode"><see cref="UnLocode"/> for this location.</param>
 /// <param name="name">Name.</param>
 public Location(UnLocode locode, string name)
 {
     UnLocode = locode;
     Name     = name;
 }
 private static void RegisterHandlingEvent(string cargoId, DateTime time, UnLocode location, HandlingEventType eventType)
 {
    InvokeCommand(new RegisterHandlingEventCommand
                     {
                        CargoId = cargoId,
                        CompletionTime = time,
                        Location = location.CodeString,
                        Type = eventType
                     });
 }
예제 #12
0
 /// <summary>
 /// Registers new handling event into the history.
 /// </summary>
 /// <param name="eventType">Type of the event.</param>
 /// <param name="location">Location where event occured.</param>
 /// <param name="registrationDate">Date when event was registered.</param>
 /// <param name="completionDate">Date when action represented by the event was completed.</param>
 public virtual void RegisterHandlingEvent(HandlingEventType eventType, UnLocode location, DateTime registrationDate, DateTime completionDate)
 {
    var @event = new HandlingEvent(eventType, location, registrationDate, completionDate);
    
    Publish(this, new CargoHandledEvent(Delivery.DerivedFrom(RouteSpecification, Itinerary, @event)));
 }      
 private static void RegisterHandlingEvent(DateTime completionTime, TrackingId trackingId, UnLocode occuranceLocation, HandlingEventType handlingEventType)
 {
     var registerHandlingEventCommand = new RegisterHandlingEventCommand()
                                            {
                                                CompletionTime = completionTime,
                                                OccuranceLocation = occuranceLocation.CodeString,
                                                TrackingId = trackingId.IdString,
                                                Type = handlingEventType
                                            };
     CommandPipeline.Process(registerHandlingEventCommand);
 }
예제 #14
0
      private Delivery(HandlingEvent lastHandlingEvent, Itinerary itinerary, RouteSpecification specification)
      {
         _calculatedAt = DateTime.Now;
         _lastEvent = lastHandlingEvent;

         _misdirected = CalculateMisdirectionStatus(itinerary, lastHandlingEvent);
         _routingStatus = CalculateRoutingStatus(itinerary, specification);
         _transportStatus = CalculateTransportStatus(lastHandlingEvent);
         _lastKnownLocation = CalculateLastKnownLocation(lastHandlingEvent);
         _eta = CalculateEta(itinerary);
         _nextExpectedActivity = CalculateNextExpectedActivity(specification, itinerary, lastHandlingEvent);
         _isUnloadedAtDestination = CalculateUnloadedAtDestination(specification, lastHandlingEvent);
      }
예제 #15
0
 public Location.Location Find(UnLocode locode)
 {
    return _storage.FirstOrDefault(x => x.UnLocode == locode);
 }
예제 #16
0
 /// <summary>
 /// Creates new location.
 /// </summary>
 /// <param name="locode"><see cref="UnLocode"/> for this location.</param>
 /// <param name="name">Name.</param>
 public Location(UnLocode locode, string name)
 {
    UnLocode = locode;
    Name = name;
 }      
예제 #17
0
 public void RegisterHandlingEvent(DateTime completionTime, TrackingId trackingId, UnLocode unLocode, HandlingEventType type)
 {
    HandlingHistory handlingHistory = _handlingEventRepository.LookupHandlingHistoryOfCargo(trackingId);
    Location location = _locationRepository.Find(unLocode);
    handlingHistory.RegisterHandlingEvent(type, location, DateTime.Now, completionTime);         
 }
예제 #18
0
 public Location.Location Find(UnLocode locode)
 {
    const string query = @"from DDDSample.Domain.Location.Location l where l.UnLocode = :unLocode";
    return Session.CreateQuery(query).SetString("unLocode",locode.CodeString)
       .UniqueResult<Location.Location>();
 }
예제 #19
0
 public void RegisterHandlingEvent(DateTime completionTime, TrackingId trackingId, UnLocode unLocode, HandlingEventType type)
 {
    Cargo cargo = _cargoRepository.Find(trackingId);                  
    Location location = _locationRepository.Find(unLocode);
    cargo.RegisterHandlingEvent(type, location, DateTime.Now, completionTime);
 }