protected void AttendButton_Click(object sender, EventArgs e)
        {
            IParticipant participant;

            if (!string.IsNullOrEmpty(HiddenEmail.Value))
            {
                participant = AttendRegistrationEngine.GetParticipant(HiddenEmail.Value, HiddenCode.Value);
                if (participant != null)
                {
                    participant = (participant as ParticipantBlock).CreateWritableClone() as ParticipantBlock;
                }
            }

            else
            {
                string participantEmail = "";
                foreach (var fragment in DetailsXFormControl.ExtractXFormControls())
                {
                    if (fragment.ID == "epost" || fragment.ID == "email")
                    {
                        participantEmail = fragment.Value;
                    }
                }


                if (string.IsNullOrEmpty(participantEmail) || Business.Email.Validation.IsEmail(participantEmail) == false)
                {
                    return;
                }

                participant = AttendRegistrationEngine.GenerateParticipation(CurrentData.ContentLink, participantEmail, true, DetailsXFormControl.Data.Data.OuterXml, "Participant submitted form");
            }
            if (participant != null)
            {
                participant.XForm    = DetailsXFormControl.Data.Data.OuterXml;
                participant.Sessions = new ContentArea();
                foreach (ContentReference item in GetChosenSessions())
                {
                    participant.Sessions.Items.Add(new ContentAreaItem()
                    {
                        ContentLink = item
                    });
                }
                Locate.ContentRepository().Save(participant as IContent, EPiServer.DataAccess.SaveAction.Publish, EPiServer.Security.AccessLevel.NoAccess);
                string propertyName = "";
                if (participant.AttendStatus == AttendStatus.Confirmed.ToString())
                {
                    propertyName = "CompleteContent";
                }
                if (participant.AttendStatus == AttendStatus.Submitted.ToString())
                {
                    propertyName = "SubmittedContent";
                }
                ContentProperty.PropertyName = propertyName;
                ContentProperty.DataBind();
                DetailsXFormControl.Visible = false;
                AttendButton.Visible        = false;
            }
        }
Beispiel #2
0
        protected void Page_Init(object sender, EventArgs e)
        {
            bool UseForms  = BVNetwork.Attend.Business.API.AttendRegistrationEngine.UseForms;
            var  eventPage = Locate.ContentRepository().Get <EventPageBase>(CurrentBlock.EventPage);

            if (UseForms == false)
            {
                DetailsXFormControl.FormDefinition = XForm.CreateInstance(new Guid(eventPage.RegistrationForm.Id.ToString()));
                PopulateForm();
                DetailsXFormControl.DataBind();
            }
            else
            {
                FormData = BVNetwork.Attend.Business.API.AttendRegistrationEngine.GetFormData(CurrentBlock);
                FormElementsRepeater.DataSource = FormData;
                FormElementsRepeater.DataBind();
            }
            XFormContainer.Visible = !UseForms;
            FormContainer.Visible  = UseForms;
            SessionList.Controls.Add(AttendSessionEngine.GetSessionsControl(CurrentData.EventPage, CurrentData));
        }