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;

public partial class etw_c_m_noticelist : System.Web.UI.Page
{
    public int page = 1;
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpCookie GetCookie = Request.Cookies["cook_admin"];
        if (Request.Cookies["cook_admin"] == null)
        {
            Response.Redirect("index.aspx");
        }
        if (!IsPostBack)
        {
            int totalOrders = (int)DbHelperSQL.GetSingle("select count(id) from etw_gonggao");
            Cache["totalproduct"] = totalOrders;
            Pager1.RecordCount = totalOrders;
            Pager2.RecordCount = totalOrders;
        }
        DataUser();
    }
    protected void Pager1_PageChanging1(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
    {
        Pager1.CurrentPageIndex = e.NewPageIndex;
        page = Pager1.CurrentPageIndex;
        DataUser();
    }
    protected void Pager2_PageChanging1(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
    {
        Pager2.CurrentPageIndex = e.NewPageIndex;
        page = Pager2.CurrentPageIndex;
        DataUser();
    }
    public void DataUser()
    {
        int i = 1;
        if (Request.QueryString["page"] != null)
        {
            i = Convert.ToInt32(Request.QueryString["page"].ToString());
        }
        int mun = (i - 1) * 20;
        DataSet ds = DbHelperSQL.Query("select top 20 * from etw_gonggao where id not in(select top " + mun + " id from etw_gonggao order by id desc) order by id desc");
        if (ds.Tables[0].Rows.Count > 0)
        {
            Repeater1.DataSource = ds.Tables[0].DefaultView;
            Repeater1.DataBind();
        }
    }
}
