예제 #1
0
        public Cargo(TrackingId trackingId, RouteSpecification routeSpec)
        {
            TrackingId = trackingId ?? throw new ArgumentNullException(nameof(trackingId));
            RouteSpec  = routeSpec ?? throw new ArgumentNullException(nameof(routeSpec));

            Delivery = new Delivery(RouteSpec, null, null);

            this.Events.Add(new NewBooked(trackingId, routeSpec));
        }
예제 #2
0
        // rehydration ctor
        public Cargo(TrackingId trackingId, RouteSpecification routeSpec, Itinerary itinerary, Delivery delivery, HandlingEvent lastHandlingEvent)
        {
            TrackingId        = trackingId;
            RouteSpec         = routeSpec;
            Itinerary         = itinerary;
            LastHandlingEvent = lastHandlingEvent;

            Delivery = new Delivery(RouteSpec, Itinerary, LastHandlingEvent);
        }
예제 #3
0
        public HandlingEvent(
            TrackingId trackingId
            , HandlingType type
            , UnLocode location
            , VoyageNumber voyage
            , DateTime completed
            , DateTime registered)
        {
            if ((type == HandlingType.Load || type == HandlingType.Unload)
                &&
                (voyage == null)
                )
            {
                throw new InvalidOperationException("loading/unloading events need a voyage");
            }

            TrackingId = trackingId ?? throw new ArgumentNullException(nameof(trackingId));
            Location   = location ?? throw new ArgumentNullException(nameof(location));
            Type       = type;
            Voyage     = voyage;
            Completed  = completed;
            Registered = registered;
        }