/// <summary>
        /// Raise an to allow consumer to check for an existing subscription. Set <c>e.Success = false</c> if an existing subscription is found.
        /// </summary>
        protected virtual void OnCheckingExistingSubscription()
        {
            // Get the form email address either as the newly submitted one (via TextBox control) or as the read-only version (via Label control).
            string emailAddress = null;

            try { emailAddress = this.email.Text; }
            catch { }
            if (string.IsNullOrEmpty(emailAddress) && this.emailReadOnly != null)
            {
                emailAddress = this.emailReadOnly.Text;
            }

            if (this.CheckingExistingSubscription != null)
            {
                this.eventArgs              = new SubscriptionEventArgs();
                this.eventArgs.Service      = this.Service;
                this.eventArgs.EmailAddress = new ContactEmail(emailAddress);
                this.CheckingExistingSubscription(this, this.eventArgs);
            }
        }
        /// <summary>
        /// Raise an event indicating that a change to the subscription options has been submitted
        /// </summary>
        protected virtual void OnSubscriptionOptionsUpdated()
        {
            // Get the form email address either as the newly submitted one (via TextBox control) or as the read-only version (via Label control).
            string emailAddress = null;

            try { emailAddress = this.email.Text; }
            catch { }
            if (string.IsNullOrEmpty(emailAddress) && this.emailReadOnly != null)
            {
                emailAddress = this.emailReadOnly.Text;
            }

            if (this.SubscriptionOptionsUpdated != null)
            {
                this.eventArgs                  = new SubscriptionEventArgs();
                this.eventArgs.Service          = this.Service;
                this.eventArgs.EmailAddress     = new ContactEmail(emailAddress);
                this.eventArgs.SubscriptionCode = this.Context.Request.QueryString[this.CodeParameter];
                this.SubscriptionOptionsUpdated(this, this.eventArgs);
            }
        }
 /// <summary>
 /// Restores view-state information from a previous request that was saved with the <see cref="M:System.Web.UI.WebControls.WebControl.SaveViewState"/> method.
 /// </summary>
 /// <param name="savedState">An object that represents the control state to restore.</param>
 protected override void LoadViewState(object savedState)
 {
     base.LoadViewState(savedState);
     if (ViewState["Service"] != null) this.Service = (SubscriptionService)ViewState["Service"];
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultTemplate"/> class.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="defaultXhtml">The default XHTML.</param>
 internal DefaultTemplate(SubscriptionService service, string defaultXhtml)
 {
     this.service = service;
     this.defaultXhtml = defaultXhtml;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultTemplate"/> class.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="defaultXhtml">The default XHTML.</param>
 internal DefaultTemplate(SubscriptionService service, string defaultXhtml)
 {
     this.service      = service;
     this.defaultXhtml = defaultXhtml;
 }
        /// <summary>
        /// Raise an event indicating that a change to the subscription options has been submitted
        /// </summary>
        protected virtual void OnSubscriptionOptionsUpdated()
        {
            // Get the form email address either as the newly submitted one (via TextBox control) or as the read-only version (via Label control).
            string emailAddress = null;
            try { emailAddress = this.email.Text; }
            catch { }
            if (string.IsNullOrEmpty(emailAddress) && this.emailReadOnly != null) emailAddress = this.emailReadOnly.Text;

            if (this.SubscriptionOptionsUpdated != null)
            {
                this.eventArgs = new SubscriptionEventArgs();
                this.eventArgs.Service = this.Service;
                this.eventArgs.EmailAddress = new ContactEmail(emailAddress);
                this.eventArgs.SubscriptionCode = this.Context.Request.QueryString[this.CodeParameter];
                this.SubscriptionOptionsUpdated(this, this.eventArgs);
            }
        }
        /// <summary>
        /// Raise an to allow consumer to check for an existing subscription. Set <c>e.Success = false</c> if an existing subscription is found.
        /// </summary>
        protected virtual void OnCheckingExistingSubscription()
        {
            // Get the form email address either as the newly submitted one (via TextBox control) or as the read-only version (via Label control).
            string emailAddress = null;
            try { emailAddress = this.email.Text; }
            catch { }
            if (string.IsNullOrEmpty(emailAddress) && this.emailReadOnly != null) emailAddress = this.emailReadOnly.Text;

            if (this.CheckingExistingSubscription != null)
            {
                this.eventArgs = new SubscriptionEventArgs();
                this.eventArgs.Service = this.Service;
                this.eventArgs.EmailAddress = new ContactEmail(emailAddress);
                this.CheckingExistingSubscription(this, this.eventArgs);
            }
        }