public ActionResult Index(FormCollection forms) { int curPage = int.Parse(forms["curPage"]); Expression <Func <cst_lost, bool> > expression = null; expression = ExpressionUtils.True <cst_lost>(); if (!string.IsNullOrEmpty(forms["lst_cust_name"])) { expression = ExpressionUtils.And <cst_lost>(expression, l => l.lst_cust_name.Contains(forms["lst_cust_name"])); } if (!string.IsNullOrEmpty(forms["lst_cust_manager_name"])) { expression = ExpressionUtils.And <cst_lost>(expression, l => l.lst_cust_manager_name.Contains(forms["lst_cust_manager_name"])); } if (int.TryParse(forms["lst_status"], out int status)) { expression = ExpressionUtils.And <cst_lost>(expression, l => l.lst_status == status); } var list = new LinqHelper().Db.cst_lost.Where(expression.Compile()).ToList(); cst_lost searchEntity = new cst_lost(); UpdateModel <cst_lost>(searchEntity); ViewData["pagerHelper"] = new PageHelper <cst_lost>(list, curPage, 3); ViewData["cstStatus"] = new SelectList(new bas_dictService().GetDictsByType("客户流失状态"), "dict_value", "dict_item"); return(View(searchEntity)); }
// // GET: /CustomerLost/ /// <summary> /// 流失客户信息 /// </summary> /// <returns></returns> public ActionResult Index() { //实例化查询对象 cst_lost searchEntity = new cst_lost(); //获得分页数据 ViewData["pagerHelper"] = new PageHelper <cst_lost>(new LinqHelper().Db.cst_lost.Where(l => true).ToList(), 1, 3); ViewData["cstStatus"] = new SelectList(new bas_dictService().GetDictsByType("客户流失状态"), "dict_value", "dict_item"); return(View(searchEntity)); }
/// <summary> /// 根据流失客户查询对象获得符合条件的流失客户集合 /// </summary> /// <param name="searchEntity"></param> /// <returns></returns> public List <cst_lost> GetLostCustomerBySearchEntity(cst_lost searchEntity) { List <cst_lost> list = (from l in LinqHelper.GetDataContext().cst_lost where l.lst_cust_name.Contains(searchEntity.lst_cust_name == null ? "" : searchEntity.lst_cust_name) && l.lst_cust_manager_name.Contains(searchEntity.lst_cust_manager_name == null ? "" : searchEntity.lst_cust_manager_name) select l).ToList(); if (searchEntity.lst_status > 0) { list = list.Where(l => l.lst_status == searchEntity.lst_status).ToList(); } return(list); }
/// <summary> /// 根据流失客户查询对象获得符合条件的流失客户集合 /// </summary> /// <param name="searchEntity"></param> /// <returns></returns> public List <cst_lost> GetLostCustomerBySearchEntity(cst_lost searchEntity) { return(new cst_lostRepository().GetLostCustomerBySearchEntity(searchEntity)); }