예제 #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);
 }
예제 #2
0
        /// <summary>
        /// Gets the hotel around hotel by id.
        /// </summary>
        /// <returns></returns>
        public List <iPow.Application.Union.Dto.HotelInfoDto> GetHotelAroundHotelById(string id)
        {
            List <iPow.Application.Union.Dto.HotelInfoDto> hi = new List <iPow.Application.Union.Dto.HotelInfoDto>();

            iPow.Application.Union.Dto.HotelInfoDto sin = null;
            var temp = GetHotelAroundHotelListById(id);

            foreach (var item in temp)
            {
                sin = hotelInfoService.GetHotelInfoById(item.id.ToString());
                if (sin != null && sin.id > 0)
                {
                    hi.Add(sin);
                }
            }
            return(hi);
        }