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 instru : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        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_Class ";
        sql_CountFirst += " where CreateClassId=282";

        //查询语句的头部
        string sql_SelectFirst = "select * ";
        sql_SelectFirst += " from NT_Class ";
        sql_SelectFirst += " where CreateClassId=282";
        sql_SelectFirst += " order by ID desc";


        DataTable dt_instru = WebControlsFunc.GetDataTableByAspNetPager(AspNetPager1, sql_CountFirst, sql_SelectFirst);
        lit_instru.Text = "";
        foreach (DataRow dr in dt_instru.Rows)
        {
            lit_instru.Text+="<div class='ny_qun'> <span><img src='"+dr["ClassPicture"]+"' width='150' height='110' /></span><ul class='ny_qun_list'><li class='ny_q_tit'>"+dr["ClassName"]+"</li><li class='mt8px q_link'>";

            foreach (DataRow dr2 in FrontFunc.GetDataByClassID("10",dr["ID"].ToString(),"").Rows)
            {
                lit_instru.Text += "<a href='instrudetails.aspx?iid="+dr2["ID"]+"' title='"+dr2["Title"]+"'>"+FrontFunc.Cutstring(dr2["Title"].ToString(),15)+"</a>";
            }
            

            lit_instru.Text += "</li><li class='look_menu'><a href='instrulist.aspx?listid="+dr["ID"]+"'><img src='images/look.jpg' /></a></li></ul></div>";
        }



    }
    #endregion

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