Beispiel #1
0
        protected Expression <Func <Model.collectgoods, bool> > Where(collectgoodsCondition con)
        {
            var searchPredicate = PredicateBuilder.True <Model.collectgoods>();

            if (!string.IsNullOrEmpty(con.goodsname))
            {
                searchPredicate = searchPredicate.And(m => m.goodsname.Contains(con.goodsname));
            }
            if (!string.IsNullOrEmpty(con.shopname))
            {
                searchPredicate = searchPredicate.And(m => m.shopname.Contains(con.shopname));
            }
            if (!string.IsNullOrEmpty(con.ifok))
            {
                searchPredicate = searchPredicate.And(m => m.ifok == con.ifok);
            }
            if (!string.IsNullOrEmpty(con.qudao))
            {
                searchPredicate = searchPredicate.And(m => m.qudao.Contains(con.qudao));
            }
            if (!string.IsNullOrEmpty(con.totalNum))
            {
                searchPredicate = searchPredicate.And(m => con.totalNum == "1" ? m.totalNum >= 10 : m.totalNum < 10);
            }
            if (!string.IsNullOrEmpty(con.type))
            {
                searchPredicate = searchPredicate.And(m => con.type == "1" ? m.perFace > 0 : m.totalNum <= 0);
            }

            return(searchPredicate);
        }
Beispiel #2
0
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <typeparam name="Tkey">类型</typeparam>
        /// <param name="pageIndex">页索引</param>
        /// <param name="pageSize">页数量</param>
        /// <param name="whereLambda">查询条件</param>
        /// <param name="orderLambda">排序条件</param>
        /// <param name="total">总记录数量</param>
        /// <returns></returns>
        public List <Model.collectgoods> GetList <Tkey>(int pageIndex, int pageSize, ref int total, collectgoodsCondition con, Expression <Func <Model.collectgoods, Tkey> > orderLambda, bool isASC = true)
        {
            Expression <Func <Model.collectgoods, bool> > whereLambda = Where(con);

            return(dal.GetPagedList(pageIndex, pageSize, ref total, whereLambda, orderLambda, isASC));
        }