public bool IsInRole(string roleName, int?userID) { try { int UserType = dbUser.GetUserById(userID.Value).UserTypeId.Value; int userTypeCount = dbUser.getAccessByUserTypeAndRoleName(UserType, roleName).Count(); if (userTypeCount > 0) { return(true); } return(false); } catch (Exception ex) { throw ex; } }