/// <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); }
/// <summary> /// Navigation /// </summary> private void Navigation() { if (selectedPatient == 0) { this.Close(); } patientDetail = new clsPatientDetails(); dateEntry = new clsDateEntry(); medicalRecord = new clsMedicalRecord(); assessment = new clsAssessment(); appointment = new clsAppointment(); prescription = new clsPrescription(); patient = new clsPatientModel() { Appointments = new List <clsAppointmentModel>(), Assessment = new List <clsAssessmentModel>(), DateEntry = new clsDateEntryModel(), MedicalRecords = new clsPatientMedicalRecordModel(), PatientDetails = new clsPatientDetailsModel(), PatientId = selectedPatient, Prescription = new clsPrescriptionModel() }; switch (navigateFrom) { case NavigationType.Appointments: case NavigationType.Patients: case NavigationType.Search: patient.PatientDetails = patientDetail.GetByPatientId(selectedPatient); patient.DateEntry = dateEntry.GetbyPatientId(selectedPatient); patient.MedicalRecords = medicalRecord.GetByPatientId(selectedPatient); patient.Prescription = prescription.GetByPatientId(selectedPatient); patient.Assessment = assessment.GetByPatientId(selectedPatient); patient.Appointments = appointment.GetByPatientId(selectedPatient); break; case NavigationType.NewPatient: break; case NavigationType.RnageOfMotion: break; case NavigationType.ViewPatient: break; default: break; } }
private void btnDeleteAssessment_Click(object sender, EventArgs e) { try { if (selectedAssessmentId == 0) { throw new Exception("Select assessment to delete"); } assessment = new clsAssessment(); assessment.DeleteByAssessmentId(selectedAssessmentId); Navigation(); if (patient != null || patient.PatientId != 0) { AssignValue(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }