예제 #1
0
 public ActionResult Index(GroupViewhelper groupViewhelper)
 {
     if (Session.getCurrentUser() == null)
         return Redirect("/admin/account/logon");
     if (!SercurityServices.HasPermission((int)TypeModule.MODULE_NGUOIDUNG, Session.getCurrentUser().username, TypeAudit.GroupUser))
     {
         return Redirect("/admin/error/error403");
     }
     saveData(groupViewhelper);
     return View();
 }
예제 #2
0
 public List<gov_group> setSearchFilter(List<gov_group> lstGroup, GroupViewhelper groupViewhelper)
 {
     if (!String.IsNullOrEmpty(groupViewhelper.KeySearch))
         lstGroup = lstGroup.Where(g => g.group_name.ToUpper().Contains(groupViewhelper.KeySearch)).ToList();
     return lstGroup;
 }
예제 #3
0
        public GroupViewhelper saveData(GroupViewhelper groupViewhelper)
        {
            List<gov_group> lstGroup = _cnttDB.gov_group.Where(g => g.hidden_flg == false).ToList();
            lstGroup = setSearchFilter(lstGroup, groupViewhelper);

            int totalCount = lstGroup.Count;
            groupViewhelper.TotalCount = totalCount;

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