public ActionResult CheckList(Models.StudyApply.CheckList vm) { return(Code.MvcHelper.Post(null, Url.Action("CheckList", new { searchText = vm.SearchText, checkStatuId = vm.CheckStatuId, PageSize = vm.Page.PageSize, PageCount = vm.Page.PageCount, PageIndex = vm.Page.PageIndex }))); }
public ActionResult CheckList() { using (var db = new XkSystem.Models.DbContext()) { var vm = new Models.StudyApply.CheckList(); vm.CheckStatusList = typeof(Code.EnumHelper.CheckStatus).ToItemList(); vm.CheckStatusList.Insert(0, new SelectListItem { Text = "==全部==", Value = "-2" }); var tbStudyApply = from p in db.Table <Study.Entity.tbStudyApply>() where p.tbStudy.IsDeleted == false && p.tbStudent.IsDeleted == false && p.tbStudy.tbYear.IsDeleted == false && p.tbStudy.tbYear.No == DateTime.Now.Year select p; if (vm.CheckStatuId != -2) { if (vm.CheckStatuId == decimal.Zero) { tbStudyApply = tbStudyApply.Where(d => d.CheckStatus == Code.EnumHelper.CheckStatus.None); } else if (vm.CheckStatuId == decimal.One) { tbStudyApply = tbStudyApply.Where(d => d.CheckStatus == Code.EnumHelper.CheckStatus.Success); } else if (vm.CheckStatuId == -decimal.One) { tbStudyApply = tbStudyApply.Where(d => d.CheckStatus == Code.EnumHelper.CheckStatus.Fail); } } if (string.IsNullOrEmpty(vm.SearchText) == false) { tbStudyApply = tbStudyApply.Where(d => d.tbStudent.StudentCode.Contains(vm.SearchText) || d.tbStudent.StudentName.Contains(vm.SearchText) || d.tbStudy.StudyName.Contains(vm.SearchText)); } vm.CheckStudyApplyList = (from p in tbStudyApply orderby p.No descending select new Dto.StudyApply.CheckList { Id = p.Id, No = p.No, StudyName = p.tbStudy.StudyName, ApplyFrom = p.tbStudy.ApplyFrom, ApplyTo = p.tbStudy.ApplyTo, IsApply = p.tbStudy.IsApply, IsRoom = p.tbStudy.IsRoom, YearName = p.tbStudy.tbYear.YearName, StudyId = p.Id, Remark = p.Remark, CheckStatus = p.CheckStatus, CheckDate = p.CheckDate, CheckRemark = p.CheckRemark, CheckUserName = p.tbCheckUser.UserName, StudentCode = p.tbStudent.StudentCode, StudentName = p.tbStudent.StudentName, SexName = p.tbStudent.tbSysUser.tbSex.SexName }).ToPageList(vm.Page); return(View(vm)); } }