private void button1_Click_1(object sender, EventArgs e) { error.Visible = false; if (email.Text == "" || password.Text == "") { error.Text = PARAM_MISSING; error.Visible = true; return; } Boolean confirmed = checkUserName(this.email.Text, this.password.Text); if (!confirmed) { error.Text = PASSWORD_DOESNT_MACH; error.Visible = true; return; } else { MessageBox.Show("Login successfull!\ncontinue to MyScreen"); } MainForm MainForm = new MainForm(); this.Hide(); MainForm.Show(); }
private void submit_Click(object sender, EventArgs e) { const string CONFIRMED = "confirmed"; if (confirmationCode.Text == "") { error.Text = NO_CONF_CODE; error.Visible = true; } User user = LocalData.getUserProperties(); using (var wb = new WebClient()) { var data = new NameValueCollection(); data["userId"] = user.UserId; data["securityCode"] = confirmationCode.Text; var response = wb.UploadValues("http://my.jce.ac.il/~eranno/act/activate.php", "POST", data); //contains conf code String body = Encoding.UTF8.GetString(response); char code = body[0]; if (code == '1' || code == '2') { //MessageBox.Show("Success code: " + body); error.Text = WORNG_CONF_CODE; error.Visible = true; return; } else { user.SecurityCode = CONFIRMED; MessageBox.Show("Login successfull!\ncontinue to MyScreen"); return; } } MainForm MainForm = new MainForm(); this.Hide(); MainForm.Show(); }