/// <summary> /// 分页每日结账单列表 /// </summary> /// <param name="search"></param> /// <returns></returns> public static PagedList <vw_DailyReport> GetDailyReportList(DailyReportSearchModel search) { string table = string.Empty, fields = string.Empty, orderby = string.Empty, where = string.Empty; //定义结构 fields = @" * "; //输出字段 table = @" vw_DailyReport "; //表或者视图 orderby = "ID desc"; //排序信息 StringBuilder sb = new StringBuilder(); //构建where条件 sb.Append(" 1=1 "); if (!string.IsNullOrWhiteSpace(search.Name))//学生姓名 { sb.AppendFormat(" and Name like '%{0}%' ", search.Name); } if (!string.IsNullOrWhiteSpace(search.BindPhone))//联系电话 { sb.AppendFormat(" and BindPhone like '%{0}%' ", search.BindPhone); } if (!string.IsNullOrWhiteSpace(search.timeStart))//开班时间 { sb.AppendFormat(" and CreateTime > = '{0}' ", search.timeStart); } if (!string.IsNullOrWhiteSpace(search.timeEnd))//结束时间 { sb.AppendFormat(" and CreateTime <= '{0}' ", search.timeEnd); } where = sb.ToString(); int allcount = 0; var list = CommonPage <vw_DailyReport> .GetPageList( out allcount, table, fields : fields, where : where.Trim(), orderby : orderby, pageindex : search.CurrentPage, pagesize : search.PageSize, connect : DBKeys.PRX); return(new PagedList <vw_DailyReport>(list, search.CurrentPage, search.PageSize, allcount)); }
/// <summary> /// 每日结账单查询 /// </summary> public ActionResult DailyReport(DailyReportSearchModel search) { DailyReportListViewModel model = new DailyReportListViewModel(); //页面模型 model.search = search; //页面的搜索模型 model.search.PageSize = 15; //每页显示 model.search.CurrentPage = Convert.ToInt32(Request["pageindex"]) <= 0 ? 1 : Convert.ToInt32(Request["pageindex"]); //当前页 model.DailyReportlist = DailyReportData.GetDailyReportList(search); //填充页面模型数据 return(View(model)); //返回页面模型 }