Exemple #1
0
 public ParticipantUpdateView(ParticipantProgressViewModel model)
 {
     DataContextChanged += ParticipantUpdateView_DataContextChanged;
     Closed             += ParticipantUpdateView_Closed;
     DataContext         = model;
     InitializeComponent();
 }
        void HandleParticipantUpdate(object sender, ParticipantEventArgs e)
        {
            var assdVM = ((List <ParticipantListItemViewModel>)AllParticipants.SourceCollection)
                         .First(p => p.Id == e.Participant.Id);

            AllParticipants.EditItem(assdVM);
            UpdateDemographics(e.Participant, assdVM);
            assdVM.VaccinesAdministered       = e.Participant.VaccinesAdministered;
            assdVM.UnsuccessfulFollowUps      = e.Participant.UnsuccessfulFollowUps;
            assdVM.OutcomeAt28Days            = e.Participant.OutcomeAt28Days;
            assdVM.DischargeDateTime          = e.Participant.DischargeDateTime;
            assdVM.DeathOrLastContactDateTime = e.Participant.DeathOrLastContactDateTime;
            assdVM.CauseOfDeath             = e.Participant.CauseOfDeath;
            assdVM.FollowUpBabyBCGReaction  = e.Participant.FollowUpBabyBCGReaction;
            assdVM.PermanentlyUncontactable = e.Participant.PermanentlyUncontactable;
            assdVM.MaternalBCGScar          = e.Participant.MaternalBCGScar;

            if (_updateWindow != null && ((ParticipantProgressViewModel)_updateWindow.DataContext).Id == assdVM.Id)
            {
                //this is here for data oversite, when update comes without having entered the data. For data collection sites, values should be the same and so updates will not be notified
                ParticipantProgressViewModel sp = (ParticipantProgressViewModel)_updateWindow.DataContext;
                UpdateDemographics(e.Participant, sp);
                sp.OutcomeAt28Days            = e.Participant.OutcomeAt28Days;
                sp.CauseOfDeath               = e.Participant.CauseOfDeath;
                sp.DeathOrLastContactDateTime = e.Participant.DeathOrLastContactDateTime;
                sp.DischargeDateTime          = e.Participant.DischargeDateTime;
                sp.LastContactWeight          = e.Participant.LastContactWeight;
                sp.LastWeightDate             = e.Participant.LastWeightDate;
                sp.OtherCauseOfDeathDetail    = e.Participant.OtherCauseOfDeathDetail;
                sp.BcgAdverse                = e.Participant.BcgAdverse;
                sp.BcgAdverseDetail          = e.Participant.BcgAdverseDetail;
                sp.BcgPapuleAtDischarge      = e.Participant.BcgPapuleAtDischarge;
                sp.IsParticipantModelChanged = false;
                sp.IsVaccineAdminChanged     = false; //ensure save changes is not enabled
                //assdVM.ParticipantModel = sp.ParticipantModel;
            }
            AllParticipants.CommitEdit();
        }