using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using VeryLead.AccessTask.Bbs;
using VeryLead.AccessTask.Bbs.ViewTopicHTML;
using VeryLead.Common;public partial class Bbs_ViewTopicHTML_ViewTopic : PageBase
{
    public int TopicID = -1;
    public string Level;
    protected void Page_Load(object sender, EventArgs e)
    {
        TopicID = Get("TopciID");        if (!this.IsPostBack)
        {
            SingleTopicBinder();//绑定Topic内容
            ListBbsReplyBinder();//绑定回复列表,带分页            aspnetpage.RecordCount = (new ViewTopic()).GetListBbsReplyCount(TopicID);//统计分页记录总数
            (new DUpDate()).BbsTopicClicksIncrease(TopicID, 1);//浏览次数加1
        }
    }
  
    //显示编辑 主题
    public string IsShowEditTopic()
    {
        string rvalue;
        string AuthorName = (new ExchangeParameter()).GetAuthorNameFromTopic(TopicID);
        if (AuthorName == (new Duser()).AuthorName)//是回复的作者
        {
            rvalue = "<a href='/Bbs/EditTopic.aspx?TopicID=" + TopicID + "'>编辑</a>";
        }
        else
        {
            rvalue = null;
        }
        return rvalue;
    }    //显示编辑 回复
    public string IsShowEditReply(int ReplyID)
    {
        string rvalue;
        string AuthorName = new ExchangeParameter().GetAuthorNameFromReply(ReplyID);
        if (AuthorName == new Duser().AuthorName)//是回复的作者
        {
            rvalue = "<a href='/Bbs/EditReply.aspx?ReplyID=" + ReplyID + "'>编辑</a>";
        }
        else
        {
            rvalue = null;
        }
        return rvalue;
    }
    
    //Topic内容绑定
    public void SingleTopicBinder()
    {
        IDataReader Dr = new ViewTopic().GetSingleBbsTopic(TopicID);
        Dr.Read();        lbl_AddTime.Text = Convert.ToDateTime(Dr["AddTime"].ToString()).ToString("yyyy年MM月dd日 H:mm");//发表日期
        lbl_Name.Text = Dr["Bbs_User.AuthorName"].ToString();//作者        lbl_TopicID.Text = TopicID.ToString();//主题编号
        lbl_Title.Text = Dr["Title"].ToString();//标题
        Page.Title = "【非常指向-VeryLead.CN】:" + lbl_Title.Text;//页面标题
        lbl_Content.Text = Dr["Content"].ToString();//内容
        //用户信息
        lblRegisterTime.Text = Convert.ToDateTime(Dr["RegisterTime"]).ToString("yyyy年MM月dd日");//用户注册日期
        lblComeFrom.Text = Dr["ComeFrom"].ToString();//用户来自
        lbl_Topics.Text = Dr["Topics"].ToString();//用户发帖数
        Level = Dr["Stars"].ToString();//用户等级    }    //回复列表绑定
    public void ListBbsReplyBinder()
    {
        DataTable Dt = new ViewTopic().GetListBbsReply(TopicID,aspnetpage.PageSize * (aspnetpage.CurrentPageIndex - 1), aspnetpage.PageSize);
        RpListReply.DataSource = Dt.DefaultView;
        RpListReply.DataBind();
    }
    
    //回复列表翻页
    protected void aspnetpage_PageChanged(object src, Wuqi.Webdiyer.PageChangedEventArgs e)
    {
        aspnetpage.CurrentPageIndex = e.NewPageIndex;
        ListBbsReplyBinder();
    }}