/// <summary> /// Creates new event. /// </summary> /// <param name="eventType"></param> /// <param name="location"></param> /// <param name="registrationDate"></param> /// <param name="completionDate"></param> public HandlingEvent(HandlingEventType eventType, UnLocode location, DateTime registrationDate, DateTime completionDate) { _eventType = eventType; _completionDate = completionDate; _registrationDate = registrationDate; _location = location; }
/// <summary> /// Registers new handling event into the history. /// </summary> /// <param name="eventType">Type of the event.</param> /// <param name="location">Location where event occured.</param> /// <param name="registrationDate">Date when event was registered.</param> /// <param name="completionDate">Date when action represented by the event was completed.</param> public virtual void RegisterHandlingEvent(HandlingEventType eventType, Location location, DateTime registrationDate, DateTime completionDate) { HandlingEvent @event = new HandlingEvent(eventType, location, registrationDate, completionDate, this); _events.Add(@event); DomainEvents.Raise(new CargoWasHandledEvent(@event)); }
/// <summary> /// Creates new event. /// </summary> /// <param name="eventType"></param> /// <param name="location"></param> /// <param name="registrationDate"></param> /// <param name="completionDate"></param> public HandlingEvent(HandlingEventType eventType, DomainModel.Potential.Location.Location location, DateTime registrationDate, DateTime completionDate) { _eventType = eventType; _completionDate = completionDate; _registrationDate = registrationDate; _location = location; }
protected override void DoHandle(CargoHandledMessage message) { HandlingEventType lastKnownEvent = (HandlingEventType)message.LastKnownEventType; HandlingEventType?nextExpectedEvent = null; if (message.NextExpectedEventType != null) { nextExpectedEvent = (HandlingEventType)message.NextExpectedEventType; } ReportingDataContext context = new ReportingDataContext(); Cargo cargo = context.Cargos.First(x => x.TrackingId == message.TrackingId); cargo.UpdateHistory( nextExpectedEvent, message.NextExpectedLocation, lastKnownEvent, message.LastKnownLocation, (RoutingStatus)message.RoutingStatus, (TransportStatus)message.TransportStatus, message.EstimatedTimeOfArrival, message.IsUnloaded, message.IsMisdirected, message.CalculatedAt); context.SubmitChanges(); }
/// <summary> /// Creates new event. /// </summary> /// <param name="eventType"></param> /// <param name="location"></param> /// <param name="registrationDate"></param> /// <param name="completionDate"></param> public HandlingEvent(HandlingEventType eventType, UnLocode location, DateTime registrationDate, DateTime completionDate) { EventType = eventType; CompletionDate = completionDate; RegistrationDate = registrationDate; Location = location; }
/// <summary> /// Creates new event. /// </summary> /// <param name="eventType"></param> /// <param name="location"></param> /// <param name="registrationDate"></param> /// <param name="completionDate"></param> public HandlingEvent(HandlingEventType eventType, Location.Location location, DateTime registrationDate, DateTime completionDate) { _eventType = eventType; _completionDate = completionDate; _registrationDate = registrationDate; _location = location; }
/// <summary> /// Creates new event. /// </summary> /// <param name="eventType"></param> /// <param name="location"></param> /// <param name="registrationDate"></param> /// <param name="completionDate"></param> public HandlingEvent(HandlingEventType eventType, DomainModel.Potential.Location.Location location, DateTime registrationDate, DateTime completionDate, HandlingHistory parent) { _eventType = eventType; _parent = parent; _completionDate = completionDate; _registrationDate = registrationDate; _location = location; }
/// <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> public HandlingActivity(HandlingEventType eventType, Location.Location location) { if (location == null) throw new ArgumentNullException("location"); _eventType = eventType; _location = location; }
/// <summary> /// Creates new event. /// </summary> /// <param name="eventType"></param> /// <param name="location"></param> /// <param name="registrationDate"></param> /// <param name="completionDate"></param> /// <param name="cargo"></param> public HandlingEvent(HandlingEventType eventType, Location.Location location, DateTime registrationDate, DateTime completionDate, Cargo.Cargo cargo) { EventType = eventType; Location = location; RegistrationDate = registrationDate; CompletionDate = completionDate; Cargo = cargo; }
public void RegisterHandlingEvent(DateTime completionTime, string trackingId, string location, HandlingEventType type) { _handlingEventService.RegisterHandlingEvent( completionTime, new TrackingId(trackingId), new UnLocode(location), type); }
/// <summary> /// Creates new event. /// </summary> /// <param name="eventType"></param> /// <param name="location"></param> /// <param name="registrationDate"></param> /// <param name="completionDate"></param> public HandlingEvent(HandlingEventType eventType, Location.Location location, DateTime registrationDate, DateTime completionDate, HandlingHistory parent) { _eventType = eventType; _parent = parent; _completionDate = completionDate; _registrationDate = registrationDate; _location = location; }
/// <summary> /// Creates new event. /// </summary> /// <param name="eventType"></param> /// <param name="location"></param> /// <param name="registrationDate"></param> /// <param name="completionDate"></param> public HandlingEvent(HandlingEventType eventType, Location.Location location, DateTime registrationDate, DateTime completionDate, HandlingHistory parent) { EventType = eventType; HandlingHistory = parent; CompletionDate = completionDate; RegistrationDate = registrationDate; Location = location; }
public HandlingActivity(HandlingEventType eventType, UnLocode location) { if (location == null) { throw new ArgumentNullException("location"); } EventType = eventType; Location = location; }
public HandlingActivity(HandlingEventType eventType, DomainModel.Potential.Location.Location location) { if (location == null) { throw new ArgumentNullException("location"); } _eventType = eventType; _location = location; }
/// <summary> /// Registers new handling event into the history. /// </summary> /// <param name="eventType">Type of the event.</param> /// <param name="location">Location where event occured.</param> /// <param name="registrationDate">Date when event was registered.</param> /// <param name="completionDate">Date when action represented by the event was completed.</param> public virtual void RegisterHandlingEvent(HandlingEventType eventType, Location.Location location, DateTime registrationDate, DateTime completionDate) { HandlingEvent @event = new HandlingEvent(eventType, location, registrationDate, completionDate, this); _handlingEvents.Add(@event); _lastHandlingEvent = @event; Delivery currentDelivery = Delivery.DerivedFrom(_routeSpecification, _itinerary, @event); DomainEvents.Raise(new CargoWasHandledEvent(this, currentDelivery, eventType)); }
/// <summary> /// Initializes a new instance of the <see cref="HandlingActivity"/> class. /// </summary> /// <param name="eventType">Type of the event.</param> /// <param name="location">The location.</param> public HandlingActivity(HandlingEventType eventType, Location.Location location) { if (location == null) { throw new ArgumentNullException("location"); } m_eventType = eventType; m_location = location; }
/// <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 RegisterHandlingEvent(DateTime completionTime, string trackingId, string location, HandlingEventType type) { var command = new RegisterHandlingEventCommand { CompletionTime = completionTime, TrackingId = trackingId, OccuranceLocation = location, Type = type }; _pipelineFactory.Process(command); }
/// <summary> /// Creates new event. /// </summary> /// <param name="eventType"></param> /// <param name="location"></param> /// <param name="registrationDate"></param> /// <param name="completionDate"></param> /// <param name="cargo"></param> public HandlingEvent(HandlingEventType eventType, Location.Location location, DateTime registrationDate, DateTime completionDate, Cargo.Cargo cargo) { EventType = eventType; Location = location; RegistrationDate = registrationDate; CompletionDate = completionDate; Cargo = cargo; DomainEvents.Raise(new CargoWasHandledEvent(this)); }
/// <summary> /// Creates new event. /// </summary> /// <param name="eventType"></param> /// <param name="location"></param> /// <param name="registrationDate"></param> /// <param name="completionDate"></param> /// <param name="cargo"></param> public HandlingEvent(HandlingEventType eventType, Location.Location location, DateTime registrationDate, DateTime completionDate, Cargo.Cargo cargo) { EventType = eventType; Location = location; RegistrationDate = registrationDate; CompletionDate = completionDate; Cargo = cargo; m_eventAggregator.Publish <CargoWasHandledEvent>(new CargoWasHandledEvent()); }
/// <summary> /// Creates new event. /// </summary> /// <param name="eventType"></param> /// <param name="location"></param> /// <param name="registrationDate"></param> /// <param name="completionDate"></param> /// <param name="cargo"></param> public HandlingEvent(HandlingEventType eventType, Location.Location location, DateTime registrationDate, DateTime completionDate, Cargo.Cargo cargo) { EventType = eventType; Location = location; RegistrationDate = registrationDate; CompletionDate = completionDate; Cargo = cargo; m_eventAggregator.Publish<CargoWasHandledEvent>(new CargoWasHandledEvent()); }
public Delivery(Cargo parent, HandlingEventType? nextExpectedEvent, string nextExpectedLocation, HandlingEventType? lastKnownEvent, string lastKnownLocation, RoutingStatus routingStatus, TransportStatus transportStatus, DateTime? estimatedTimeOfArrival, bool isUnloadedAtDestination, bool isMisdirected, DateTime calculatedAt) : this() { Id = Guid.NewGuid(); Cargo = parent; NextExpectedEventType = nextExpectedEvent; NextExpectedLocation = nextExpectedLocation; LastKnownEventType = lastKnownEvent; LastKnownLocation = lastKnownLocation; RoutingStatus = routingStatus; TransportStatus = transportStatus; Eta = estimatedTimeOfArrival; UnloadedAtDest = isUnloadedAtDestination; IsMisdirected = isMisdirected; CalculatedAt = calculatedAt; }
/// <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> public HandlingEvent(HandlingEventType eventType, Location.Location location, DateTime registrationDate, DateTime completionDate, Cargo.Cargo cargo) { if (cargo == null) throw new ArgumentNullException("cargo", "Cargo is required."); if (location == null) throw new ArgumentNullException("location", "Location 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.RequiresVoyage()) throw new ArgumentException("Voyage is required for event type event type : " + eventType, "eventType"); _eventType = eventType; _completionDate = completionDate; _registrationDate = registrationDate; _location = location; _cargo = cargo; _voyage = null; }
public ActionResult RegisterHandlingEvent(string trackingId, DateTime? completionTime, string location, HandlingEventType type) { bool validationError = false; if (!completionTime.HasValue) { ViewData.ModelState.AddModelError("completionTime", "Event completion date is required and must be a valid date."); validationError = true; } if (string.IsNullOrEmpty(trackingId)) { ViewData.ModelState.AddModelError("trackingId", "Tracking id must be specified."); validationError = true; } if (validationError) { AddHandlingLocations(); AddHandlingEventTypes(); return View(); } _handlingEventFacade.RegisterHandlingEvent(completionTime.Value, trackingId, location, type ); return RedirectToAction("Track", "Tracking", new {trackingId}); }
public CargoWasHandledEvent(Cargo cargo, Delivery delivery, HandlingEventType eventType) { _cargo = cargo; _eventType = eventType; _delivery = delivery; }
public void RegisterHandlingEvent(DateTime completionTime, TrackingId trackingId, UnLocode unLocode, HandlingEventType type) { Cargo cargo = _cargoRepository.Find(trackingId); Location location = _locationRepository.Find(unLocode); cargo.RegisterHandlingEvent(type, location, DateTime.Now, completionTime); }
/// <summary> /// Registers new handling event into the history. /// </summary> /// <param name="eventType">Type of the event.</param> /// <param name="location">Location where event occured.</param> /// <param name="registrationDate">Date when event was registered.</param> /// <param name="completionDate">Date when action represented by the event was completed.</param> public virtual void RegisterHandlingEvent(HandlingEventType eventType, UnLocode location, DateTime registrationDate, DateTime completionDate) { var @event = new HandlingEvent(eventType, location, registrationDate, completionDate); Publish(this, new CargoHandledEvent(Delivery.DerivedFrom(RouteSpecification, Itinerary, @event))); }
public static ItineraryTestHelper IsNotExpectedToBe(this Itinerary itinerary, HandlingEventType eventType) { return new ItineraryTestHelper(false, eventType, itinerary); }
partial void OnNextExpectedEventTypeChanging(HandlingEventType? value);
public HandlingActivity(HandlingEventType eventType, string location) { EventType = eventType; Location = location; }
public void should_handle_specific_event_types_to_require_carrier_movement_association(HandlingEventType handlingEventType) { Assert.Throws<ArgumentException>(delegate { new HandlingEvent(handlingEventType, _hongkong, DateTime.Now, DateTime.Now, _cargo); } ); }
private static HandlingEvent Event(HandlingEventType eventType, Location.Location location) { return new HandlingEvent(eventType, location, DateTime.Now, DateTime.Now, null); }
public ActionResult RegisterHandlingEvent(string trackingId, DateTime?completionTime, string location, HandlingEventType type) { bool validationError = false; if (!completionTime.HasValue) { ViewData.ModelState.AddModelError("completionTime", "Event completion date is required and must be a valid date."); validationError = true; } if (string.IsNullOrEmpty(trackingId)) { ViewData.ModelState.AddModelError("trackingId", "Tracking id must be specified."); validationError = true; } if (validationError) { AddHandlingLocations(); AddHandlingEventTypes(); return(View()); } _handlingEventFacade.RegisterHandlingEvent(completionTime.Value, trackingId, location, type); return(RedirectToAction("Index", "Home")); }
private static void RegisterHandlingEvent(Guid cargoId, DateTime time, UnLocode location, HandlingEventType eventType) { InvokeCommand(new RegisterHandlingEventCommand { CargoId = cargoId, CompletionTime = time, Location = location.CodeString, Type = eventType }); }
private static void RegisterHandlingEvent(DateTime completionTime, TrackingId trackingId, UnLocode occuranceLocation, HandlingEventType handlingEventType) { var registerHandlingEventCommand = new RegisterHandlingEventCommand() { CompletionTime = completionTime, OccuranceLocation = occuranceLocation.CodeString, TrackingId = trackingId.IdString, Type = handlingEventType }; CommandPipeline.Process(registerHandlingEventCommand); }
public ItineraryTestHelper(bool expected, HandlingEventType eventType, Itinerary itinerary) { _expected = expected; _itinerary = itinerary; _eventType = eventType; }
/// <summary> /// Checks if this <see cref="HandlingEventType"/> requires specyfying a <see cref="DDDSample.Domain.Voyage.Voyage"/> /// object when constructing new <see cref="HandlingEvent"/>. /// </summary> /// <param name="eventType">Event type value.</param> /// <returns>True, if requires.</returns> public static bool RequiresVoyage(this HandlingEventType eventType) { return(eventType == HandlingEventType.Load || eventType == HandlingEventType.Unload); }
partial void OnLastKnownEventTypeChanging(HandlingEventType? value);
/// <summary> /// Registers new handling event into the history. /// </summary> /// <param name="eventType">Type of the event.</param> /// <param name="location">Location where event occured.</param> /// <param name="registrationDate">Date when event was registered.</param> /// <param name="completionDate">Date when action represented by the event was completed.</param> public virtual void RegisterHandlingEvent(HandlingEventType eventType, UnLocode location, DateTime registrationDate, DateTime completionDate) { HandlingEvent @event = new HandlingEvent(eventType, location, registrationDate, completionDate); Publish(this, new CargoHandledEvent(Delivery.DerivedFrom(_routeSpecification, _itinerary, @event))); }
public static ItineraryTestHelper IsNotExpectedToBe(this Itinerary itinerary, HandlingEventType eventType) { return(new ItineraryTestHelper(false, eventType, itinerary)); }
private static HandlingEvent Event(HandlingEventType eventType, Location.Location location) { return(new HandlingEvent(eventType, location, DateTime.Now, DateTime.Now, null)); }
public void RegisterHandlingEvent(DateTime completionTime, TrackingId trackingId, UnLocode unLocode, HandlingEventType type) { HandlingHistory handlingHistory = _handlingEventRepository.LookupHandlingHistoryOfCargo(trackingId); Location location = _locationRepository.Find(unLocode); handlingHistory.RegisterHandlingEvent(type, location, DateTime.Now, completionTime); }
public virtual void UpdateHistory(HandlingEventType? nextExpectedEvent, string nextExpectedLocation, HandlingEventType? lastKnownEvent, string lastKnownLocation, RoutingStatus routingStatus, TransportStatus transportStatus, DateTime? estimatedTimeOfArrival, bool isUnloadedAtDestination, bool isMisdirected, DateTime calculatedAt) { Delivery delivery = new Delivery(this, nextExpectedEvent, nextExpectedLocation, lastKnownEvent, lastKnownLocation, routingStatus, transportStatus, estimatedTimeOfArrival, isUnloadedAtDestination, isMisdirected, calculatedAt); DeliveryHistory.Add(delivery); CurrentInformation = delivery; }
/// <summary> /// Checks if this <see cref="HandlingEventType"/> prohibits specyfying a <see cref="DDDSample.Domain.Voyage.Voyage"/> /// object when constructing new <see cref="HandlingEvent"/>. /// </summary> /// <param name="eventType">Event type value.</param> /// <returns>True, if prohibits.</returns> public static bool ProhibitsVoyage(this HandlingEventType eventType) { return(!RequiresVoyage(eventType)); }
/// <summary> /// Registers new handling event into the history. /// </summary> /// <param name="eventType">Type of the event.</param> /// <param name="location">Location where event occured.</param> /// <param name="registrationDate">Date when event was registered.</param> /// <param name="completionDate">Date when action represented by the event was completed.</param> public virtual void RegisterHandlingEvent(HandlingEventType eventType, Location.Location location, DateTime registrationDate, DateTime completionDate) { HandlingEvent @event = new HandlingEvent(eventType, location, registrationDate, completionDate,this); _events.Add(@event); DomainEvents.Raise(new CargoWasHandledEvent(@event)); }
private static void RegisterHandlingEvent(string cargoId, DateTime time, UnLocode location, HandlingEventType eventType) { InvokeCommand(new RegisterHandlingEventCommand { CargoId = cargoId, CompletionTime = time, Location = location.CodeString, Type = eventType }); }
public void RegisterHandlingEvent(DateTime completionTime, TrackingId trackingId, UnLocode unLocode, HandlingEventType type) { var cargo = _cargoRepository.Find(trackingId); var location = _locationRepository.Find(unLocode); var @event = new HandlingEvent(type, location, DateTime.Now, completionTime, cargo); _handlingEventRepository.Store(@event); }