Exemplo n.º 1
0
        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();
            }
        }