public AssignToRouteModel GetAssignToRouteModel(string trackingId) { Reporting.Cargo cargo = _bookingFacade.LoadCargoForRouting(trackingId); return(new AssignToRouteModel( cargo, _routingFacade.FetchRoutesForSpecification(cargo.Origin, cargo.Destination, cargo.ArrivalDeadline) )); }
/// <summary> /// Loads DTO of cargo for cargo routing function. /// </summary> /// <param name="trackingId">Cargo tracking id.</param> /// <returns>DTO.</returns> public Reporting.Cargo LoadCargoForRouting(string trackingId) { Reporting.Cargo c = _cargoDataAccess.FindByTrackingId(trackingId); if (c == null) { throw new ArgumentException("Cargo with specified tracking id not found."); } return(c); }
public ActionResult ChangeDestination(string trackingId) { Reporting.Cargo cargo = _bookingFacade.LoadCargoForRouting(trackingId); IList <SelectListItem> shippingLocations = _bookingFacade.ListShippingLocations(); ViewData["destination"] = shippingLocations.Where(x => x.Value != cargo.Origin).ToList(); return(View(GetDetailsModel(trackingId))); }
public ActionResult Track(string trackingId) { Reporting.Cargo cargo = _cargoDataAccess.Find(trackingId); if (cargo == null) { ViewData.ModelState.AddModelError("trackingId", "Provided tracking id is invalid."); return(View()); } return(View(new CargoTrackingViewAdapter(cargo))); }
public ActionResult AssignToRoute(string trackingId, List <LegDTO> legs) { Reporting.Cargo cargo = _bookingFacade.LoadCargoForRouting(trackingId); _bus.Send(new AssignCargoToRouteCommand { CargoId = cargo.Id, Legs = legs }); return(RedirectToDetails(trackingId)); }
public ActionResult ChangeDestination(string trackingId, string destination) { Reporting.Cargo cargo = _bookingFacade.LoadCargoForRouting(trackingId); _bus.Send(new ChangeDestinationCommand { CargoId = cargo.Id, NewDestination = destination }); return(RedirectToDetails(trackingId)); }
public void Handle(Cargo.Cargo source, CargoRegisteredEvent @event) { var spec = @event.RouteSpecification; var cargo = new Reporting.Cargo(source.Id, @event.TrackingId.IdString, spec.Origin.CodeString, spec.Destination.CodeString, spec.ArrivalDeadline); _cargoDataAccess.Store(cargo); }
/// <summary> /// Loads DTO of cargo for cargo routing function. /// </summary> /// <param name="trackingId">Cargo tracking id.</param> /// <returns>DTO.</returns> public Reporting.Cargo LoadCargoForRouting(string trackingId) { ReportingDataContext context = new ReportingDataContext(); Reporting.Cargo c = context.Cargos.FirstOrDefault(x => x.TrackingId == trackingId); if (c == null) { throw new ArgumentException("Cargo with specified tracking id not found."); } return(c); }
public ActionResult Track(string trackingId) { ReportingDataContext context = new ReportingDataContext(); Reporting.Cargo cargo = context.Cargos.FirstOrDefault(x => x.TrackingId == trackingId); if (cargo == null) { ViewData.ModelState.AddModelError("trackingId", "Provided tracking id is invalid."); return(View()); } return(View(new CargoTrackingViewAdapter(cargo))); }
public ActionResult RegisterHandlingEvent(string trackingId, RegisterHandlingEventCommand command) { if (command.CompletionTime == DateTime.MinValue) { ModelState.AddModelError("command.CompletionTime", "Event completion date is required and must be a valid date."); } if (string.IsNullOrEmpty(trackingId)) { ModelState.AddModelError("trackingId", "Tracking id must be specified."); } if (!ModelState.IsValid) { AddHandlingLocations(); AddHandlingEventTypes(); return(View()); } Reporting.Cargo cargo = _cargoDataAccess.FindByTrackingId(trackingId); command.CargoId = cargo.AggregateId; _bus.Send(command); return(RedirectToAction("Index", "Home")); }
public AssignToRouteModel(Reporting.Cargo cargo, IList<RouteCandidateDTO> routeCandidates) { _routeCandidates = routeCandidates; _cargo = cargo; }
public AssignToRouteModel(Reporting.Cargo cargo, IList <RouteCandidateDTO> routeCandidates) { _routeCandidates = routeCandidates; _cargo = cargo; }