Пример #1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="cargo">cargo</param>
        /// <param name="completionTime">completion time, the reported time that the event actually happened (e.g. the receive took place).</param>
        /// <param name="registrationTime">registration time, the time the message is received</param>
        /// <param name="type">type of event</param>
        /// <param name="location">where the event took place</param>
        /// <param name="voyage">the voyage</param>
        /// <param name="operatorCode">operator code for port operator</param>
        internal HandlingEvent(Cargo cargo,
                               DateTime completionTime,
                               DateTime registrationTime,
                               HandlingActivityType type,
                               Location location,
                               Voyage voyage,
                               OperatorCode operatorCode)
        {
            Validate.notNull(cargo, "Cargo is required");
            Validate.notNull(location, "Location is required");
            Validate.notNull(voyage, "Voyage is required");
            Validate.notNull(operatorCode, "Operator code is required");

            if (!type.isVoyageRelated())
            {
                throw new ArgumentException("Voyage is not allowed with event type " + type);
            }

            SequenceNumber   = EventSequenceNumber.Next();
            Cargo            = cargo;
            CompletionTime   = completionTime;
            RegistrationTime = registrationTime;
            Activity         = new HandlingActivity(type, location, voyage);
            OperatorCode     = operatorCode;
        }
Пример #2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="cargo">cargo</param>
        /// <param name="completionTime">completion time, the reported time that the event actually happened (e.g. the receive took place).</param>
        /// <param name="registrationTime">registration time, the time the message is received</param>
        /// <param name="type">type of event</param>
        /// <param name="location">where the event took place</param>
        public HandlingEvent(Cargo cargo,
                             DateTime completionTime,
                             DateTime registrationTime,
                             HandlingActivityType type,
                             Location location)
        {
            // TODO: make internal
            Validate.notNull(cargo, "Cargo is required");
            Validate.notNull(location, "Location is required");

            if (type.isVoyageRelated())
            {
                throw new ArgumentException("Voyage is required for event type " + type);
            }

            SequenceNumber   = EventSequenceNumber.Next();
            CompletionTime   = completionTime;
            RegistrationTime = registrationTime;
            Cargo            = cargo;
            Activity         = new HandlingActivity(type, location);
        }