public ActionResult ProductBrowseHistory(int?id, CBCrBrowseHistory para) { var dicProductBrowseHistory = AppContentBo.Instance.QueryProBroHistory(para, id ?? 1); var model = new PagedList <CBCrBrowseHistory> { TData = dicProductBrowseHistory.Any() ? dicProductBrowseHistory.First().Value : null, CurrentPageIndex = id ?? 1, TotalItemCount = dicProductBrowseHistory.Any() ? dicProductBrowseHistory.First().Key : 0 }; if (Request.IsAjaxRequest()) { return(PartialView("pAjaxPager_ProBrowseHis", model)); } return(View(model)); }
/// <summary> /// 商品浏览历史记录查询 /// </summary> /// <param name="para">CBCrBrowseHistory</param> /// <param name="currPageIndex">当前页索引</param> /// <param name="pageSize">每页显示条数</param> /// <returns>Pager-CBCrBrowseHistory分页对象</returns> /// <remarks>2013-9-4 黄伟 创建</remarks> /// <remarks>2013-11-07 郑荣华 商品名称改为模糊查询</remarks> public override Dictionary <int, IList <CBCrBrowseHistory> > QueryProBroHistory(CBCrBrowseHistory para, int currPageIndex = 1, int pageSize = 10) { string sqlSelect = @"h.*,c.account as CustomerAccount,p.easname as ProductName,p.ErpCode", sqlFrom = @"CrBrowseHistory h left join CrCustomer c on h.customersysno=c.sysno left join PdProduct p on h.productsysno=p.sysno", sqlCondition = @"(@account is null or c.account=@account) and (@productname is null or charindex(p.easname,@productname)>0)"; using (var context = Context.UseSharedConnection(true)) { var lstResult = context.Select <CBCrBrowseHistory>(sqlSelect) .From(sqlFrom). AndWhere(sqlCondition) .Parameter("account", para.CustomerAccount) .Parameter("productname", para.ProductName) .Paging(currPageIndex, pageSize)//index从1开始 .OrderBy("h.sysno desc") .QueryMany(); var count = context.Select <int>(@"count(*)") .From(sqlFrom). AndWhere(sqlCondition) .Parameter("account", para.CustomerAccount) .Parameter("productname", para.ProductName) .QuerySingle(); return(new Dictionary <int, IList <CBCrBrowseHistory> > { { count, lstResult } }); } }
/// <summary> /// 商品浏览历史记录查询 /// </summary> /// <param name="para">CBCrBrowseHistory</param> /// <param name="currPageIndex">当前页索引</param> /// <param name="pageSize">每页显示条数</param> /// <returns>Pager-CBCrBrowseHistory分页对象</returns> /// <remarks>2013-9-4 黄伟 创建</remarks> public Dictionary <int, IList <CBCrBrowseHistory> > QueryProBroHistory(CBCrBrowseHistory para, int currPageIndex = 1, int pageSize = 10) { return(IAppContentDao.Instance.QueryProBroHistory(para, currPageIndex, pageSize)); }
/// <summary> /// 商品浏览历史记录查询 /// </summary> /// <param name="para">CBCrBrowseHistory</param> /// <param name="currPageIndex">当前页索引</param> /// <param name="pageSize">每页显示条数</param> /// <returns>Dictionary-CBCrBrowseHistory</returns> /// <remarks>2013-9-4 黄伟 创建</remarks> public abstract Dictionary <int, IList <CBCrBrowseHistory> > QueryProBroHistory(CBCrBrowseHistory para, int currPageIndex = 1, int pageSize = 10);