Ejemplo n.º 1
0
        /// <summary>
        /// 构造多酒店查询XML
        /// </summary>
        /// <returns>多酒店查询XML</returns>
        private string GetMultiRequestXML()
        {
            StringBuilder NodeInfo = new StringBuilder();

            #region Build XML

            NodeInfo.Append("<HotelAvailRQ>");
            NodeInfo.Append("<HotelAvailCriteria AvailReqType=\"" + Enum.GetName(typeof(AvailReqTypeEnum), AvailReqType) + "\">");
            NodeInfo.Append("<ConfirmRightNowIndicator>" + Utils.BoolToYesOrNo(ConfirmRightNowIndicator) + "</ConfirmRightNowIndicator>");
            NodeInfo.Append("<StayDateRange Duration=\"\"  CheckOutDate=\"" + CheckOutDate + "\" CheckInDate=\"" + CheckInDate + "\"/>");
            NodeInfo.Append("<RatePlanCandidates>");
            NodeInfo.Append("<RatePlanCandidate RatePlanCode=\"" + RatePlanCode + "\" RatePlanType=\"" + RatePlanType + "\" Payment=\"" + Payment + "\">");
            //指定供应商 开始
            if (!String.IsNullOrEmpty(VendorCode))
            {
                NodeInfo.Append("<VendorsIncluded>");
                NodeInfo.Append("<Vendor VendorCode=\"" + VendorCode + "\"/>");
                NodeInfo.Append("</VendorsIncluded>");
                NodeInfo.Append("<IsDefinedChannel>" + IsDefinedChannel + "</IsDefinedChannel>");
                NodeInfo.Append("<IsDefinedVendor>" + IsDefinedVendor + "</IsDefinedVendor>");
            }
            //指定供应商 结束
            NodeInfo.Append("</RatePlanCandidate>");
            NodeInfo.Append("</RatePlanCandidates>");
            //价格
            NodeInfo.Append("<RateRange MaxRate=\"" + (PriceMaxRate.HasValue ? PriceMaxRate.ToString() : string.Empty) + "\" Currency=\"" + PriceCurrency + "\" MinRate=\"" + (PriceMinRate.HasValue ? PriceMinRate.ToString() : string.Empty) + "\"/>");
            NodeInfo.Append("<HotelSearchCriteria>");
            //经纬度
            NodeInfo.Append("<Position LongitudeFrom=\"" + MinimumLongitude + "\" LatitudeFrom=\"" + MinimumLatitude + "\" Longitude=\"" + Longitude + "\" LongitudeTo=\"" + MaximumLongitude + "\" Latitude=\"" + Latitude + "\" LatitudeTo=\"" + MaximumLatitude + "\"/>");
            //地理位置(地标)
            if (!String.IsNullOrEmpty(LandMark))
            {
                NodeInfo.Append("<LandMark>" + LandMark + "</LandMark>");
            }
            if (!String.IsNullOrEmpty(PhoneNumber))
            {
                NodeInfo.Append("<PhoneNumber>" + PhoneNumber + "</PhoneNumber>");
            }
            if (!String.IsNullOrEmpty(Radius))
            {
                NodeInfo.Append("<Radius>" + Radius + "</Radius>");
            }
            NodeInfo.Append("<HotelRef");
            if (!String.IsNullOrEmpty(District))
            {
                NodeInfo.Append(" District=\"" + District + "\"");
            }
            NodeInfo.Append(" CityCode=\"" + CityCode + "\"");
            if (!String.IsNullOrEmpty(HotelBrandName))
            {
                NodeInfo.Append(" HotelBrandName=\"" + HotelBrandName + "\"");
            }
            if (AirReception != BoolEnum.none)
            {
                NodeInfo.Append(" AirReception=\"" + Enum.GetName(typeof(BoolEnum), AirReception) + "\"");
            }
            if (!String.IsNullOrEmpty(HotelChainCode))
            {
                NodeInfo.Append(" HotelChainCode=\"" + HotelChainCode + "\"");
            }
            if (!String.IsNullOrEmpty(HotelCode))
            {
                NodeInfo.Append(" HotelCode=\"" + HotelCode + "\"");
            }
            if (!String.IsNullOrEmpty(HotelEnglishName))
            {
                NodeInfo.Append(" HotelEnglishName=\"" + HotelEnglishName + "\"");
            }
            if (!String.IsNullOrEmpty(HotelBrandCode))
            {
                NodeInfo.Append(" HotelBrandCode=\"" + HotelBrandCode + "\"");
            }
            if (!String.IsNullOrEmpty(HotelChineseName))
            {
                NodeInfo.Append(" HotelChineseName=\"" + HotelChineseName + "\"");
            }
            if (!String.IsNullOrEmpty(HotelChainName))
            {
                NodeInfo.Append(" HotelChainName=\"" + HotelChainName + "\"");
            }
            NodeInfo.Append(" />");
            if (!String.IsNullOrEmpty(Fitment))
            {
                NodeInfo.Append("<Fitment>" + Fitment + "</Fitment>");
            }
            if (!String.IsNullOrEmpty(OpenDate))
            {
                NodeInfo.Append("<OpenDate>" + OpenDate + "</OpenDate>");
            }
            NodeInfo.Append("<RoomStayCandidates>");
            NodeInfo.Append("<RoomStayCandidate");
            if (!String.IsNullOrEmpty(RoomView))
            {
                NodeInfo.Append(" RoomView=\"" + RoomView + "\"");
            }
            if (!String.IsNullOrEmpty(RoomName))
            {
                NodeInfo.Append(" RoomName=\"" + RoomName + "\"");
            }
            if (Internet != BoolEnum.none)
            {
                NodeInfo.Append(" Internet=\"" + Enum.GetName(typeof(BoolEnum), Internet) + "\"");
            }
            if (NoSmoking != BoolEnum.none)
            {
                NodeInfo.Append(" NoSmoking=\"" + Enum.GetName(typeof(BoolEnum), NoSmoking) + "\"");
            }
            if (RoomQuantity > 0)
            {
                NodeInfo.Append(" Quantity=\"" + RoomQuantity.ToString() + "\"");
            }
            if (!String.IsNullOrEmpty(BedType))
            {
                NodeInfo.Append(" BedType=\"" + BedType + "\"");
            }
            NodeInfo.Append(">");
            NodeInfo.Append("<RoomAmenity");
            if (QualityLevel != QualityLevelEnum.None)
            {
                NodeInfo.Append(" QualityLevel=\"" + Enum.GetName(typeof(QualityLevelEnum), QualityLevel) + "\"");
            }
            if (RoomTypeGuestMaxNum > 0)
            {
                NodeInfo.Append(" RoomTypeGuestMaxNum=\"" + RoomTypeGuestMaxNum.ToString() + "\"");
            }
            NodeInfo.Append(" />");
            NodeInfo.Append("</RoomStayCandidate>");
            NodeInfo.Append("</RoomStayCandidates>");
            //星级
            if (HotelRank != HotelRankEnum._00)
            {
                NodeInfo.Append("<Rank>" + Enum.GetName(typeof(HotelRankEnum), HotelRank).Substring(1) + "</Rank>");
            }
            NodeInfo.Append("</HotelSearchCriteria>");
            //分页信息
            NodeInfo.Append("<ReqPageInfo>");
            NodeInfo.Append("<ReqNumOfEachPage>" + NumOfEachPage.ToString() + "</ReqNumOfEachPage>");
            NodeInfo.Append("<ReqPageNo>" + PageNo.ToString() + "</ReqPageNo>");
            NodeInfo.Append("<IsPageView>" + Utils.BoolToYesOrNo(IsPageView) + "</IsPageView>");
            NodeInfo.Append("</ReqPageInfo>");
            //是否显示房型
            NodeInfo.Append("<RoomTypeDetailShowed>" + Utils.BoolToYesOrNo(RoomTypeDetailShowed) + "</RoomTypeDetailShowed>");
            //排序
            if (OrderBy != HotelOrderBy.Default)
            {
                NodeInfo.Append("<OrderBy>" + Enum.GetName(typeof(HotelOrderBy), OrderBy) + "</OrderBy>");
            }
            NodeInfo.Append("</HotelAvailCriteria>");
            NodeInfo.Append("</HotelAvailRQ>");

            #endregion

            return(NodeInfo.ToString());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 构造单酒店查询XML
        /// </summary>
        /// <returns>单酒店查询XML</returns>
        private string GetSingleRequestXML()
        {
            StringBuilder NodeInfo = new StringBuilder();

            #region Build XML

            NodeInfo.Append("<HotelAvailRQ>");
            NodeInfo.Append("<HotelAvailCriteria AvailReqType=\"" + Enum.GetName(typeof(AvailReqTypeEnum), AvailReqType) + "\">");
            NodeInfo.Append("<StayDateRange Duration=\"\"  CheckOutDate=\"" + CheckOutDate + "\" CheckInDate=\"" + CheckInDate + "\"/>");
            NodeInfo.Append("<RatePlanCandidates>");
            NodeInfo.Append("<RatePlanCandidate");
            if (!String.IsNullOrEmpty(RatePlanCode))
            {
                NodeInfo.Append(" RatePlanCode=\"" + RatePlanCode + "\"");
            }
            if (!String.IsNullOrEmpty(RatePlanType))
            {
                NodeInfo.Append(" RatePlanType=\"" + RatePlanType + "\"");
            }
            NodeInfo.Append(">");
            //指定供应商 开始
            if (!String.IsNullOrEmpty(VendorCode))
            {
                NodeInfo.Append("<VendorsIncluded>");
                NodeInfo.Append("<Vendor VendorCode=\"" + VendorCode + "\"/>");
                NodeInfo.Append("</VendorsIncluded>");
            }
            //指定供应商 结束
            NodeInfo.Append("</RatePlanCandidate>");
            NodeInfo.Append("</RatePlanCandidates>");
            //价格
            NodeInfo.Append("<RateRange");
            if (PriceMaxRate.HasValue)
            {
                NodeInfo.Append(" MaxRate=\"" + PriceMaxRate + "\"");
            }
            if (PriceMinRate.HasValue)
            {
                NodeInfo.Append(" MinRate=\"" + PriceMinRate + "\"");
            }
            NodeInfo.Append("/>");
            NodeInfo.Append("<HotelSearchCriteria>");
            //经纬度
            NodeInfo.Append("<Position Longitude=\"" + Longitude + "\" Latitude=\"" + Latitude + "\" />");
            //地理位置(地标)
            if (!String.IsNullOrEmpty(LandMark))
            {
                NodeInfo.Append("<LandMark>" + LandMark + "</LandMark>");
            }
            if (!String.IsNullOrEmpty(PhoneNumber))
            {
                NodeInfo.Append("<PhoneNumber>" + PhoneNumber + "</PhoneNumber>");
            }
            if (!String.IsNullOrEmpty(Radius))
            {
                NodeInfo.Append("<Radius>" + Radius + "</adius>");
            }
            NodeInfo.Append("<HotelRef");
            if (!String.IsNullOrEmpty(HotelCode))
            {
                NodeInfo.Append(" HotelCode=\"" + HotelCode + "\"");
            }
            NodeInfo.Append(" />");
            if (!String.IsNullOrEmpty(Fitment))
            {
                NodeInfo.Append("<Fitment>" + Fitment + "</Fitment>");
            }
            if (!String.IsNullOrEmpty(OpenDate))
            {
                NodeInfo.Append("<OpenDate>" + OpenDate + "</OpenDate>");
            }
            NodeInfo.Append("<RoomStayCandidates>");
            NodeInfo.Append("<RoomStayCandidate");
            if (!String.IsNullOrEmpty(RoomView))
            {
                NodeInfo.Append(" RoomView=\"" + RoomView + "\"");
            }
            if (Internet != BoolEnum.none)
            {
                NodeInfo.Append(" Internet=\"" + Enum.GetName(typeof(BoolEnum), Internet) + "\"");
            }
            if (NoSmoking != BoolEnum.none)
            {
                NodeInfo.Append(" NoSmoking=\"" + Enum.GetName(typeof(BoolEnum), NoSmoking) + "\"");
            }
            if (RoomQuantity > 0)
            {
                NodeInfo.Append(" Quantity=\"" + RoomQuantity.ToString() + "\"");
            }
            if (!String.IsNullOrEmpty(BedType))
            {
                NodeInfo.Append(" BedType=\"" + BedType + "\"");
            }
            if (!String.IsNullOrEmpty(RoomTypeCode))
            {
                NodeInfo.Append(" RoomTypeCode=\"" + RoomTypeCode + "\"");
            }
            NodeInfo.Append(">");
            NodeInfo.Append("<RoomAmenity");
            if (QualityLevel != QualityLevelEnum.None)
            {
                NodeInfo.Append(" QualityLevel=\"" + Enum.GetName(typeof(QualityLevelEnum), QualityLevel) + "\"");
            }
            if (RoomTypeGuestMaxNum > 0)
            {
                NodeInfo.Append(" RoomTypeGuestMaxNum=\"" + RoomTypeGuestMaxNum.ToString() + "\"");
            }
            NodeInfo.Append(" />");
            NodeInfo.Append("</RoomStayCandidate>");
            NodeInfo.Append("</RoomStayCandidates>");
            //星级
            if (HotelRank != HotelRankEnum._00)
            {
                NodeInfo.Append("<Rank>" + Enum.GetName(typeof(HotelRankEnum), HotelRank).Substring(1) + "</Rank>");
            }
            NodeInfo.Append("</HotelSearchCriteria>");
            NodeInfo.Append("</HotelAvailCriteria>");
            NodeInfo.Append("</HotelAvailRQ>");

            #endregion

            return(NodeInfo.ToString());
        }