Exemple #1
0
        public static IParticipant UpdateParticipation(IParticipant participant, NameValueCollection nvc)
        {
            string sessions = nvc.AllKeys.Contains(__AttendSessions) ? nvc[__AttendSessions] : "";

            participant.Sessions = parseSessionsToContentArea(parseSessionsToStringArray(sessions));
            participant.XForm    = FormParser.SerializeForm(nvc);
            Attend.Business.API.AttendRegistrationEngine.SaveParticipant(participant);

            return(participant);
        }
Exemple #2
0
        public static void ProcessForm(NameValueCollection rawFormData, FormContainerBlock formBlock, Submission submissionData)
        {
            string        eventPageIds     = rawFormData[__AttendEvent];
            string        participantEmail = rawFormData[__AttendParticipantEmail];
            string        participantCode  = rawFormData[__AttendParticipantCode];
            List <string> eventPages       = null;

            if (string.IsNullOrEmpty(eventPageIds)) // Not an Attend form - exit form processing.
            {
                return;
            }
            if (eventPageIds.Split(',').Length > 1)
            {
                eventPages = eventPageIds.Split(',').ToList <string>();
            }
            else
            {
                eventPages = new List <string>()
                {
                    eventPageIds
                }
            };

            SetPrivatePropertyValue <PropertyData>(false, "IsReadOnly", formBlock.Property["SubmitSuccessMessage"]);

            NameValueCollection nvc     = FormParser.ParseForm(submissionData, formBlock);
            StringBuilder       message = new StringBuilder();
            StringBuilder       codes   = new StringBuilder();

            foreach (string eventPageId in eventPages)
            {
                ContentReference eventPage     = new ContentReference(eventPageId).ToPageReference();
                EventPageBase    eventPageBase = ServiceLocator.Current.GetInstance <IContentRepository>().Get <EventPageBase>(eventPage);

                if (eventPages.Count > 1)
                {
                    message.Append("<strong>" + eventPageBase.Name + "</strong><br/>");
                }

                IParticipant participant = null;
                if (!string.IsNullOrEmpty(participantCode) && !string.IsNullOrEmpty(participantEmail))
                {
                    participant = BVNetwork.Attend.Business.API.AttendRegistrationEngine.GetParticipant(participantEmail, participantCode);
                    participant = FormParser.UpdateParticipation(participant, nvc);
                }
                if (participant == null)
                {
                    participant = FormParser.GenerateParticipation(eventPage, nvc);
                }


                if (participant.AttendStatus == AttendStatus.Confirmed.ToString())
                {
                    if (eventPageBase.CompleteContentXhtml != null)
                    {
                        message.Append(eventPageBase.CompleteContentXhtml.ToHtmlString());
                    }
                    else
                    {
                        message.Append(EPiServer.Framework.Localization.LocalizationService.Current.GetString("/eventRegistrationPage/confirmed"));
                    }
                }

                if (participant.AttendStatus == AttendStatus.Submitted.ToString())
                {
                    if (eventPageBase.SubmittedContentXhtml != null)
                    {
                        message.Append(eventPageBase.SubmittedContentXhtml.ToHtmlString());
                    }
                    else
                    {
                        message.Append(EPiServer.Framework.Localization.LocalizationService.Current.GetString("/eventRegistrationPage/submitted"));
                    }
                }
                if (message.Length == 0)
                {
                    message.Append(EPiServer.Framework.Localization.LocalizationService.Current.GetString("/eventRegistrationPage/error"));
                }
                message.Append("<br/><br/>");
                codes.Append(participant.Code + ",");
            }

            if (formBlock.RedirectToPage != null)
            {
                SetPrivatePropertyValue <PropertyData>(false, "IsReadOnly", formBlock.Property["RedirectToPage"]);
                Url redirectUrl = new Url(formBlock.RedirectToPage.Uri.ToString() + "?code=" + codes.ToString() + "&eventPageID=" + eventPageIds);
                formBlock.RedirectToPage = redirectUrl;
            }
            formBlock.SubmitSuccessMessage = new XhtmlString(message.ToString());
        }
Exemple #3
0
        public static IParticipant GenerateParticipation(ContentReference eventPage, NameValueCollection nvc)
        {
            string       email       = nvc.AllKeys.Contains(__AttendEmail) ? nvc[__AttendEmail] : "";
            IParticipant participant = null;

            if (!string.IsNullOrEmpty(email))
            {
                participant = Attend.Business.API.AttendRegistrationEngine.GenerateParticipation(eventPage, email, FormParser.SerializeForm(nvc));
                string sessions = nvc.AllKeys.Contains(__AttendSessions) ? nvc[__AttendSessions] : "";
                participant.Sessions = parseSessionsToContentArea(parseSessionsToStringArray(sessions));
            }
            Attend.Business.API.AttendRegistrationEngine.SaveParticipant(participant);
            Attend.Business.API.AttendRegistrationEngine.SendStatusMail(participant);

            return(participant);
        }