예제 #1
0
        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;
            }
        }