Пример #1
0
 private void ParticipantProviderBase_OnAddingParticipant(object sender, ParticipantEventArgs e)
 {
     if (string.IsNullOrEmpty(e.CurrentParticipant.XForm))
     {
         StringBuilder xform = new StringBuilder();
         xform.AppendLine("<instance>");
         var eventRef  = e.CurrentParticipant.EventPage;
         var rep       = EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance <IContentRepository>();
         var eventPage = rep.Get <EventPage>(eventRef);
         if (eventPage != null && eventPage.RegistrationFormContainer != null)
         {
             foreach (ContentAreaItem contentAreaItem in eventPage.RegistrationFormContainer.FilteredItems)
             {
                 if (contentAreaItem.ContentLink != null)
                 {
                     var formContainerBlock = rep.Get <FormContainerBlock>(contentAreaItem.ContentLink);
                     if (formContainerBlock != null)
                     {
                         foreach (ContentAreaItem formElement in formContainerBlock.ElementsArea.FilteredItems)
                         {
                             IContent element = rep.Get <IContent>(formElement.ContentLink);
                             if (element != null && !string.IsNullOrEmpty(element.Name) && (element as AttendSubmitButton == null))
                             {
                                 xform.AppendLine("<" + element.Name + ">" + "</" + element.Name + ">");
                             }
                         }
                     }
                 }
             }
         }
         xform.AppendLine("</instance>");
         e.CurrentParticipant.XForm = xform.ToString();
     }
 }
Пример #2
0
        private void OnNewParticipant(object sender, ParticipantEventArgs e)
        {
            ListViewItem item = listViewParticipants.Items.Add(e.Participant.ApplicationName);

            item.SubItems.Add(e.Participant.ParticipantCoupon.ToString());
            item.SubItems.Add(e.Participant.Suspended ? "X" : string.Empty);
            item.SubItems.Add(e.Participant.Secure ? "X" : string.Empty);
            item.Tag = e.Participant;
        }
Пример #3
0
        void _repository_ParticipantUpdated(object sender, ParticipantEventArgs e)
        {
            if (e.Participant.ProtocolViolations == null)
            {
                e.Participant.ProtocolViolations = _repository.ProtocolViolations.Where(v => v.ParticipantId == e.Participant.Id).ToList();
            }

            handleParrticipantUpdated(e.Participant);
        }
Пример #4
0
        public override IParticipant GenerateParticipant(ContentReference EventPageBase, string email, bool sendMail, string xform, string logText)
        {
            var contentRepository = ServiceLocator.Current.GetInstance <IContentRepository>();

            EventPageBase EventPageBaseData = contentRepository.Get <EventPageBase>(EventPageBase);

            ContentFolder participantsFolder = GetOrCreateParticipantsFolder(EventPageBase);

            ParticipantBlock newParticipant = contentRepository.GetDefault <ParticipantBlock>(participantsFolder.ContentLink);

            (newParticipant as IContent).Name = email;
            newParticipant.Code          = GenerateCode();
            newParticipant.XForm         = xform;
            newParticipant.EventPage     = EventPageBase as PageReference;
            newParticipant.Email         = email;
            newParticipant.AttendStatus  = (GetAvailableSeats(EventPageBase) > 0) ? AttendStatus.Confirmed.ToString() : AttendStatus.Submitted.ToString();
            newParticipant.Price         = EventPageBaseData.EventDetails.Price;
            newParticipant.Username      = EPiServerProfile.Current.UserName;
            newParticipant.DateSubmitted = DateTime.Now;

            ParticipantEventArgs e1 = new ParticipantEventArgs();

            e1.CurrentParticipant = newParticipant;
            e1.CancelEvent        = false;
            e1.SendMail           = sendMail;
            RaiseOnAddingParticipant(e1);

            if (e1.CancelEvent == true)
            {
                return(null);
            }

            contentRepository.Save(newParticipant as IContent, EPiServer.DataAccess.SaveAction.Publish, EPiServer.Security.AccessLevel.NoAccess);
            newParticipant = ParticipantLog.AddLogTextAndSave("Generated", logText, newParticipant as ParticipantBlock) as ParticipantBlock;
            newParticipant = ParticipantLog.AddLogTextAndSave("Status", "Status set to " + newParticipant.AttendStatus, newParticipant as IParticipant) as ParticipantBlock;

            sendMail = e1.SendMail;

            ParticipantEventArgs e2 = new ParticipantEventArgs();

            e2.CurrentParticipant = newParticipant;
            e2.CancelEvent        = false;
            e2.SendMail           = sendMail;
            RaiseOnAddedParticipant(e2);

            sendMail = e1.SendMail;

            if (sendMail)
            {
                SendStatusMail(newParticipant);
            }



            return(newParticipant);
        }
Пример #5
0
        private void RaiseParticipantCreatedEvent(ParticipantBaseModel participant)
        {
            var handler = ParticipantCreated;

            if (handler != null)
            {
                ParticipantEventArgs e = new ParticipantEventArgs(participant);
                handler(this, e);
            }
        }
Пример #6
0
        private void OnParticipantAdded(object sender, ParticipantEventArgs e)
        {
            var partBase = ParticipantBaseMap(e.Participant);

            partBase.StudyCentre = _repository.FindStudyCentre(partBase.CentreId);
            var viewModel = new ParticipantListItemViewModel(partBase, _repository);

            _ageUpdater.AddParticipant(viewModel);
            AllParticipants.AddNewItem(viewModel);
            AllParticipants.CommitNew();
            SetDisplayName();
        }
Пример #7
0
        private void OnSecureBind(object sender, ParticipantEventArgs e)
        {
            for (int i = 0; i < listViewParticipants.Items.Count; i++)
            {
                ListViewItem item = listViewParticipants.Items[i];

                if (item.Tag == e.Participant)
                {
                    item.SubItems[3].Text = e.Participant.Secure ? "X" : string.Empty;
                    break;
                }
            }
        }
Пример #8
0
        private void OnParticipantStateChange(object sender, ParticipantEventArgs e)
        {
            for (int i = 0; i < listViewParticipants.Items.Count; i++)
            {
                ListViewItem item = listViewParticipants.Items[i];

                if (item.Tag == e.Participant)
                {
                    item.SubItems[2].Text = e.Participant.Suspended ? "X" : string.Empty;
                    break;
                }
            }
        }
        public override IParticipant GenerateParticipant(ContentReference EventPageBase, string email, bool sendMail, string xform, string logText)
        {
            var contentRepository = ServiceLocator.Current.GetInstance<IContentRepository>();

            EventPageBase EventPageBaseData = contentRepository.Get<EventPageBase>(EventPageBase);

            ContentFolder participantsFolder = GetOrCreateParticipantsFolder(EventPageBase);

            ParticipantBlock newParticipant = contentRepository.GetDefault<ParticipantBlock>(participantsFolder.ContentLink);
            (newParticipant as IContent).Name = email;
            newParticipant.Code = GenerateCode();
            newParticipant.XForm = xform;
            newParticipant.EventPage = EventPageBase as PageReference;
            newParticipant.Email = email;
            newParticipant.AttendStatus = (GetAvailableSeats(EventPageBase) > 0) ? AttendStatus.Confirmed.ToString() : AttendStatus.Submitted.ToString();
            newParticipant.Price = EventPageBaseData.EventDetails.Price;
            newParticipant.Username = EPiServerProfile.Current.UserName;
            newParticipant.DateSubmitted = DateTime.Now;

            ParticipantEventArgs e1 = new ParticipantEventArgs();
            e1.CurrentParticipant = newParticipant;
            e1.CancelEvent = false;
            e1.SendMail = sendMail;
            RaiseOnAddingParticipant(e1);

            if (e1.CancelEvent == true)
                return null;

            contentRepository.Save(newParticipant as IContent, EPiServer.DataAccess.SaveAction.Publish, EPiServer.Security.AccessLevel.NoAccess);
            newParticipant = ParticipantLog.AddLogTextAndSave("Generated", logText, newParticipant as ParticipantBlock) as ParticipantBlock;
            newParticipant = ParticipantLog.AddLogTextAndSave("Status", "Status set to " + newParticipant.AttendStatus, newParticipant as IParticipant) as ParticipantBlock;

            sendMail = e1.SendMail;

            ParticipantEventArgs e2 = new ParticipantEventArgs();
            e2.CurrentParticipant = newParticipant;
            e2.CancelEvent = false;
            e2.SendMail = sendMail;
            RaiseOnAddedParticipant(e2);

            sendMail = e1.SendMail;

            if (sendMail)
                SendStatusMail(newParticipant);




            return newParticipant;
        }
Пример #10
0
        void _repository_ParticipantAdded(object sender, ParticipantEventArgs e)
        {
            var newPos = _participantData.AddParticipant(e.Participant.Id, e.Participant.TrialArm, ParticipantBaseModel.DataRequiredFunc(e.Participant));

            if (_participantData.ColHeaders.Count > ParticipantData.ColHeaders.Count) //1st patient randomised to new arm
            {
                int newColIndex = _participantData.ColHeaders.Count - 1;
                for (var i = 0; i < _participantData.Participants.Length; i++)
                {
                    ParticipantData.Row[i].SummaryCells.Add(new ParticipantSummaryItemViewModel(_participantData.Participants[i][newColIndex]));
                }
                ParticipantData.ColHeaders.Add(ParticipantBaseModel.GetTrialArmDescription(_participantData.ColHeaders[newColIndex]));
            }
            ParticipantData.Row[newPos.x].SummaryCells[newPos.y].ParticipantIds = _participantData.Participants[newPos.x][newPos.y];
        }
Пример #11
0
        private void OnParticipantLeave(object sender, ParticipantEventArgs e)
        {
            for (int i = 0; i < listViewParticipants.Items.Count; i++)
            {
                ListViewItem item = listViewParticipants.Items[i];

                if (item.Tag == e.Participant)
                {
                    listViewParticipants.Items.Remove(item);
                    break;
                }
            }

            if (listViewParticipants.Items.Count == 0)
            {
                listViewContext.Items.Clear();
            }
        }
Пример #12
0
        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();
        }
Пример #13
0
 private void ActivityCloudConnectorParticipantAdded(object sender, ParticipantEventArgs e)
 {
     ActivityStore.Activities[e.ActivityId].Participants.Add(e.Participant);
     var participantAddedToActivity = new
                                          {
                                              u = e.Participant,
                                              activityId = e.ActivityId
                                          };
     _publisher.Publish(UserEvents.ParticipantAdded.ToString(), participantAddedToActivity);
 }
Пример #14
0
 protected virtual void OnParticipantCreated(ParticipantEventArgs e)
 {
     if (ParticipantCreated != null)
         ParticipantCreated(this, e);
 }