Exemple #1
0
 private void AddAppointment(object sender, EventArgs e)
 {
     if (txtb_A_Appointment_Housenumber.Text == "" || txtb_A_Appointment_Residence.Text == "" || txtb_A_Appointment_Streetname.Text == "" || txtb_A_Appointment_Zipcode.Text == "" || rtb_A_Appointment.Text == "")
     {
         MessageBox.Show("Make sure all fields are filled in correctly!");
     }
     else if (dtp_A_Appointment.Value < DateTime.Now)
     {
         MessageBox.Show("Date cannot be in the past!");
     }
     else if (!Regex.IsMatch(txtb_A_Appointment_Zipcode.Text, @"^[1-9][0-9]{3}\s?[a-zA-Z]{2}$"))
     {
         MessageBox.Show("Invalid zipcode");
     }
     else
     {
         dbh.OpenConnection();
         if (dbh.AddAppointment(cb_Appointment_Select_Customer.SelectedValue.ToString(), dtp_A_Appointment.Value.ToString(), txtb_A_Appointment_Residence.Text, txtb_A_Appointment_Streetname.Text, txtb_A_Appointment_Housenumber.Text, txtb_A_Appointment_Zipcode.Text, rtb_A_Appointment.Text))
         {
             MessageBox.Show("Succesfully added an appointment!");
         }
         else
         {
             MessageBox.Show("An error occcured while adding an appointment.");
         }
         dbh.CloseConnection();
     }
 }
Exemple #2
0
 private void btn_AddMeeting_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(tbox_Location.Text))
     {
         MessageBox.Show("Locatie invullen is verplicht");
     }
     else
     {
         DatabaseHandler.AddAppointment(new Appointment(currentuser as Client, targetuser as Volunteer, dtp_Date.Value, tbox_Location.Text));
         this.Close();
     }
 }