Exemplo n.º 1
0
        /// <summary>
        /// 品牌关联列表页
        /// zhoub 20150707
        /// </summary>
        /// <param name="searchModel"></param>
        /// <returns></returns>
        public JsonResult Brand_CategoryList(SearchBrandModel searchModel)
        {
            var result = _brand_CategoryService.GetPagingBrand_Category(searchModel);

            var data = new
            {
                rows  = result.Data,
                total = result.Data.TotalCount,
            };

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// 品牌关联分页
        /// zhoub 20150709
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ResultModel GetPagingBrand_Category(SearchBrandModel model)
        {
            var whereExpr = base._database.Db.Brand_Category.BrandID == model.BrandID;

            whereExpr = new SimpleExpression(whereExpr, base._database.Db.Category_Lang.LanguageID == model.LanguageID, SimpleExpressionType.And);

            var result = new ResultModel()
            {
                Data =
                    new SimpleDataPagedList <Brand_Category>(base._database.Db.Brand_Category.All().Join(base._database.Db.Category_Lang).On(base._database.Db.Category_Lang.CategoryId == base._database.Db.Brand_Category.CategoryId).Select(base._database.Db.Brand_Category.Brand_CategoryId, base._database.Db.Category_Lang.CategoryName.As("AddUser")).Where(whereExpr),
                                                             model.PagedIndex, model.PagedSize)
            };

            return(result);
        }
Exemplo n.º 3
0
 /// <summary>
 ///     查询商品品牌
 /// </summary>
 /// <param name="model">搜索实体对象</param>
 /// <returns></returns>
 /// <remarks>added by jimmy,2015-7-3</remarks>
 public JsonResult List(SearchBrandModel model)
 {
     try
     {
         model.PagedSize = model.PagedSize == 0 ? 10 : model.PagedSize;
         var list =
             _brandService.Select(
                 new SearchBrandModel
         {
             PagedIndex = model.PagedIndex,
             PagedSize  = model.PagedSize,
             BrandName  = model.BrandName,
             BrandState = model.BrandState,
             LanguageID = ACultureHelper.GetLanguageID
         });
         var data = new { rows = list.Data, total = list.Data.TotalCount };
         var json = Json(data, JsonRequestBehavior.AllowGet);
         return(json);
     }
     catch (Exception ex)
     {
     }
     return(Json("", JsonRequestBehavior.AllowGet));
 }
Exemplo n.º 4
0
        /// <summary>
        /// 商品品牌对象分布查询
        /// </summary>
        /// <param name="model">输入查询参数对象</param>
        /// <returns></returns>
        /// <remarks>added by jimmy,2015-7-7</remarks>
        public ResultModel Select(SearchBrandModel model)
        {
            var whereParam = new SimpleExpression(1, 1, SimpleExpressionType.Equal);

            if (model.BrandState != 0)
            {
                whereParam = new SimpleExpression(whereParam, _database.Db.Brand.BrandState == model.BrandState, SimpleExpressionType.And);
            }
            if (!string.IsNullOrEmpty(model.BrandName))
            {
                whereParam = new SimpleExpression(whereParam, _database.Db.Brand.Brand_Lang.BrandName.Like("%" + model.BrandName + "%"), SimpleExpressionType.And);
            }
            var query = base._database.Db.Brand.All().
                        With(base._database.Db.Brand.Brand_Lang).
                        Where(base._database.Db.Brand.Brand_Lang.LanguageID == model.LanguageID).
                        Where(whereParam).
                        OrderByDescending(base._database.Db.Brand.AddTime);
            var result = new ResultModel()
            {
                Data = new SimpleDataPagedList <BrandModel>(query, model.PagedIndex, model.PagedSize)
            };

            return(result);
        }