예제 #1
0
        public static void GetTransfers(Dictionary<int, decimal> transfers, SuperAvailabilityResponse superAvailabilityResponse, AggregatorSetting aggregatorSetting)
        {
            var threads = new List<ThreadWorking>();
            foreach (var transfer in transfers)
            {
                var transfersRequestV3 = new TransfersRequestV3
                {
                    ClientType = 0,
                    ConfirmationLevel = 0,
                    ChildAge = superAvailabilityResponse.AvailabilityRequest.ChildAge,
                    NoOfAdults = superAvailabilityResponse.AvailabilityRequest.NoOfAdults,
                    NoOfChildren = superAvailabilityResponse.AvailabilityRequest.NoOfChildren,
                    SvcDateFrom = superAvailabilityResponse.AvailabilityRequest.SvcDate,
                    SvcDateTo = superAvailabilityResponse.AvailabilityRequest.SvcDate.AddDays(superAvailabilityResponse.AvailabilityRequest.Nites),
                    LocationID = transfer.Key
                };

                var thread = new ThreadWorking
                {
                    TransferSearch = new TransferSearch(transfersRequestV3, aggregatorSetting)
                };

                thread.Thread = new Thread(thread.TransferSearch.Search);
                thread.Thread.Start();
                threads.Add(thread);
            }

            // join up all the threads
            foreach (var threadWorking in threads)
            {
                threadWorking.Thread.Join();
                transfers[threadWorking.TransferSearch.Request.LocationID] = threadWorking.TransferSearch.CheapestTransferPrice;
            }
        }
예제 #2
0
        public static TransfersResponseV3 Search(TransfersRequestV3 request, AggregatorSetting aggregatorSetting)
        {
            var authSoapHd = new AuthSoapHd
            {
                strUserName = aggregatorSetting.PtsUserName,
                strNetwork = aggregatorSetting.PtsNetwork,
                strPassword = aggregatorSetting.PtsPassword,
                strUserRef = "",
                strCustomerIP = "" //HttpContext.Current == null ? String.Empty : (HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] ?? HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]).Split(',')[0].Trim()
            };

            var service = new AccommodationService { Url = aggregatorSetting.PtsUrl, AuthSoapHdValue = authSoapHd, Timeout = aggregatorSetting.PtsTimeOut };
            var stopwatch = new Stopwatch();
            stopwatch.Start();
            TransfersResponseV3 response =  service.GetTransfersV3(request);
            stopwatch.Stop();

            return response;
        }
예제 #3
0
 /// <remarks/>
 public void GetTransfersV3Async(TransfersRequestV3 TransfersRequestV3, object userState) {
     if ((this.GetTransfersV3OperationCompleted == null)) {
         this.GetTransfersV3OperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetTransfersV3OperationCompleted);
     }
     this.InvokeAsync("GetTransfersV3", new object[] {
                 TransfersRequestV3}, this.GetTransfersV3OperationCompleted, userState);
 }
예제 #4
0
 /// <remarks/>
 public void GetTransfersV3Async(TransfersRequestV3 TransfersRequestV3) {
     this.GetTransfersV3Async(TransfersRequestV3, null);
 }
예제 #5
0
 public TransferSearch(TransfersRequestV3 request, AggregatorSetting aggregatorSetting)
 {
     Request = request;
     AggregatorSetting = aggregatorSetting;
 }