/// <summary>
        /// 分页获取商城用户列表
        /// </summary>
        /// <param name="model">搜索模型</param>
        /// <returns>列表数据</returns>
        public ResultModel GetPagingYH_User(SearchYHUserModel model)
        {
            var tb        = _database.Db.YH_User;
            var whereExpr = tb.Account.Like("%" + (model.Account != null ? model.Account.Trim() : model.Account) + "%");

            if (model.RealName != null)
            {
                whereExpr = new SimpleExpression(whereExpr, tb.RealName.Like("%" + model.RealName.Trim() + "%"), SimpleExpressionType.And);
            }

            if (model.Phone != null)
            {
                whereExpr = new SimpleExpression(whereExpr, tb.Phone.Like("%" + model.Phone.Trim() + "%"), SimpleExpressionType.And);
            }

            if (model.IsLock != -1)
            {
                whereExpr = new SimpleExpression(whereExpr, tb.IsLock == model.IsLock, SimpleExpressionType.And);
            }
            if (model.RegisterDateBegin != null)
            {
                whereExpr = new SimpleExpression(whereExpr, tb.RegisterDate >= model.RegisterDateBegin, SimpleExpressionType.And);
            }
            if (model.RegisterDateEnd != null)
            {
                whereExpr = new SimpleExpression(whereExpr, tb.RegisterDate < Convert.ToDateTime(model.RegisterDateEnd).AddDays(1), SimpleExpressionType.And);
            }

            var result = new ResultModel
            {
                Data = new SimpleDataPagedList <YH_UserModel>(_database.Db.YH_User.All().Where(whereExpr), model.PagedIndex, model.PagedSize)
            };

            return(result);
        }
Exemple #2
0
        /// <summary>
        /// 商城用户列表页
        /// zhoub 20150714
        /// </summary>
        /// <param name="searchModel"></param>
        /// <returns></returns>
        public JsonResult YH_UserList(SearchYHUserModel searchModel)
        {
            var result = _yh_UserService.GetPagingYH_User(searchModel);
            var data   = new
            {
                rows  = result.Data,
                total = result.Data.TotalCount,
            };

            return(Json(data, JsonRequestBehavior.AllowGet));
        }