using System;

using System.Configuration;

namespace norke
{
	/// <summary>
	/// mySqlPager 的摘要说明。
	/// </summary>
	public sealed class mySqlPager
	{

        public static void setAttribute( DevCenter.SqlPager SqlPager, 
            string strControlToPaginate, string strSelectCommand)
        {
            SqlPager.ControlToPaginate = strControlToPaginate;
            SqlPager.ConnectionString = ConfigurationSettings.AppSettings["ConnStr"];
            SqlPager.SelectCommand = strSelectCommand;
            SqlPager.ItemsPerPage = 10;
            SqlPager.CurrentPageIndex = 0;
            SqlPager.DataBind();
        }

        public static void setAttribute( DevCenter.SqlPager SqlPager, 
            string strControlToPaginate, string strSelectCommand,
            int iItemsPerPage)
        {
            SqlPager.ControlToPaginate = strControlToPaginate;
            SqlPager.ConnectionString = ConfigurationSettings.AppSettings["ConnStr"];
            SqlPager.SelectCommand = strSelectCommand;
            SqlPager.ItemsPerPage = iItemsPerPage;
            SqlPager.CurrentPageIndex = 0;
            SqlPager.DataBind();
        }

        public static void setAttribute( DevCenter.SqlPager SqlPager, 
            string strControlToPaginate, string strSelectCommand,
            string strSortField, int iItemsPerPage)
        {
            SqlPager.ControlToPaginate = strControlToPaginate;
            SqlPager.ConnectionString = ConfigurationSettings.AppSettings["ConnStr"];
            SqlPager.SelectCommand = strSelectCommand;
            SqlPager.SortField = strSortField;//只能 ASC
            SqlPager.ItemsPerPage = iItemsPerPage;
            SqlPager.CurrentPageIndex = 0;
            SqlPager.DataBind();
        }

        public static void setAttribute( DevCenter.SqlPager SqlPager, 
            string strControlToPaginate, string strSelectCommand,
            string strSortField, int iItemsPerPage, int iCurrentPageIndex)
        {
            SqlPager.ControlToPaginate = strControlToPaginate;
            SqlPager.ConnectionString = ConfigurationSettings.AppSettings["ConnStr"];
            SqlPager.SelectCommand = strSelectCommand;
            SqlPager.SortField = strSortField;//只能 ASC
            SqlPager.ItemsPerPage = iItemsPerPage;
            SqlPager.CurrentPageIndex = iCurrentPageIndex;
            SqlPager.DataBind();
        }


	}
}
