Esempio n. 1
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 = sightCommRepository.GetList(e => idList.Contains(e.CommID)).ToList();
                if (delete != null && delete.Count > 0)
                {
                    res = DeleteTrue(delete, operUser);
                }
            }
            return(res);
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
        /// <summary>
        /// Inits the sight comm list.
        /// 初始化当前景区的评论列表
        /// </summary>
        /// <param name="sightId">The sys_ sight info.</param>
        /// <param name="pageIndex">Index of the page.</param>
        /// <param name="defaultPageSize">Default size of the page.</param>
        /// <returns></returns>
        public PagedList <iPow.Domain.Dto.Sys_SightCommDto> GetSightCommPageListBySid(int sightId, int?pageIndex, int?defaultPageSize)
        {
            var res = sightCommRepository
                      .GetList(d => d.SightID == sightId)
                      .OrderByDescending(d => d.AddTime).AsEnumerable();
            var count = res.Count();

            pageIndex       = pageIndex == null ? 1 : pageIndex;
            defaultPageSize = defaultPageSize == null ? 5 : defaultPageSize;
            defaultPageSize = defaultPageSize < 0 ? 5 : defaultPageSize;
            pageIndex       = (pageIndex - 1) < 0 ? 0 : (pageIndex - 1);
            res             = res.Skip((int)(pageIndex * defaultPageSize)).Take((int)defaultPageSize);
            var dto = res.ToDto();
            PagedList <iPow.Domain.Dto.Sys_SightCommDto> commList = new PagedList <iPow.Domain.Dto.Sys_SightCommDto>(dto, (int)pageIndex, (int)defaultPageSize, count);

            return(commList);
        }
Esempio n. 4
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);
        }