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 = sightClassRepository.GetList(e => idList.Contains(e.ClassID)).ToList();
                if (delete != null && delete.Count > 0)
                {
                    res = DeleteTrue(delete, operUser);
                }
            }
            return(res);
        }
Esempio n. 2
0
        /// <summary>
        /// Updates the top class.
        /// </summary>
        /// <param name="si">The si.</param>
        /// <returns></returns>
        public List <TopClassDto> GetTopClassBySight(IEnumerable <iPow.Infrastructure.Data.DataSys.Sys_SightInfo> si)
        {
            List <TopClassDto> tc = new List <TopClassDto>();

            //在这里,去更新TopClass
            tc = (from d in si
                  group d by d.ClassID into g
                  orderby g.Count() descending
                  select new TopClassDto
            {
                count = g.Count(),
                name = (from s in sightClassRepository.GetList() where s.ClassID == g.Key select s).FirstOrDefault().ClassName,
                Type = g.Key
            }).ToList();
            return(tc);
        }
Esempio n. 3
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. 4
0
        /// <summary>
        /// Gets the tour detail sight by id and day.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="day">The day.</param>
        /// <returns></returns>
        public IQueryable <Dto.TourDetailSightDto> GetTourDetailSightByIdAndDay(int id, int day)
        {
            IQueryable <Dto.TourDetailSightDto> data = null;
            var sightList = GetSightOrHotelIdList(id, "sight", day);

            data = sightInfoRepository.GetList(e => sightList.Contains(e.ParkID))
                   .Select(e => new Dto.TourDetailSightDto
            {
                SightId   = e.ParkID,
                Name      = e.Title,
                Py        = e.PY,
                Address   = e.Address,
                OpToTime  = e.OpToTime,
                ShowHours = e.ShopHours,
                Ticket    = e.Ticket,
                PlanId    = id,
                Type      = sightClassRepository.GetList(d => d.ClassID == e.ClassID).Select(d => d.ClassName).FirstOrDefault(),
                Lat       = e.Latitude,
                Long      = e.Longitude
            }).AsQueryable();
            return(data);
        }
Esempio n. 5
0
        /// <summary>
        /// Gets the detail base info by id.
        /// </summary>
        /// <param name="sid">The sid.</param>
        /// <returns></returns>
        public DetailSightBaseDto GetDetailSightBaseInfoById(int sid)
        {
            DetailSightBaseDto data = sightInfoRepository.GetList(e => e.ParkID == sid)
                                      .Select(e => new DetailSightBaseDto
            {
                GoCount   = e.GoCount,
                ParkID    = e.ParkID,
                Py        = e.PY,
                Ticket    = e.Ticket,
                Title     = e.Title,
                Type      = sightClassRepository.GetList(d => d.ClassID == e.ClassID).FirstOrDefault().ClassName,
                WantCount = e.WantCount,
                ParkMap   = e.ParkMap
            }).FirstOrDefault();

            return(data);
        }
Esempio n. 6
0
        /// <summary>
        /// Inits the sight info. 根据城市得到景区
        /// 并分页
        /// 中文的省和名哦
        /// 数据库里面存的中文的名字,不是拼音
        /// </summary>
        /// <param name="li">The li.</param>
        /// <param name="currentClassId">The current class id.</param>
        /// <param name="province">The province.</param>
        /// <param name="city">The city or province.</param>
        /// <param name="type">The type.</param>
        /// <param name="pi">Index of the page.</param>
        /// <param name="take">Size of the page.</param>
        /// <param name="total">The total.</param>
        /// <param name="sortCount">The sort count.</param>
        /// <param name="topList">The top list.</param>
        /// <returns></returns>
        public List <DefaultSightInfoDto> GetSightListByProvinceOrCity(
            LocationInfoDto li, ref int currentClassId, string province, string city,
            int?type, int?pi, int?take, ref int total, ref int sortCount,
            ref List <iPow.Application.jq.Dto.TopClassDto> topList)
        {
            var typeList = sightClassRepository.GetList().Distinct().Select(d => d.ClassID);
            int index    = (pi == null || pi < 0) ? 1 : (int)pi;
            int size     = (take == null || pi < 0) ? 10 : (int)take;

            List <DefaultSightInfoDto> sightList = new List <DefaultSightInfoDto>();
            IEnumerable <iPow.Infrastructure.Data.DataSys.Sys_SightInfo> temp = null;

            //根据传入城市
            if (string.IsNullOrEmpty(province) && !string.IsNullOrEmpty(city))
            {
                #region
                if (typeList != null && typeList.Contains((int)type))
                {
                    temp = (from d in sightInfoRepository.GetList()
                            where d.City == city && d.ClassID == type && d.IsDelete == 0
                            orderby d.ViCount descending
                            select d);
                    currentClassId = (int)type;
                }
                else
                {
                    temp = (from d in sightInfoRepository.GetList()
                            where d.City == city && d.IsDelete == 0
                            orderby d.ViCount descending
                            select d);
                    currentClassId = 0;
                }
                topList   = topClassService.GetTopClassBySight(temp);
                sightList = ToPageList(addSortService.SelectSightInfo(temp), index, size);
                sortCount = addSortService.AddSortSightInfoByCity(sightList, city, index, size);
                #endregion
                total = temp.Count();
            }
            //根据当前IP中的市选择
            else if (string.IsNullOrEmpty(province) && string.IsNullOrEmpty(city))
            {
                #region

                if (typeList != null && typeList.Contains((int)type))
                {
                    temp = (from d in sightInfoRepository.GetList()
                            where d.City == li.City && d.ClassID == type && d.IsDelete == 0
                            orderby d.ViCount descending
                            select d);
                    currentClassId = (int)type;
                }
                else
                {
                    temp = (from d in sightInfoRepository.GetList()
                            where d.City == li.City && d.IsDelete == 0
                            orderby d.ViCount descending
                            select d);
                    currentClassId = 0;
                }
                topList   = topClassService.GetTopClassBySight(temp);
                sightList = ToPageList(addSortService.SelectSightInfo(temp), index, size);
                sortCount = addSortService.AddSortSightInfoByCity(sightList, city, index, size);
                #endregion
                total = temp.Count();
            }
            //根据传入省
            else if (!string.IsNullOrEmpty(province) && string.IsNullOrEmpty(city))
            {
                #region

                if (typeList != null && typeList.Contains((int)type))
                {
                    temp = (from d in sightInfoRepository.GetList()
                            where d.Province == province && d.ClassID == type && d.IsDelete == 0
                            orderby d.ViCount descending
                            select d).ToList();
                    currentClassId = (int)type;
                }
                else
                {
                    temp = (from d in sightInfoRepository.GetList()
                            where d.Province == province && d.IsDelete == 0
                            orderby d.ViCount descending
                            select d).ToList();
                    currentClassId = 0;
                }
                topList   = topClassService.GetTopClassBySight(temp);
                sightList = ToPageList(addSortService.SelectSightInfo(temp), index, size);
                sortCount = addSortService.AddSortSightInfoByProvince(sightList, province, (int)pi, (int)take);
                #endregion
                total = temp.Count();
            }
            //根据传入省和市选
            else
            {
                #region

                if (typeList != null && typeList.Contains((int)type))
                {
                    temp = (from d in sightInfoRepository.GetList()
                            where d.City == city && d.Province == province && d.ClassID == type && d.IsDelete == 0
                            orderby d.ViCount descending
                            select d);
                    currentClassId = (int)type;
                }
                else
                {
                    temp = (from d in sightInfoRepository.GetList()
                            where d.City == city && d.Province == province && d.IsDelete == 0
                            orderby d.ViCount descending
                            select d);
                    currentClassId = 0;
                }
                topList   = topClassService.GetTopClassBySight(temp);
                sightList = ToPageList(addSortService.SelectSightInfo(temp), index, size);
                sortCount = addSortService.AddSortSightInfoByCity(sightList, city, (int)pi, (int)take);
                #endregion
                total = temp.Count();
            }
            //添加全局排序的景区
            int global = addSortService.AddSortSightInfoByGlobal(sightList, (int)pi, (int)take);
            sortCount += global;
            total     += global;
            return(sightList);
        }