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

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

        PageFunc.IfSystemLogin(this.Page);

        #endregion
        if (IsPostBack)
            return;

        BindData();
    }

    #region 评论绑定
    /// <summary>
    /// 数据绑定
    /// </summary>
    private void BindData()
    {

        //计算总数的语句的头部
        string sql_CountFirst = string.Empty;
        sql_CountFirst += " select";
        sql_CountFirst += " count(*)";
        sql_CountFirst += " from NT_Video ";
        sql_CountFirst += " where MemberId=" + Session["ID1"].ToString();

        //查询语句的头部
        string sql_SelectFirst = "select v.ID as vid,v.Content,v.AddTime,d.Title,d.ID ";
        sql_SelectFirst += " from NT_Video v left join NT_Data d on v.DataId=d.ID ";
        sql_SelectFirst += " where v.MemberId=" + Session["ID1"].ToString();
        sql_SelectFirst += " order by v.ID desc";


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

    }
    #endregion

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

    //删除
    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();
    }
}
