// Goes back to the previous window private void BackButton_Click(object sender, RoutedEventArgs e) { GuestNoMeetingWindow guestNoMeetingWindow = new GuestNoMeetingWindow(); guestNoMeetingWindow.GetController(controller); guestNoMeetingWindow.Show(); Thread.Sleep(10); this.Close(); }
// Goes to the next window private void Ok_Button(object sender, RoutedEventArgs e) { // If the text boxes are not filled, and the terms and conditions are not accepted, a messagebox will appear. if (string.IsNullOrEmpty(nameBox.Text) || string.IsNullOrEmpty(compBox.Text) || string.IsNullOrEmpty(phoneBox.Text) || string.IsNullOrEmpty(emailBox.Text) || termsBox.IsChecked == false) { MessageBox.Show("Please fill out the 4 fields. \nPlease accept terms and conditions"); } else { // controller.SendMail(emailBox.Text.ToString()); guestRepo.AddGuestToDB(idBox.Text, nameBox.Text, compBox.Text, emailBox.Text, phoneBox.Text); //Assigns a new checkin to the selectedguest CheckIn checkIn = new CheckIn() { person = guestRepo.SelectedGuest }; controller.CheckInRepo.CheckIn(checkIn); int parsedId = 0; bool test = Int32.TryParse(idBox.Text, out parsedId); // Checks if the guest has an appointment in the database, and sends them to the relevant window. if (appointmentRepo.CheckIfAppointment(parsedId) == true) { GuestMeetingWindow meetingGuestWindow = new GuestMeetingWindow(); controller.CurrentPersonName = nameBox.Text; meetingGuestWindow.GetController(controller); meetingGuestWindow.Show(); Thread.Sleep(10); this.Close(); } else { GuestNoMeetingWindow noReservationWindow = new GuestNoMeetingWindow(); controller.CurrentPersonName = nameBox.Text; noReservationWindow.GetController(controller); noReservationWindow.Show(); Thread.Sleep(10); this.Close(); } } }