Example #1
0
 /// <summary>
 /// Gets the hotel around sight by lat.
 /// </summary>
 /// <param name="cityName">Name of the city.</param>
 /// <param name="lat">The lat.</param>
 /// <param name="lon">The lon.</param>
 /// <param name="take">The take.</param>
 /// <returns></returns>
 public List<iPow.Domain.Dto.Sys_SightInfoDto> GetHotelAroundSightByLat(string cityName, double lat, double lon, int take)
 {
     cityName = cityName.Replace("市", "");
     List<iPow.Infrastructure.Data.DataSys.Sys_SightInfo> res = new List<Sys_SightInfo>();
     //在数据库中 按 要添加景区的城市 选景区
     var sightList = sightInfoRepository.GetList(e => e.Latitude != 0)
         .Where(e => e.Longitude != 0)
         .Where(e => e.City.Contains(cityName));
     if (sightList != null && sightList.Count() > 0)
     {
         foreach (var item in sightList)
         {
             //算周边景区,
             if (CirPoint(lat, lon, (double)item.Latitude, (double)item.Longitude, 0.1))
             {
                 res.Add(item);
             }
         }
     }
     res = res.OrderBy(e => e.ViCount).Take(take).ToList();
     return res.ToDto().ToList();
 }
Example #2
0
 /// <summary>
 /// Inits the sight default pic info.
 /// 得到每个景区一张缩略图
 /// </summary>
 /// <param name="si">The si.</param>
 /// <returns></returns>
 public List<Miaow.Domain.Dto.Sys_PicInfoDto> GetSightDefaultPic(PagedList<DefaultSightInfoDto> si)
 {
     List<Miaow.Infrastructure.Data.DataSys.Sys_PicInfo> spc = new List<Infrastructure.Data.DataSys.Sys_PicInfo>();
     if (si != null)
     {
         foreach (var i in si)
         {
             var rand = new Random();
             var temp = (from e in picInfoRepository.GetList() where e.ParkID == i.ParkID select e).Count();
             if (temp > 0)
             {
                 var toKip = rand.Next(0, temp);
                 var tempPic = (from e in picInfoRepository.GetList()
                                where e.ParkID == i.ParkID
                                orderby e.ViewCount
                                select e).Skip(toKip).Take(1).FirstOrDefault();
                 if (tempPic != null)
                 {
                     spc.Add(tempPic);
                 }
             }
         }
     }
     return spc.ToDto().ToList();
 }