예제 #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 TopicSubscribe(int topicid, bool remove)
        {
            var user   = HttpContext.Current.User.Identity.Name;
            var member = Membership.GetUser(user, true);

            if (member != null && member.ProviderUserKey != null)
            {
                if (remove)
                {
                    Subscriptions.RemoveTopicSubscription((int)member.ProviderUserKey, topicid);
                }
                else
                {
                    Subscriptions.AddTopicSubscription((int)member.ProviderUserKey, topicid);
                }
            }
        }