public Patient(Form previousForm, RADGSHALibrary.Patient selectedPatient) { selectedVisit = selectedPatient.getCurrentVisit(); editingPatient = false; InitializeComponent(); this.previousForm = previousForm; this.selectedPatient = selectedPatient; //set the patient passed to this form as the active patient displayPatient(); disableCurrentPatientTextBoxes(); //selectedVisit = new RADGSHALibrary.Visit(); //selectedVisit.setPatientId(selectedPatient.getSSN()); checkInOutButton.Text = (selectedVisit == null) ? "Check In" : "Check Out"; //checkInOutButton.Text = (selectedVisit.getExitDate() == null) ? "Check Out" : "Check In"; }
private void checkInOutButton_Click(object sender, EventArgs e) { if (selectedVisit != null) { //the patient must be checking out, as they never exited their last visit. CheckOut C = new CheckOut(this, ref selectedPatient, ref selectedVisit); C.Closed += (s, args) => this.Close(); C.Show(); Hide(); //selectedVisit.setExitDate(DateTime.Now); //RADGSHALibrary.DBConnectionObject conn = RADGSHALibrary.DBConnectionObject.getInstance(); //conn.addVisit(selectedVisit, selectedPatient); //checkInOutButton.Text = "Check In"; //selectedVisit = null; } else { DBConnectionObject conn = DBConnectionObject.getInstance(); //The patient has already finished their last visit, must be checking into a new visit. //this.Hide(); selectedPatient.checkIn(); selectedVisit = selectedPatient.getCurrentVisit(); selectedVisit.setEntryDate(DateTime.Now); selectedVisit.changeDiagnosis(VisitDiagnosisTextBox.Text); selectedVisit.setAttendingPhysician(textAttendingPhy.Text); selectedVisit.setNote(visitNotes.Text); ChangeRoom C = new ChangeRoom(this, ref selectedPatient, ref selectedVisit); // C.Closed += (s, args) => this.Close(); C.ShowDialog(); conn.addVisit(selectedVisit, selectedPatient); for (int i = 0; i < textSymptoms.Lines.Length; i++) { selectedVisit.addSymptom(textSymptoms.Lines[i].Trim()); conn.addSymptom(selectedPatient, selectedVisit, textSymptoms.Lines[i].Trim()); } // if (selectedVisit.getRoomList()[0]!=null) conn.addStaysIn(selectedVisit.getRoomList()[0], selectedPatient, selectedVisit); checkInOutButton.Text = "Check Out"; displayPatient(); } }