Ejemplo n.º 1
0
 public ActionResult Index(UserViewhelper UserViewhelper)
 {
     if (Session.getCurrentUser() == null)
         return Redirect("/admin/account/logon");
     if (!SercurityServices.HasPermission((int)TypeModule.MODULE_NGUOIDUNG, Session.getCurrentUser().username, TypeAudit.Addnew)
         && !SercurityServices.HasPermission((int)TypeModule.MODULE_NGUOIDUNG, Session.getCurrentUser().username, TypeAudit.Edit)
         && !SercurityServices.HasPermission((int)TypeModule.MODULE_NGUOIDUNG, Session.getCurrentUser().username, TypeAudit.Delete))
     {
         return Redirect("/admin/error/error403");
     }
     saveData(UserViewhelper);
     return View();
 }
Ejemplo n.º 2
0
 public List<gov_user> setSearchFilter(List<gov_user> lstUser, UserViewhelper userViewhelper)
 {
     Expression<Func<gov_user, bool>> predicate = PredicateBuilder.False<gov_user>();
     if (!String.IsNullOrWhiteSpace(userViewhelper.KeySearch)) {
         predicate = predicate.Or(d => d.username != null && d.username.ToUpper().Contains(userViewhelper.KeySearch.ToUpper()));
         predicate = predicate.Or(d => (d.family_name  + " " + d.first_name).ToUpper().Contains(userViewhelper.KeySearch.ToUpper()));
         predicate = predicate.Or(d => d.email != null && d.email.ToUpper().Contains(userViewhelper.KeySearch.ToUpper()));
         lstUser = lstUser.Where(predicate.Compile()).ToList();
     }
     if (!String.IsNullOrWhiteSpace(userViewhelper.FilterActive)) {
         lstUser = lstUser.Where(u => u.active_flg == Convert.ToBoolean(userViewhelper.FilterActive)).ToList();
     }
     return lstUser;
 }
Ejemplo n.º 3
0
        public UserViewhelper saveData(UserViewhelper userViewhelper)
        {
            List<gov_user> lstUser = _cnttDB.gov_user.Where(u => u.hidden_flg == false).ToList();
            lstUser = setSearchFilter(lstUser, userViewhelper);
            int totalCount = lstUser.Count;
            userViewhelper.TotalCount = totalCount;

            if (userViewhelper.TotalCount > 0)
            {
                int totalPage = pageCalculation(totalCount, Constant.limit);
                userViewhelper.TotalPage = totalPage;
                userViewhelper.Page = pageTransition(userViewhelper.Direction, userViewhelper.Page, totalPage);
                userViewhelper.FirstPage = fistPageCalculation(Constant.maxPageLine, totalPage, userViewhelper.Page);
                userViewhelper.LastPage = lastPageCalculation(Constant.maxPageLine, totalPage, userViewhelper.Page, userViewhelper.FirstPage);
                int take = Constant.limit;
                int skip = (userViewhelper.Page - 1) * take;
                userViewhelper.LstUser = lstUser.OrderByDescending(u => u.entry_datetime).Skip(skip).Take(take).ToList();
            }
            ViewData["userViewhelper"] = userViewhelper;
            return userViewhelper;
        }