private void button2_Click(object sender, EventArgs e) { if (txtEmail.Text != "" && txtPassword.Text != "" && txtCPassword.Text != "" && txtName.Text != "" && txtSurname.Text != "" && GenderComboBox.SelectedIndex != -1 && CountrycomboBox.SelectedIndex != -1) { if (txtPassword.Text.Length >= 6 && txtPassword.Text.Any(Char.IsUpper) && txtPassword.Text.Any(Char.IsNumber)) { if (txtPassword.Text == txtCPassword.Text) { DateTime Selectedate = new DateTime(); Selectedate = Convert.ToDateTime(dtDateOfBirth.Text); DateTime CurrentDate = new DateTime(); CurrentDate = DateTime.Now; TimeSpan time = CurrentDate - Selectedate; float RunnerAge = Convert.ToSingle(time.Days / 354.3); RunnerAge = Convert.ToSingle(Math.Round(RunnerAge, 1)); if (RunnerAge > 10) { label13.Visible = false; DBConnection.GetEmail = txtEmail.Text; Password = txtPassword.Text; FirstName = txtName.Text; SurName = txtSurname.Text; Gender = GenderComboBox.SelectedValue.ToString(); DateOfBirth = dtDateOfBirth.Text; County = CountrycomboBox.SelectedValue.ToString(); PathToPhoto = txtPath.Text; tr = true; this.Close(); RegistrationOnMarathon ROMForm = new RegistrationOnMarathon(); ROMForm.Show(); } else { label13.Visible = true; label13.Text = "Runner must be over 10 years old"; } } else { label13.Visible = true; label13.Text = "Passwords do not match"; } } else { label13.Visible = true; label13.Text = "The password must contain at least 6 characters Minimum 1 capital letter At least 1 digit"; } } else { label13.Visible = true; label13.Text = "Fill all Fields"; } }
private void button1_Click(object sender, EventArgs e) { tr = true; this.Close(); RegForm.Cross = 4; RegistrationOnMarathon RegistrationOnMarathon1 = new RegistrationOnMarathon(); RegistrationOnMarathon1.Show(); }