Esempio n. 1
0
        public List<Member> GetSelection()
        {
            var postData = new FormValueCollection
            {
                {"task", "sel_selection"},
                {"action", "perform"},
                {"button", "post"},
                {"sel_id", "1216"},
                {"export_type", "1"},
                {"usr_cse_id", "3"},
                {"sort_field[0][field_nm]", ""},
                {"group_field[0]", ""},
                //{"submit", "Uitvoeren"},
            };
            var request = new PostRequest(ResolveUrl("index.php"), postData);
            //var request = new Request(ResolveUrl("index.php?task=sel_selection&action=perform&button=post&sel_id=1216"));
            var response = httpBrowser.DoRequest(request);
            var contents = response.Content;

            if (!contents.StartsWith("\"Lidnummer\","))
            {
                Error(response, "Expected \"Lidnummer\" not found");
            }

            var csvReader = new CsvConverter(contents);
            var membersCsv = new MembersCsv();
            return membersCsv.GetMembers(csvReader);
        }
Esempio n. 2
0
        public Response Authenticate(string username, string password)
        {
            var url = string.Format("{0}rs/user/", this.baseUrl);
            var loginPageRequest = new Request(url);
            var loginPageResponse = browser.DoRequest(loginPageRequest);

            var formValues = loginPageResponse.GetForms().Single().Values;
            formValues.Update("userid", username);

            var loginPageSubmit = new PostRequest(url, formValues);
            var openIdPage = browser.DoRequest(loginPageSubmit);

            formValues = openIdPage.GetForms().Single().Values;
            formValues.Update("openid_password", password);
            formValues.Update("openid_action", "Login");

            var openIdSubmit = new PostRequest(openIdPage.ResponseUri, formValues);
            var response = browser.DoRequest(openIdSubmit);

            return response;
        }
Esempio n. 3
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");
 }