public AvailabilityService() { this.ws = new AvailabilityRequest(); this.reg = new RegionalAvailabilityExtRequest(); this.cli = new AvailabilityServiceSoapClient(); this.og = new OGHeader(); this.origin = new EndPoint(); this.dest = new EndPoint(); this.segment = new AvailRequestSegment(); this.hotelSearch = new HotelSearchCriterion(); this.hotelRef = new HotelReference(); this.roomStay = new RoomStayCandidate(); this.request = new AvailabilityRequest(); this.packageRequest = new FetchAvailablePackagesRequest(); this.timeSpan = new Availability.TimeSpan(); this.rate = new MinMaxRate(); this.response = new AvailabilityResponse(); this.packageResponse = new FetchAvailablePackagesResponse(); this.ratePlan = new RatePlanCandidate(); this.tempObj = new Object(); }
/// <summary> /// 订单验证 /// </summary> /// <param name="hotelCode"></param> /// <param name="ratePlanCategory"></param> /// <param name="ratePlanCode"></param> /// <param name="roomNum"></param> /// <param name="guestCount"></param> /// <param name="start"></param> /// <param name="end"></param> /// <param name="lastArriveTime">HH:mm</param> public HotelAvailReponse CheckOrderAvail(string hotelCode, string ratePlanCategory, string ratePlanCode, int roomNum, int guestCount, DateTime start, DateTime end, string lastArriveTime) { HotelAvailRequest req = new HotelAvailRequest(); AvailRequestSegment s = new AvailRequestSegment(); Criterion_Avail c = new Criterion_Avail(); c.HotelCode = hotelCode; c.RatePlanCandidates.RatePlanCandidateList.Add(new RatePlanCandidate_Avail() { RatePlanCategory = ratePlanCategory, RatePlanCode = ratePlanCode.Replace("_c", "") }); RoomStayCandidate r = new RoomStayCandidate(); r.Quantity = roomNum; r.GuestCounts.GuestCountList.Add(new GuestCount() { Count = guestCount }); c.RoomStayCandidates.RoomStayCandidateList.Add(r); c.StartDate = start.ToString("yyyy-MM-dd"); c.EndDate = end.ToString("yyyy-MM-dd"); //入住人最晚到店时间,有可能最晚到店日期为第二天凌晨,格式为 yyyy-MM-dd hh:mm:ss DateTime arrTime = new DateTime(); string temp = start.Date.ToString("yyyy-MM-dd") + " " + lastArriveTime; if (DateTime.TryParse(temp, out arrTime)) { if (arrTime > DateTime.Now) { c.TPA_Extensions.LateArrivalTime = arrTime.Hour < 6 ? (start.AddDays(1).ToString("yyyy-MM-dd") + "T" + lastArriveTime + ":00.000+08:00") : (start.ToString("yyyy-MM-dd") + "T" + lastArriveTime + ":00.000+08:00"); } else { if (DateTime.Now.Hour > 23 && DateTime.Now.Minute > 30) { c.TPA_Extensions.LateArrivalTime = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") + "T03:00:00.000+08:00"; } else if (DateTime.Now.Date > start.Date) { c.TPA_Extensions.LateArrivalTime = DateTime.Now.ToString("yyyy-MM-dd") + "T03:30:00.000+08:00"; } else { c.TPA_Extensions.LateArrivalTime = DateTime.Now.ToString("yyyy-MM-dd") + "T23:50:00.000+08:00"; } } } else if (start.Date == DateTime.Now.Date) { c.TPA_Extensions.LateArrivalTime = DateTime.Now.Hour < 6 ? (DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") + "T" + "03:00:00.000+08:00") : (DateTime.Now.ToString("yyyy-MM-dd") + "T" + "23:50:00.000+08:00"); } else { c.TPA_Extensions.LateArrivalTime = start.ToString("yyyy-MM-ddT23:50:00.000+08:00"); } s.HotelSearchCriteria.CriterionList.Add(c); req.OTA_HotelAvailRQ.AvailRequestSegments.AvailRequestSegmentList.Add(s); var res = ExecutePost(req); return(res); }