private void BtnMakeAppointment_Click(object sender, EventArgs e) { if (cmbHospital.SelectedItem != null & cmbDoctor.SelectedItem != null & cmbDepartment.SelectedItem != null & cmbHour.SelectedItem != null) { List <int> patientID = examinationController.ExaminationPatientId(appointmentID); appointmentController = new AppointmentController(); Appointment appointment = new Appointment(); appointment.DoctorId = Homepage.userID; appointment.AppointmentDate = dtpAppointmentDate.Value; appointment.HourId = ((Hour)(cmbHour.SelectedItem)).HourId; appointment.PatientId = Convert.ToInt32(patientID[0]); appointmentController.Add(appointment); ExaminationSave(); MessageBox.Show("Hastanız için gerekli randevu oluşturuldu."); Clear(); } else { MessageBox.Show("Lütfen gerekli alanları doldurunuz."); } }