Exemple #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;
        }
Exemple #2
0
        //国内城市商区汇总
        public List<CityZone> ZoneCollection(string _hotelCity)
        {
            List<CityZone> zones = new List<CityZone>();
            List<CityZone> zones2 = new List<CityZone>();
            XmlDocument xmldoc2 = new XmlDocument();
            xmldoc2.Load(AppDomain.CurrentDomain.BaseDirectory + "/CtripData/国内城市.xml");
            string xpath2 = "/CityDetails/CityDetail";
            XmlNodeList cityDetail = xmldoc2.SelectNodes(xpath2);

            foreach (XmlNode xn in cityDetail)
            {
                CityZone zone = new CityZone();
                zone.CityName = xn.SelectSingleNode("CityName").InnerText;
                zone.City = xn.SelectSingleNode("City").InnerText;
                zones.Add(zone);
            }

            string xpath = "/ZoneDetails/ZoneDetail/City";
            HotelCityCodeTranslator hcct = new HotelCityCodeTranslator();

            XmlDocument xmldoc = new XmlDocument();
            xmldoc.Load(AppDomain.CurrentDomain.BaseDirectory + "/CtripData/商业区全部.xml");
            XmlNodeList zoneDetail = xmldoc.SelectNodes(xpath);

            foreach (CityZone cz in zones)
            {
                CityZone cityZone = new CityZone();
                foreach (XmlNode xn in zoneDetail)
                {
                    if (xn.InnerText.Equals(cz.City))
                    {
                        Zone zone = new Zone();
                        zone.ZoneName = xn.ParentNode.SelectSingleNode("ZoneName").InnerText;
                        zone.ZoneCode = xn.ParentNode.SelectSingleNode("Zone").InnerText;
                        cityZone.City = xn.ParentNode.SelectSingleNode("City").InnerText;
                        cityZone.CityName = hcct.TranslateToName(cityZone.City);
                        cityZone.Zones.Add(zone);
                    }
                }
                zones2.Add(cityZone);

            }
            this.GenerateXmlFileFromZone(zones2);
            return zones2;
        }