private void btnAddAppointment_Click(object sender, EventArgs e) { try { DateTime newAppointment = dpAddAppointment.Value.Date + dpAppointmentTime.Value.TimeOfDay; if (newAppointment.Date == DateTime.Today.Date) { throw new Exception("Appointment cannot be today"); } appointment = new clsAppointment(); appointment.Save(patient.PatientId, newAppointment); Navigation(); if (patient != null || patient.PatientId != 0) { AssignValue(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Save patient details /// </summary> private void SavePatient() { int patientId = 0; patientDetails = new clsPatientDetails(); patientId = patientDetails.Save(patient.PatientDetails); if (patientId == 0) { throw new Exception("Cannot save patient"); } dateEntry = new clsDateEntry(); dateEntry.Save(patientId, patient.DateEntry); if (patient.Appointments.Count > 0) { var selectedAppointment = patient.Appointments.First(); if (selectedAppointment.Appointment.Date != DateTime.Today.Date) { appointment = new clsAppointment(); appointment.Save(patientId, selectedAppointment.Appointment); } } medicalRecord = new clsMedicalRecord(); medicalRecord.Save(patientId, patient.MedicalRecords); assessment = new clsAssessment(); assessment.Save(patientId, patient.Assessment); prescription = new clsPrescription(); prescription.Save(patientId, patient.Prescription); }