Esempio n. 1
0
        public RehabilitationRoom Edit(RehabilitationRoom obj)
        {
            List <RehabilitationRoom> rooms = _stream.ReadAll().ToList();

            rooms[rooms.FindIndex(apt => apt.IdRoom == obj.IdRoom)] = obj;
            _stream.SaveAll(rooms);
            return(obj);
        }
        public bool AddPatient(MedicalRecord record, RehabilitationRoom room)
        {
            RehabilitationRoom foundRehabilitationRoom = _roomRepository.GetRoom(room);

            if (foundRehabilitationRoom.CurrentlyInUse >= foundRehabilitationRoom.MaxCapacity)
            {
                return(false);
            }
            else
            {
                foundRehabilitationRoom.Patients.Add(record);
                foundRehabilitationRoom.CurrentlyInUse++;
                _roomRepository.Edit(foundRehabilitationRoom);
                return(true);
            }
        }
Esempio n. 3
0
        public bool Delete(RehabilitationRoom obj)
        {
            List <RehabilitationRoom> rooms        = _stream.ReadAll().ToList();
            RehabilitationRoom        roomToRemove = rooms.SingleOrDefault(acc => acc.IdRoom == obj.IdRoom);

            if (roomToRemove != null)
            {
                rooms.Remove(roomToRemove);
                _stream.SaveAll(rooms);
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public bool ReleasePatient(MedicalRecord record, RehabilitationRoom room)
        {
            var foundRehabilitationRoom = _roomRepository.GetRoom(room);

            if (foundRehabilitationRoom.CurrentlyInUse > 0)
            {
                foreach (MedicalRecord oneRecord in foundRehabilitationRoom.Patients)
                {
                    if (oneRecord.Id.Equals(record.Id))
                    {
                        foundRehabilitationRoom.Patients.Remove(oneRecord);
                        break;
                    }
                }
                foundRehabilitationRoom.CurrentlyInUse--;
                _roomRepository.Edit(foundRehabilitationRoom);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 5
0
 public RehabilitationRoom Save(RehabilitationRoom obj)
 {
     _stream.AppendToFile(obj);
     return(obj);
 }
Esempio n. 6
0
        public ReferralToHospitalTreatment WriteReferralToHospitalTreatment(Treatment treatment, DateTime startDate, DateTime endDate, string cause, List <Drug> drugs, RehabilitationRoom room)
        {
            ReferralToHospitalTreatment referralToHospitalTreatment = new ReferralToHospitalTreatment(cause, drugs);

            treatment.ReferralToHospitalTreatment = referralToHospitalTreatment;
            MedicalRecord medicalRecord = MedicalRecordRepository.Instance.GetMedicalRecordByTreatmentId(treatment.Id);

            RehabilitationRoomService.Instance.AddPatient(medicalRecord, room);
            return(treatment.ReferralToHospitalTreatment);
        }
 public RehabilitationRoom GetRoom(RehabilitationRoom room)
 {
     return(_roomRepository.GetRoom(room));
 }
 public bool Delete(RehabilitationRoom obj)
 {
     return(_service.Delete(obj));
 }
 public bool Delete(RehabilitationRoom obj)
 {
     return(_roomRepository.Delete(obj));
 }
        public RehabilitationRoom Create(RehabilitationRoom obj)
        {
            RehabilitationRoom rehabilitationRoom = _roomRepository.Save(obj);

            return(rehabilitationRoom);
        }
 public bool ReleasePatient(MedicalRecord record, RehabilitationRoom room)
 {
     return(_service.ReleasePatient(record, room));
 }
 public RehabilitationRoom GetRoom(RehabilitationRoom room)
 {
     return(_service.GetRoom(room));
 }
 public RehabilitationRoom Edit(RehabilitationRoom obj)
 {
     return(_service.Edit(obj));
 }
Esempio n. 14
0
        public RehabilitationRoom GetRoom(RehabilitationRoom room)
        {
            List <RehabilitationRoom> rooms = _stream.ReadAll().ToList();

            return(rooms[rooms.FindIndex(apt => apt.IdRoom == room.IdRoom)]);
        }
 public RehabilitationRoom Edit(RehabilitationRoom obj)
 {
     return(_roomRepository.Edit(obj));
 }
Esempio n. 16
0
 public ReferralToHospitalTreatment WriteReferralToHospitalTreatment(Model.Treatment.Treatment treatment, DateTime startDate, DateTime endDate, String cause, List <Drug> drugs, RehabilitationRoom room)
 {
     return(_service.WriteReferralToHospitalTreatment(treatment, startDate, endDate, cause, drugs, room));
 }
 public RehabilitationRoom Create(RehabilitationRoom obj)
 {
     return(_service.Create(obj));
 }