Beispiel #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());
     }
 }
Beispiel #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());
     }
 }
Beispiel #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());
     }
 }
Beispiel #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());
     }
 }
Beispiel #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());
     }
 }
Beispiel #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());
     }
 }
Beispiel #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);
        }
Beispiel #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());
     }
 }