public void informacionTracking() { TrackRequest request = CreateTrackRequest(); // TrackService service = new TrackService(); if (usePropertyFile()) { service.Url = getProperty("endpoint"); } // try { // Call the Track web service passing in a TrackRequest and returning a TrackReply TrackReply reply = service.track(request); if (reply.HighestSeverity == NotificationSeverityType.SUCCESS || reply.HighestSeverity == NotificationSeverityType.NOTE || reply.HighestSeverity == NotificationSeverityType.WARNING) { ShowTrackReply(reply); } ShowNotifications(reply); } catch (SoapException e) { Console.WriteLine(e.Detail.InnerText); } catch (Exception e) { Console.WriteLine(e.Message); } Console.WriteLine("Press any key to quit!"); Console.ReadKey(); }
private TrackResult FedEx_Track(CarrierAPI api, string trackingNumber) { TrackResult result = new TrackResult(); FedEx_API FedEx = new FedEx_API(api); TrackReply FedEx_Result = FedEx.Tracking(trackingNumber); if (FedEx_Result.HighestSeverity != NotificationSeverityType.SUCCESS) { throw new Exception(string.Join(";", FedEx_Result.Notifications.Select(n => n.Message).ToArray())); } TrackDetail detail = FedEx_Result.CompletedTrackDetails[0].TrackDetails[0]; if (detail.Events != null) { List <TrackEvent> FedEx_EventList = detail.Events.ToList(); if (FedEx_EventList.Any(e => e.EventType == "PU")) { result.PickupDate = FedEx_EventList.First(e => e.EventType == "PU").Timestamp.ToUniversalTime(); result.DeliveryStatus = (int)OrderService.DeliveryStatusType.Intransit; } result.DeliveryNote = FedEx_EventList.Select(e => e.Timestamp.ToString() + " " + e.EventDescription).First(); if (FedEx_EventList.Any(e => e.EventType == "DL")) { result.DeliveryDate = FedEx_EventList.First(e => e.EventType == "DL").Timestamp.ToUniversalTime(); result.DeliveryStatus = (int)OrderService.DeliveryStatusType.Delivered; } } return(result); }
public TrackReply GetFedexTrack(FedexTrackService.TrackRequest request) { TrackReply reply = null; FedexTrackService.TrackService svc = new FedexTrackService.TrackService(); reply = svc.track(request); return(reply); }
private static void ShowNotifications(TrackReply reply) { Console.WriteLine("Notifications"); for (int i = 0; i < reply.Notifications.Length; i++) { Notification notification = reply.Notifications[i]; Console.WriteLine("Notification no. {0}", i); ShowNotification(notification); } }
public void CreateTrackRequest(string trackingNumber) { // Initialize this.request = new TrackRequest(); // Authentication information request.WebAuthenticationDetail = new WebAuthenticationDetail(); request.WebAuthenticationDetail.UserCredential = new WebAuthenticationCredential(); request.WebAuthenticationDetail.UserCredential.Key = KEY; // Replace "XXX" with the Key request.WebAuthenticationDetail.UserCredential.Password = PASSWORD; // Replace "XXX" with the Password // Account & meter numbers request.ClientDetail = new ClientDetail(); request.ClientDetail.AccountNumber = ACCOUNT_NUMBER; // Replace "XXX" with the client's account number request.ClientDetail.MeterNumber = METER_NUMBER; // Replace "XXX" with the client's meter number // request.TransactionDetail = new TransactionDetail(); request.TransactionDetail.CustomerTransactionId = "***Track Request using VC#***"; //This is a reference field for the customer. Any value can be used and will be provided in the response. // request.Version = new VersionId(); // // Tracking information request.SelectionDetails = new TrackSelectionDetail[1] { new TrackSelectionDetail() }; request.SelectionDetails[0].PackageIdentifier = new TrackPackageIdentifier(); request.SelectionDetails[0].PackageIdentifier.Value = trackingNumber; // Replace "XXX" with tracking number or door tag request.SelectionDetails[0].PackageIdentifier.Type = TrackIdentifierType.TRACKING_NUMBER_OR_DOORTAG; // Date range is optional. // If omitted, set to false request.SelectionDetails[0].ShipDateRangeBegin = DateTime.Parse("06/18/2012"); //MM/DD/YYYY request.SelectionDetails[0].ShipDateRangeEnd = request.SelectionDetails[0].ShipDateRangeBegin.AddDays(0); request.SelectionDetails[0].ShipDateRangeBeginSpecified = false; request.SelectionDetails[0].ShipDateRangeEndSpecified = false; // Include detailed scans is optional. // If omitted, set to false request.ProcessingOptions = new TrackRequestProcessingOptionType[1]; request.ProcessingOptions[0] = TrackRequestProcessingOptionType.INCLUDE_DETAILED_SCANS; // Run the track request and get reply try { this.reply = this.service.track(request); } catch (Exception) { throw; } }
public static List <DeliveryNotice> GetLogisticsTraceDetail(Context ctx, List <DeliveryNotice> notices) { if (notices != null && notices.Count > 0) { foreach (var notice in notices) { if (notice != null) { if (notice.TraceEntry != null && notice.TraceEntry.Count > 0) { foreach (var trace in notice.TraceEntry) { if (trace != null) { TrackRequest request = CreateTrackRequest(trace.FCarryBillNo); LogXML("trackingNumber:[" + trace.FCarryBillNo + "] Request", request, typeof(TrackRequest)); // TrackService service = new TrackService(); if (usePropertyFile()) { service.Url = getProperty("endpoint"); } // try { // Call the Track web service passing in a TrackRequest and returning a TrackReply TrackReply reply = service.track(request); LogXML("trackingNumber:[" + trace.FCarryBillNo + "] Reply", reply, typeof(TrackReply)); if (reply.HighestSeverity == NotificationSeverityType.SUCCESS || reply.HighestSeverity == NotificationSeverityType.NOTE || reply.HighestSeverity == NotificationSeverityType.WARNING) { ShowTrackReply(reply); notice.LocusEntry = GetLocusDetail(reply); } ShowNotifications(reply); } catch (SoapException ex) { SynchroDataHelper.WriteSynchroLog(ctx, SynchroDataType.DeliveryNoticeBill, ex.Message + System.Environment.NewLine + ex.StackTrace); } catch (Exception ex) { SynchroDataHelper.WriteSynchroLog(ctx, SynchroDataType.DeliveryNoticeBill, ex.Message + System.Environment.NewLine + ex.StackTrace); } } } } } } } return(notices); }
private static List <DeliveryNoticeLocusEntry> GetLocusDetail(TrackReply reply) { List <DeliveryNoticeLocusEntry> locuses = null; DeliveryNoticeLocusEntry locus = null; if (reply != null) { locuses = new List <DeliveryNoticeLocusEntry>(); if (reply.CompletedTrackDetails != null && reply.CompletedTrackDetails.Length > 0) { foreach (CompletedTrackDetail completedTrackDetail in reply.CompletedTrackDetails) { if (completedTrackDetail != null) { if (completedTrackDetail.TrackDetails != null && completedTrackDetail.TrackDetails.Length > 0) { foreach (TrackDetail trackDetail in completedTrackDetail.TrackDetails) { if (trackDetail != null) { locus = new DeliveryNoticeLocusEntry(); locus.F_HS_AreaCode = trackDetail.ClearanceLocationCode; locus.F_HS_TarckStatus = trackDetail.StatusDetail.Description; locus.F_HS_AreaName = trackDetail.StatusDetail.Location.GeographicCoordinates; if (trackDetail.InformationNotes != null && trackDetail.InformationNotes.Length > 0) { foreach (var info in trackDetail.InformationNotes) { string note = info.Description; } } locuses.Add(locus); } } } } } } } return(locuses); }
public TrackReply Tracking(string trackingNumber) { TrackRequest request = _trackingInit(); request.TransactionDetail = new QDLogistics.FedExTrackService.TransactionDetail(); request.TransactionDetail.CustomerTransactionId = "*** Track Request ***"; request.Version = new QDLogistics.FedExTrackService.VersionId(); request.SelectionDetails = new TrackSelectionDetail[1] { new TrackSelectionDetail() }; request.SelectionDetails[0].PackageIdentifier = new TrackPackageIdentifier(); request.SelectionDetails[0].PackageIdentifier.Value = trackingNumber; request.SelectionDetails[0].PackageIdentifier.Type = TrackIdentifierType.TRACKING_NUMBER_OR_DOORTAG; TrackPortTypeClient client = new TrackPortTypeClient(); TrackReply reply = client.track(request); return(reply); }
public void MailService_Fedex_GetTrack() { //arrange string fedexKey = string.Empty; string fedexPassword = string.Empty; string fedexAccountNumber = string.Empty; string fedexMeterNumber = string.Empty; string fedexTrackingNumber = string.Empty; TrackRequest request = _mailSvc.CreateFedexTrackRequest(fedexKey, fedexPassword, fedexAccountNumber, fedexMeterNumber, fedexTrackingNumber); //act TrackReply reply = _mailSvc.GetFedexTrack(request); //assert foreach (CompletedTrackDetail detail in reply.completedTrackDetailsField) { foreach (TrackDetail trackDetail in detail.trackDetailsField) { Address address = trackDetail.destinationAddressField; //trackDetail.actualDeliveryAddressField; string status = trackDetail.statusDetailField != null ? trackDetail.statusDetailField.descriptionField : ""; DateTime actualDeliveryTime; DateTime estimatedDeliveryTime; DateTime pickupTime; if (trackDetail.estimatedPickupTimestampFieldSpecified) { pickupTime = trackDetail.estimatedPickupTimestampField; } if (trackDetail.actualDeliveryTimestampFieldSpecified) { actualDeliveryTime = trackDetail.actualDeliveryTimestampField; } if (trackDetail.estimatedDeliveryTimestampFieldSpecified) { estimatedDeliveryTime = trackDetail.estimatedDeliveryTimestampField; } } } }
private static List <DeliveryNoticeLocusEntry> GetLocusDetail(TrackReply reply) { List <DeliveryNoticeLocusEntry> locuses = null; DeliveryNoticeLocusEntry locus = null; if (reply != null) { locuses = new List <DeliveryNoticeLocusEntry>(); if (reply.CompletedTrackDetails != null && reply.CompletedTrackDetails.Length > 0) { foreach (CompletedTrackDetail completedTrackDetail in reply.CompletedTrackDetails) { if (completedTrackDetail != null) { if (completedTrackDetail.TrackDetails != null && completedTrackDetail.TrackDetails.Length > 0) { foreach (TrackDetail trackDetail in completedTrackDetail.TrackDetails) { if (trackDetail != null) { locus = new DeliveryNoticeLocusEntry(); locus.F_HS_Signtime = trackDetail.StatusDetail.CreationTime; locus.F_HS_AreaCode = trackDetail.StatusDetail.Location.CountryCode + trackDetail.StatusDetail.Location.StateOrProvinceCode; locus.F_HS_TrackInfo = trackDetail.StatusDetail.Description; locus.F_HS_AreaName = trackDetail.StatusDetail.Location.CountryName + "," + trackDetail.StatusDetail.Location.City; locus.F_HS_TarckStatus = TrackingStatusCodes.GetTrackingStatusDescription(trackDetail.StatusDetail.Code); locuses.Add(locus); } } } } } } } return(locuses); }
private static void ShowTrackReply(TrackReply reply) { // Track details for each package foreach (CompletedTrackDetail completedTrackDetail in reply.CompletedTrackDetails) { foreach (TrackDetail trackDetail in completedTrackDetail.TrackDetails) { Console.WriteLine("Tracking details:"); Console.WriteLine("**************************************"); ShowNotification(trackDetail.Notification); Console.WriteLine("Tracking number: {0}", trackDetail.TrackingNumber); Console.WriteLine("Tracking number unique identifier: {0}", trackDetail.TrackingNumberUniqueIdentifier); Console.WriteLine("Track Status: {0} ({1})", trackDetail.StatusDetail.Description, trackDetail.StatusDetail.Code); Console.WriteLine("Carrier code: {0}", trackDetail.CarrierCode); if (trackDetail.OtherIdentifiers != null) { foreach (TrackOtherIdentifierDetail identifier in trackDetail.OtherIdentifiers) { Console.WriteLine("Other Identifier: {0} {1}", identifier.PackageIdentifier.Type, identifier.PackageIdentifier.Value); } } if (trackDetail.Service != null) { Console.WriteLine("ServiceInfo: {0}", trackDetail.Service.Description); } if (trackDetail.PackageWeight != null) { Console.WriteLine("Package weight: {0} {1}", trackDetail.PackageWeight.Value, trackDetail.PackageWeight.Units); } if (trackDetail.ShipmentWeight != null) { Console.WriteLine("Shipment weight: {0} {1}", trackDetail.ShipmentWeight.Value, trackDetail.ShipmentWeight.Units); } if (trackDetail.Packaging != null) { Console.WriteLine("Packaging: {0}", trackDetail.Packaging); } Console.WriteLine("Package Sequence Number: {0}", trackDetail.PackageSequenceNumber); Console.WriteLine("Package Count: {0} ", trackDetail.PackageCount); if (trackDetail.DatesOrTimes != null) { foreach (TrackingDateOrTimestamp timestamp in trackDetail.DatesOrTimes) { Console.WriteLine("{0}: {1}", timestamp.Type, timestamp.DateOrTimestamp); } } if (trackDetail.DestinationAddress != null) { Console.WriteLine("Destination: {0}, {1}", trackDetail.DestinationAddress.City, trackDetail.DestinationAddress.StateOrProvinceCode); } if (trackDetail.AvailableImages != null) { foreach (AvailableImagesDetail ImageDetail in trackDetail.AvailableImages) { Console.WriteLine("Image availability: {0}", ImageDetail.Type); } } if (trackDetail.NotificationEventsAvailable != null) { foreach (NotificationEventType notificationEventType in trackDetail.NotificationEventsAvailable) { Console.WriteLine("NotificationEvent type : {0}", notificationEventType); } } //Events Console.WriteLine(); if (trackDetail.Events != null) { Console.WriteLine("Track Events:"); foreach (TrackEvent trackevent in trackDetail.Events) { if (trackevent.TimestampSpecified) { Console.WriteLine("Timestamp: {0}", trackevent.Timestamp); } Console.WriteLine("Event: {0} ({1})", trackevent.EventDescription, trackevent.EventType); Console.WriteLine("***"); } Console.WriteLine(); } Console.WriteLine("**************************************"); } } }
/// <summary> /// Gets all events for a tracking number. /// </summary> /// <param name="trackingNumber">The tracking number to track</param> /// <returns>List of Shipment Events.</returns> public virtual IList <ShipmentStatusEvent> GetShipmentEvents(string trackingNumber) { var result = new List <ShipmentStatusEvent>(); try { //use try-catch to ensure exception won't be thrown is web service is not available //build the TrackRequest var request = new TrackRequest(); // request.WebAuthenticationDetail = new WebAuthenticationDetail(); request.WebAuthenticationDetail.UserCredential = new WebAuthenticationCredential(); request.WebAuthenticationDetail.UserCredential.Key = _fedexSettings.Key; // Replace "XXX" with the Key request.WebAuthenticationDetail.UserCredential.Password = _fedexSettings.Password; // Replace "XXX" with the Password // request.ClientDetail = new ClientDetail(); request.ClientDetail.AccountNumber = _fedexSettings.AccountNumber; // Replace "XXX" with client's account number request.ClientDetail.MeterNumber = _fedexSettings.MeterNumber; // Replace "XXX" with client's meter number // request.TransactionDetail = new TransactionDetail(); request.TransactionDetail.CustomerTransactionId = "***NasCommerce v5 Request using VC#***"; //creates the Version element with all child elements populated from the wsdl request.Version = new VersionId(); //tracking information request.PackageIdentifier = new TrackPackageIdentifier(); request.PackageIdentifier.Value = trackingNumber; request.PackageIdentifier.Type = TrackIdentifierType.TRACKING_NUMBER_OR_DOORTAG; request.IncludeDetailedScans = true; request.IncludeDetailedScansSpecified = true; //initialize the service var service = new TrackService(_fedexSettings.Url); //this is the call to the web service passing in a TrackRequest and returning a TrackReply TrackReply reply = service.track(request); //parse response if (reply.HighestSeverity == NotificationSeverityType.SUCCESS || reply.HighestSeverity == NotificationSeverityType.NOTE || reply.HighestSeverity == NotificationSeverityType.WARNING) // check if the call was successful { foreach (TrackDetail trackDetail in reply.TrackDetails) { if (trackDetail.Events != null) { //Set the parent level attributes //var statusDescription = trackDetail.StatusDescription; //var tatusCode = trackDetail.StatusCode; //if (statusCode == "DL") //{ // var delivered = true; //} //if (trackDetail.SignatureProofOfDeliveryAvailable == true) //{ // trackResults.SignedForBy = trackDetail.DeliverySignatureName; //} //if (trackDetail.ShipmentWeight != null) //{ // var shipmentWeight = string.Format("{0} {1}", trackDetail.ShipmentWeight.Value, trackDetail.ShipmentWeight.Units); //} //else //{ // var shipmentWeight = string.Format("{0} {1}", trackDetail.PackageWeight.Value, trackDetail.PackageWeight.Units); //} //var shipDate = trackDetail.ShipTimestamp; //var serviceType = trackDetail.ServiceInfo; //var packageCount = int.Parse(trackDetail.PackageCount); //var destination = string.Format("{0}, {1} {2}", trackDetail.DestinationAddress.City, trackDetail.DestinationAddress.StateOrProvinceCode, trackDetail.DestinationAddress.CountryCode); //var deliveryDate = trackDetail.ActualDeliveryTimestamp; //Set the TrackingActivity foreach (TrackEvent trackevent in trackDetail.Events) { var sse = new ShipmentStatusEvent(); if (trackevent.TimestampSpecified) { sse.Date = trackevent.Timestamp; } sse.EventName = String.Format("{0} ({1})", trackevent.EventDescription, trackevent.EventType); sse.Location = trackevent.Address.City; sse.CountryCode = trackevent.Address.CountryCode; //other properties (not used yet) //trackevent.EventType; //trackevent.Address.PostalCode; //trackevent.Address.StateOrProvinceCode; //trackevent.StatusExceptionCode; //trackevent.StatusExceptionDescription; result.Add(sse); } } } } //result.AddRange(trackResponse.Shipment.SelectMany(c => c.Package[0].Activity.Select(x => ToStatusEvent(x))).ToList()); } catch (SoapException ex) { var sb = new StringBuilder(); sb.AppendFormat("SoapException Message= {0}.", ex.Message); sb.AppendFormat("SoapException Category:Code:Message= {0}.", ex.Detail.LastChild.InnerText); //sb.AppendFormat("SoapException XML String for all= {0}.", ex.Detail.LastChild.OuterXml); _logger.Error(string.Format("Error while getting Fedex shipment tracking info - {0}", trackingNumber), new Exception(sb.ToString())); } catch (Exception exc) { _logger.Error(string.Format("Error while getting Fedex shipment tracking info - {0}", trackingNumber), exc); } return(result); }
public string ShowTrackReply(TrackReply reply) { string rtn = ""; // Track details for each package foreach (CompletedTrackDetail completedTrackDetail in reply.CompletedTrackDetails) { foreach (TrackDetail trackDetail in completedTrackDetail.TrackDetails) { //rtn+=("<b>Tracking details:</b><br/>"); //rtn+=("**************************************<br>"); ShowNotification(trackDetail.Notification); rtn += "<b>Tracking number:</b>" + trackDetail.TrackingNumber + "<br>"; rtn += "<b>Tracking number unique identifier:</b>" + trackDetail.TrackingNumberUniqueIdentifier + "<br>"; rtn += "<b>Track Status:</b>" + trackDetail.StatusDetail.Description + "<br>"; //rtn+="<b>Carrier code:</b>"+trackDetail.CarrierCode+"<br>"; //if (trackDetail.OtherIdentifiers != null) //{ // foreach (TrackOtherIdentifierDetail identifier in trackDetail.OtherIdentifiers) // { // Console.WriteLine("Other Identifier: {0} {1}", identifier.PackageIdentifier.Type, identifier.PackageIdentifier.Value); // } //} if (trackDetail.Service != null) { rtn += "<b>ServiceInfo: </b>" + trackDetail.Service.Description + "<br>"; } if (trackDetail.PackageWeight != null) { rtn += "<b>Package weight:</b> " + trackDetail.PackageWeight.Value + ", " + trackDetail.PackageWeight.Units + "<br>"; } if (trackDetail.ShipmentWeight != null) { rtn += "<b>Shipment weight:</b>" + trackDetail.ShipmentWeight.Value + ", " + trackDetail.ShipmentWeight.Units + "<br>"; } if (trackDetail.Packaging != null) { rtn += "<b>Packaging: </b>" + trackDetail.Packaging + "<br>"; } rtn += "<b>Package Sequence Number: </b>" + trackDetail.PackageSequenceNumber + "<br>"; rtn += "<b>Package Count:</b>" + trackDetail.PackageCount + "<br>"; if (trackDetail.DatesOrTimes != null) { foreach (TrackingDateOrTimestamp timestamp in trackDetail.DatesOrTimes) { switch (timestamp.Type.ToString()) { case "ACTUAL_DELIVERY": rtn += "<b>Actual Delevery</b>" + ", " + timestamp.DateOrTimestamp + "<br>"; break; case "ACTUAL_PICKUP": rtn += "<b>Actual Pickup</b>" + ": " + timestamp.DateOrTimestamp + "<br>"; break; case "APPOINTMENT_DELIVERY": rtn += "<b>Apoinment Delevery</b>" + ": " + timestamp.DateOrTimestamp + "<br>"; break; case "ESTIMATED_DELIVERY": rtn += "<b>Estimated Delevery</b>" + ": " + timestamp.DateOrTimestamp + "<br>"; break; case "ESTIMATED_PICKUP": rtn += "<b>Estimated Pickup</b>" + ": " + timestamp.DateOrTimestamp + "<br>"; break; } } } if (trackDetail.DestinationAddress != null) { rtn += "<b>Destination:</b> " + trackDetail.DestinationAddress.City + ", " + trackDetail.DestinationAddress.StateOrProvinceCode + "<br>"; } if (trackDetail.AvailableImages != null) { foreach (AvailableImagesDetail ImageDetail in trackDetail.AvailableImages) { rtn += "<b>Image availability:</b> " + ImageDetail.Type + "<br>"; } } //if (trackDetail.NotificationEventsAvailable != null) //{ // foreach (NotificationEventType notificationEventType in trackDetail.NotificationEventsAvailable) // { // rtn+="<b>NotificationEvent type : </b>"+ notificationEventType+"<br>"; // } //} //Events //Console.WriteLine(); if (trackDetail.Events != null) { rtn += "<b><u>Track Events</u></b><br>"; foreach (TrackEvent trackevent in trackDetail.Events) { if (trackevent.TimestampSpecified) { rtn += "<b>Timestamp:</b>" + trackevent.Timestamp + ": "; } rtn += "<b>Event: </b>" + trackevent.EventDescription + "<br>"; //Console.WriteLine("***"); } //Console.WriteLine(); } //Console.WriteLine("**************************************"); } } return(rtn); }
private void ParseFedExRawDataIntoList(TrackerData Entry, TrackReply NewData) { foreach (CompletedTrackDetail completedTrackDetail in NewData.CompletedTrackDetails) { foreach (TrackDetail trackDetail in completedTrackDetail.TrackDetails) { //Check for error, likely from invalid tracking number if (trackDetail.Notification.Severity == NotificationSeverityType.ERROR) { Entry.Location = "INVALID TRACKING NUMBER"; Entry.Status = PackageStatus.NotFound; } else { //check for error-less state of no record found by web service if (trackDetail.StatusDetail != null) { //Input city state location as single string Entry.Location = trackDetail.StatusDetail.Location.City + ", " + trackDetail.StatusDetail.Location.StateOrProvinceCode; } else { Entry.Location = "NO CURRENT LOCATION FOUND"; } Entry.Service = ParcelService.FedEx; //check for error-less state of no record found by web service if (trackDetail.StatusDetail != null) { //a small sample of the package status codes, mapped to PackageStatus ENUM switch (trackDetail.StatusDetail.Code) { case "DL": Entry.Status = PackageStatus.Delivered; break; case "OD": Entry.Status = PackageStatus.OutForDelivery; break; case "ED": Entry.Status = PackageStatus.OutForDelivery; break; case "RS": Entry.Status = PackageStatus.Returned; break; case "IT": Entry.Status = PackageStatus.Shipped; break; case "PU": Entry.Status = PackageStatus.Shipped; break; case "DP": Entry.Status = PackageStatus.Shipped; break; case "AP": Entry.Status = PackageStatus.NotShipped; break; case "OF": Entry.Status = PackageStatus.NotShipped; break; default: Entry.Status = PackageStatus.Other; break; } } else { Entry.Status = PackageStatus.NotFound; } } } } }
public static List <DeliveryNotice> GetLogisticsTraceDetail(Context ctx) { #region //if (notices != null && notices.Count > 0) //{ // foreach (var notice in notices) // { // if (notice != null) // { // if (notice.TraceEntry != null && notice.TraceEntry.Count > 0) // { // foreach (var trace in notice.TraceEntry) // { // if (trace != null) // { // TrackRequest request = CreateTrackRequest(trace.FCarryBillNo); // LogXML("trackingNumber:["+ trace.FCarryBillNo + "] Request",request,typeof(TrackRequest)); // // // TrackService service = new TrackService(); // if (usePropertyFile()) // { // service.Url = getProperty("endpoint"); // } // // // try // { // // Call the Track web service passing in a TrackRequest and returning a TrackReply // TrackReply reply = service.track(request); // LogXML("trackingNumber:[" + trace.FCarryBillNo + "] Reply", reply, typeof(TrackReply)); // if (reply.HighestSeverity == NotificationSeverityType.SUCCESS || reply.HighestSeverity == NotificationSeverityType.NOTE || reply.HighestSeverity == NotificationSeverityType.WARNING) // { // ShowTrackReply(reply); // notice.LocusEntry = GetLocusDetail(reply); // } // ShowNotifications(reply); // } // catch (SoapException ex) // { // (ctx, SynchroDataType.DeliveryNoticeBill, ex.Message + System.Environment.NewLine + ex.StackTrace); // } // catch (Exception ex) // { // (ctx, SynchroDataType.DeliveryNoticeBill, ex.Message + System.Environment.NewLine + ex.StackTrace); // } // } // } // } // } // } //} //return notices; #endregion List <DeliveryNotice> notices = null; Dictionary <DeliveryNotice, TrackRequest> dict = CreateTrackRequest(GetTrackingNumbers(ctx)); if (dict != null && dict.Count > 0) { notices = new List <DeliveryNotice>(); foreach (var item in dict) { if (item.Key != null && item.Value != null) { LogXML("trackingNumber:[" + item.Key.FBillNo + "] Request", item.Value, typeof(TrackRequest)); TrackService service = new TrackService(); try { // Call the Track web service passing in a TrackRequest and returning a TrackReply TrackReply reply = service.track(item.Value); LogXML("trackingNumber:[" + item.Key.FBillNo + "] Reply", reply, typeof(TrackReply)); if (reply.HighestSeverity == NotificationSeverityType.SUCCESS || reply.HighestSeverity == NotificationSeverityType.NOTE || reply.HighestSeverity == NotificationSeverityType.WARNING) { item.Key.LocusEntry = GetLocusDetail(reply); notices.Add(item.Key); } } catch (SoapException ex) { LogUtils.WriteSynchroLog(ctx, SynchroDataType.DeliveryNoticeBill, ex.Message + System.Environment.NewLine + ex.StackTrace); } catch (Exception ex) { LogUtils.WriteSynchroLog(ctx, SynchroDataType.DeliveryNoticeBill, ex.Message + System.Environment.NewLine + ex.StackTrace); } } } } return(notices); }