Ejemplo n.º 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);
        }
Ejemplo n.º 2
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 = tourPlanDetailRepository.GetList(e => idList.Contains(e.PlanDetailID)).ToList();
                if (delete != null && delete.Count > 0)
                {
                    res = DeleteTrue(delete, operUser);
                }
            }
            return(res);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
        public ActionResult DeleteTourDetailPlan(int id)
        {
            int?planId = 0;

            if (id > 0)
            {
                var temp = tourPlanDetailRepository.GetList(e => e.PlanDetailID == id).FirstOrDefault();
                if (temp != null && temp.PlanDetailID > 0)
                {
                    planId = temp.PlanID;
                    //tourPlanDetailRepository.Delete(temp);
                    tourPlanDetailRepository.Uow.Commit();
                }
            }
            if (planId.HasValue)
            {
                var modelList = CurrentUserTourPlanDetail().Where(e => e.PlanID == planId);
                var dto       = modelList.ToDto();
                InitDetailPlan(dto);
                var model = new { Data = dto.ToList(), Total = dto.Count() };
                return(Json(model, JsonRequestBehavior.AllowGet));
            }
            return(View());
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Check  Is Exist
        /// </summary>
        /// <param name="PlanID"></param>
        /// <param name="Remark"></param>
        /// <returns></returns>
        public bool CheckTourPlanDetailIsExist(int PlanID, int SightID, string Remark)
        {
            var res = tourPlanDetailRepository.GetList(e => e.SightIDOrHotelID == SightID && e.Remark == Remark).Where(e => e.PlanID == PlanID).Any();

            return(res);
        }