示例#1
0
 public static List <RolePermission> GetPermissionRolesByRoleId(int idRole)
 {
     using (var configuration_context = new Configuration_Entities())
     {
         return(configuration_context.RolePermission.Where(x => x.IdRole == idRole).ToList());
     }
 }
示例#2
0
 public static Role GetById(int idRole)
 {
     using (var configuration_context = new Configuration_Entities())
     {
         return(configuration_context.Role.Where(x => x.Id == idRole).FirstOrDefault());
     }
 }
示例#3
0
 public static List <UserRole> GetUserRolesByUsername(string username)
 {
     using (var configuration_context = new Configuration_Entities())
     {
         return(configuration_context.UserRole.Where(x => x.Username == username).ToList());
     }
 }
示例#4
0
 public static List <MenuPermission> GetMenuPermissionByMenuId(int idMenu)
 {
     using (var configuration_context = new Configuration_Entities())
     {
         return(configuration_context.MenuPermission.Where(x => x.IdMenu == idMenu).ToList());
     }
 }
示例#5
0
 public static Menu GetById(int idMenu)
 {
     using (var configuration_context = new Configuration_Entities())
     {
         return(configuration_context.Menu.Where(x => x.Id == idMenu).FirstOrDefault());
     }
 }
示例#6
0
 public static List <SP_MenuGroup_Menu_GetAll_Result> GetAll()
 {
     using (var configuration_context = new Configuration_Entities())
     {
         return(configuration_context.SP_MenuGroup_Menu_GetAll().ToList());
     }
 }
示例#7
0
        public static List <Permission> GetUserPermissionList(string username)
        {
            List <Permission> rtn = new List <Permission>();

            if (username != null)
            {
                using (var configuration_context = new Configuration_Entities())
                {
                    List <UserRole> userRoleList = GetUserRole(username);
                    foreach (UserRole userRole in userRoleList)
                    {
                        List <RolePermission> userRolePermissionList = configuration_context.RolePermission.Where(x => x.IdRole == userRole.IdRole).ToList();

                        foreach (RolePermission userRolePermission in userRolePermissionList)
                        {
                            Permission permissionToAdd = configuration_context.Permission.Where(x => x.Id == userRolePermission.IdPermission).FirstOrDefault();

                            if (permissionToAdd != null)
                            {
                                rtn.Add(permissionToAdd);
                            }
                        }
                    }
                }
            }
            return(rtn);
        }
示例#8
0
 public static Permission GetById(int idPermission)
 {
     using (var configuration_context = new Configuration_Entities())
     {
         return(configuration_context.Permission.Where(x => x.Id == idPermission).FirstOrDefault());
     }
 }