private void btnBestel_Click(object sender, EventArgs e)
        {
            //Check for errors
            if (string.IsNullOrEmpty(txtNaam.Text))
            {
                MessageBox.Show("Vul een naam in"); txtNaam.Focus(); return;
            }
            if (string.IsNullOrEmpty(txtAdres.Text))
            {
                MessageBox.Show("Vul een adres in"); txtAdres.Focus(); return;
            }
            if (string.IsNullOrEmpty(txtWoonplaats.Text))
            {
                MessageBox.Show("Vul een woonplaats in"); txtWoonplaats.Focus(); return;
            }
            if (lblBioscoopvertoning.SelectedItem == null)
            {
                MessageBox.Show("Selecteer een vertoning"); lblBioscoopvertoning.Focus(); return;
            }
            if (lblStoelen.SelectedItem == null)
            {
                MessageBox.Show("Selecteer een stoel"); lblStoelen.Focus(); return;
            }
            double age    = DateTime.Now.Subtract(geboortedatumDTP.Value).TotalDays / 365;
            double minAge = (lblBioscoopvertoning.SelectedItem as Bioscoopvertoning).Leeftijdscategorie;

            if (minAge > age)
            {
                MessageBox.Show("Je bent nog te jong voor deze film"); return;
            }
            if (!txtEmail.Text.Contains('@'))
            {
                MessageBox.Show("Incorrect emailadres"); txtEmail.Focus(); return;
            }

            string   naam          = txtNaam.Text;
            string   adres         = txtAdres.Text;
            string   woonplaats    = txtWoonplaats.Text;
            DateTime geboortedatum = geboortedatumDTP.Value;
            Bezoeker bezoeker      = new Bezoeker(naam, adres, woonplaats, geboortedatum);

            Bioscoop.VoegPersoonToe(bezoeker);

            Bestelling bestelling = new Bestelling(bezoeker, lblBioscoopvertoning.SelectedItem as Bioscoopvertoning, lblStoelen.SelectedItem as Stoel);

            MessageBox.Show("Betaal: €" + bestelling.Price);
            this.Close();
        }
Exemple #2
0
 private void btnRegistreer_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtNaam.Text))
     {
         MessageBox.Show("Vul een naam in");
         txtNaam.Focus();
         return;
     }
     if (string.IsNullOrEmpty(txtAdres.Text))
     {
         MessageBox.Show("Vul een adres in");
         txtAdres.Focus();
         return;
     }
     if (string.IsNullOrEmpty(txtWoonplaats.Text))
     {
         MessageBox.Show("Vul een woonplaats in");
         txtWoonplaats.Focus();
         return;
     }
     if (string.IsNullOrEmpty(txtGebruikersnaam.Text))
     {
         MessageBox.Show("Vul een gebruikersnaam in");
         txtGebruikersnaam.Focus();
         return;
     }
     if (string.IsNullOrEmpty(txtWachtwoord.Text))
     {
         MessageBox.Show("Vul een wachtwoord in");
         txtWachtwoord.Focus();
         return;
     }
     if (chbVoorwaarde.Checked)
     {
         string   Naam           = txtNaam.Text;
         string   Adres          = txtAdres.Text;
         string   Woonplaats     = txtWoonplaats.Text;
         DateTime Geboortedatum  = dtpGeboortedatum.Value;
         string   Gebruikersnaam = txtGebruikersnaam.Text;
         string   Wachtwoord     = txtWachtwoord.Text;
         Lid      NieuwLid       = new Lid(Naam, Adres, Woonplaats, Geboortedatum, Gebruikersnaam, Wachtwoord);
         bioscoop.VoegPersoonToe(NieuwLid);
         this.Close();
     }
 }