Ejemplo n.º 1
0
        //根据商区/酒店名搜索
        public HotelResponseList RestrictSearchHotel(string _hotelCity, string _rating, DateTime _start, DateTime _end, string _hotelName, int _zone)
        {
            HotelResponseList hotels = new HotelResponseList();
            HotelCityCodeTranslator hcct = new HotelCityCodeTranslator();
            int hotelCityCode = int.Parse(hcct.TranslateToCode(_hotelCity));
            HotelSearch hs = new HotelSearch(hotelCityCode, _rating, _start, _end);
            if (_hotelName == null || _hotelName == "") { }
            else
            {
                hs.SetHotelName(_hotelName);
            }
            if (_zone <= 0) { }
            else
            {
                hs.SetZone(_zone);
            }
            hs.SetReturnEntity(this.apiCallProxy);

            List<DomesticHotelDataForList> li = hs.returnEntity.HotelDataList;
            foreach (DomesticHotelDataForList dhdf in li)
            {
                HotelResponse hr = new HotelResponse();
                hr.address = dhdf.Address;
                hr.brief = dhdf.Brief;
                hr.graph = dhdf.HotelPic550URL;
                hr.hotelName = dhdf.HotelName;
                hr.price = dhdf.MinPrice.ToString();
                hr.zone = dhdf.Zone;
                hr.zoneName = dhdf.ZoneName;
                hr.provider = "携程旅行网";
                hotels.SetHotelResponse(hr);
            }
            this.GenerateXmlFileFromHotel(hotels);

            return hotels;
        }
Ejemplo n.º 2
0
 public void SetHotelResponse(HotelResponse hr)
 {
     li.Add(hr);
 }
Ejemplo n.º 3
0
 public HotelResponse SearchHotelInResult(string _hotelName, string _address)
 {
     HotelResponse data = new HotelResponse();
     XmlDocument xmldoc = new XmlDocument();
     xmldoc.Load(AppDomain.CurrentDomain.BaseDirectory + "/CtripData//HotelData.xml");
     XmlNodeList routes = xmldoc.SelectNodes("/HotelResponses");
     foreach (XmlNode route in routes)
     {
         XmlNodeList li = route.SelectNodes("FlightResponse");
         foreach (XmlNode xn in li)
         {
             if (xn.SelectSingleNode("Hotel").InnerText == _hotelName && xn.SelectSingleNode("Address").InnerText == _address)
             {
                 data.address = _address;
                 data.brief = xn.SelectSingleNode("Brief").InnerText;
                 data.graph = xn.SelectSingleNode("Graph").InnerText;
                 data.hotelName = _hotelName;
                 data.price = xn.SelectSingleNode("Price").InnerText;
                 data.provider = xn.SelectSingleNode("Provider").InnerText;
                 data.zoneName = xn.SelectSingleNode("Zone").InnerText;
                 return data;
             }
         }
     }
     return data;
 }