Пример #1
0
 public void RaiseOnAddedParticipant(ParticipantEventArgs e)
 {
     if (OnAddedParticipant != null)
     {
         OnAddedParticipant(null, e);
     }
 }
Пример #2
0
 public void RaiseOnDeletingParticipant(ParticipantEventArgs e)
 {
     if (OnDeletingParticipant != null)
     {
         OnDeletingParticipant(null, e);
     }
 }
        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;
        }
Пример #4
0
 public void RaiseOnAddedParticipant(ParticipantEventArgs e)
 {
     if (OnAddedParticipant != null)
         OnAddedParticipant(null, e);
 }
Пример #5
0
 public void RaiseOnDeletingParticipant(ParticipantEventArgs e)
 {
     if (OnDeletingParticipant != null)
         OnDeletingParticipant(null, e);
 }