using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using JuSNS.Factory;
using JuSNS.Model;


namespace JuSNS.Home
{
    /// <summary>
    /// 通用分页
    /// </summary>
    public class UtilPage
    {
        static private IUtilPage dal;
        /// <summary>
        /// 构造函数
        /// </summary>
        static UtilPage()
        {
            dal = DataAccess.CreateUtilPage();
        }
        /// <summary>
        /// 取得分页
        /// </summary>
        /// <param name="pageCode">分页代码,通常为类名</param>
        /// <param name="pageIndex">当前页码(从１开始，大于总页数，则为最后一页)</param>
        /// <param name="pageSize">每页记录条数</param>
        /// <param name="recordCount">返回记录总数</param>
        /// <param name="pageCount">返回总页数</param>
        /// <param name="conditions">查询条件</param>
        /// <returns></returns>
        static public DataTable GetPage(string pageCode, int pageIndex, int pageSize, out int recordCount, out int pageCount, params SqlConditionInfo[] conditions)
        {
            return dal.GetPage(pageCode, pageIndex, pageSize, out  recordCount, out  pageCount, conditions);
        }

        /// <summary>
        /// 找好朋友分页
        /// </summary>
        /// <param name="keywords">标识</param>
        /// <param name="pr">省</param>
        /// <param name="city">市</param>
        /// <param name="beginYear">最小年龄</param>
        /// <param name="endyear">最大年龄</param>
        /// <param name="sex">性别</param>
        /// <param name="tx">是否显示头像</param>
        /// <param name="PageSize"></param>
        /// <param name="RecordCount"></param>
        /// <param name="PageCount"></param>
        /// <param name="SqlCondition"></param>
        /// <returns></returns>
        static public DataTable GetUserPage(int pr, int city, int beginYear, int endyear, int sex, int tx, int PageIndex, int PageSize, out int RecordCount, out int PageCount, params SqlConditionInfo[] SqlCondition)
        {
            return dal.GetUserPage(pr, city, beginYear, endyear, sex, tx, PageIndex, PageSize, out RecordCount, out PageCount, SqlCondition);
        }

        static public DataTable GetMinPage(int PageIndex, int PageSize, out int RecordCount, out int PageCount, params SqlConditionInfo[] SqlCondition)
        {
            return dal.GetMinPage(PageIndex, PageSize, out RecordCount, out PageCount, SqlCondition);
        }
    }
}
