Пример #1
0
        protected void TopicSubscribe(object sender, EventArgs eventArgs)
        {
            var btn  = (ImageButton)sender;
            var page = (PageBase)Page;
            int id   = Convert.ToInt32(btn.CommandArgument);

            switch (btn.CommandName)
            {
            case "topicsub":
                Subscriptions.AddTopicSubscription(page.Member == null ? 0 : page.Member.Id, id);
                break;

            case "topicunsub":
                Subscriptions.RemoveTopicSubscription(page.Member == null ? 0 : page.Member.Id, id);
                break;

            case "forumsub":
                Subscriptions.AddForumSubscription(page.Member == null ? 0 : page.Member.Id, id);
                break;

            case "forumunsub":
                Subscriptions.RemoveForumSubscription(page.Member == null ? 0 : page.Member.Id, id);
                break;
            }
        }
Пример #2
0
        public void ForumSubscribe(int forumid, bool remove)
        {
            var user   = HttpContext.Current.User.Identity.Name;
            var member = Membership.GetUser(user, true);

            if (member != null && member.ProviderUserKey != null)
            {
                if (remove)
                {
                    Subscriptions.RemoveForumSubscription((int)member.ProviderUserKey, forumid);
                }
                else
                {
                    Subscriptions.AddForumSubscription((int)member.ProviderUserKey, forumid);
                }
            }
        }