Beispiel #1
0
 /// <summary>
 /// Gets the hotel traffic by id.
 /// </summary>
 /// <param name="id">The id.</param>
 /// <returns></returns>
 public iPow.Application.Union.Dto.HotelTrafficDto GetHotelTrafficById(string id)
 {
     iPow.Application.Union.Dto.HotelTrafficDto data = new iPow.Application.Union.Dto.HotelTrafficDto();
     iPow.Application.Union.Dto.HotelInfoDto    hi   = hotelInfoService.GetHotelInfoById(id);
     if (hi.id > 0)
     {
         data.SigleHotelInfo = hi;
         data.HotelId        = int.Parse(id);
         var cityName = cityService.GetUnionCityNameById(hi.cid);
         var cityArea = cityAreaCodeRepository.GetList(d => d.city.Contains(cityName)).FirstOrDefault();
         if (cityArea != null)
         {
             data.HotelAreaCode = cityArea.areacode;
         }
         var arroundHotel = new List <iPow.Application.Union.Dto.HotelInfoDto>();
         arroundHotel.Add(hi);
         arroundHotel.AddRange(hotelAroundHotelService.GetHotelAroundHotelById(id));
         arroundHotel   = arroundHotel.OrderBy(d => d.id).Take(Take).ToList();
         data.HotelInfo = arroundHotel;
         string pos = hi.hotelpos.Replace("(", "");
         pos = pos.Replace(")", "");
         var posList = pos.Split(',').ToList();
         if (posList.Count == 2)
         {
             var lat = double.Parse(posList[0]); //纬度
             var lon = double.Parse(posList[1]); //经度
             data.SightInfo = GetHotelAroundSightByLat(cityName, lat, lon, Take).ToList();
         }
     }
     return(data);
 }
Beispiel #2
0
        /// <summary>
        /// Gets the hotel traffic by id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        public iPow.Application.Union.Dto.HotelTrafficDto GetHotelTrafficById(string id)
        {
            iPow.Application.Union.Dto.HotelTrafficDto data = new iPow.Application.Union.Dto.HotelTrafficDto();
            iPow.Application.Union.Dto.HotelInfoDto hi = hotelInfoService.GetHotelInfoById(id);
            if (hi.id > 0)
            {
                data.SigleHotelInfo = hi;
                data.HotelId = int.Parse(id);
                var cityName = cityService.GetUnionCityNameById(hi.cid);
                var cityArea = cityAreaCodeRepository.GetList(d => d.city.Contains(cityName)).FirstOrDefault();
                if (cityArea != null)
                {
                    data.HotelAreaCode = cityArea.areacode;

                }
                var arroundHotel = new List<iPow.Application.Union.Dto.HotelInfoDto>();
                arroundHotel.Add(hi);
                arroundHotel.AddRange(hotelAroundHotelService.GetHotelAroundHotelById(id));
                arroundHotel = arroundHotel.OrderBy(d => d.id).Take(Take).ToList();
                data.HotelInfo = arroundHotel;
                string pos = hi.hotelpos.Replace("(", "");
                pos = pos.Replace(")", "");
                var posList = pos.Split(',').ToList();
                if (posList.Count == 2)
                {
                    var lat = double.Parse(posList[0]);//纬度
                    var lon = double.Parse(posList[1]);//经度
                    data.SightInfo = GetHotelAroundSightByLat(cityName, lat, lon, Take).ToList();
                }
            }
            return data;
        }