コード例 #1
0
        //Removes a patient from ward
        public void TransferPatient(Patient patient)
        {
            DeliveryRoom tempRoom = Ward.DeliveryRooms.Find(x => x.PatientsInRoom.Contains(patient));

            if (tempRoom != null)
            {
                if (patient.Children.Count > 0)
                {
                    foreach (Patient child in patient.Children)
                    {
                        if (tempRoom.PatientsInRoom.Contains(child))
                        {
                            tempRoom.PatientsInRoom.Remove(child);
                            CurrentPatients.Remove(child);
                        }
                    }
                }
                tempRoom.PatientsInRoom.Remove(patient);
                CurrentPatients.Remove(patient);
                tempRoom.Occupied = false;
            }
            else
            {
                throw new ArgumentException("Input patient not found in room");
            }
        }
コード例 #2
0
ファイル: Filemanagement.cs プロジェクト: Saftevand/P3Midwife
        public static void ReadRooms(string FilePath)
        {
            Stream AccountFile = File.Open(FilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);

            using (StreamReader sr = new StreamReader(AccountFile))
            {
                string       _tempString;
                string[]     _subStrings;
                DeliveryRoom currentRoom;

                while ((_tempString = sr.ReadLine()) != null)
                {
                    _subStrings = _tempString.Split(' ');

                    currentRoom = new DeliveryRoom(Convert.ToInt32(_subStrings[0]), Convert.ToBoolean(_subStrings[1]));
                    Ward.DeliveryRooms.Add(currentRoom);
                    if (_subStrings.Length > 2)
                    {
                        for (int i = 2; i < _subStrings.Length; i++)
                        {
                            currentRoom.PatientsInRoom.Add(Ward.Patients.Find(x => x.CPR == _subStrings[i]));
                        }
                    }
                }
            }
        }
コード例 #3
0
ファイル: Patient.cs プロジェクト: Saftevand/P3Midwife
 public void DischargePatientFromRoom(DeliveryRoom room)
 {
     if (room.PatientsInRoom.Contains(this))
     {
         room.PatientsInRoom.Remove(this);
     }
     else
     {
         throw new ArgumentException(Name + " with CPR:" + CPR.ToString() + " is NOT in room:" + room.RoomID.ToString());
     }
 }
コード例 #4
0
ファイル: Patient.cs プロジェクト: Saftevand/P3Midwife
 public void AdmitPatientToRoom(DeliveryRoom room)
 {
     if (!room.PatientsInRoom.Contains(this))
     {
         room.PatientsInRoom.Add(this);
     }
     else
     {
         throw new ArgumentException(Name + " with CPR:" + CPR.ToString() + " is already in room:" + room.RoomID.ToString());
     }
 }
コード例 #5
0
        //Puts a patient in a vacant room
        private void AssignPatientToDRoom(Patient _patient)
        {
            DeliveryRoom currentRoom = Ward.DeliveryRooms.Find(x => x.Occupied == false);

            if (currentRoom != null)
            {
                currentRoom.PatientsInRoom.Add(_patient);
                currentRoom.Occupied = true;
            }
            else
            {
                throw new Exception("There are no empty rooms to assign patients to");
            }
        }