Esempio n. 1
0
 void Instance_PublishingContent(object sender, EPiServer.ContentEventArgs e)
 {
     if (e.Content as ParticipantBlock != null)
     {
         ParticipantBlock participant = (e.Content as ParticipantBlock);
         ParticipantLog.AddLogText("Saved", "Participant saved with e-mail " + participant.Email + " and status " + participant.AttendStatus, participant);
     }
 }
        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);
        }
Esempio n. 3
0
        public bool SendStatusMail(ParticipantBlock participant, EmailTemplateBlock et)
        {
            EmailSender email;

            email = new EmailSender(participant, et);

            email.Send();

            return(true);
        }
Esempio n. 4
0
 public static string StatusCssClass(this ParticipantBlock participantBlock)
 {
     if (participantBlock.AttendStatus == AttendStatus.Confirmed.ToString())
     {
         return("panel-success");
     }
     if (participantBlock.AttendStatus == AttendStatus.Submitted.ToString() || participantBlock.AttendStatus == AttendStatus.Standby.ToString())
     {
         return("panel-warning");
     }
     if (participantBlock.AttendStatus == AttendStatus.Cancelled.ToString() || participantBlock.AttendStatus == AttendStatus.Deleted.ToString())
     {
         return("panel-danger");
     }
     return("");
 }
Esempio n. 5
0
 protected string[] GetInvoiceValues(ParticipantBlock participant)
 {
     string[] values = GetInvoiceFields();
     for (int i = 0; i < values.Length; i++)
     {
         if (values[i] == "eventname")
         {
             values[i] = GetCourseName(participant.EventPage) + " for " + GetFormData(participant, "firstname") + " " + GetFormData(participant, "lastname");
         }
         else
         {
             values[i] = GetFormData(participant, values[i]);
         }
     }
     return(values);
 }
Esempio n. 6
0
        public static Control GetSessionsControl(ContentReference currentEvent, ParticipantBlock participant)
        {
            var         sessions = AttendSessionEngine.GetSessionsList(currentEvent);
            PlaceHolder ph       = new PlaceHolder();

            foreach (AttendSessionEngine.Session session in sessions)
            {
                if (session.CheckBox)
                {
                    var cb = new CheckBox()
                    {
                        Enabled = session.Enabled, Checked = (from ContentAreaItem item in participant.Sessions.Items where item.ContentLink.ID == session.ContentID select item).Any()
                    };
                    cb.InputAttributes.Add("value", session.ContentID.ToString());
                    cb.InputAttributes.Add("name", session.Group);
                    ph.Controls.Add(cb);
                    ph.Controls.Add(new LiteralControl(session.Name + "<br/>"));
                }
                else
                {
                    if (session.NewGroup)
                    {
                        ph.Controls.Add(new LiteralControl("<br/>"));
                    }
                    var li = new RadioButton()
                    {
                        Enabled = session.Enabled, Checked = (from ContentAreaItem item in participant.Sessions.Items where item.ContentLink.ID == session.ContentID select item).Any(), GroupName = session.Group
                    };
                    li.InputAttributes.Add("value", session.ContentID.ToString());
                    li.InputAttributes.Add("name", session.Group);
                    ph.Controls.Add(li);
                    ph.Controls.Add(new LiteralControl(session.Name + "<br/>"));
                }
            }
            return(ph);
        }
Esempio n. 7
0
        public static EventPage EventPageData(this ParticipantBlock participantBlock)
        {
            var contentLoader = EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance <IContentLoader>();

            return(contentLoader.Get <EventPage>(participantBlock.EventPage));
        }