예제 #1
0
        /// <summary>
        /// </summary>
        /// <param name="request"></param>
        /// <param name="aggregatorSetting"></param>
        /// <param name="settings"></param>
        /// <returns></returns>
        private static AvailabilityRequest GetRequest(AccommodationSearchRequest request, AggregatorSetting aggregatorSetting, Settings settings)
        {
            var availabilityRequest = new AvailabilityRequest
            {
                HotelId = request.SuperIds == null ? null :  string.Join(",",  request.SuperIds),
                H2H = GetH2H(request.CityCode, aggregatorSetting, settings),
                FeatureCode = aggregatorSetting.PtsFeatureCode,
                DetailLevel = 5,
                CityCode = request.CityCode,
                ConfirmationLevel = 0
            };

            TimeSpan ts = request.CheckOut - request.CheckIn;
            availabilityRequest.Nites = (sbyte)ts.Days;
            availabilityRequest.SvcDate = request.CheckIn;
            availabilityRequest.NoOfAdults = (sbyte)request.NumberOfAdults;
            availabilityRequest.NoOfChildren = (sbyte)(request.ChildAge == null ? 0 : request.ChildAge.Count + request.NumberOfInfants ?? 0);
            if (request.ResortCode.HasValue && request.ResortCode.Value > 0)
                availabilityRequest.Location = (int)request.ResortCode.Value;

            var ages = new List<sbyte>();

            if (request.ChildAge != null)
                foreach (var i in request.ChildAge)
                {
                    ages.Add((sbyte)i);
                }

            for (var i = 0; i < request.NumberOfInfants; i++)
            {
                ages.Add(1);
            }

            availabilityRequest.ChildAge = ages.ToArray();
            availabilityRequest.Units = (sbyte)request.NumberOfRooms;

            return availabilityRequest;
        }
예제 #2
0
 /// <remarks/>
 public void GetAvailabilityAsync(AvailabilityRequest AvailabilityRequest, object userState) {
     if ((this.GetAvailabilityOperationCompleted == null)) {
         this.GetAvailabilityOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetAvailabilityOperationCompleted);
     }
     this.InvokeAsync("GetAvailability", new object[] {
                 AvailabilityRequest}, this.GetAvailabilityOperationCompleted, userState);
 }
예제 #3
0
 /// <remarks/>
 public void GetAvailabilityAsync(AvailabilityRequest AvailabilityRequest) {
     this.GetAvailabilityAsync(AvailabilityRequest, null);
 }