Exemple #1
0
        /// <summary>
        /// Gets the search tour model.
        /// </summary>
        /// <param name="search">The search.</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 <Dto.SearchTourDto> GetSearchTourModel(Dto.SearchInfoDto search, int pageIndex, int take, ref int total)
        {
            IQueryable <Dto.SearchTourDto> data = null;
            var temp = tourPlanRepository.GetList(e => e.Days <= search.Days && e.Days > ((search.Days - 2) > 0 ? (search.Days - 2) : 0))
                       .Where(e => e.IsDelete == 0)
                       .Where(e => e.PlanTitle.Contains(search.Bide) ||
                              e.Destination.Contains(search.Bide) ||
                              e.Remark.Contains(search.Bide)
                              )
                       .OrderByDescending(e => e.Days);

            total = temp.Count();
            data  = temp.Select(e => new Dto.SearchTourDto
            {
                ViCount        = e.VisitCount,
                Id             = e.PlanID,
                PlanTitle      = e.PlanTitle,
                Days           = e.Days,
                TopReason      = e.Destination,
                PlanTotalMoney = tourPlanDetailRepository.GetList(c => c.PlanID == e.PlanID).Sum(d => d.CurrentPrice),
                UserName       = e.UserName,
                ClassId        = e.PlanClass,
                AddTime        = e.AddTime
            }).OrderByDescending(e => e.ViCount)
                    .Skip(((pageIndex - 1) < 0 ? 0 : (pageIndex - 1)) * take)
                    .Take(take).AsQueryable();
            return(data);
        }
Exemple #2
0
        private IEnumerable <iPow.Infrastructure.Data.DataSys.Sys_TourPlan> CurrentUserTourPlan()
        {
            var data          = tourPlanRepository.GetList().OrderByDescending(e => e.AddTime).AsEnumerable();
            var currentUserId = 0;

            if (currentUserId != 0)
            {
                //data = data.Where(e => e.UserId == currentUserId);
            }
            return(data);
        }
Exemple #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 = tourPlanRepository.GetList(e => idList.Contains(e.PlanID)).ToList();
                if (delete != null && delete.Count > 0)
                {
                    res = DeleteTrue(delete, operUser);
                }
            }
            return(res);
        }
Exemple #4
0
        /// Gets the list type mid tour plan list.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="pageIndex">Size of the page.</param>
        /// <param name="take">The take.</param>
        /// <param name="total">The total.</param>
        /// <returns></returns>
        public IQueryable <ListTypeMidTourPlanDto> GetListTypeMidTourPlanListByTypeId(int id, int pi, int take, ref int total)
        {
            IQueryable <ListTypeMidTourPlanDto> data = null;
            var temp = tourPlanRepository.GetList(e => (e.IsDelete == 0 || e.IsDelete == null))
                       .Where(e => e.PlanClass == id);

            total = temp.Count();
            data  = temp.OrderByDescending(e => e.VisitCount)
                    .Select(e => new ListTypeMidTourPlanDto
            {
                Id             = e.PlanID,
                PlanTitle      = e.PlanTitle,
                Days           = e.Days,
                TopReason      = e.Destination,
                PlanTotalMoney = tourPlanDetailRepository.GetList(c => c.PlanID == e.PlanID).Sum(d => d.CurrentPrice),
                UserName       = e.UserName,
                ViCount        = e.VisitCount,
                ClassId        = e.PlanClass,
                AddTime        = e.AddTime
            }).Skip(((pi - 1) < 0 ? 0 : (pi - 1)) * take).Take(take).AsQueryable();
            return(data);
        }
Exemple #5
0
        public ActionResult Index(int id)
        {
            var model = tourPlanService.GetTourDetailTopById(id);

            try
            {
                tourPlanRepository.GetList(d => d.PlanID == id).FirstOrDefault().VisitCount++;
                tourPlanRepository.Uow.Commit();
            }
            catch
            {
                throw new ArgumentNullException("plan is null");
            }
            return(View(model));
        }
Exemple #6
0
        protected iPow.Infrastructure.Data.DataSys.Sys_TourPlan SysSingleTourPlan(int id)
        {
            var data = tourPlanRepository.GetList(e => e.PlanID == id).FirstOrDefault();

            return(data);
        }
Exemple #7
0
 /// <summary>
 /// Gets the tour info count.
 /// </summary>
 /// <returns></returns>
 public int GetTourInfoCount()
 {
     return(tourPlanRepository.GetList().Count());
 }
Exemple #8
0
        //用于根据城市查询路线并分页
        public IQueryable <Dto.TopTourPlanDto> GetTourPlanListByCity(string city, int pi, int take, ref int total)
        {
            IQueryable <Dto.TopTourPlanDto> temp = null;

            if (!string.IsNullOrEmpty(city))
            {
                temp = tourPlanRepository.GetList(d => d.Destination != null)
                       .Where(d => d.Destination.Contains(city))
                       .Where(d => d.IsDelete == 0 || d.IsDelete == null)
                       .Select(e => new Dto.TopTourPlanDto
                {
                    Id             = e.PlanID,
                    PlanTitle      = e.PlanTitle,
                    Days           = e.Days,
                    TopReason      = e.Destination,
                    PlanTotalMoney =
                        tourPlanDetailRepository.GetList(c => c.PlanID == e.PlanID).Sum(d => d.CurrentPrice),
                    UserName = e.UserName,
                    ViCount  = e.VisitCount,
                    ClassId  = e.PlanClass
                }).AsQueryable();;
            }
            else
            {
                temp = (from e in tourPlanRepository.GetList()
                        where (e.IsDelete == 0 || e.IsDelete == null)
                        orderby e.VisitCount descending
                        select new Dto.TopTourPlanDto
                {
                    Id = e.PlanID,
                    PlanTitle = e.PlanTitle,
                    Days = e.Days,
                    TopReason = e.Destination,
                    PlanTotalMoney = tourPlanDetailRepository.GetList(c => c.PlanID == e.PlanID).Sum(d => d.CurrentPrice),
                    UserName = e.UserName,
                    ViCount = e.VisitCount,
                    ClassId = e.PlanClass
                }
                        ).AsQueryable();
            }
            return(temp);
        }