public void assignCargoToRoute(string trackingIdStr, RouteCandidateDTO routeCandidateDTO) { var itinerary = DTOAssembler.fromDTO(routeCandidateDTO, voyageRepository, locationRepository); var trackingId = new TrackingId(trackingIdStr); bookingService.assignCargoToRoute(itinerary, trackingId); }
private static void AssignCargoToRoute(TrackingId trackingId, RouteCandidateDTO selectedRoute) { var assignToRouteCommand = new AssignCargoToRouteCommand() { Route = selectedRoute, TrackingId = trackingId.IdString }; CommandPipeline.Process(assignToRouteCommand); }
public void AssignCargoToRoute(string trackingIdStr, RouteCandidateDTO routeCandidateDTO) { try { Itinerary itinerary = new ItineraryCandidateDTOAssembler().FromDTO(routeCandidateDTO, VoyageRepository, LocationRepository); var trackingId = new TrackingId(trackingIdStr); BookingService.AssignCargoToRoute(itinerary, trackingId); } catch (Exception exception) { throw new NDDDRemoteBookingException(exception.Message); } }
internal static Itinerary fromDTO(RouteCandidateDTO routeCandidateDTO, VoyageRepository voyageRepository, LocationRepository locationRepository) { var legs = new List <Leg>(routeCandidateDTO.getLegs().Count()); foreach (LegDTO legDTO in routeCandidateDTO.getLegs()) { var voyageNumber = new VoyageNumber(legDTO.getVoyageNumber()); var voyage = voyageRepository.find(voyageNumber); var from = locationRepository.find(new UnLocode(legDTO.getFrom())); var to = locationRepository.find(new UnLocode(legDTO.getTo())); legs.Add(Leg.DeriveLeg(voyage, from, to)); } return(new Itinerary(legs)); }
public ActionResult AssignItinerary(RouteAssignmentCommand command) { var legs = command.legs .Select(leg => new LegDTO( leg.voyageNumber, leg.fromUnLocode, leg.toUnLocode, leg.fromDate, leg.toDate)); var selectedRoute = new RouteCandidateDTO(legs); _bookingServiceFacade.assignCargoToRoute(command.trackingId, selectedRoute); return(RedirectToAction("Show", new { command.trackingId })); }
/// <summary> /// Assemble a Itinerary from provided RouteCandidateDTO. /// </summary> /// <param name="routeCandidateDTO">route candidate DTO</param> /// <param name="voyageRepository">voyage repository</param> /// <param name="locationRepository">location repository</param> /// <returns>An itinerary</returns> public Itinerary FromDTO(RouteCandidateDTO routeCandidateDTO, IVoyageRepository voyageRepository, ILocationRepository locationRepository) { var legs = new List <Leg>(routeCandidateDTO.Legs.Count); foreach (LegDTO legDTO in routeCandidateDTO.Legs) { VoyageNumber voyageNumber = new VoyageNumber(legDTO.VoyageNumber); Voyage voyage = voyageRepository.Find(voyageNumber); Location from = locationRepository.Find(new UnLocode(legDTO.FromLocation)); Location to = locationRepository.Find(new UnLocode(legDTO.ToLocation)); legs.Add(new Leg(voyage, from, to, legDTO.LoadTime, legDTO.UnloadTime)); } return(new Itinerary(legs)); }
/// <summary> /// Assemble a Itinerary from provided RouteCandidateDTO. /// </summary> /// <param name="routeCandidateDTO">route candidate DTO</param> /// <param name="voyageRepository">voyage repository</param> /// <param name="locationRepository">location repository</param> /// <returns>An itinerary</returns> public Itinerary FromDTO(RouteCandidateDTO routeCandidateDTO, IVoyageRepository voyageRepository, ILocationRepository locationRepository) { var legs = new List<Leg>(routeCandidateDTO.Legs.Count); foreach (LegDTO legDTO in routeCandidateDTO.Legs) { VoyageNumber voyageNumber = new VoyageNumber(legDTO.VoyageNumber); Voyage voyage = voyageRepository.Find(voyageNumber); Location from = locationRepository.Find(new UnLocode(legDTO.FromLocation)); Location to = locationRepository.Find(new UnLocode(legDTO.ToLocation)); legs.Add(new Leg(voyage, from, to, legDTO.LoadTime, legDTO.UnloadTime)); } return new Itinerary(legs); }
public ActionResult AssignItinerary(string trackingId, IList<LegCommand> legCommands) { var legDTOs = new List<LegDTO>(legCommands.Count); legDTOs.AddRange( legCommands.Select( leg => new LegDTO( leg.VoyageNumber, leg.FromUnLocode, leg.ToUnLocode, leg.FromDate, leg.ToDate )) ); var selectedRoute = new RouteCandidateDTO(legDTOs); BookingServiceFacade.AssignCargoToRoute(trackingId, selectedRoute); return RedirectToAction("Show", new RouteValueDictionary(new {trackingId})); }
public ActionResult AssignItinerary(string trackingId, IList <LegCommand> legCommands) { var legDTOs = new List <LegDTO>(legCommands.Count); legDTOs.AddRange( legCommands.Select( leg => new LegDTO( leg.VoyageNumber, leg.FromUnLocode, leg.ToUnLocode, leg.FromDate, leg.ToDate )) ); var selectedRoute = new RouteCandidateDTO(legDTOs); BookingServiceFacade.AssignCargoToRoute(trackingId, selectedRoute); return(RedirectToAction("Show", new RouteValueDictionary(new { trackingId }))); }
public ActionResult AssignToRoute(string trackingId, RouteCandidateDTO routeCandidate) { _bookingFacade.AssignCargoToRoute(trackingId, routeCandidate); return RedirectToDetails(trackingId); }
public ActionResult AssignToRoute(string trackingId, RouteCandidateDTO routeCandidate) { _bookingFacade.AssignCargoToRoute(trackingId, routeCandidate); return(RedirectToDetails(trackingId)); }
public Itinerary FromDTO(RouteCandidateDTO routeCandidate) { return(new Itinerary(routeCandidate.Legs.Select(FromLegDTO))); }
/// <summary> /// Binds cargo to selected delivery route. /// </summary> /// <param name="trackingId">Cargo tracking id.</param> /// <param name="route">Route definition.</param> public void AssignCargoToRoute(String trackingId, RouteCandidateDTO route) { var command = new AssignCargoToRouteCommand { TrackingId = trackingId, Route = route }; _pipelineFactory.Process(command); }