Пример #1
0
        public IEnumerable<ShipmentStatusEvent> GetShipmentStatusEvents(string trackingNumber)
        {
            var settings = UPSSettings.LoadFrom(_settingsService);
            var track = CreateTrackService(settings);
            var request = new TrackRequest();
            var requestType = new RequestType();
            requestType.RequestOption = new string[] { "15" };
            request.Request = requestType;
            request.InquiryNumber = trackingNumber;
            System.Net.ServicePointManager.ServerCertificateValidationCallback += delegate { return true; };

            var trackResponse = track.ProcessTrack(request);
            var result = new List<ShipmentStatusEvent>();

            result.AddRange(trackResponse.Shipment.SelectMany(c => c.Package[0].Activity.Select(x => ToStatusEvent(x))).ToList());

            return result;
        }
Пример #2
0
 /// <remarks/>
 public void ProcessTrackAsync(TrackRequest TrackRequest) {
     this.ProcessTrackAsync(TrackRequest, null);
 }
Пример #3
0
 /// <remarks/>
 public void ProcessTrackAsync(TrackRequest TrackRequest, object userState) {
     if ((this.ProcessTrackOperationCompleted == null)) {
         this.ProcessTrackOperationCompleted = new System.Threading.SendOrPostCallback(this.OnProcessTrackOperationCompleted);
     }
     this.InvokeAsync("ProcessTrack", new object[] {
                 TrackRequest}, this.ProcessTrackOperationCompleted, userState);
 }