コード例 #1
0
        public List <DTO_Role> GetRolesOfUser(String username)
        {
            List <DTO_Role> result = new List <DTO_Role>();
            DataTable       data;

            try
            {
                data = DAO_Role.Instance.GetRolesOfUser(username);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            foreach (DataRow row in data.Rows)
            {
                DTO_Role tmpObject = new DTO_Role();

                tmpObject.RoleName     = row["GRANTED_ROLE"].ToString();
                tmpObject.Admin_Option = row["ADMIN_OPTION"].ToString();

                result.Add(tmpObject);
            }

            return(result);
        }
コード例 #2
0
        public bool CheckRole(String roleName)
        {
            DataTable data = DAO_Role.Instance.GetAllRoles();

            foreach (DataRow row in data.Rows)
            {
                DTO_Role tmpObject = new DTO_Role();
                tmpObject.RoleName = row["ROLE"].ToString();

                if (tmpObject.RoleName.Equals(roleName))
                {
                    return(true);
                }
            }
            return(false);
        }
コード例 #3
0
        public List <DTO_Role> GetAllRoles()
        {
            //Get all data from DAO Layer
            List <DTO_Role> result = new List <DTO_Role>();
            DataTable       data   = DAO_Role.Instance.GetAllRoles();

            foreach (DataRow row in data.Rows)
            {
                DTO_Role tmpObject = new DTO_Role();

                tmpObject.RoleName = row["ROLE"].ToString();
                tmpObject.Role_ID  = row["ROLE_ID"].ToString();

                result.Add(tmpObject);
            }

            return(result);
        }