private void btnAdd_Click(object sender, EventArgs e) { if (txtGroup.Text == "") { ShowErrorMessage("Provide the group name"); return; } try { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { //get application user roles sbfa.UserRoleActionResponse response = agent.operation.AddUserGroup(txtGroup.Text, txtDescription.Text); if (response.actionStatus) { string currentRole = txtGroup.Text; treeUserGroups.Nodes["userGroups"].Nodes.Add(currentRole, currentRole); treeUserGroups.Nodes["userGroups"].Nodes[currentRole].Nodes.Add(txtDescription.Text); } } } catch { ShowErrorMessage("Failed to add group"); } }
private void btnRemoveRole_Click(object sender, EventArgs e) { try { SBFAApi agent = new SBFAApi(); using (new OperationContextScope(agent.context)) { sbfa.UserRoleActionResponse response = agent.operation.RemoveUserGroupRole(treeUserGroups.SelectedNode.Text, treeUserRoles.SelectedNode.Text); if (response.actionStatus) { TreeNode temp = treeUserRoles.SelectedNode; treeUserRoles.SelectedNode.Remove(); treeSystemRoles.Nodes["systemRoles"].Nodes.Add(temp); } else { ; } } } catch { ShowErrorMessage("Failed to update configuration"); } }