Subscription functionality

Hello,

I'm new to episerver, and i'm apologising if i'm asking for something obvious.
I'm trying to build subscription fiction, and i found some examples but seams that that is for older versions of episerver. I want to create subscription page from code where user can add email and choose pages on which. I found that this check box list is posible to create with subscription list control and all pages that are below this root pare will be in that list.
So is it posible to do this from code, and which type should be the property for subscription list?

Thanks

#89274
Aug 12, 2014 15:00
Vote:

Hi Uros,

I did a subscription function for 7.5 not long ago. In my case the subscription form was added to the specific pagetype. But in your case I would have added a bool property to show that the page can be subscribed to and then list all pages with it set to true on your subscription page.

I used the DDS to save the subscriptions and then had a scheduled job that runs ones a day and checkes the store to see if any pages have updated and sends the email. You could ofcourse hook on the page published event instead run the email sending code then and there.

Here is the code for the DDSSubscriptionStore

 /// 
    [EPiServerDataStore(StoreName = "EmailSubscriptionStore", AutomaticallyCreateStore = true)]
    public class EmailSubscription : IDynamicData
    {
        /// 
        public Identity Id { get; set; }
        
        /// 
        public DateTime Time { get; set; }

        /// 
        public int PageID { get; set; }

        /// 
        public string Email { get; set; }

        /// 
        public bool IsVerified { get; set; }

        /// 
        public EmailSubscription()
        {
            Initialize();
        }

        /// 
        /// The id of the page subscribed to
        /// The Email of the subscriber
        public EmailSubscription(int pageId, string email)
        {
            Initialize();
            PageID = pageId;
            Email = email;
        }

        /// 
        /// Id to fetch
        /// 
        public static EmailSubscription GetSubscription(Identity id)
        {
            var store = typeof(EmailSubscription).GetStore();
            return store.Load



#89281
Aug 12, 2014 15:39
Vote:

Hi,
I have finished subscription functionality. I used DDS as you suggested , but i created generic repository for working with DDS. This allowed me to have loosely coupled class's where DDS's are used and for which i can write test's.

public interface IRepository
public class Repository



Thank you againt for you help!

#90535
Edited, Sep 11, 2014 15:36

Cool, thanks for sharing!

#90536
Sep 11, 2014 16:01
error This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.