private void MetaInfoEnd(MetaInfoEndToken token)
        {
            Midwife m = parentStack.Peek();

            m.MetaMode = false;
            CreateInstance(m);
        }
 private void CreateInstance(Midwife m)
 {
     m.CreateInstance();
     if (m.Id != null)
     {
         id2obj.Add((int)m.Id, m.Obj);
     }
 }
        private void CompositeEndHandler(EndToken token)
        {
            Type    type    = typeIds[(int)token.TypeId];
            Midwife midwife = parentStack.Pop();

            if (midwife.Obj == null)
            {
                CreateInstance(midwife);
            }
            midwife.Populate();
            SetValue(token.Name, midwife.Obj);
        }
        private void InstantiateParent()
        {
            if (parentStack.Count == 0)
            {
                return;
            }
            Midwife m = parentStack.Peek();

            if (!m.MetaMode && m.Obj == null)
            {
                CreateInstance(m);
            }
        }
 private void SetValue(string name, object value)
 {
     if (parentStack.Count == 0)
     {
         parentStack.Push(new Midwife(value));
     }
     else
     {
         Midwife m = parentStack.Peek();
         if (m.MetaMode == false && m.Obj == null)
         {
             CreateInstance(m);
         }
         m.AddValue(name, value);
     }
 }
        public RecordViewModel()
        {
            SetValue(ChildBirthDateProperty, DateTime.Today);
            SetValue(ChildBirthTimeProperty, DateTime.Now);

            Messenger.Default.Register <NotificationMessage>(this, "LogOut", parameter =>
            {
                RecordCurrent.Note    = RecordCurrent.NewNote;
                RecordCurrent.NewNote = null;
            });
            Messenger.Default.Register <Record>(this, "NewRecordToRecordView", (ActiveRecord) => { RecordCurrent = ActiveRecord; Note = ActiveRecord.Note; });
            Messenger.Default.Register <Patient>(this, "PatientToRecordView", (ActivePatient) => { PatientCurrent = ActivePatient; });
            Messenger.Default.Register <Employee>(this, "EmployeetoRecordView", (ActiveEmployee) => { EmployeeCurrent = ActiveEmployee; });
            Messenger.Default.Register <String>(this, "SaveToDatabase", (thestring) => ExitAndSave());

            _availableMedicalServices.AddRange(Ward.MedicalServicesList);
            #region Command Definitions
            //Command to add a medical service to the list of medical services
            this.AddMedicalService = new RelayCommand(parameter =>
            {
                MedicalServicesList.Add(SelectedAvailableMedicalServiceInfo);
            });
            //Command to create a new child in the system
            this.CreateChildCommand = new RelayCommand(parameter =>
            {
                Midwife tempMidwife = EmployeeCurrent as Midwife;
                ChildBirthDate      = ChildBirthDate.Add(ChildBirthTime.TimeOfDay);
                tempMidwife.CreatePatient(PatientCurrent, ChildGender, ChildBirthDate);
                Patient tempChild      = PatientCurrent.Children.Last();
                RecordCurrent.ChildCPR = tempChild.CPR;
                new P3_Midwife.Views.NewChildWindow(RecordCurrent);
                Messenger.Default.Send(RecordCurrent, "ChildRecordToNewChildView");
                Messenger.Default.Send(PatientCurrent, "PatientToNewChildView");
                Messenger.Default.Send(EmployeeCurrent, "EmployeetoNewChildView");
                Messenger.Default.Send(tempChild, "ChildToNewChildView");
                Messenger.Default.Send <NotificationMessage>(new NotificationMessage("ToNewChild"));
            });
            //Command to remove a medical service from the list of medical services
            this.RemoveMedicalService = new RelayCommand(parameter =>
            {
                MedicalServicesList.Remove(SelectedMedicalServiceInfo);
            });
            //Command to return to the record view without creating a child
            this.Cancel = new RelayCommand(parameter =>
            {
                Messenger.Default.Send <NotificationMessage>(new NotificationMessage("ToRecord"));
            });
            //Command to log the user out of the system
            this.LogOutCommand = new RelayCommand(parameter =>
            {
                Filemanagement.SaveToDatabase(PatientCurrent);
                this.RecordCurrent.BirthInformationList.AddRange(BirthInformationListProperty.Where(x => !RecordCurrent.BirthInformationList.Contains(x)));
                this.RecordCurrent.ContractionIVDripList.AddRange(ContractionListProperty.Where(x => !RecordCurrent.ContractionIVDripList.Contains(x)));
                this.RecordCurrent.MicturitionList.AddRange(MicturitionListProperty.Where(x => !RecordCurrent.MicturitionList.Contains(x)));
                this.RecordCurrent.VaginalExplorationList.AddRange(VaginalExplorationListProperty.Where(x => !RecordCurrent.VaginalExplorationList.Contains(x)));
                this.RecordCurrent.FetusObservationList.AddRange(FetusObservationListProperty.Where(x => !RecordCurrent.FetusObservationList.Contains(x)));
                this.RecordCurrent.CurrentBill.BillItemList.AddRange(MedicalServicesList.Where(x => !RecordCurrent.CurrentBill.BillItemList.Contains(x)));
                Filemanagement.SaveRecord(RecordCurrent);
                System.Diagnostics.Process.Start(Application.ResourceAssembly.Location);
                Application.Current.Shutdown();
            });
            //Command to close to program
            this.ExitCommand = new RelayCommand(parameter =>
            {
                ExitAndSave();
            });
            //Command to return to the previous view
            this.BackCommand = new RelayCommand(Parameter =>
            {
                Filemanagement.SaveToDatabase(PatientCurrent);
                this.RecordCurrent.BirthInformationList.AddRange(BirthInformationListProperty.Where(x => !RecordCurrent.BirthInformationList.Contains(x)));
                BirthInformationListProperty.Clear();
                this.RecordCurrent.ContractionIVDripList.AddRange(ContractionListProperty.Where(x => !RecordCurrent.ContractionIVDripList.Contains(x)));
                ContractionListProperty.Clear();
                this.RecordCurrent.MicturitionList.AddRange(MicturitionListProperty.Where(x => !RecordCurrent.MicturitionList.Contains(x)));
                MicturitionListProperty.Clear();
                this.RecordCurrent.VaginalExplorationList.AddRange(VaginalExplorationListProperty.Where(x => !RecordCurrent.VaginalExplorationList.Contains(x)));
                VaginalExplorationListProperty.Clear();
                this.RecordCurrent.FetusObservationList.AddRange(FetusObservationListProperty.Where(x => !RecordCurrent.FetusObservationList.Contains(x)));
                FetusObservationListProperty.Clear();
                this.RecordCurrent.CurrentBill.BillItemList.AddRange(MedicalServicesList.Where(x => !RecordCurrent.CurrentBill.BillItemList.Contains(x)));
                MedicalServicesList.Clear();
                Filemanagement.SaveRecord(RecordCurrent);
                Messenger.Default.Send(EmployeeCurrent, "Employee");
                Messenger.Default.Send(PatientCurrent, "Patient");
                Messenger.Default.Send(new NotificationMessage("ToPatient"));
            });
            //Command to open a view where a new child can be created in the system
            this.NewChildDialogCommand = new RelayCommand(parameter =>
            {
                this.RecordCurrent.BirthInformationList.AddRange(BirthInformationListProperty.Where(x => !RecordCurrent.BirthInformationList.Contains(x)));
                this.RecordCurrent.ContractionIVDripList.AddRange(ContractionListProperty.Where(x => !RecordCurrent.ContractionIVDripList.Contains(x)));
                this.RecordCurrent.MicturitionList.AddRange(MicturitionListProperty.Where(x => !RecordCurrent.MicturitionList.Contains(x)));
                this.RecordCurrent.VaginalExplorationList.AddRange(VaginalExplorationListProperty.Where(x => !RecordCurrent.VaginalExplorationList.Contains(x)));
                this.RecordCurrent.FetusObservationList.AddRange(FetusObservationListProperty.Where(x => !RecordCurrent.FetusObservationList.Contains(x)));
                this.RecordCurrent.CurrentBill.BillItemList.AddRange(MedicalServicesList.Where(x => !RecordCurrent.CurrentBill.BillItemList.Contains(x)));
                Messenger.Default.Send(new NotificationMessage("NewChildDialog"));
            });
            //Command to save and archive a record, so that it cannot be edited anymore. The patient is also transfered away from the room
            this.SaveAndCompleteCommand = new RelayCommand(parameter =>
            {
                Messenger.Default.Send(new NotificationMessage("RecordSave"));
                this.RecordCurrent.Note += "\n" + RecordCurrent.NewNote;
                this.RecordCurrent.BirthInformationList.AddRange(BirthInformationListProperty.Where(x => !RecordCurrent.BirthInformationList.Contains(x)));
                this.RecordCurrent.BirthInformationList.AddRange(BirthInformationListProperty);
                BirthInformationListProperty.Clear();
                this.RecordCurrent.ContractionIVDripList.AddRange(ContractionListProperty.Where(x => !RecordCurrent.ContractionIVDripList.Contains(x)));
                ContractionListProperty.Clear();
                this.RecordCurrent.MicturitionList.AddRange(MicturitionListProperty.Where(x => !RecordCurrent.MicturitionList.Contains(x)));
                MicturitionListProperty.Clear();
                this.RecordCurrent.VaginalExplorationList.AddRange(VaginalExplorationListProperty.Where(x => !RecordCurrent.VaginalExplorationList.Contains(x)));
                VaginalExplorationListProperty.Clear();
                this.RecordCurrent.FetusObservationList.AddRange(FetusObservationListProperty.Where(x => !RecordCurrent.FetusObservationList.Contains(x)));
                FetusObservationListProperty.Clear();
                this.RecordCurrent.CurrentBill.BillItemList.AddRange(MedicalServicesList.Where(x => !RecordCurrent.CurrentBill.BillItemList.Contains(x)));
                MedicalServicesList.Clear();
                RecordCurrent.IsActive = false;
                (EmployeeCurrent as Midwife).TransferPatient(PatientCurrent);
                Filemanagement.SaveToDatabase(PatientCurrent);
                Filemanagement.SaveRecord(RecordCurrent);
                Messenger.Default.Send(new NotificationMessage("ToPatient"));
                Messenger.Default.Send(EmployeeCurrent, "Employee");
                Messenger.Default.Send(PatientCurrent, "Patient");
            });
            //Command to add a new line of the type Birth Information in the record view
            this.AddBirthInfo = new RelayCommand(parameter =>
            {
                BirthInfo = new BirthInformation();
                BirthInfo.CurrentEmployee = EmployeeCurrent;
                BirthInformationListProperty.Add(BirthInfo);
            });
            //Command to add a new line of the type ContractionIVDrip Informaion  in the record view
            this.AddContractionIVDripInfo = new RelayCommand(parameter =>
            {
                ContractionIVDripInfo = new ContractionIVDrip();
                ContractionIVDripInfo.CurrentEmployee = EmployeeCurrent;
                ContractionListProperty.Add(ContractionIVDripInfo);
            });
            //Command to add a new line of the type Fetus Observation Information in the record view
            this.AddFetusObservationInfo = new RelayCommand(parameter =>
            {
                FetusObservationInfo = new FetusObservation();
                FetusObservationInfo.CurrentEmployee = EmployeeCurrent;
                FetusObservationListProperty.Add(FetusObservationInfo);
            });
            //Command to add a new line of the type Micturition Information in the record view
            this.AddMicturitionInfo = new RelayCommand(parameter =>
            {
                MicturitionInfo = new Micturition();
                MicturitionInfo.CurrentEmployee = EmployeeCurrent;
                MicturitionListProperty.Add(MicturitionInfo);
            });
            //Command to add a new line of the type Vaginal Exploration Information in the record view
            this.AddVaginalExplorationInfo = new RelayCommand(parameter =>
            {
                VaginalExplorationInfo = new VaginalExploration();
                VaginalExplorationInfo.CurrentEmployee = EmployeeCurrent;
                VaginalExplorationListProperty.Add(VaginalExplorationInfo);
            });
            #endregion
        }
Exemple #7
0
 private void CreateInstance(Midwife m) {
   m.CreateInstance();
   if (m.Id != null)
     id2obj.Add((int)m.Id, m.Obj);
 }
Exemple #8
0
 private void InitNewChild(Employee employee)
 {
     CurrentEmployee = employee;
     Midwife temp = CurrentEmployee as Midwife;
 }
Exemple #9
0
        public List <Clinician> GenerateClinicians()
        {
            List <Clinician> list = new List <Clinician>();

            Context clinicContext = new Context();

            for (int i = 0; i < 10; i++)
            {
                var temp = new Midwife()
                {
                    FirstName = GetRandomFirstName(),
                    LastName  = GetRandomLastName(),
                    DoB       = DateTime.Today
                };

                list.Add(temp);
            }

            for (int i = 0; i < 4; i++)
            {
                var temp = new Secretary()
                {
                    FirstName = GetRandomFirstName(),
                    LastName  = GetRandomLastName(),
                    DoB       = DateTime.Today
                };

                list.Add(temp);
            }

            for (int i = 0; i < 20; i++)
            {
                var temp = new Nurse()
                {
                    FirstName = GetRandomFirstName(),
                    LastName  = GetRandomLastName(),
                    DoB       = DateTime.Today
                };

                list.Add(temp);
            }

            for (int i = 0; i < 5; i++)
            {
                var temp = new Doctor()
                {
                    FirstName = GetRandomFirstName(),
                    LastName  = GetRandomLastName(),
                    DoB       = DateTime.Today
                };

                list.Add(temp);
            }

            for (int i = 0; i < 20; i++)
            {
                var temp = new SocialHealthAss()
                {
                    FirstName = GetRandomFirstName(),
                    LastName  = GetRandomLastName(),
                    DoB       = DateTime.Today
                };

                list.Add(temp);
            }
            return(list);
        }