public ActionResult RechargeTotal(DateTime?time) { int id = int.Parse(Request["id"]); int pageIndex = int.Parse(Request["pageIndex"] ?? "1"); int pageSize = int.Parse(Request["pageSize"] ?? "20"); int total = 0; string comboName = Request["comboName"]; var param = new RechargeParam() { PageIndex = pageIndex, PageSize = pageSize, Total = total, CompanyId = id, comboName = comboName, InTime = time }; ViewData.Model = CompanyBll.LoadEntities(r => r.Id == id).FirstOrDefault(); var list = RechargeBll.LoadRechargeTotal(param).ToList(); ViewBag.CurrentId = id; ViewData["Recharge"] = list; ViewData["pageCount"] = param.Total; ViewData["pageSize"] = param.PageSize; ViewData["pageIndex"] = param.PageIndex; return(View()); }
public IQueryable <Recharge> LoadRechargeTotal(RechargeParam param) { var temp = dbSession.RechargeDal.LoadEntities(r => r.CompanyId == param.CompanyId); if (!string.IsNullOrEmpty(param.comboName)) { temp = temp.Where(t => t.ComboName.Contains(param.comboName)); } if (param.InTime.HasValue) { temp = temp.Where(t => DbFunctions.DiffDays(t.InTime, param.InTime) == 0); // temp = temp.Where(t => SqlFunctions.DateName(param.InTime,t.InTime).ToString().Contains(param.InTime)); } param.Total = temp.Count(); return(temp.OrderByDescending(d => d.InTime).Skip(param.PageSize * (param.PageIndex - 1)).Take(param.PageSize).AsQueryable()); }