Пример #1
0
 private void chosenPatient_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     Filemanagement.ReadBirthRecords((Patient)chosenPatient.SelectedItem);
     Messenger.Default.Send <Employee>((Employee)chosenPatient.Tag, "Employee");
     Messenger.Default.Send <Patient>((Patient)chosenPatient.SelectedItem, "Patient");
     Messenger.Default.Send <NotificationMessage>(new NotificationMessage("ToPatient"));
 }
Пример #2
0
 public LoginViewModel()
 {
     Filemanagement.InitialiseFoldersAndFiles();
     //Command to log in to the system
     this.LoginCommand = new RelayCommand(parameter =>
     {
         if (Ward.Employees.Exists(x => x.Email.ToUpper() == Email.ToUpper() && x.Password.Equals(Password)))
         {
             Employee SendEmp = Ward.Employees.Find(x => x.Email.ToUpper() == Email.ToUpper() && x.Password.Equals(Password));
             Messenger.Default.Send(new NotificationMessage("StartWorker"));
             Messenger.Default.Send(new NotificationMessage(last));
             Messenger.Default.Send(SendEmp, "ActiveUser");
             if (last == "FromLogInToHome")
             {
                 last = "ToHome";
             }
             Messenger.Default.Send(new NotificationMessage(last));
         }
         else
         {
             MessageBox.Show("Ugyldigt login", "Fejl");
         }
     });
     //Command to log the user out of the system
     this.LogOutCommand = new RelayCommand(parameter =>
     {
         System.Diagnostics.Process.Start(Application.ResourceAssembly.Location);
         Application.Current.Shutdown();
     });
     Messenger.Default.Register <NotificationMessage>(this, setLast);
 }
Пример #3
0
        public HomeScreenViewModel()
        {
            Messenger.Default.Register <Employee>(this, "ActiveUser", (ActiveUser) => { CurrentEmployee = ActiveUser; });
            Messenger.Default.Register <Employee>(this, "ReturnEmployee", (ActiveUser) => { CurrentEmployee = ActiveUser; });
            Messenger.Default.Register <NotificationMessage>(this, bw_StartWorker);

            //Command to log the user out of the system
            this.LogOutCommand = new RelayCommand(parameter =>
            {
                logoutCommand();
            });
            //Command to close to program
            this.ExitCommand = new RelayCommand(parameter =>
            {
                Application.Current.Shutdown();
            });
            //Command to find a patient from a userinput
            this.FindPatientCommand = new RelayCommand(parameter =>
            {
                SelectedPatient = FindPatient(CPR);
                if (SelectedPatient != null)
                {
                    Messenger.Default.Send <Employee>(CurrentEmployee, "Employee");
                    Messenger.Default.Send <Patient>(SelectedPatient, "Patient");
                    Messenger.Default.Send <NotificationMessage>(new NotificationMessage("ToPatient"));
                }
                else
                {
                    Messenger.Default.Send <NotificationMessage>(new NotificationMessage("NoCPRInput"));
                }
            });
            //Command to open the view where the user can add a patient to their active patients
            this.OpenAddPatientCommand = new RelayCommand(parameter =>
            {
                Messenger.Default.Send(new NotificationMessage("ToDialog"));
                Messenger.Default.Send <Employee>(CurrentEmployee, "Employee");
            });
            //Command to open the patient view
            this.OpenPatientCommand = new RelayCommand(parameter =>
            {
                Messenger.Default.Send <Employee>(CurrentEmployee, "Employee");
                Messenger.Default.Send <Patient>(SelectedPatient, "Patient");
                Messenger.Default.Send <NotificationMessage>(new NotificationMessage("ToPatient"));
            });
            //Command to open the patient view when a patient is clicked in the list of active patients
            this.OpenPatientOnClick = new RelayCommand(parameter =>
            {
                if (SelectedPatient != null)
                {
                    Filemanagement.ReadBirthRecords(SelectedPatient);
                    Messenger.Default.Send <Employee>(CurrentEmployee, "Employee");
                    Messenger.Default.Send <Patient>(SelectedPatient, "Patient");
                    Messenger.Default.Send <NotificationMessage>(new NotificationMessage("ToPatient"));
                }
            });
            bw.RunWorkerAsync();
            bw.WorkerSupportsCancellation = true;
            bw.DoWork             += new DoWorkEventHandler(bw_DoWork);
            bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
        }
Пример #4
0
        //Method to create a patient when a baby is born.
        public void CreatePatient(Patient mother, char gender, DateTime date)
        {
            Patient child = new Patient(gender, date, mother);

            Ward.Patients.Add(child);
            Ward.DeliveryRooms.Find(x => x.PatientsInRoom.Contains(mother)).PatientsInRoom.Add(child);
            Filemanagement.CreatePatientFolderAndFile(child);
        }
Пример #5
0
 public static void InitialiseFoldersAndFiles()
 {
     InitialiseMainFolders();
     Filemanagement.CreatePatientFolderAndFile(new Patient("0110960042", "Cecilie De-la-cour"));
     Filemanagement.CreatePatientFolderAndFile(new Patient("1805960074", "Line Grigel"));
     Filemanagement.CreatePatientFolderAndFile(new Patient("1406880148", "Anne Jensen"));
     Filemanagement.CreatePatientFolderAndFile(new Patient("0711940138", "Trine Østergaard"));
     Filemanagement.CreatePatientFolderAndFile(new Patient("0109940178", "Estavana Poldman"));
     Filemanagement.CreatePatientFolderAndFile(new Patient("0909990068", "Veronika Kristiansen"));
     ReadPatients();
     //ReadWords();
     InitialiseAdminFiles();
 }
Пример #6
0
        private static void ExitAndSave(CancelEventArgs e)
        {
            MessageBoxResult result = MessageBox.Show("Data er muligvis ikke blevet gemt. \n Vil du gemme inden programmet lukkes?", "Gem og afslut", MessageBoxButton.YesNoCancel, MessageBoxImage.Warning);

            if (result == MessageBoxResult.Yes)
            {
                Filemanagement.SaveToDatabase();
                e.Cancel = false;
                Application.Current.Shutdown();
            }
            else if (result == MessageBoxResult.No)
            {
                Application.Current.Shutdown();
            }
            else if (result == MessageBoxResult.Cancel || result == MessageBoxResult.None)
            {
                e.Cancel = true;
            }
        }
Пример #7
0
 //Admits patient to the ward. Also places patient in a room using the AssignPatientToDRoom method
 public void AdmitPatient(Patient patient)
 {
     AssignPatientToDRoom(patient);
     this.CurrentPatients.Add(patient);
     Filemanagement.SaveToDatabase(patient);
 }