public List<Role> GetRoles(Response response) { var document = new HtmlDocument(); document.LoadHtml(response.Content); var select = document.DocumentNode.SelectSingleNode("//select[@name='role_id']"); if (select == null) { return null; } var options = select.ChildNodes; List<Role> roles = new List<Role>(); Role role = null; foreach (var option in options) { if (option.Name == "option") { role = new Role(); role.Id = option.GetAttributeValue("value", null); roles.Add(role); } if (option.NodeType == HtmlNodeType.Text) { if (role != null) { role.Name = option.InnerText; } } } return roles; }
private string GetUserId(Role role) { var roleId = role.Id; var parts = roleId.Split(','); return parts[1]; }
public List<Member> GetSelection(Role role) { lock (lockObject) { SwitchRole(role); return GetSelection(); } }
// TODO maak deze private en voeg Role parameter toe aan de functies die deze nodig hebben. public void SwitchRole(Role role) { var postData = new FormValueCollection { {"task", "ma_function"}, {"action", "edit"}, {"button", "changeRole"}, {"submit", "Wissel rol"}, {"role_id", role.Id}, }; var request = new PostRequest(ResolveUrl("/index.php"), postData); var response = httpBrowser.DoRequest(request); CheckNoticeMessage(response, "Rol gewisseld naar"); }