示例#1
0
        public void Handle(Cargo.Cargo source, CargoAssignedToRouteEvent @event)
        {
            var cargo = _cargoDataAccess.FindByTrackingId(source.TrackingId.IdString);

            cargo.RouteSpecification = ConvertItineraryToLegDtos(@event.NewItinerary);

            _cargoDataAccess.Store(cargo);
        }
        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);
        }
        public void Handle(Cargo.Cargo source, CargoDestinationChangedEvent @event)
        {
            var cargo = _cargoDataAccess.FindByTrackingId(source.TrackingId.IdString);
            var spec  = @event.NewSpecification;

            cargo.UpdateRouteSpecification(
                spec.Origin.CodeString,
                spec.Destination.CodeString,
                spec.ArrivalDeadline);

            _cargoDataAccess.Store(cargo);
        }
示例#4
0
        public void Handle(Cargo.Cargo source, CargoHandledEvent @event)
        {
            var del = @event.Delivery;
            var lastKnownActivity = new Reporting.HandlingActivity(del.LastEventType.Value, del.LastKnownLocation.CodeString);

            Reporting.HandlingActivity nextExpectedActivity = null;
            if (del.NextExpectedActivity != null)
            {
                nextExpectedActivity = new Reporting.HandlingActivity(del.NextExpectedActivity.EventType, del.NextExpectedActivity.Location.CodeString);
            }
            var cargo = _cargoDataAccess.FindByTrackingId(source.TrackingId.IdString);

            cargo.UpdateHistory(
                nextExpectedActivity,
                lastKnownActivity,
                del.RoutingStatus,
                del.TransportStatus,
                del.EstimatedTimeOfArrival,
                del.IsUnloadedAtDestination,
                del.IsMisdirected,
                del.CalculatedAt);

            _cargoDataAccess.Store(cargo);
        }
        protected override void DoHandle(CargoRegisteredMessage message)
        {
            Cargo cargo = new Cargo(message.CargoId, message.TrackingId, message.Origin, message.Destination, message.ArrivalDeadline);

            _cargoDataAccess.Store(cargo);
        }