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); }
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); }
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); }