public List<gov_testscore> setSearchFilter(List<gov_testscore> lstTestscore, TestscoreViewhelper TestscoreViewhelper) { Expression<Func<gov_testscore, bool>> predicate = PredicateBuilder.False<gov_testscore>(); if (!String.IsNullOrWhiteSpace(TestscoreViewhelper.KeySearch)) { predicate = predicate.Or(d => d.test_class != null && d.test_class.ToUpper().Contains(TestscoreViewhelper.KeySearch.ToUpper())); predicate = predicate.Or(d => d.test_name != null && d.test_name.ToUpper().Contains(TestscoreViewhelper.KeySearch.ToUpper())); } return lstTestscore; }
public ActionResult Index(TestscoreViewhelper testscoreViewhelper) { if (Session.getCurrentUser() == null) return Redirect("/admin/account/logon"); if (!SercurityServices.HasPermission((int)TypeModule.MODULE_DIEMTHI, Session.getCurrentUser().username, TypeAudit.Addnew) && !SercurityServices.HasPermission((int)TypeModule.MODULE_DIEMTHI, Session.getCurrentUser().username, TypeAudit.Edit) && !SercurityServices.HasPermission((int)TypeModule.MODULE_DIEMTHI, Session.getCurrentUser().username, TypeAudit.Delete)) { return Redirect("/admin/error/error403"); } saveData(testscoreViewhelper); return View(); }
public TestscoreViewhelper saveData(TestscoreViewhelper testscoreViewhelper) { List<gov_testscore> lstTestscore = _cnttDB.gov_testscore.ToList(); lstTestscore = setSearchFilter(lstTestscore, testscoreViewhelper); int totalCount = lstTestscore.Count; testscoreViewhelper.TotalCount = totalCount; if (testscoreViewhelper.TotalCount > 0) { int totalPage = pageCalculation(totalCount, Constant.limit); testscoreViewhelper.TotalPage = totalPage; testscoreViewhelper.Page = pageTransition(testscoreViewhelper.Direction, testscoreViewhelper.Page, totalPage); testscoreViewhelper.FirstPage = fistPageCalculation(Constant.maxPageLine, totalPage, testscoreViewhelper.Page); testscoreViewhelper.LastPage = lastPageCalculation(Constant.maxPageLine, totalPage, testscoreViewhelper.Page, testscoreViewhelper.FirstPage); int take = Constant.limit; int skip = (testscoreViewhelper.Page - 1) * take; testscoreViewhelper.LstTestscore = lstTestscore.OrderByDescending(m => m.entry_datetime).Skip(skip).Take(take).ToList(); } ViewData["testscoreViewhelper"] = testscoreViewhelper; return testscoreViewhelper; }
public ActionResult Index(TestscoreViewhelper testscoreViewhelper) { saveData(testscoreViewhelper); return View(); }
public ActionResult Index() { TestscoreViewhelper testscoreViewhelper = new TestscoreViewhelper(); saveData(testscoreViewhelper); return View(); }