Exemple #1
0
 /// <summary>
 /// Creates new leg instance.
 /// </summary>
 /// <param name="voyage">Voyage</param>
 /// <param name="loadLocation">Location where cargo is supposed to be loaded.</param>
 /// <param name="loadDate">Date and time when cargo is supposed to be loaded</param>
 /// <param name="unloadLocation">Location where cargo is supposed to be unloaded.</param>
 /// <param name="unloadDate">Date and time when cargo is supposed to be unloaded.</param>
 public Leg(Voyage.Voyage voyage, Location.Location loadLocation, DateTime loadDate, Location.Location unloadLocation, DateTime unloadDate)
 {
    _loadLocation = loadLocation;
    _voyage = voyage;
    _unloadDate = unloadDate;
    _unloadLocation = unloadLocation;
    _loadDate = loadDate;
 }
Exemple #2
0
 /// <summary>
 /// Creates new leg instance.
 /// </summary>
 /// <param name="voyage">Voyage</param>
 /// <param name="loadLocation">Location where cargo is supposed to be loaded.</param>
 /// <param name="loadDate">Date and time when cargo is supposed to be loaded</param>
 /// <param name="unloadLocation">Location where cargo is supposed to be unloaded.</param>
 /// <param name="unloadDate">Date and time when cargo is supposed to be unloaded.</param>
 public Leg(Voyage.Voyage voyage, Location.Location loadLocation, DateTime loadDate, Location.Location unloadLocation, DateTime unloadDate)
 {
     _loadLocation   = loadLocation;
     _voyage         = voyage;
     _unloadDate     = unloadDate;
     _unloadLocation = unloadLocation;
     _loadDate       = loadDate;
 }
		/// <summary>
		/// Creates an instance of <see cref="HandlingActivity"/> from the handling event type and the location.
		/// </summary>
		/// <param name="eventType">The handling event type.</param>
		/// <param name="location">The location where the handling is done.</param>
		/// <param name="voyage"></param>
		public HandlingActivity(HandlingEventType eventType, Location.Location location, Voyage.Voyage voyage)
		{
			if (location == null)
				throw new ArgumentNullException("location");
			if (voyage == null)
				throw new ArgumentNullException("voyage");

			_eventType = eventType;
			_location = location;
			_voyage = voyage;
		}
        public void UpdateDeliveryUponUnloadInPort()
        {
            var delivery = Delivery.BeforeHandling();
            var voyage = new Voyage.Voyage(new VoyageNumber("abc"));
            var unloadInLongBeach = HandlingActivity.UnloadOff(voyage, Location.Location.LongBeach);
            delivery = delivery.OnHandling(unloadInLongBeach);

            Assert.AreEqual(now, delivery.LastUpdatedOn);
            Assert.AreEqual(Voyage.Voyage.None, delivery.CurrentVoyage);
            Assert.AreEqual(TransportStatus.InPort, delivery.TransportStatus);
            Assert.AreEqual(unloadInLongBeach, delivery.MostRecentHandlingActivity);
            Assert.AreEqual(Location.Location.LongBeach, delivery.LastKnownLocation);
        }
        public void UpdateDeliveryUponLoad()
        {
            var delivery = Delivery.BeforeHandling();
            var voyage = new Voyage.Voyage(new VoyageNumber("abc"));
            var loadInHongKong = HandlingActivity.LoadOnto(voyage, Location.Location.HongKong);
            delivery = delivery.OnHandling(loadInHongKong);

            Assert.AreEqual(now, delivery.LastUpdatedOn);
            Assert.AreEqual(voyage, delivery.CurrentVoyage);
            Assert.AreEqual(TransportStatus.OnboardCarrier, delivery.TransportStatus);
            Assert.AreEqual(loadInHongKong, delivery.MostRecentHandlingActivity);
            Assert.AreEqual(Location.Location.HongKong, delivery.LastKnownLocation);
        }
Exemple #6
0
		/// <summary>
		/// Creates new leg instance.
		/// </summary>
		/// <param name="voyage"></param>
		/// <param name="loadLocation">Location where cargo is supposed to be loaded.</param>
		/// <param name="loadDate">Date and time when cargo is supposed to be loaded.</param>
		/// <param name="unloadLocation">Location where cargo is supposed to be unloaded.</param>
		/// <param name="unloadDate">Date and time when cargo is supposed to be unloaded.</param>
		public Leg(Voyage.Voyage voyage, Location.Location loadLocation, DateTime loadDate, Location.Location unloadLocation, DateTime unloadDate)
		{
			if (voyage == null)
				throw new ArgumentNullException("voyage", "The voyage cannot be null");
			if (loadLocation == null)
				throw new ArgumentNullException("loadLocation", "The load location cannot be null");
			if (unloadLocation == null)
				throw new ArgumentNullException("unloadLocation", "The unload location cannot be null");
			if (loadDate == default(DateTime))
				throw new ArgumentException("The load date is not correct.", "loadDate");
			if (unloadDate == default(DateTime))
				throw new ArgumentException("The unloadDate date is not correct.", "unloadDate");

			_voyage = voyage;
			_loadLocation = loadLocation;
			_unloadDate = unloadDate;
			_unloadLocation = unloadLocation;
			_loadDate = loadDate;
		}
		/// <summary>
		/// Creates new event.
		/// </summary>
		/// <param name="eventType">Type of the event.</param>
		/// <param name="location">The location where the event took place.</param>
		/// <param name="registrationDate">Registration time, the time the message is received.</param>
		/// <param name="completionDate">Completion time, the reported time that the event actually happened (e.g. the receive took place).</param>
		/// <param name="cargo">Cargo.</param>
		/// <param name="voyage">The voyage.</param>
		public HandlingEvent(HandlingEventType eventType, Location.Location location, DateTime registrationDate, DateTime completionDate, Cargo.Cargo cargo, Voyage.Voyage voyage)
		{
			if (cargo == null)
				throw new ArgumentNullException("cargo", "Cargo is required.");
			if (location == null)
				throw new ArgumentNullException("location", "Location is required.");
			if (voyage == null)
				throw new ArgumentNullException("voyage", "Voyage is required.");
			if (registrationDate == default(DateTime))
				throw new ArgumentException("The registration date is required.", "registrationDate");
			if (completionDate == default(DateTime))
				throw new ArgumentException("The completion date is required.", "completionDate");

			if (eventType.ProhibitsVoyage())
				throw new ArgumentException("Voyage is not allowed with event type : " + eventType, "eventType");

			_eventType = eventType;
			_completionDate = completionDate;
			_registrationDate = registrationDate;
			_location = location;
			_cargo = cargo;
			_voyage = voyage;
		}
		private Delivery(HandlingEvent lastHandlingEvent, Itinerary itinerary, RouteSpecification specification)
		{
			_calculatedAt = DateTime.Now;
			_lastEvent = lastHandlingEvent;

			_misdirected = CalculateMisdirectionStatus(itinerary);
			_routingStatus = CalculateRoutingStatus(itinerary, specification);
			_transportStatus = CalculateTransportStatus();
			_lastKnownLocation = CalculateLastKnownLocation();
			_currentVoyage = CalculateCurrentVoyage();
			_eta = CalculateEta(itinerary);
			_nextExpectedActivity = CalculateNextExpectedActivity(specification, itinerary);
			_isUnloadedAtDestination = CalculateUnloadedAtDestination(specification);
		}