Exemplo n.º 1
0
      public IList<Itinerary> FetchRoutesFor(Cargo cargoToBeRouted)
      {
         var possibleRoutes = GetAllPossibleRoutes(cargoToBeRouted.RouteSpecification);         
         var agreement = _agreementRepository.Find(cargoToBeRouted.OrderingCustomer);

         return agreement.RoutingPolicy.SelectOptimal(possibleRoutes).ToList();
      }
 public CargoRoutingDTO ToDTO(Cargo cargo)
 {         
    return new CargoRoutingDTO(            
       cargo.TrackingId.IdString,
       cargo.RouteSpecification.Origin.UnLocode.CodeString,
       cargo.RouteSpecification.Destination.UnLocode.CodeString,
       cargo.RouteSpecification.ArrivalDeadline,
       cargo.Delivery.RoutingStatus == RoutingStatus.Misrouted,
       ToLegDTOs(cargo.Itinerary));
 }
 public CargoTrackingViewAdapter(Cargo cargo, HandlingHistory handlingHistory)
 {
    _cargo = cargo;
    if (handlingHistory != null)
    {
       _handlingEvents = handlingHistory.EventsByCompletionTime.ToList();  
    }
    else
    {
       _handlingEvents = new List<HandlingEvent>();
    }
 }
Exemplo n.º 4
0
      public TrackingId BookNewCargo(string customerLogin, UnLocode originUnLocode, UnLocode destinationUnLocode, DateTime arrivalDeadline)
      {
         var origin = _locationRepository.Find(originUnLocode);
         var destination = _locationRepository.Find(destinationUnLocode);
         var customer = _customerRepository.Find(customerLogin);

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

         _cargoRepository.Store(cargo);
         return trackingId;
      }
 public HandlingEventViewAdapter(DomainModel.Operations.Handling.HandlingEvent handlingEvent, Cargo cargo)
 {
    _handlingEvent = handlingEvent;
    _cargo = cargo;
 }