示例#1
0
    /// <summary>
    /// Topic move action handler.
    /// </summary>
    protected void btnMove_Click(object sender, EventArgs e)
    {
        int forumId = ValidationHelper.GetInteger(this.drpMoveToForum.SelectedValue, 0);

        if (forumId > 0)
        {
            ForumPostInfo fpi = ForumContext.CurrentThread;
            if ((fpi == null) && (this.CurrentThread > 0))
            {
                fpi = ForumPostInfoProvider.GetForumPostInfo(this.CurrentThread);
            }

            if (fpi != null)
            {
                // Move the thread
                ForumPostInfoProvider.MoveThread(fpi, forumId);

                this.plcMoveInner.Visible = false;

                // Generate back button
                this.ltlMoveBack.Text = GetLink(null, GetString("general.back"), "ActionLink", ForumActionType.Thread);

                string    targetForumName = this.drpMoveToForum.SelectedItem.Text.TrimStart(' ');
                ForumInfo fi = ForumInfoProvider.GetForumInfo(forumId);
                if (fi != null)
                {
                    targetForumName = HTMLHelper.HTMLEncode(fi.ForumDisplayName);
                }

                // Display info
                this.lblMoveInfo.Text    = String.Format(GetString("forum.thread.topicmoved"), targetForumName);
                this.lblMoveInfo.Visible = true;

                this.SetValue("TopicMoved", true);

                if (TopicMoved != null)
                {
                    TopicMoved(this, null);
                }
            }
        }
        else
        {
            this.lblMoveError.Text    = GetString("forum.thread.movetopic.selectforum");
            this.lblMoveError.Visible = true;
        }
    }