示例#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;
            }
        }
 protected string GetPdfUrl()
 {
     if (Locate.ContentRepository().Get <EventPageBase>(CurrentData.EventPage).EventDetails.PdfTemplate != null)
     {
         return(String.Format("<a class=\"btn btn-default btn-sm\" href=\"{0}?participant={1}&code={2}&email={3}\" target=\"_blank\">PDF</a>", UriSupport.ResolveUrlBySettings("~/Modules/BVNetwork.Attend/Views/Pages/Pdf.aspx"), CurrentData.Code, CurrentData.Code, CurrentData.Email));
     }
     return(string.Empty);
 }
        private List <IParticipant> FilterSessions(List <IParticipant> contents)
        {
            if (SessionDropDownList.SelectedIndex > 0)
            {
                var session = Locate.ContentRepository().Get <IContent>(new ContentReference(int.Parse(SessionDropDownList.SelectedValue)));
                contents =
                    contents.Where(
                        x =>
                        (x as IParticipant).Sessions != null && (x as IParticipant).Sessions.Items.Where(s => s.ContentLink.ID.ToString() == SessionDropDownList.SelectedValue).Any()).ToList <IParticipant>();
            }

            return(contents);
        }
示例#4
0
        protected void UpdateSessions_Click(object sender, EventArgs e)
        {
            ParticipantBlock current = (CurrentBlock.CreateWritableClone() as ParticipantBlock);

            current.Sessions = new ContentArea();
            current.Sessions.Items.Clear();
            foreach (ContentReference item in GetChosenSessions())
            {
                current.Sessions.Items.Add(new ContentAreaItem()
                {
                    ContentLink = item
                });
            }
            Locate.ContentRepository().Save(current as IContent, EPiServer.DataAccess.SaveAction.Publish, EPiServer.Security.AccessLevel.NoAccess);
        }
示例#5
0
        private void ConvertEmailTemplateToLocal(string sharedBlock, string localBlock)
        {
            EventPageBase      currentEventPageBase = CurrentPage.CreateWritableClone() as EventPageBase;
            EmailTemplateBlock sharedBlockData      = Get <EmailTemplateBlock>((CurrentPage as EventPageBase)[sharedBlock] as ContentReference) as EmailTemplateBlock;
            EmailTemplateBlock localBlockData       = currentEventPageBase[localBlock] as EmailTemplateBlock;

            localBlockData.BCC                = sharedBlockData.BCC;
            localBlockData.CC                 = sharedBlockData.CC;
            localBlockData.From               = sharedBlockData.From;
            localBlockData.MainBody           = sharedBlockData.MainBody;
            localBlockData.MainTextBody       = sharedBlockData.MainTextBody;
            localBlockData.Subject            = sharedBlockData.Subject;
            localBlockData.To                 = sharedBlockData.To;
            currentEventPageBase[sharedBlock] = null;
            Locate.ContentRepository().Save(currentEventPageBase, AttendScheduledEmailEngine.GetForcedSaveActionFor(currentEventPageBase));
            ClientScript.RegisterStartupScript(this.GetType(), "scriptid", "window.parent.location.href='" + EPiServer.Editor.PageEditing.GetEditUrl((CurrentData as IContent).ContentLink) + "'", true);
        }
        protected string GetSessions()
        {
            string sessions = "";

            if (CurrentData.Sessions != null)
            {
                int sessionsCount = CurrentData.Sessions.Count;
                foreach (var session in CurrentData.Sessions.Items)
                {
                    sessions += Locate.ContentRepository().Get <IContent>(session.ContentLink).Name + ", ";
                }
                if (sessions.Length > 1)
                {
                    sessions = sessions.Substring(0, sessions.Length - 2);
                }
                return(string.Format("<span title='{0}'>{1}</span>", sessions, sessionsCount));
            }
            return(sessions);
        }
        // Note! This broke with CMS 8, but since we're not using the languageselector
        //       from code, we just ignore it
        //public virtual T Get<T>(ContentReference contentLink) where T : IContentData
        //{
        //    // CMS 8
        //    // LoaderOptions options  = new LoaderOptions();
        //    // options.Add(new LanguageLoaderOption() {FallbackBehaviour = LanguageBehaviour.Fallback});
        //    return this.Get<T>(contentLink, (LanguageSelector)LanguageSelector.AutoDetect(true));
        //}
        public virtual T Get <T>(ContentReference contentLink) where T : IContentData
        {
            T obj = Locate.ContentRepository().Get <T>(contentLink);

            if ((object)obj == null)
            {
                return(default(T));
            }
            AccessLevel access    = contentLink.CompareToIgnoreWorkID(this.CurrentContentLink) ? AccessLevel.Read : AccessLevel.Read;
            ISecurable  securable = (object)obj as ISecurable;

            if (securable != null && !securable.GetSecurityDescriptor().HasAccess(PrincipalInfo.CurrentPrincipal, access))
            {
                if (PrincipalInfo.CurrentPrincipal.Identity.IsAuthenticated)
                {
                    throw new AccessDeniedException();
                }
                DefaultAccessDeniedHandler.AccessDenied((object)this);
            }
            return(obj);
        }
示例#8
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));
        }
示例#9
0
        protected void UpdateParticipant_Click(object sender, EventArgs e)
        {
            try
            {
                bool UseForms = BVNetwork.Attend.Business.API.AttendRegistrationEngine.UseForms;

                ParticipantBlock current = (CurrentBlock.CreateWritableClone() as ParticipantBlock);
                if (UseForms)
                {
                    XmlDocument doc = new XmlDocument();

                    XmlNode rootNode = doc.CreateElement("FormData");
                    doc.AppendChild(rootNode);
                    foreach (RepeaterItem item in FormElementsRepeater.Items)
                    {
                        if (item.ItemType == ListItemType.Item ||
                            item.ItemType == ListItemType.AlternatingItem)
                        {
                            System.Web.UI.WebControls.Label label = (System.Web.UI.WebControls.Label)item.FindControl("FormLabel");
                            TextBox textBox = (TextBox)item.FindControl("FormTextBox");

                            XmlNode formElementNode = doc.CreateElement(label.Text);
                            formElementNode.InnerText = textBox.Text;
                            rootNode.AppendChild(formElementNode);
                        }
                    }
                    current.XForm = doc.InnerXml;
                }
                else
                {
                    current.XForm = DetailsXFormControl.Data.Data.OuterXml;
                }
                Locate.ContentRepository().Save(current as IContent, EPiServer.DataAccess.SaveAction.Publish);
            }
            catch (Exception ex) {
                StatusLiteral.Text = ex.Message;
            }
        }
示例#10
0
        // Note! This broke with CMS 8, but since we're not using the languageselector
        //       from code, we just ignore it
        //public virtual T Get<T>(ContentReference contentLink) where T : IContentData
        //{
        //    // CMS 8
        //    // LoaderOptions options  = new LoaderOptions();
        //    // options.Add(new LanguageLoaderOption() {FallbackBehaviour = LanguageBehaviour.Fallback});
        //    return this.Get<T>(contentLink, (LanguageSelector)LanguageSelector.AutoDetect(true));
        //}
        public virtual T Get <T>(ContentReference contentLink) where T : IContentData
        {
            T obj = Locate.ContentRepository().Get <T>(contentLink);

            if ((object)obj == null)
            {
                return(default(T));
            }
            AccessLevel access    = contentLink.CompareToIgnoreWorkID(this.CurrentContentLink) ? AccessLevel.Read : AccessLevel.Read;
            ISecurable  securable = (object)obj as ISecurable;

            if (securable != null && !securable.GetSecurityDescriptor().HasAccess(PrincipalInfo.CurrentPrincipal, access))
            {
                if (PrincipalInfo.CurrentPrincipal.Identity.IsAuthenticated)
                {
                    throw new AccessDeniedException();
                }
                IAccessDeniedHandler handler =
                    ServiceLocator.Current.GetInstance <IAccessDeniedHandler>();
                handler.AccessDenied(new HttpContextWrapper(Context)); // Man - we really need to get rid of web forms soon!
            }
            return(obj);
        }
示例#11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SendOptionsControl.ApplyEditAttributes <ScheduledEmailBlock>(p => p.EmailSendOptions);
            BlockName.ApplyEditAttributes <ScheduledEmailBlock>(p => (p as IContent).Name);
            SendOnStatusControl.ApplyEditAttributes <ScheduledEmailBlock>(p => p.SendOnStatus);
            ScheduledRelativeAmountControl.ApplyEditAttributes <ScheduledEmailBlock>(p => p.ScheduledRelativeAmount);
            ScheduledRelativeToControl.ApplyEditAttributes <ScheduledEmailBlock>(p => p.ScheduledRelativeTo);
            ScheduledRelativeUnitControl.ApplyEditAttributes <ScheduledEmailBlock>(p => p.ScheduledRelativeUnit);
            (this as PageBase).EditHints.Add("ScheduledRelativeTo");
            (this as PageBase).EditHints.Add("ScheduledRelativeAmount");
            (this as PageBase).EditHints.Add("ScheduledRelativeUnit");
            (this as PageBase).EditHints.Add("SendOnStatus");
            (this as PageBase).EditHints.Add("EmailSendOptions");
            (this as PageBase).EditHints.Add("SendOptions");
            (this as PageBase).EditHints.Add("EmailTemplateContentReference");


            if ((CurrentData as ScheduledEmailBlock).EmailTemplateContentReference != null &&
                (CurrentData as ScheduledEmailBlock).EmailTemplateContentReference != ContentReference.EmptyReference)
            {
                SetupPreviewPropertyControl(MailTemplateBlockPreview,
                                            new[]
                {
                    Locate.ContentRepository()
                    .Get <IContent>((CurrentData as ScheduledEmailBlock).EmailTemplateContentReference)
                }, "MailPreview");
            }
            else
            {
                ConfirmMailTemplateBlockPreviewPlaceHolder.Visible = false;
            }

            MailTemplateBlockPreview.RenderSettings.Tag = "edit";
            MailTemplateBlockPreview.DataBind();

            this.DataBind();
        }
 protected void DeleteScheduledEmail_OnClick(object sender, EventArgs e)
 {
     Locate.ContentRepository().Delete((CurrentBlock as IContent).ContentLink, true, AccessLevel.NoAccess);
     this.Visible = false;
 }
示例#13
0
 protected void SendMail_Click(object sender, EventArgs e)
 {
     UpdateParticipant_Click(sender, e);
     AttendRegistrationEngine.SendStatusMail(Locate.ContentRepository().Get <ParticipantBlock>((CurrentBlock as IContent).ContentLink));
 }