public Appointment ConvertCSVFormatToEntity(string entityCSVFormat)
        {
            string[]          tokens    = entityCSVFormat.Split(_delimiter.ToCharArray());
            long              patientId = long.Parse(tokens[2]);
            ExamOperationRoom room      = ExamOperationRoomRepository.Instance.GetRoomById(long.Parse(tokens[6]));
            TypeOfAppointment type      = (TypeOfAppointment)Enum.Parse(typeof(TypeOfAppointment), tokens[3], true);
            DateTime          startDate = DateTime.Parse(tokens[4]);
            DateTime          endDate   = DateTime.Parse(tokens[5]);

            var doctorRepository  = DoctorRepository.Instance;
            var patientRepository = PatientRepository.Instance;

            Doctor doctor = doctorRepository.GetDoctorById(long.Parse(tokens[1]));

            Patient patient = patientRepository.GetPatientById(patientId);


            return(new Appointment(long.Parse(tokens[0]),
                                   doctor,
                                   patient,
                                   room,
                                   type,
                                   startDate,
                                   endDate));
        }
        public ExamOperationRoom Edit(ExamOperationRoom obj)
        {
            List <ExamOperationRoom> rooms = _stream.ReadAll().ToList();

            rooms[rooms.FindIndex(ro => ro.Id == obj.Id)] = obj;
            _stream.SaveAll(rooms);
            return(obj);
        }
Ejemplo n.º 3
0
        public List <Appointment> GetAppointmentsByTimeAndRoom(ExamOperationRoom room, DateTime startDate, DateTime endDate)
        {
            List <Appointment> appointments       = _appointmentRepository.GetAll();
            List <Appointment> wantedAppointments = new List <Appointment>();

            foreach (Appointment appointment in appointments)
            {
                if ((appointment.RoomId.Equals(room.Id)) && (appointment.StartDate >= startDate) && (appointment.EndDate <= endDate))
                {
                    wantedAppointments.Add(appointment);
                }
            }

            return(wantedAppointments);
        }
        public bool Delete(ExamOperationRoom obj)
        {
            List <ExamOperationRoom> rooms        = _stream.ReadAll().ToList();
            ExamOperationRoom        roomToRemove = rooms.SingleOrDefault(ro => ro.Id == obj.Id);

            if (roomToRemove != null)
            {
                rooms.Remove(roomToRemove);
                _stream.SaveAll(rooms);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 5
0
        public List <Appointment> GetAppointmentsByRoom(ExamOperationRoom room)
        {
            List <Appointment> appointments       = _appointmentRepository.GetAll();
            List <Appointment> wantedAppointments = new List <Appointment>();

            foreach (Appointment appointment in appointments)
            {
                if (appointment.RoomId.Equals(room.Id))
                {
                    wantedAppointments.Add(appointment);
                }
            }


            return(wantedAppointments);
        }
Ejemplo n.º 6
0
        public List <Appointment> GetAppointmentsByDayAndDoctorAndRoomAndPatient(DateTime day, Doctor doctor, ExamOperationRoom room, Patient patient)
        {
            List <Appointment> appointments = new List <Appointment>();
            DateTime           endDate      = day.AddDays(1);

            foreach (Appointment appointment in GetAppointmentsByDate(day, endDate))
            {
                if (appointment.Patient.Id == patient.Id || appointment.Doctor.Id == doctor.Id || appointment.ExamOperationRoom.Id == room.Id)
                {
                    appointments.Add(appointment);
                }
            }
            return(appointments);
        }
Ejemplo n.º 7
0
 public ExamOperationRoom Edit(ExamOperationRoom obj)
 {
     _examOperationRoomRepository.Edit(obj);
     return(obj);
 }
Ejemplo n.º 8
0
 public bool Delete(ExamOperationRoom obj)
 {
     return(_examOperationRoomRepository.Delete(obj));
 }
Ejemplo n.º 9
0
        public ExamOperationRoom Create(ExamOperationRoom obj)
        {
            var newExamOperRoom = _examOperationRoomRepository.Save(obj);

            return(newExamOperRoom);
        }
 public bool Delete(ExamOperationRoom obj)
 {
     return(_service.Delete(obj));
 }
Ejemplo n.º 11
0
 public SpecialistAppointment ScheduleSpecialistAppointment(Doctor specialist, String cause, Treatment treatment, ExamOperationRoom room, DateTime startDate, DateTime endDate)
 {
     return(_service.ScheduleSpecialistAppointment(specialist, cause, treatment, room, startDate, endDate));
 }
 public ExamOperationRoom Save(ExamOperationRoom obj)
 {
     _stream.AppendToFile(obj);
     return(obj);
 }
 public List <Appointment> GetAppointmentsByDayAndDoctorAndRoomAndPatient(DateTime day, Doctor doctor, ExamOperationRoom room, Patient patient)
 {
     return(_service.GetAppointmentsByDayAndDoctorAndRoomAndPatient(day, doctor, room, patient));
 }
 public List <Appointment> GetAppointmentsByTimeAndRoom(ExamOperationRoom room, DateTime startDate, DateTime endDate)
 {
     return(_service.GetAppointmentsByTimeAndRoom(room, startDate, endDate));
 }
 public List <Appointment> GetAppointmentsByRoom(ExamOperationRoom room)
 {
     return(_service.GetAppointmentsByRoom(room));
 }
 public ExamOperationRoom Edit(ExamOperationRoom obj)
 {
     return(_service.Edit(obj));
 }
Ejemplo n.º 17
0
        public SpecialistAppointment ScheduleSpecialistAppointment(Doctor specialist, String cause, Treatment treatment, ExamOperationRoom room, DateTime startDate, DateTime endDate)
        {
            SpecialistAppointment specialistAppointment = new SpecialistAppointment(cause, specialist);

            treatment.SpecialistAppointment = specialistAppointment;
            MedicalRecord medicalRecord = MedicalRecordRepository.Instance.GetMedicalRecordByTreatmentId(treatment.Id);
            Patient       patient       = medicalRecord.Patient;
            Appointment   appointment   = new Appointment(specialist, patient, room, TypeOfAppointment.EXAM, startDate, endDate);

            AppointmentRepository.Instance.Save(appointment);
            return(treatment.SpecialistAppointment);
        }
Ejemplo n.º 18
0
        public ScheduledSurgery ScheduleSurgery(Treatment treatment, DateTime startDate, DateTime endDate, string cause, Surgeon surgeon, ExamOperationRoom room)
        {
            ScheduledSurgery scheduledSurgery = new ScheduledSurgery(startDate, endDate, cause, surgeon);

            treatment.ScheduledSurgery = scheduledSurgery;
            MedicalRecord medicalRecord = MedicalRecordRepository.Instance.GetMedicalRecordByTreatmentId(treatment.Id);
            Patient       patient       = medicalRecord.Patient;
            Appointment   surgery       = new Appointment(surgeon, patient, room, TypeOfAppointment.SURGERY, startDate, endDate);

            AppointmentRepository.Instance.Save(surgery);
            return(treatment.ScheduledSurgery);
        }
Ejemplo n.º 19
0
 public ScheduledSurgery ScheduleSurgery(Model.Treatment.Treatment treatment, DateTime startDate, DateTime endDate, String cause, Surgeon surgeon, ExamOperationRoom room)
 {
     return(_service.ScheduleSurgery(treatment, startDate, endDate, cause, surgeon, room));
 }
 public ExamOperationRoom Create(ExamOperationRoom obj)
 {
     return(_service.Create(obj));
 }