Пример #1
0
 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;
 }
Пример #2
0
 private string GetUserId(Role role)
 {
     var roleId = role.Id;
     var parts = roleId.Split(',');
     return parts[1];
 }
Пример #3
0
 public List<Member> GetSelection(Role role)
 {
     lock (lockObject)
     {
         SwitchRole(role);
         return GetSelection();
     }
 }
Пример #4
0
 // 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");
 }