예제 #1
0
 public List<gov_notebook> setSearchFilter(List<gov_notebook> lstnotebook, NotebookViewhelper notebookViewhelper)
 {
     Expression<Func<gov_notebook, bool>> predicate = PredicateBuilder.False<gov_notebook>();
     if (!String.IsNullOrWhiteSpace(notebookViewhelper.KeySearch))
     {
         predicate = predicate.Or(d => d.title != null && d.title.ToUpper().Contains(notebookViewhelper.KeySearch.ToUpper()));
         predicate = predicate.Or(d => d.teacher != null && d.teacher.ToUpper().Contains(notebookViewhelper.KeySearch.ToUpper()));
         predicate = predicate.Or(d => d.remember != null && d.remember.ToUpper().Contains(notebookViewhelper.KeySearch.ToUpper()));
         predicate = predicate.Or(d => d.note != null && d.note.ToUpper().Contains(notebookViewhelper.KeySearch.ToUpper()));
         predicate = predicate.Or(d => d.dream != null && d.dream.ToUpper().Contains(notebookViewhelper.KeySearch.ToUpper()));
         lstnotebook = lstnotebook.Where(predicate.Compile()).ToList();
     }
     if (notebookViewhelper.CourseFilter != 0) {
         lstnotebook = lstnotebook.Where(n => n.course_id == notebookViewhelper.CourseFilter).ToList();
     }
     if (notebookViewhelper.SpecializedFilter != 0)
     {
         lstnotebook = lstnotebook.Where(n => n.specialized_id == notebookViewhelper.SpecializedFilter).ToList();
     }
     if (!String.IsNullOrWhiteSpace(notebookViewhelper.FilterActive))
     {
         lstnotebook = lstnotebook.Where(n => n.active_flg == Boolean.Parse(notebookViewhelper.FilterActive)).ToList();
     }
     return lstnotebook;
 }
예제 #2
0
 public ActionResult Index(NotebookViewhelper notebookViewhelper)
 {
     if (Session.getCurrentUser() == null)
         return Redirect("/admin/account/logon");
     if (!SercurityServices.HasPermission((int)TypeModule.MODULE_CUUSINHVIEN, Session.getCurrentUser().username, TypeAudit.ManagerNotebook))
     {
         return Redirect("/admin/error/error403");
     }
     saveData(notebookViewhelper);
     return View();
 }
        public void saveData(NotebookViewhelper notebookViewhelper)
        {
            List<gov_notebook> lstnotebook = _cnttDB.gov_notebook.Where(u => u.active_flg == true).ToList();
            lstnotebook = setSearchFilter(lstnotebook, notebookViewhelper);
            int totalCount = lstnotebook.Count;
            notebookViewhelper.TotalCount = totalCount;

            if (notebookViewhelper.TotalCount > 0)
            {
                int totalPage = pageCalculation(totalCount, Constant.limit);
                notebookViewhelper.TotalPage = totalPage;
                notebookViewhelper.Page = pageTransition(notebookViewhelper.Direction, notebookViewhelper.Page, totalPage);
                notebookViewhelper.FirstPage = fistPageCalculation(Constant.maxPageLine, totalPage, notebookViewhelper.Page);
                notebookViewhelper.LastPage = lastPageCalculation(Constant.maxPageLine, totalPage, notebookViewhelper.Page, notebookViewhelper.FirstPage);
                int take = Constant.limit;
                int skip = (notebookViewhelper.Page - 1) * take;
                notebookViewhelper.LstNotebook = lstnotebook.OrderByDescending(u => u.entry_datetime).Skip(skip).Take(take).ToList();
            }
            notebookViewhelper.LstCourse = _cnttDB.gov_course.OrderByDescending(c => c.course_name).ToList();
            notebookViewhelper.LstSpecialized = _cnttDB.gov_specialized.OrderBy(s => s.specialized_name).ToList();
            ViewData["notebookViewhelper"] = notebookViewhelper;
        }
 public ActionResult Index(NotebookViewhelper notebookViewhelper)
 {
     saveData(notebookViewhelper);
     return View("Index");
 }
 public ActionResult Index()
 {
     NotebookViewhelper notebookViewhelper = new NotebookViewhelper();
     saveData(notebookViewhelper);
     return View();
 }