using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;
using System.Data;

public partial class BackCenter_Video_VideoContent : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        #region 过期和权限

        PageFunc.IfLogin(this.Page);
        //PubPageFunc.PageHavePurview(this.Page, "2001");

        #endregion
        if (!IsPostBack)
        {
            if (Request["Id"] != null&&Request.QueryString["Id"].ToString()!="")
            {
                BindData();
            }

        }
    }


    //绑定
    public void BindData()
    {

        //计算总数的语句的头部
        string sql_CountFirst = string.Empty;
        sql_CountFirst += " select";
        sql_CountFirst += " count(*)";
        sql_CountFirst += " from NT_Video v,NT_Data d,NT_Member m ";
        sql_CountFirst += " where v.DataId=d.ID and v.MemberId=m.ID and v.DataId=" + Request["Id"] + "";


        //查询语句的头部
        string sql_SelectFirst = "select v.Id ,v.DataId, v.Content,v.AddTime,m.Account,m.Name  ";
        sql_SelectFirst += " from NT_Video v,NT_Data d,NT_Member m ";
        sql_SelectFirst += " where  v.DataId=d.ID and v.MemberId=m.ID and v.DataId=" + Request["Id"] + "";
        sql_SelectFirst += " order by v.Id desc";



        WebControlsFunc.BindToAspNetPagerAndGridView(this.Page, GridView1, AspNetPager1, sql_CountFirst, sql_SelectFirst);

    }


    //分页
    protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
    {
        this.AspNetPager1.CurrentPageIndex = e.NewPageIndex;
        BindData();
    }

    //删除
    protected void btnDelete_Command(object sender, CommandEventArgs e)
    {
        string sql = "delete * from NT_Video where ID=" + e.CommandArgument.ToString();

        DbHelperOleDb.ExecuteNonQuery(CommandType.Text, sql, null);
        BindData();
    }
}
