/// <summary> /// 作用:查询 /// 作者:汪建龙 /// 编写时间:2017年3月20日16:15:13 /// </summary> /// <param name="parameter"></param> /// <returns></returns> public List <ConductStandard> Search(ConductStandardParameter parameter) { var query = Db.ConductStandards.AsQueryable(); if (parameter.ELID.HasValue) { query = query.Where(e => e.ELID == parameter.ELID.Value); } if (parameter.SystemData.HasValue) { query = query.Where(e => e.SystemData == parameter.SystemData.Value); } if (parameter.StartTime.HasValue) { query = query.Where(e => e.CreateTime >= parameter.StartTime.Value); } if (parameter.EndTime.HasValue) { query = query.Where(e => e.CreateTime <= parameter.EndTime.Value); } if (parameter.Degree.HasValue) { query = query.Where(e => e.Degree == parameter.Degree.Value); } if (!string.IsNullOrEmpty(parameter.ELName)) { query = query.Where(e => e.ELName.ToLower().Contains(parameter.ELName.ToLower())); } if (parameter.Credit.HasValue) { query = query.Where(e => e.Credit == parameter.Credit.Value); } if (!string.IsNullOrEmpty(parameter.StandardName)) { query = query.Where(e => e.StandardName.ToLower().Contains(parameter.StandardName.ToLower())); } if (parameter.MinScore.HasValue) { query = query.Where(e => e.Score >= parameter.MinScore.Value); } if (parameter.MaxScore.HasValue) { query = query.Where(e => e.Score <= parameter.MaxScore.Value); } if (parameter.State.HasValue) { query = query.Where(e => e.State == parameter.State.Value); } query = query.OrderByDescending(e => e.CreateTime).SetPage(parameter.Page); return(query.ToList()); }
/// <summary> /// 作用 /// 作者:汪建龙 /// 编写时间:2017年3月8日15:12:47 /// </summary> /// <returns></returns> public ActionResult List( int?UserId = null, DateTime?startTime = null, DateTime?EndTime = null, CreditDegree?degree = null, string systemData = null, string ELname = null, Credit?credit = null, string standardName = null, double?minScore = null, double?maxScore = null, BaseState?state = null, DateTime?startUpdateTime = null, DateTime?endUpdateTime = null, int page = 1, int rows = 20 ) { var parameter = new ConductStandardParameter { StartTime = startTime, EndTime = EndTime, Degree = degree, ELName = ELname, Credit = credit, StandardName = standardName, MinScore = minScore, MaxScore = maxScore, State = state, Page = new PageParameter(page, rows) }; if (!string.IsNullOrEmpty(systemData)) { parameter.SystemData = EnumHelper.GetEnum <SystemData>(systemData); } var list = Core.ConductStandardManager.Search(parameter); ViewBag.List = list; ViewBag.Parameter = parameter; ViewBag.Page = parameter.Page; return(View()); }