Пример #1
0
        private List <SubscriptionObject> GetSubscriptionObjectsByType(Guid productID, Guid moduleID, Guid typeID)
        {
            List <SubscriptionObject> subscriptionObjects  = new List <SubscriptionObject>();
            ISubscriptionProvider     subscriptionProvider = SubscriptionProvider;

            if (typeID.Equals(_wikiSubscriptionTypeNewPageID))
            {
                List <string> wikiList = new List <string>(
                    subscriptionProvider.GetSubscriptions(
                        Constants.NewPage,
                        WikiNotifySource.Instance.GetRecipientsProvider().GetRecipient(SecurityContext.CurrentAccount.ID.ToString()),
                        false)
                    );

                if (wikiList.Contains(null))
                {
                    subscriptionObjects.Add(new SubscriptionObject()
                    {
                        ID               = new Guid("{56A0EC10-5A1C-45ab-95AA-8F56827A8CCC}").ToString(),
                        Name             = WikiResource.NotifyAction_NewPage,
                        URL              = string.Empty,
                        SubscriptionType = GetSubscriptionTypes().Find(st => st.ID.Equals(_wikiSubscriptionTypeNewPageID))
                    });
                }
            }
            else if (typeID.Equals(_wikiSubscriptionTypeChangePageID))
            {
                List <string> wikiList = new List <string>(
                    subscriptionProvider.GetSubscriptions(
                        Constants.EditPage,
                        WikiNotifySource.Instance.GetRecipientsProvider().GetRecipient(SecurityContext.CurrentAccount.ID.ToString()),
                        false)
                    );

                foreach (string wikiObj in wikiList)
                {
                    subscriptionObjects.Add(new SubscriptionObject()
                    {
                        ID               = wikiObj,
                        Name             = string.IsNullOrEmpty(wikiObj) ? WikiResource.MainWikiCaption : wikiObj,
                        URL              = ActionHelper.GetViewPagePath(WikiNotifySource.Instance.GetDefPageHref(), wikiObj),
                        SubscriptionType = GetSubscriptionTypes().Find(st => st.ID.Equals(_wikiSubscriptionTypeChangePageID)),
                    });
                }
            }
            else if (typeID.Equals(_wikiSubscriptionTypeAddPageToCat))
            {
                List <string> wikiList = new List <string>(
                    subscriptionProvider.GetSubscriptions(
                        Constants.AddPageToCat,
                        WikiNotifySource.Instance.GetRecipientsProvider().GetRecipient(SecurityContext.CurrentAccount.ID.ToString()),
                        false)
                    );



                foreach (string wikiObj in wikiList)
                {
                    subscriptionObjects.Add(new SubscriptionObject()
                    {
                        ID               = wikiObj,
                        Name             = wikiObj.Equals(string.Empty) ? WikiResource.MainWikiCaption : wikiObj,
                        URL              = ActionHelper.GetViewPagePath(WikiNotifySource.Instance.GetDefPageHref(), wikiObj),
                        SubscriptionType = GetSubscriptionTypes().Find(st => st.ID.Equals(_wikiSubscriptionTypeAddPageToCat)),
                    });
                }
            }

            return(subscriptionObjects);
        }