public void SubmitReport(HandlingReport handlingReport)
        {
            IList<string> errors = new List<string>();

            DateTime? completionTime = HandlingReportParser.ParseCompletionTime(handlingReport, errors);
            VoyageNumber voyageNumber = HandlingReportParser.ParseVoyageNumber(handlingReport.VoyageNumber, errors);
            HandlingType type = HandlingReportParser.ParseEventType(handlingReport.Type, errors);
            UnLocode unLocode = HandlingReportParser.ParseUnLocode(handlingReport.UnLocode, errors);

            foreach (string trackingIdStr in handlingReport.TrackingIds)
            {
                TrackingId trackingId = HandlingReportParser.ParseTrackingId(trackingIdStr, errors);

                if (errors.IsEmpty())
                {
                    DateTime registrationTime = DateTime.Now;
                    var attempt = new HandlingEventRegistrationAttempt(
                        registrationTime, completionTime.Value, trackingId, voyageNumber, type, unLocode);
                    applicationEvents.ReceivedHandlingEventRegistrationAttempt(attempt);
                }
                else
                {
                    string errorString = String.Join("\r\n", errors.ToArray());
                    logger.Error("Parse error in handling report: " + errorString);

                    throw new FaultException<HandlingReportException>(new HandlingReportException(errorString), new FaultReason(errorString));
                }
            }
        }
예제 #2
0
        public void SubmitReport(HandlingReport handlingReport)
        {
            IList <string> errors = new List <string>();

            DateTime?    completionTime = HandlingReportParser.ParseCompletionTime(handlingReport, errors);
            VoyageNumber voyageNumber   = HandlingReportParser.ParseVoyageNumber(handlingReport.VoyageNumber, errors);
            HandlingType type           = HandlingReportParser.ParseEventType(handlingReport.Type, errors);
            UnLocode     unLocode       = HandlingReportParser.ParseUnLocode(handlingReport.UnLocode, errors);

            foreach (string trackingIdStr in handlingReport.TrackingIds)
            {
                TrackingId trackingId = HandlingReportParser.ParseTrackingId(trackingIdStr, errors);

                if (errors.IsEmpty())
                {
                    DateTime registrationTime = DateTime.Now;
                    var      attempt          = new HandlingEventRegistrationAttempt(
                        registrationTime, completionTime.Value, trackingId, voyageNumber, type, unLocode);
                    applicationEvents.ReceivedHandlingEventRegistrationAttempt(attempt);
                }
                else
                {
                    string errorString = String.Join("\r\n", errors.ToArray());
                    logger.Error("Parse error in handling report: " + errorString);

                    throw new FaultException <HandlingReportException>(new HandlingReportException(errorString), new FaultReason(errorString));
                }
            }
        }
예제 #3
0
 public void ReceivedHandlingEventRegistrationAttempt(HandlingEventRegistrationAttempt attempt)
 {
     logger.Info("Received handling event registration attempt " + attempt);
     MessageBus.Publish(new HandlingEventRegistrationAttemptMessage()
     {
         HandlingEventRegistration = attempt
     });
 }
예제 #4
0
        private void QueueAttempt(string completionTimeStr, string trackingIdStr, string voyageNumberStr,
                                  string unLocodeStr, string eventTypeStr)
        {
            var errors = new List <string>();

            DateTime     date         = HandlingReportParser.ParseDate(completionTimeStr, errors);
            TrackingId   trackingId   = HandlingReportParser.ParseTrackingId(trackingIdStr, errors);
            VoyageNumber voyageNumber = HandlingReportParser.ParseVoyageNumber(voyageNumberStr, errors);
            HandlingType eventType    = HandlingReportParser.ParseEventType(eventTypeStr, errors);
            UnLocode     unLocode     = HandlingReportParser.ParseUnLocode(unLocodeStr, errors);

            if (errors.IsEmpty())
            {
                var attempt = new HandlingEventRegistrationAttempt(DateTime.Now, date,
                                                                   trackingId, voyageNumber,
                                                                   eventType, unLocode);
                AppEvents.ReceivedHandlingEventRegistrationAttempt(attempt);
            }
            else
            {
                throw new Exception(ToStringBuilder.ReflectionToString(errors));
            }
        }
예제 #5
0
 public void ReceivedHandlingEventRegistrationAttempt(HandlingEventRegistrationAttempt attempt)
 {
     System.Console.WriteLine("EVENT: received handling event registration attempt");
 }
        private void QueueAttempt(string completionTimeStr, string trackingIdStr, string voyageNumberStr,
                                  string unLocodeStr, string eventTypeStr)
        {
            var errors = new List<string>();

            DateTime date = HandlingReportParser.ParseDate(completionTimeStr, errors);
            TrackingId trackingId = HandlingReportParser.ParseTrackingId(trackingIdStr, errors);
            VoyageNumber voyageNumber = HandlingReportParser.ParseVoyageNumber(voyageNumberStr, errors);
            HandlingType eventType = HandlingReportParser.ParseEventType(eventTypeStr, errors);
            UnLocode unLocode = HandlingReportParser.ParseUnLocode(unLocodeStr, errors);

            if (errors.IsEmpty())
            {
                var attempt = new HandlingEventRegistrationAttempt(DateTime.Now, date,
                                                                   trackingId, voyageNumber,
                                                                   eventType, unLocode);
                AppEvents.ReceivedHandlingEventRegistrationAttempt(attempt);
            }
            else
            {
                throw new Exception(ToStringBuilder.ReflectionToString(errors));
            }
        }
 public void ReceivedHandlingEventRegistrationAttempt(HandlingEventRegistrationAttempt attempt)
 {
     System.Console.WriteLine("EVENT: received handling event registration attempt");
 }
 public void ReceivedHandlingEventRegistrationAttempt(HandlingEventRegistrationAttempt attempt)
 {
     logger.Info("Received handling event registration attempt " + attempt);
     MessageBus.Publish(new HandlingEventRegistrationAttemptMessage() {HandlingEventRegistration = attempt });
 }