Ejemplo n.º 1
0
 public InputSubscription()
 {
     SubscriptionDescriptor = new SubscriptionDescriptor
     {
         ProfileGuid    = Library.Profiles.Default,
         SubscriberGuid = Guid.NewGuid()
     };
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the changed pages under one subscription root for a specific user.
        /// </summary>
        /// <param name="profile">The profile for a user.</param>
        /// <param name="language">The requested language.</param>
        /// <param name="subscribedPage">The subscribed subscription root.</param>
        /// <param name="principal">The principal for the user.</param>
        /// <returns>A collection of pages that have been changed and are children of the subscribedPage.</returns>
        protected PageDataCollection GetChangedPages(EPiServerProfile profile, string language, SubscriptionDescriptor subscribedPage, IPrincipal principal)
        {
            IList <PageLanguage> pageLanguageList = this._subscriptionDB.PagesChangedAfter(subscribedPage.PageID, profile.SubscriptionInfo.LastMessage, 100);
            int count  = pageLanguageList.Count;
            int pageID = -1;
            PageDataCollection pageDataCollection = new PageDataCollection();
            IList <string>     stringList         = (IList <string>) new List <string>();

            foreach (PageLanguage pageLanguage in (IEnumerable <PageLanguage>)pageLanguageList)
            {
                if (string.Compare(pageLanguage.LanguageID, language, StringComparison.InvariantCultureIgnoreCase) == 0)
                {
                    if (pageLanguage.PageID != pageID && pageID != -1)
                    {
                        PageData page = this.GetPage(pageID, pageLanguage.LanguageID, principal, true);
                        if (page != null)
                        {
                            pageDataCollection.Add(page);
                        }
                        stringList.Clear();
                    }
                    stringList.Add(pageLanguage.LanguageID);
                    pageID = pageLanguage.PageID;
                }
            }
            if (pageID != -1)
            {
                foreach (string language1 in (IEnumerable <string>)stringList)
                {
                    PageData page = this.GetPage(pageID, language1, principal, true);
                    if (page != null)
                    {
                        pageDataCollection.Add(page);
                    }
                }
            }
            return(pageDataCollection);
        }