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); }
/// <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); }
/// <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>(); }
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); }
public void AssignCargoToRoute(TrackingId trackingId, Itinerary itinerary) { Cargo cargo = _cargoRepository.Find(trackingId); cargo.AssignToRoute(itinerary); }
public IList<Itinerary> RequestPossibleRoutesForCargo(TrackingId trackingId) { Cargo cargo = _cargoRepository.Find(trackingId); return _routingService.FetchRoutesFor(cargo); }
public DomainModel.Operations.Cargo.Cargo Find(TrackingId trackingId) { return Session.CreateCriteria(typeof(Cargo)) .Add(Restrictions.Eq("TrackingId", trackingId)) .UniqueResult<DomainModel.Operations.Cargo.Cargo>(); }
public HandlingHistory(TrackingId cargoTrackingId) { TrackingId = cargoTrackingId; _events = new List<HandlingEvent>(); }