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)); } } }
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)); } } }