Пример #1
0
        public void getRoomList(ref Patient patient, ref Visit visit)
        // Attaches the room(s) associated with this patient visit
        {
            string procedureName = "getStaysIn";

            List <SqlParameter> parameters = new List <SqlParameter>();

            parameters.Add(new SqlParameter("@roomNumber", ""));
            parameters.Add(new SqlParameter("@patientId", patient.getSSN()));
            parameters.Add(new SqlParameter("@visitEntryDate", visit.getEntryDate()));
            SqlDataReader reader = executeStoredProcedure(procedureName, parameters);

            int         count = 0;
            List <Room> rooms = visit.getRoomList();

            rooms.Clear(); // make sure we clear the room list, as we are adding room(s) back on

            SortedList <string, DateTime> roomDataHolder = new SortedList <string, DateTime>();

            while (reader.Read() && count < QUERY_LIMIT)
            {
                string   roomNum           = reader.GetString((int)staysInCol.RoomNumber);
                DateTime roomEffectiveDate = reader.GetDateTime((int)staysInCol.RoomEffectiveDate);

                roomDataHolder.Add(roomNum, roomEffectiveDate);


                /* Console.WriteLine("Room Number: " + reader.GetString((int)staysInCol.RoomNumber)
                 + "Room Effective Date: " + reader.GetDateTime((int)staysInCol.RoomEffectiveDate)
                 + "Patient SSN: " + reader.GetString((int)staysInCol.PatientId));
                 + Console.WriteLine("\tVisit Entry Date: " + reader.GetDateTime((int)staysInCol.VisitEntryDate)
                 + "Room Entry Date: " + reader.GetDateTime((int)staysInCol.RoomEntryDateTime)
                 + "Room Exit Date: " + reader.GetDateTime((int)staysInCol.RoomExitDateTime)); */

                count++;
            }
            closeReader(ref reader);

            foreach (KeyValuePair <string, DateTime> kvp in roomDataHolder)
            {
                Room room = getRoom(kvp.Key, kvp.Value);

                visit.addRoom(room);
            }
        }
Пример #2
0
        private void submitButton_Click(object sender, EventArgs e)
        {
            newRoom = new Room(RoomListView.SelectedItems[0].SubItems[0].Text, Decimal.Parse(RoomListView.SelectedItems[0].SubItems[1].Text), DateTime.Parse(RoomListView.SelectedItems[0].SubItems[2].Text));

            DBConnectionObject conn = DBConnectionObject.getInstance();

            foreach (RADGSHALibrary.Room r in selectedVisit.getRoomList())
            {
                conn.getRoomEntryExitDates(selectedPatient, selectedVisit, r, out DateTime entry, out DateTime roomExit, out bool stillInRoom);
                if (stillInRoom)
                {
                    conn.closeStaysIn(selectedPatient, selectedVisit, r, DateTime.Now);
                }
            }

            conn.addStaysIn(newRoom, selectedPatient, selectedVisit, DateTime.Now);
            selectedVisit.addRoom(newRoom);
            Close();
        }