コード例 #1
0
 private List <MenuQuyenHanModel> DocDanhSachChucNang()
 {
     if ((bool)Session[ConstantValues.SessionKeyVaiTro])
     {
         return(MenuQuyenHanModel.SapXepMenu(xlChucNang.DocDanhSachChucNang().ToList()));
     }
     else
     {
         return(MenuQuyenHanModel.SapXepMenu(xlChucNang.DocDanhSachTatCaChucNangTuDanhSachId(currentUser.DanhSachChucNang)));
     }
 }
コード例 #2
0
 public ActionResult DanhSachChucNang()
 {
     if (SessionManager.CheckSession(ConstantValues.SessionKeyCurrentUser))
     {
         var chucNangs = xlchucnang.DocDanhSachTatCaChucNang();
         List <MenuQuyenHanModel> menuModel = MenuQuyenHanModel.SapXepMenu(chucNangs);
         return(View("DanhSachChucNang", menuModel));
     }
     if (Request.Url != null)
     {
         SessionManager.RegisterSession(ConstantValues.SessionKeyUrl, Request.Url.AbsolutePath);
     }
     return(RedirectToAction("Index", "Login"));
 }
コード例 #3
0
        public PartialViewResult MenuQuyenHan()
        {
            List <MenuQuyenHanModel> menuModel = new List <MenuQuyenHanModel>();

            if (Session[ConstantValues.SessionKeyMenu] != null)
            {
                menuModel = new List <MenuQuyenHanModel>(SessionManager.ReturnSessionObject(ConstantValues.SessionKeyMenu) as List <MenuQuyenHanModel>);
            }
            else
            {
                var user = SessionManager.ReturnSessionObject(ConstantValues.SessionKeyCurrentUser) as NguoiDung;
                if (user.DanhSachChucNang.Count() > 0)
                {
                    //var dsPhanQuyen = user.DanhSachChucNang;
                    var dsChucNang = xlchucnang.DocDanhSachTatCaChucNangTuDanhSachId(user.DanhSachChucNang);
                    menuModel = MenuQuyenHanModel.SapXepMenu(dsChucNang);
                }
                SessionManager.RegisterSession(ConstantValues.SessionKeyMenu, menuModel);
            }

            return(PartialView(menuModel));
        }