Esempio n. 1
0
        public PatientViewModel(Nurse sessionDoctor)
        {
            try
            {
                ((IDatabaseCommutable)sessionDoctor).LoadFromDb(sessionDoctor.Id);
            }
            catch (KeyNotFoundException)
            {
                ErrorWindow errorWindow = new ErrorWindow("A database error occured");
                errorWindow.ShowDialog();
            }
            catch (HaveBeenFiredException e)
            {
                ErrorWindow errorWindow = new ErrorWindow(e);
                errorWindow.ShowDialog();
            }

            CurrentDoc = sessionDoctor;

            AllPatients = PatientLoader.LoadAll();

            foreach (Patient patient in CurrentDoc.Patients)
            {
                foreach (Patient patientFromAll in AllPatients)
                {
                    if (patientFromAll.Id == patient.Id)
                    {
                        AllPatients.Remove(patientFromAll);
                        break;
                    }
                }
            }
        }
Esempio n. 2
0
        public NewDocViewModel(HeadPhysician sessionDoctor)
        {
            try
            {
                ((IDatabaseCommutable)sessionDoctor).LoadFromDb(sessionDoctor.Id);
            }
            catch (KeyNotFoundException)
            {
                ErrorWindow errorWindow = new ErrorWindow("A database error occured");
                errorWindow.ShowDialog();
            }
            catch (HaveBeenFiredException e)
            {
                ErrorWindow errorWindow = new ErrorWindow(e);
                errorWindow.ShowDialog();
            }

            CurrentDoc = sessionDoctor;
        }
Esempio n. 3
0
        public MeViewModel(Nurse sessionDoctor)
        {
            // LOAD AGAIN TO UPDATE IF SMTH CHANGED; (WE GONNA CALL SOME ERRORS BEEEACH)
            try
            {
                ((IDatabaseCommutable)sessionDoctor).LoadFromDb(sessionDoctor.Id);
            }
            catch (KeyNotFoundException)
            {
                ErrorWindow errorWindow = new ErrorWindow("A database error occured");
                errorWindow.ShowDialog();
            }
            catch (HaveBeenFiredException e)
            {
                ErrorWindow errorWindow = new ErrorWindow(e);
                errorWindow.ShowDialog();
            }

            CurrentDoc = sessionDoctor;
        }
Esempio n. 4
0
        public DoctorsViewModel(Nurse sessionDoctor)
        {
            try
            {
                ((IDatabaseCommutable)sessionDoctor).LoadFromDb(sessionDoctor.Id);
            }
            catch (KeyNotFoundException)
            {
                ErrorWindow errorWindow = new ErrorWindow("A database error occured");
                errorWindow.ShowDialog();
            }
            catch (HaveBeenFiredException e)
            {
                ErrorWindow errorWindow = new ErrorWindow(e);
                errorWindow.ShowDialog();
            }

            CurrentDoc = sessionDoctor;

            AllDoctors    = PatientLoader.LoadDoctors();
            AllNurses     = PatientLoader.LoadNurses();
            AllHeadPhyses = PatientLoader.LoadHeadPhyses();
        }