Beispiel #1
0
        public void AllLiveDemographicsUpdatable()
        {
            Mapper.Initialize(x =>
            {
                x.AddProfile <PatientProfiles>();
            });
            List <int> idsCannotExecute = new List <int>();

            using (var liveRepo = new Repository(() => new TrialDataContext()))
            {
                foreach (var p in liveRepo.Participants.ToList())
                {
                    PatientDemographicsModel model = Mapper.Map <PatientDemographicsModel>(p);
                    model.StudyCentre = liveRepo.FindStudyCentre(p.CentreId);
                    Assert.IsNotNull(model.StudyCentre, "Foreign key constraint violated: database does not include record for given study centre id: {0}", p.CentreId);
                    var vm = new PatientDemographicsViewModel(liveRepo, model);
                    vm.Name += " ";
                    if (!vm.UpdateDemographicsCmd.CanExecute(null))
                    {
                        idsCannotExecute.Add(model.Id);
                    }
                }
            }
            Assert.IsFalse(idsCannotExecute.Any(), "unable to update demographics for ids: {0}", string.Join(",", idsCannotExecute));
        }
Beispiel #2
0
 public PatientDemographicsViewModel(IRepository repository, PatientDemographicsModel patient) : base(repository)
 {
     base.DisplayName                  = Strings.NewPatientVM_DisplayName;
     _patient                          = patient ?? throw new ArgumentNullException("patient");
     HasSiblingEnrolled                = patient.MultipleSiblingId.HasValue;
     RandomiseCmd                      = new RelayCommand(Randomise, CanRandomise);
     ClearAllCmd                       = new RelayCommand(ClearAllFields, CanClear);
     AddScreenCmd                      = new RelayCommand(AddScreen, CanScreen);
     CloseWindowCmd                    = new RelayCommand(param => OnRequestClose(), param => true);
     UpdateDemographicsCmd             = new RelayCommand(UpdateDemographics, obj => WasValidOnLastNotify);
     _repository.StudySiteAddOrUpdate += Repository_StudySiteAddOrUpdate;
 }
Beispiel #3
0
        private void ClearAllFields()
        {
            _patient = new PatientDemographicsModel {
                WasEnvelopeRandomised = BlowTrialDataService.IsEnvelopeRandomising()
            };
            StudyCentre         = StudyCentreOptions.First().Key;
            _multipleSibling    = null;
            _hasSiblingEnrolled = false;

            _wtForAgeCentile = null;
            NotifyPropertyChanged("Name", "HospitalIdentifier", "AdmissionWeight", "GestAgeDays", "GestAgeWeeks", "IsMale", "DateOfBirth", "TimeOfBirth", "DateOfEnrollment", "TimeOfEnrollment", "LikelyDie24Hr", "BadMalform", "BadInfectnImmune", "WasGivenBcgPrior", "RefusedConsent", "MothersName", "WtForAgeCentile", "PhoneNumber", "IsYoungerThanMinEnrolTime", "EnvelopeNumber", "OkToRandomise", "IsConsentRequired", "HasSiblingEnrolled", "MultipleSiblingId", "HasNoPhone", "AdmissionDiagnosis", "StudyCentre", "BackgroundBrush", "TextBrush", "HospitalIdentifierMask", "PhoneMask", "IsInborn");
            RecordAltered = false;
            _isEnrollmentDateTimeAssigned = false;
        }
        void RegisterNewPatient()
        {
            PatientDemographicsViewModel newPatientVM = (PatientDemographicsViewModel)Workspaces.FirstOrDefault(w => w is PatientDemographicsViewModel);

            if (newPatientVM == null)
            {
                var newPatient = new PatientDemographicsModel {
                    WasEnvelopeRandomised = IsEnvelopeRandomising
                };
                newPatientVM = new PatientDemographicsViewModel(_repository, newPatient);
                this.Workspaces.Add(newPatientVM);
            }
            this.SetActiveWorkspace(newPatientVM);
        }