Пример #1
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);
      }
Пример #2
0
 /// <summary>
 /// Creates new <see cref="Cargo"/> object with provided tracking id and route specification.
 /// </summary>
 /// <param name="trackingId">Tracking id of this cargo.</param>
 /// <param name="routeSpecification">Route specification.</param>
 /// <param name="orderingCustomer">Customer who ordered this cargo.</param>
 public Cargo(TrackingId trackingId, RouteSpecification routeSpecification, Customer orderingCustomer)
 {
     if (trackingId == null)
     {
         throw new ArgumentNullException("trackingId");
     }
     if (routeSpecification == null)
     {
         throw new ArgumentNullException("routeSpecification");
     }
     OrderingCustomer   = orderingCustomer;
     TrackingId         = trackingId;
     RouteSpecification = routeSpecification;
     Delivery           = Delivery.DerivedFrom(RouteSpecification, Itinerary, null);
 }
Пример #3
0
 /// <summary>
 /// Creates new <see cref="Cargo"/> object with provided tracking id and route specification.
 /// </summary>
 /// <param name="trackingId">Tracking id of this cargo.</param>
 /// <param name="routeSpecification">Route specification.</param>
 /// <param name="orderingCustomer">Customer who ordered this cargo.</param>
 public Cargo(TrackingId trackingId, RouteSpecification routeSpecification, Customer orderingCustomer)
 {
    if (trackingId == null)
    {
       throw new ArgumentNullException("trackingId");
    }
    if (routeSpecification == null)
    {
       throw new ArgumentNullException("routeSpecification");
    }
    OrderingCustomer = orderingCustomer;
    TrackingId = trackingId;
    RouteSpecification = routeSpecification;
    Delivery = Delivery.DerivedFrom(RouteSpecification, Itinerary, null);
 }
 public HandlingHistory LookupHandlingHistoryOfCargo(TrackingId cargoTrackingId)
 {         
    return Session.CreateCriteria(typeof(HandlingHistory))
       .Add(Restrictions.Eq("TrackingId", cargoTrackingId))            
       .UniqueResult<HandlingHistory>();
 }
Пример #5
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);         
 }
Пример #6
0
 public void AssignCargoToRoute(TrackingId trackingId, Itinerary itinerary)
 {
    Cargo cargo = _cargoRepository.Find(trackingId);
    cargo.AssignToRoute(itinerary);
 }
Пример #7
0
 public IList<Itinerary> RequestPossibleRoutesForCargo(TrackingId trackingId)
 {
    Cargo cargo = _cargoRepository.Find(trackingId);
    return _routingService.FetchRoutesFor(cargo);
 }
Пример #8
0
 public DomainModel.Operations.Cargo.Cargo Find(TrackingId trackingId)
 {         
    return Session.CreateCriteria(typeof(Cargo))
       .Add(Restrictions.Eq("TrackingId", trackingId))
       .UniqueResult<DomainModel.Operations.Cargo.Cargo>();
 }
Пример #9
0
 public HandlingHistory(TrackingId cargoTrackingId)
 {
    TrackingId = cargoTrackingId;
    _events = new List<HandlingEvent>();
 }