/// <summary>
        /// 获取票的信息
        /// </summary>
        /// <param name="validityDate">游玩日期</param>
        /// <param name="ticketId"></param>
        /// <returns></returns>
        public Tbl_Ticket GetTicket(DateTime validityDate, int ticketId)
        {
            //根据游玩日期,变动价格
            var whereR = PredicateBuilder.True <Tbl_TicketRelation>();

            if (validityDate != DateTime.MinValue)
            {
                DateTime endPay = validityDate.AddDays(-1);
                whereR = PredicateBuilder.And(@whereR, p =>
                                              p.ExpiryDateStart <= validityDate &&
                                              p.ExpiryDateEnd >= validityDate);
            }
            var ticket = _ticketRepository.FirstOrDefault(o => o.TicketId == ticketId);

            if (ticket == null)
            {
                return(null);
            }
            //根据游玩日期,变动价格
            whereR = PredicateBuilder.And(@whereR, p => p.ScenicId == ticket.ScenicId);
            whereR = PredicateBuilder.And(@whereR, p => p.TicketId == ticket.TicketId);

            //根据orderId 顺序排列 取第一条
            var ticketRelation = _ticketRelationRepository.GetAll().Where(whereR).OrderBy(c => c.OrderId).First();

            if (ticketRelation != null && ticketRelation.SalePrice > 0)
            {
                ticket.SalePrice = ticketRelation.SalePrice;
            }
            return(ticket);
        }
 /// <summary>
 /// Merges two filters into one final query.
 /// </summary>
 /// <param name="query">The IQueryable instance to be parsed.</param>
 /// <returns>The string lambda expression.</returns>
 private Expression <Func <Entity, bool> > MergeFilters(PagedDataSettings settings,
                                                        Expression <Func <Entity, bool> > expressionLeft,
                                                        Expression <Func <Entity, bool> > expressionRight,
                                                        bool isAllSearch = false)
 {
     if (expressionLeft == null && expressionRight == null)
     {
         return(x => 1 == 1);
     }
     else if (expressionLeft != null && expressionRight != null)
     {
         if (isAllSearch)
         {
             return(PredicateBuilder.Or(expressionLeft, expressionRight));
         }
         else
         {
             return(PredicateBuilder.And(expressionLeft, expressionRight));
         }
     }
     else if (expressionLeft == null)
     {
         return(expressionRight);
     }
     else
     {
         return(expressionLeft);
     }
 }
示例#3
0
        private static Expression <Func <OpcSupplierInfo, bool> > Filter(SupplierFilter filter)
        {
            var query = PredicateBuilder.True <OpcSupplierInfo>();

            if (filter != null)
            {
                if (!String.IsNullOrWhiteSpace(filter.NamePrefix))
                {
                    query = PredicateBuilder.And(query, v => v.SupplierName.StartsWith(filter.NamePrefix));
                }

                if (filter.Status != null)
                {
                    query = PredicateBuilder.And(query, v => v.Status == filter.Status.Value);
                }
                else
                {
                    query = PredicateBuilder.And(query, v => v.Status > 0);
                }

                if (!String.IsNullOrWhiteSpace(filter.Name))
                {
                    query = PredicateBuilder.And(query, v => v.SupplierName == filter.Name);
                }
            }

            return(query);
        }
示例#4
0
        public IEnumerable <Menu> SearchNotAddedInRole(IConnectionHandler connectionHandler, Guid roleId, string value)
        {
            var predicateBuilder = new PredicateBuilder <Menu>();
            var guids            = new RoleMenuBO().Select(connectionHandler, x => x.MenuId, x => x.RoleId == roleId, true);

            if (guids.Any())
            {
                predicateBuilder.And(x => x.Id.NotIn(guids));
            }
            predicateBuilder.And(x => x.Enabled);
            if (!string.IsNullOrEmpty(value))
            {
                predicateBuilder.And(x => x.Url.Contains(value) || x.Title.Contains(value));
            }
            return(this.OrderBy(connectionHandler, x => x.Title, predicateBuilder.GetExpression()));
        }
示例#5
0
        public JsonResult GetSocialCircleJsonList(SearchModel model)
        {
            PageResultModel m        = new PageResultModel();
            var             ownerId  = GetCurrentUser().Id;
            var             PlaceIds = GetVerifiedPlaceIds();

            //查询条件
            Expression <Func <T_SocialCircle, bool> > where = s => PlaceIds.Contains(s.PlaceId) && s.CreaterId != ownerId &&
                                                              s.UserSocialCircles.Count(us => us.UserId == ownerId && us.ApplyStatus == ConstantParam.IsVerified_YES) == 0;
            if (!string.IsNullOrEmpty(model.Kword))
            {
                where = PredicateBuilder.And(where, s => s.Name.Contains(model.Kword));
            }
            ISocialCircleBLL socialCircleBLL = BLLFactory <ISocialCircleBLL> .GetBLL("SocialCircleBLL");

            m.Total  = socialCircleBLL.Count(where);
            m.Result = socialCircleBLL.GetPageList(where, "Id", false, model.PageIndex).Select(s => new SocialCircleItemModel()
            {
                Id        = s.Id,
                Name      = s.Name.Length > 10 ? s.Name.Substring(0, 10) + ".." : s.Name,
                PlaceName = s.PropertyPlace.Name.Length > 10 ? s.PropertyPlace.Name.Substring(0, 10) + ".." : s.PropertyPlace.Name,
                HeadPath  = s.HeadImgPath,
                IsApplyed = s.UserSocialCircles.Count(us => us.UserId == ownerId && us.ApplyStatus == 0) > 0
            });
            return(Json(m, JsonRequestBehavior.AllowGet));
        }
示例#6
0
        public IEnumerable <Content> Search(IConnectionHandler connectionHandler, string qry)
        {
            var predicateBuilder = new PredicateBuilder <Content>();
            var b = new ContentContentBO().Select(connectionHandler, x => x.Id, x => x.Abstract.Contains(qry) ||
                                                  x.Text.Contains(qry) || x.Title.Contains(qry) || x.Subject.Contains(qry));

            if (b.Any())
            {
                predicateBuilder.And(x => x.PageName.Contains(qry) || x.Link.Contains(qry) || x.Id.In(b));
            }
            else
            {
                predicateBuilder.And(x => x.PageName.Contains(qry) || x.Link.Contains(qry));
            }
            return(this.Where(connectionHandler, predicateBuilder.GetExpression()));
        }
示例#7
0
        public ActionResult LinkupTypeList(LinkupTypeSearchModel model)
        {
            //初始化默认查询模型
            DateTime today = DateTime.Today;

            if (model.BeforeDate == null)
            {
                model.BeforeDate = today.AddDays(-today.Day + 1);
            }
            if (model.EndDate == null)
            {
                model.EndDate = today;
            }

            //获取当前小区ID
            var propertyplaceid = GetSessionModel().PropertyPlaceId.Value;

            //根据发帖时间查询
            DateTime endTime = model.EndDate.Value.AddDays(1);

            Expression <Func <T_PostBarTopic, bool> > where = u => u.PropertyPlaceId == propertyplaceid && u.PostDate >= model.BeforeDate.Value && u.PostDate < endTime;

            //根据发帖人进行查询
            if (!string.IsNullOrEmpty(model.UserName))
            {
                where = PredicateBuilder.And(where, u => u.PostUser.UserName.Contains(model.UserName));
            }

            //根据查询条件调用BLL层 获取分页数据
            IPostBarTopicBLL postBarTopicBll = BLLFactory <IPostBarTopicBLL> .GetBLL("PostBarTopicBLL");

            model.DataList = postBarTopicBll.GetSetTopPageList(where, model.PageIndex, ConstantParam.PAGE_SIZE) as PagedList <T_PostBarTopic>;

            return(View(model));
        }
示例#8
0
        /// <summary>
        /// 批量增加单元户的远程验证
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public string RemoteCheck(BuildDoorBatchAddModel model, int BuildId)
        {
            IBuildDoorBLL doorBll = BLLFactory <IBuildDoorBLL> .GetBLL("BuildDoorBLL");

            var lamdaList = new List <Expression <Func <T_BuildDoor, bool> > >();

            foreach (var name in model.DoorName)
            {
                lamdaList.Add(r => r.DoorName == name);
            }
            Expression <Func <T_BuildDoor, bool> > lamda  = p => false;
            Expression <Func <T_BuildDoor, bool> > lamda1 = r => (r.UnitId == model.UnitId && r.BuildUnit.BuildId == model.BuildId);

            foreach (var expression in lamdaList)
            {
                lamda = PredicateBuilder.Or <T_BuildDoor>(lamda, expression);
            }

            lamda = PredicateBuilder.And(lamda, lamda1);

            var doorlist = doorBll.GetList(lamda);//查询

            if (doorlist.Count() > 0)
            {
                // 校验不通过
                return(string.Join(",", doorlist.ToList().Select(q => q.DoorName).Distinct().ToArray()));
            }
            else
            {
                // 校验通过
                return("");
            }
        }
示例#9
0
        /// <summary>
        /// 获取小区列表
        /// </summary>
        /// <param name="model">物业小区查询模型</param>
        /// <returns></returns>
        public PropertyPlaceSearchModel GetPlaceList(PropertyPlaceSearchModel model)
        {
            model.PlaceTypeList = GetPlaceTypeList(null);
            //查询条件
            Expression <Func <T_PropertyPlace, bool> > where = u => u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT;
            //如果查询的物业公司ID不为空
            if (model.CompanyId != null)
            {
                where = PredicateBuilder.And(where, u => u.CompanyId == model.CompanyId);
            }
            if (model.PlaceType != null)
            {
                where = PredicateBuilder.And(where, u => u.PlaceType == model.PlaceType.Value);
            }
            if (!string.IsNullOrEmpty(model.PlaceName))
            {
                where = PredicateBuilder.And(where, u => u.Name.Contains(model.PlaceName));
            }

            //排序
            var sortModel = this.SettingSorting("Id", false);
            //将查询到的数据赋值传到页面
            IPropertyPlaceBLL placeBll = BLLFactory <IPropertyPlaceBLL> .GetBLL("PropertyPlaceBLL");

            model.DataList = placeBll.GetPageList(where, sortModel.SortName, sortModel.IsAsc, model.PageIndex) as PagedList <T_PropertyPlace>;
            return(model);
        }
示例#10
0
        private Expression <Func <IndexedItem, bool> > GetPredicateForItemDerivesFromIndexedItem()
        {
            var notIndexedItem = PredicateBuilder.Create <IndexedItem>(i => !i.AllTemplates.Contains(IdHelper.NormalizeGuid(Templates.IndexedItem.ID)));
            var indexedItemWithShowInResults = PredicateBuilder.And <IndexedItem>(i => i.AllTemplates.Contains(IdHelper.NormalizeGuid(Templates.IndexedItem.ID)), i => i.ShowInSearchResults);

            return(notIndexedItem.Or(indexedItemWithShowInResults));
        }
示例#11
0
        public ActionResult OrderList(StoreOrderSearchModel model)
        {
            //获取登录用户的门店
            int      userId  = GetSessionModel().UserID;
            IShopBLL shopBll = BLLFactory <IShopBLL> .GetBLL("ShopBLL");

            var shop = shopBll.GetEntity(u => u.ShopUserId == userId);

            //如果该门店存在
            if (shop != null)
            {
                //获取订单状态下拉列表
                model.OrderStatusList = GetOrderStatusList(shop.Type.Contains(ConstantParam.SHOP_TYPE_0.ToString()));

                //获取支付方式下拉列表
                model.PayWayList = GetPayWayList(shop.Type.Contains(ConstantParam.SHOP_TYPE_0.ToString()));

                //初始化默认查询模型
                DateTime today = DateTime.Today;
                if (model.StartDate == null)
                {
                    model.StartDate = today.AddDays(-today.Day + 1);
                }
                if (model.EndDate == null)
                {
                    model.EndDate = today;
                }

                //获取当前门店ID
                var shopId = GetCurrentShopId().Value;

                //根据订单日期查询
                DateTime endDate = model.EndDate.Value.AddDays(1);
                Expression <Func <T_Order, bool> > where = u => u.OrderDate >= model.StartDate.Value && u.OrderDate < endDate && u.ShopId == shopId &&
                                                           u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.IsStoreHided == ConstantParam.DEL_FLAG_DEFAULT;

                //根据订单状态查询
                if (model.OrderStatus != null)
                {
                    where = PredicateBuilder.And(where, u => u.OrderStatus == model.OrderStatus);
                }

                //根据支付方式查询
                if (model.PayWay != null)
                {
                    where = PredicateBuilder.And(where, u => u.PayWay == model.PayWay);
                }

                //根据查询条件调用BLL层 获取分页数据
                IOrderBLL orderBll = BLLFactory <IOrderBLL> .GetBLL("OrderBLL");

                var sortName = this.SettingSorting("Id", false);
                model.DataList = orderBll.GetPageList(where, sortName.SortName, sortName.IsAsc, model.PageIndex) as PagedList <T_Order>;
                return(View(model));
            }

            //否则返回首页
            return(RedirectToAction("Index", "ShopPlatform"));
        }
示例#12
0
        public decimal GetTransactionId(IConnectionHandler connectionHandler, Guid congressId, string year = "", string moth = "")
        {
            PredicateBuilder <HotelUser> predicateBuilder = new PredicateBuilder <HotelUser>();

            predicateBuilder.And(x => x.Hotel.CongressId == congressId && x.TransactionId.HasValue && x.Transaction.Done);
            if (!string.IsNullOrEmpty(moth) && !string.IsNullOrEmpty(year))
            {
                predicateBuilder.And(
                    x => x.RegisterDate.Substring(5, 2) == moth && x.RegisterDate.Substring(0, 4) == year);
            }
            else if (!string.IsNullOrEmpty(year))
            {
                predicateBuilder.And(x => x.RegisterDate.Substring(0, 4) == year);
            }

            return(Sum(connectionHandler, x => x.Transaction.Amount, predicateBuilder.GetExpression()));
        }
示例#13
0
        public IEnumerable <Temp> GetByUserId(IConnectionHandler connectionHandler, Guid userId)
        {
            var query = new PredicateBuilder <Temp>();
            var list  = Select(connectionHandler, c => (Guid)c.ParentId, c => c.ParentId != null, true);

            if (userId != Guid.Empty)
            {
                query.And(c => c.PayerId == userId);
            }
            if (list.Any())
            {
                query.And(c => c.Id.NotIn(list));
            }
            var res = this.OrderByDescending(connectionHandler, c => c.Date, query.GetExpression());

            return(res);
        }
示例#14
0
 protected override void VisitNot(NotExpression expression)
 {
     if (expression.InnerExpression != null)
     {
         var rightClause = VisitInner(expression.InnerExpression);
         LinqExpression = PredicateBuilder.And(PredicateBuilder.False <TextContent>(), rightClause);
     }
 }
示例#15
0
        public ApiPageResultModel GetSaleList([FromUri] GoodsSearchModel model)
        {
            ApiPageResultModel resultModel = new ApiPageResultModel();

            try
            {
                //根据用户ID查找业主
                IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL");

                T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);
                //如果业主存在
                if (owner != null)
                {
                    //如果验证Token不通过或已过期
                    if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token)
                    {
                        resultModel.Msg = APIMessage.TOKEN_INVALID;
                        return(resultModel);
                    }
                    //更新最近登录时间和Token失效时间
                    owner.LatelyLoginTime  = DateTime.Now;
                    owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid")));
                    ownerBll.Update(owner);

                    //该门店销售中的商品
                    Expression <Func <T_ShopSale, bool> > where = s => s.GoodsCategory.ShopId == model.ShopId && s.InSales == 1;
                    //如果选择了商品分类
                    if (model.GoodsCategoryId > 0)
                    {
                        where = PredicateBuilder.And(where, s => s.GoodsCategoryId == model.GoodsCategoryId);
                    }
                    //获取指定门店指定类别的商品列表
                    IShopSaleBLL SaleBll = BLLFactory <IShopSaleBLL> .GetBLL("ShopSaleBLL");

                    resultModel.Total  = SaleBll.Count(where);
                    resultModel.result = SaleBll.GetPageList(where, "Id", false, model.PageIndex).ToList().Select(s => new
                    {
                        GoodsId        = s.Id,
                        GoodsName      = s.Title,
                        GoodsDesc      = s.Content,
                        RemainingAmout = s.RemainingAmout,
                        SellAmout      = s.OrderDetails.Where(od => od.Order.OrderStatus == ConstantParam.OrderStatus_FINISH).Select(od => od.SaledAmount).ToArray().Sum(),
                        GoodsCoverImg  = string.IsNullOrEmpty(s.ImgThumbnail) ? "" : s.ImgThumbnail.Split(';')[0],
                        GoodsOtherImg  = string.IsNullOrEmpty(s.ImgPath) ? "" : s.ImgPath,
                        Price          = s.Price
                    });
                }
                else
                {
                    resultModel.Msg = APIMessage.NO_USER;
                }
            }
            catch
            {
                resultModel.Msg = APIMessage.REQUEST_EXCEPTION;
            }
            return(resultModel);
        }
示例#16
0
        public int GetUserTempCount(IConnectionHandler connectionHandler, Guid userId)
        {
            var query = new PredicateBuilder <Temp>();
            var list  = this.Select(connectionHandler, c => (Guid)c.ParentId, c => c.ParentId != null, true);

            if (userId != Guid.Empty)
            {
                query.And(c => c.PayerId == userId);
            }
            if (list.Any())
            {
                query.And(c => c.Id.NotIn(list));
            }

            var res = this.Count(connectionHandler, c => c.Id, query.GetExpression());

            return(res);
        }
示例#17
0
        public ActionResult Index(Guid?parentId)
        {
            var galleryFacade = GalleryComponent.Instance.GalleryFacade;

            ViewBag.ParentGallery = new SelectList(galleryFacade.SelectKeyValuePair(x => x.Id, x => x.Title, gallery => gallery.IsExternal == false), "Key", "Value");
            var predicateBuilder = new PredicateBuilder <Radyn.Gallery.DataStructure.Gallery>();

            if (parentId.HasValue)
            {
                predicateBuilder.And(x => x.ParentGallery == parentId);
            }
            else
            {
                predicateBuilder.And(x => x.ParentGallery == null);
            }
            var list = galleryFacade.Where(predicateBuilder.GetExpression());

            return(View(list));
        }
示例#18
0
        public IEnumerable <Menu> SearchMenu(IConnectionHandler connectionHandler, string filter)
        {
            var predicateBuilder = new PredicateBuilder <Menu>();

            if (!string.IsNullOrEmpty(filter))
            {
                predicateBuilder.And(x => x.Url.Contains(filter) || x.Title.Contains(filter));
            }
            return(this.OrderBy(connectionHandler, x => x.Order, predicateBuilder.GetExpression()));
        }
示例#19
0
        /// <summary>
        /// contentType 是  1,2,3   Description: 1. URL中带News 2. URL中带Message 3. URL中带 QuestionDetail [removed]
        /// LED ContentType 51.News 52.Courses 53.MicroCourses
        /// </summary>
        /// <param name="fromDateTime"></param>
        /// <param name="toDateTime"></param>
        private void ImportDataByTime(DateTime fromDateTime, DateTime toDateTime)
        {
            var articleReportLogs = new List <ArticleReport>();
            var predicate         = PredicateBuilder.True <UserBehavior>();

            predicate = PredicateBuilder.And(predicate, x => x.CreatedTime <= toDateTime && x.CreatedTime > fromDateTime);

            predicate = PredicateBuilder.And(predicate, x => x.ContentType == 1 || x.ContentType == 2 || x.ContentType == 51 || x.ContentType == 52 || x.ContentType == 53);//|| x.ContentType == 3 remove by andrew.

            predicate = PredicateBuilder.And(predicate, x => x.Content != null || x.Content != "");

            //第一层过滤 按ContentType
            var logs = _userBehaviorService.Repository.Entities.Where(predicate).ToList().Where(x => !string.IsNullOrEmpty(x.Content)).ToList();

            //去多表取数据
            logs.GroupBy(x => x.ContentType).ToList().ForEach(x =>
            {
                //根据ContentType去相应的表去拿最终集合
                switch (x.Key)
                {
                case 1:
                    articleReportLogs.AddRange(GetNewsListByIds(x.ToList()));
                    break;

                case 2:
                    articleReportLogs.AddRange(GetMessageListByIds(x.ToList()));
                    break;

                //case 3:
                //    articleReportLogs.AddRange(GetQuestionListByIds(x.ToList()));
                //    break;
                case 51:
                case 52:
                case 53:
                    articleReportLogs.AddRange(GetArticleListByIds(x.ToList()));
                    break;
                }
            });

            //先按AppId分组--再按Title分--再按创建时间分--就能得到某个APP下某标题下某天的数据访问量
            //lstExtentions.GroupBy(x => x.AppId).ToList().
            //ForEach(x => x.GroupBy(y => y.Title).ToList().
            //ForEach(z => z.GroupBy(w => w.CreatedTime).ToList().
            //ForEach(group => articleReportLogs.Add(new ArticleReport
            //{
            //    ArticleId = int.Parse(z.First().Content),
            //    ArticleTitle = z.First().Title,
            //    AppId = z.First().AppId,
            //    VisitTimes = z.Count(),
            //    AccessDate = z.First().CreatedTime,
            //    VisitorCount = z.GroupBy(y => y.UserId).Count()
            //}))));

            _articleReportService.Repository.Insert(articleReportLogs.AsEnumerable());
        }
        public TPageResult <OrderViewModel> GetList(OrderQueryModel model)
        {
            var where = PredicateBuilder.True <Tbl_TravelAgencyOrder>();
            where     = PredicateBuilder.And(@where, x => x.OTABusinessId == model.OTABusinessId);
            if (!string.IsNullOrEmpty(model.OrderNo))
            {
                where = PredicateBuilder.And(@where, x => x.OrderNo.Contains(model.OrderNo));
            }
            if (!string.IsNullOrEmpty(model.Mobile))
            {
                where = PredicateBuilder.And(@where, x => x.Mobile == model.Mobile);
            }
            if (!string.IsNullOrEmpty(model.Linkman))
            {
                where = PredicateBuilder.And(@where, x => x.Linkman.Contains(model.Linkman));
            }
            if (model.OrderStatus > 0)
            {
                where = PredicateBuilder.And(@where, x => x.OrderStatus == model.OrderStatus);
            }
            if (model.AuditStatus > 0)
            {
                where = PredicateBuilder.And(@where, x => x.AuditStatus == model.AuditStatus);
            }
            if (model.PlaceOrderType > 0)
            {
                where = PredicateBuilder.And(@where, x => x.PlaceOrderType == model.PlaceOrderType);
            }
            if (model.ValidityDate.HasValue)
            {
                where = PredicateBuilder.And(@where, x => x.ValidityDateStart == model.ValidityDate.Value);
            }
            var total  = 0;
            var list   = _travelAgencyOrderRepository.GetPageList(model.Limit, model.Page, out total, where, a => a.CreateTime, false);
            var result = new TPageResult <OrderViewModel>();
            var data   = list.Select(a => new OrderViewModel
            {
                Id              = a.Id,
                IdCard          = a.IdCard,
                Mobile          = a.Mobile,
                OTABusinessName = a.OTABusinessName,
                AuditStatus     = a.AuditStatus,
                BookCount       = a.BookCount,
                CreateTime      = a.CreateTime,
                Linkman         = a.Linkman,
                OrderNo         = a.OrderNo,
                OrderStatus     = a.OrderStatus,
                PlaceOrderType  = a.PlaceOrderType,
                TotalAmount     = a.TotalAmount,
                ValidityDate    = a.ValidityDateStart.ToString("yyyy-MM-dd"),
                PlaceOrderName  = a.PlaceOrderName
            }).ToList();

            return(result.SuccessResult(data, total));
        }
示例#21
0
        /// <summary>
        /// 主题详细列表Json方式获取
        /// </summary>
        /// <param name="topicId"></param>
        /// <param name="isTag"> 0表示所有楼层都显示 其它Id代表具体那楼层Id。</param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public JsonResult TopicDetailJsonList(int topicId, int floorId, int pageIndex)
        {
            PageResultModel model = new PageResultModel();

            IPostBarTopicDiscussBLL topicDiscussBLL = BLLFactory <IPostBarTopicDiscussBLL> .GetBLL("PostBarTopicDiscussBLL");

            //主题下面所有的一级Ids
            var level1Ids = topicDiscussBLL.GetList(m => m.TopicId == topicId && m.ParentId == null, "PostTime", true).Select(m => m.Id).ToList();

            Expression <Func <T_PostBarTopicDiscuss, bool> > where = m => true;

            if (floorId > 0)
            {
                where = PredicateBuilder.And(where, m => m.TopicId == topicId && m.Id == floorId);
            }
            else
            {
                where = PredicateBuilder.And(where, m => m.TopicId == topicId && m.ParentId == null);
            }

            // 获取我的帖子回复列表
            var list = topicDiscussBLL.GetPageList(where, "PostTime", true, pageIndex, ConstantParam.PAGE_SIZE).Select(m => new
            {
                Id              = m.Id,
                UserId          = m.PostUserId,
                PostDate        = TimeFormat(m.PostTime),
                UserImage       = m.PostUser.HeadPath,
                UserName        = m.PostUser.UserName,
                Content         = m.Content == null ? "" : m.Content,
                PicList         = m.ImgPath,
                RepliedUserName = m.ReplyUser.UserName,
                Level2Count     = m.PostBarTopicDiscusses.Count(),
                PropertyPlaceId = m.PostBarTopic.PropertyPlaceId,
                FloorNo         = level1Ids.FindIndex(l => l == m.Id) + 1,

                Level2DiscussList = m.PostBarTopicDiscusses.Select(o =>
                                                                   new
                {
                    Level2Id              = o.Id,
                    Level2ParentId        = o.ParentId,
                    Level2UserId          = o.PostUserId,
                    Level2UserName        = o.PostUser.UserName,
                    Level2Content         = o.Content,
                    Level2PostDate        = TimeFormat(o.PostTime),
                    Level2RepliedUserName = o.ReplyUser.UserName,
                    Level2PicList         = o.ImgPath
                }).OrderByDescending(o => o.Level2PostDate).Take(2).ToList(),
                Level2DiscussListCount = m.PostBarTopicDiscusses.Count()
            }).ToList();

            model.Result = list;
            model.Total  = topicDiscussBLL.Count(m => m.TopicId == topicId && m.ParentId == null);

            return(Json(model, JsonRequestBehavior.AllowGet));
        }
示例#22
0
        public ActionResult Index(FormCollection formCollection)
        {
            var parentid = formCollection["Gallerys"];
            var facade   = GalleryComponent.Instance.GalleryFacade;

            ViewBag.ParentGallery = new SelectList(facade.SelectKeyValuePair(x => x.Id, x => x.Title, gallery => gallery.IsExternal == false), "Key", "Value");
            var predicateBuilder = new PredicateBuilder <Radyn.Gallery.DataStructure.Gallery>();

            if (!string.IsNullOrEmpty(parentid))
            {
                predicateBuilder.And(x => x.ParentGallery == parentid.ToGuid());
            }
            else
            {
                predicateBuilder.And(x => x.ParentGallery == null);
            }
            var list = facade.Where(predicateBuilder.GetExpression());

            return(View(list));
        }
示例#23
0
        public IActionResult GetAnnotationUserList([FromRoute] Guid taskId)
        {
            var currentUserId = this.GetCurrentUserId();
            ResponseModel <List <UserModel> > res = new ResponseModel <List <UserModel> >();

            PredicateBuilder <User> where = new PredicateBuilder <User>(true);
            where = where.And(x => x.CreatorId == currentUserId);
            List <UserModel> userList = _userService.QueryByWhere(where);

            return(Ok(res));
        }
示例#24
0
        public Expression <Func <TModel, bool> > GetFilterExpression()
        {
            Expression <Func <TModel, bool> > filterExpression = (e) => true;

            foreach (var filterRule in AppliedFilters)
            {
                filterExpression = PredicateBuilder.And(filterExpression, filterRule.GenerateExpression());
            }

            return(filterExpression);
        }
示例#25
0
        public ApiPageResultModel ShopList([FromUri] ShopSearchModel model)
        {
            ApiPageResultModel resultModel = new ApiPageResultModel();

            try
            {
                //根据用户ID查找业主
                IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL");

                T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);
                //如果业主存在
                if (owner != null)
                {
                    //如果验证Token不通过或已过期
                    if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token)
                    {
                        resultModel.Msg = APIMessage.TOKEN_INVALID;
                        return(resultModel);
                    }
                    //更新最近登录时间和Token失效时间
                    owner.LatelyLoginTime  = DateTime.Now;
                    owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid")));
                    ownerBll.Update(owner);

                    IShopBLL shopBll = BLLFactory <IShopBLL> .GetBLL("ShopBLL");

                    Expression <Func <T_Shop, bool> > where = u => u.Type.Contains(model.Type.ToString());
                    //如果是生活小卖店或五金店
                    if (model.Type == 2 || model.Type == 3)
                    {
                        var placeList = owner.UserPlaces.Select(m => m.PropertyPlaceId);
                        where = PredicateBuilder.And(where, u => u.ShopPlaces.Count(p => placeList.Contains(p.PropertyPlaceId)) > 0);
                    }
                    resultModel.Total  = shopBll.Count(where);
                    resultModel.result = shopBll.GetPageList(where, "Id", false, model.PageIndex).ToList().Select(s => new
                    {
                        Id       = s.Id,
                        ShopName = s.ShopName,
                        Content  = s.MainSale,
                        Phone    = string.IsNullOrEmpty(s.Phone) ? "" : s.Phone,
                        Img      = string.IsNullOrEmpty(s.ImgThumbnail) ? "" : s.ImgThumbnail.Split(';')[0]
                    });
                }
                else
                {
                    resultModel.Msg = APIMessage.NO_USER;
                }
            }
            catch
            {
                resultModel.Msg = APIMessage.REQUEST_EXCEPTION;
            }
            return(resultModel);
        }
示例#26
0
        public ActionResult Index(Guid?parentId)
        {
            var predicateBuilder = new PredicateBuilder <CongessGallery>();

            predicateBuilder.And(x => x.CongressId == this.Homa.Id);
            if (parentId.HasValue)
            {
                predicateBuilder.And(x => x.Gallery.ParentGallery == parentId);
            }
            else
            {
                predicateBuilder.And(x => x.Gallery.ParentGallery == null);
            }
            var list = CongressComponent.Instance.BaseInfoComponents.CongessGalleryFacade.Select(x => x.Gallery, predicateBuilder.GetExpression(), new OrderByModel <CongessGallery>()
            {
                Expression = x => x.Gallery.Order
            });

            return(View(list));
        }
示例#27
0
        private System.Linq.Expressions.Expression <Func <Articulo, bool> > GenerarWhereTipos(System.Linq.Expressions.Expression <Func <Articulo, bool> > predicado, IEnumerable <int> tipos)
        {
            if (tipos != null && tipos.Count() > 0)
            {
                predicado = PredicateBuilder.And(predicado, wh => tipos.Contains(wh.Tipo.Id));
            }



            return(predicado);
        }
示例#28
0
        private System.Linq.Expressions.Expression <Func <Articulo, bool> > GenerarWhereTags(System.Linq.Expressions.Expression <Func <Articulo, bool> > predicado, IEnumerable <String> tags)
        {
            if (tags != null && tags.Count() > 0)
            {
                predicado = PredicateBuilder.And(predicado, wh => wh.Tags.Any(any => tags.Contains(any.Descripcion)));
            }



            return(predicado);
        }
        /// <summary>
        /// 获取票的信息
        /// </summary>
        /// <param name="validityDate">游玩日期</param>
        /// <param name="ticketId"></param>
        /// <returns></returns>
        public Tbl_Ticket GetTicket(DateTime validityDate, int ticketId)
        {
            //根据游玩日期,变动价格
            var whereR = PredicateBuilder.True <Tbl_TicketRelation>();

            if (validityDate != DateTime.MinValue)
            {
                DateTime endPay = validityDate.AddDays(-1);
                whereR = PredicateBuilder.And(@whereR, p =>
                                              p.ExpiryDateStart <= validityDate &&
                                              p.ExpiryDateEnd >= validityDate);
            }
            var ticket = _ticketRepository.FirstOrDefault(o => o.TicketId == ticketId);

            if (ticket == null)
            {
                return(null);
            }
            var Tbl_TicketRelations = _ticketRelationRepository.GetAllList(o => o.TicketId == ticketId);
            //过滤掉已过期的产品
            DateTime nowTime = DateTime.Now.Date;
            //根据游玩日期,变动价格
            //特殊时间段价格表(同票类重复时取排序第一位的值)(为第一优先级)
            var tbl_TicketRelation = Tbl_TicketRelations.Where(p =>
                                                               p.TicketId == ticketId &&
                                                               p.Type == (int)TicketRelationEnum.TimeSlot &&
                                                               p.ExpiryDateStart <= nowTime &&
                                                               p.ExpiryDateEnd >= nowTime
                                                               ).OrderBy(c => c.OrderId).FirstOrDefault();

            if (tbl_TicketRelation != null)
            {
                ticket.SalePrice = tbl_TicketRelation.SalePrice;
                ticket.MarkPrice = tbl_TicketRelation.MarkPrice;
                return(ticket);
            }
            //周末价格策略(为第二优先级)
            //特殊时间段价格表为空 同时 游玩日期 是周末则启动周末价格策略
            var dayOfWeek = validityDate.DayOfWeek;

            if (dayOfWeek != DayOfWeek.Saturday && dayOfWeek != DayOfWeek.Sunday)
            {
                return(ticket);
            }
            var ticketRelation = Tbl_TicketRelations.FirstOrDefault(p => p.TicketId == ticketId && p.Type == (int)TicketRelationEnum.Weekend);

            if (ticketRelation != null)
            {
                ticket.SalePrice = ticketRelation.SalePrice;
                ticket.MarkPrice = ticketRelation.MarkPrice;
            }
            return(ticket);
        }
示例#30
0
        public ActionResult QuestionCompanyPlatformList(QuestionPlatformSearchModel model)
        {
            //1.初始化默认查询模型
            DateTime today = DateTime.Today;

            if (model.StartTime == null)
            {
                model.StartTime = today.AddDays(-today.Day + 1);
            }
            if (model.EndTime == null)
            {
                model.EndTime = today;
            }
            model.StatusList = GetStatusList();

            int CompanyId = GetSessionModel().CompanyId.Value;

            //根据提报时间查询
            DateTime endTime = model.EndTime.Value.AddDays(1);

            Expression <Func <T_Question, bool> > where = u => u.UploadTime >= model.StartTime.Value && u.UploadTime < endTime &&
                                                          u.PropertyPlace.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.PropertyPlace.CompanyId == CompanyId;

            //根据小区名称查询
            if (model.PropertyPlaceId != null)
            {
                where = PredicateBuilder.And(where, u => u.PropertyPlaceId == model.PropertyPlaceId.Value);
            }

            //根据状态名称查询
            if (model.Status != null)
            {
                where = PredicateBuilder.And(where, u => u.Status == model.Status);
            }

            //根据问题名称模糊查询
            if (!string.IsNullOrEmpty(model.Title))
            {
                where = PredicateBuilder.And(where, u => u.Title.Contains(model.Title));
            }

            //根据查询条件调用BLL层 获取分页数据
            IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL");

            var sortName = this.SettingSorting("Id", false);

            model.DataList = questionBll.GetPageList(where, sortName.SortName, sortName.IsAsc, model.PageIndex) as PagedList <T_Question>;

            //获取所有物业小区列表
            model.PropertyPlaceList = GetPropertyPlaceList();

            return(View(model));
        }