Пример #1
0
        /// <summary>
        /// Inits the sight default pic info.
        /// 得到每个景区一张缩略图
        /// </summary>
        /// <param name="si">The si.</param>
        /// <returns></returns>
        public List <iPow.Domain.Dto.Sys_PicInfoDto> GetSightDefaultPic(PagedList <DefaultSightInfoDto> si)
        {
            List <iPow.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());
        }
Пример #2
0
        /// <summary>
        /// Gets the sight pic by new.
        /// </summary>
        /// <param name="sid">The sid.</param>
        /// <param name="pageIndex">Index of the page.</param>
        /// <param name="take">The take.</param>
        /// <param name="total">The total.</param>
        /// <returns></returns>
        public IQueryable <iPow.Domain.Dto.Sys_PicInfoDto> GetSightPicByNew(int sid, int pageIndex, int take, ref int total)
        {
            var picList = picInfoRepository.GetList(e => e.ParkID == sid && e.IsDelete == 0)
                          .OrderByDescending(e => e.AddTime);

            total = picList.Count();
            var res = picList
                      .Skip(((pageIndex - 1) > 0 ? (pageIndex - 1) : 0) * take)
                      .Take(take).AsQueryable();
            var data = res.ToDto().AsQueryable();

            return(data);
        }
Пример #3
0
        public bool DeleteTrue(IList <int> idList, iPow.Infrastructure.Data.DataSys.Sys_AdminUser operUser)
        {
            var res = false;

            if (idList != null && idList.Count > 0)
            {
                var delete = picInfoRepository.GetList(e => idList.Contains(e.PicID)).ToList();
                if (delete != null && delete.Count > 0)
                {
                    res = DeleteTrue(delete, operUser);
                }
            }
            return(res);
        }
Пример #4
0
        /// <summary>
        /// Selects the sight info.
        /// </summary>
        /// <param name="info">The info.</param>
        /// <returns></returns>
        public IEnumerable <DefaultSightInfoDto> SelectSightInfo(IEnumerable <iPow.Infrastructure.Data.DataSys.Sys_SightInfo> info)
        {
            var data = info.Select(e => new DefaultSightInfoDto
            {
                Remark    = e.Remark,
                WantCount = e.WantCount,
                City      = e.City,
                ParkID    = e.ParkID,
                Province  = e.Province,
                Py        = e.PY,
                Ticket    = e.Ticket,
                Title     = e.Title,
                Type      = sightClassRepository.GetList(d => d.ClassID == e.ClassID).Select(d => d.ClassName).FirstOrDefault(),
                VoIndex   = e.VoIndex,
                ViCount   = e.ViCount,
                GoCount   = e.GoCount,
                IsShort   = e.IsShort,
                Address   = e.Address,
                PicCount  = picInfoRepository.GetList().Where(d => d.ParkID == e.ParkID).Count(),
                CommCount = sightCommRepository.GetList().Where(d => d.SightID == e.ParkID).Count(),
                CityPy    = cityInfoRepository.GetList(d => d.city == e.City && d.province == e.Province).Select(d => d.pinyin).FirstOrDefault(),
                ProvPy    = cityInfoRepository.GetList(d => d.city == e.City && d.province == e.Province).Select(d => d.ProvincePy).FirstOrDefault(),
                Lat       = e.Latitude,
                Long      = e.Longitude,
                Url       = e.Url
            });

            return(data);
        }
Пример #5
0
        /// <summary>
        /// Gets the map sight info by tour id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        public IQueryable <Dto.MapSightInfoDto> GetMapSightInfoByTourIdAndDay(int id, int day)
        {
            IQueryable <Dto.MapSightInfoDto> data = null;
            var trueSightList = GetSightOrHotelIdList(id, "sight", day);
            var nearSightList = sightInfoRepository.GetList(e => trueSightList.Contains(e.ParkID))
                                .Select(e => e.CirParkID);
            List <int?> sightIdList = new List <int?>();

            if (nearSightList != null && nearSightList.Count() > 0)
            {
                string[] array = null;
                foreach (var item in nearSightList)
                {
                    array = item.Split(',');
                    if (array.Length > 0)
                    {
                        for (int i = 0; i < array.Length; i++)
                        {
                            if (!string.IsNullOrEmpty(array[i]))
                            {
                                try
                                {
                                    sightIdList.Add(int.Parse(array[i]));
                                }
                                catch
                                {
                                    continue;
                                }
                            }
                        }
                    }
                }
            }
            sightIdList.AddRange(trueSightList);
            data = sightInfoRepository.GetList(e => sightIdList.Contains(e.ParkID))
                   .Select(e => new Dto.MapSightInfoDto
            {
                SightId   = e.ParkID,
                Name      = e.Title,
                Py        = e.PY,
                Address   = e.Address,
                Ticket    = e.Ticket,
                Type      = sightClassRepository.GetList(d => d.ClassID == e.ClassID).Select(d => d.ClassName).FirstOrDefault(),
                Lat       = e.Latitude,
                Long      = e.Longitude,
                CommCount = sightCommRepository.GetList(d => d.ParentID == e.ParkID).Count(),
                ImgCount  = picInfoRepository.GetList(d => d.ParkID == e.ParkID).Count()
            }).AsQueryable();

            return(data);
        }