using System;
|
using System.Collections.Generic;
|
using System.Data;
|
using System.Data.SqlClient;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using Dapper;
|
|
namespace GasolineBlend.DAL
|
{
|
public class GetPagingDAL:BaseNewsDAL
|
{
|
#region 分页获取数据
|
/// <summary>
|
/// 分页
|
/// </summary>
|
/// <typeparam name="T"></typeparam>
|
/// <param name="selectStr">查询的列数</param>
|
/// <param name="tableName">查询的表名</param>
|
/// <param name="pageIndex">当前页</param>
|
/// <param name="pageSize">页面长度</param>
|
/// <param name="strWhere">查询条件</param>
|
/// <param name="orderName">排序条件</param>
|
/// <param name="RecordCount">返回条数</param>
|
/// <returns></returns>
|
public List<T> GetUserAccess<T>(string selectStr, string tableName, int pageIndex, int pageSize, string strWhere, string orderName, ref int TotalCount)
|
{
|
var p = new DynamicParameters();
|
p.Add("@TableFields", selectStr);
|
p.Add("@TableName", tableName);
|
p.Add("@SqlWhere", strWhere);
|
p.Add("@OrderBy", orderName);
|
p.Add("@PageIndex", pageIndex);
|
p.Add("@PageSize", pageSize);
|
p.Add("@TotalCount", dbType: DbType.Int32, direction: ParameterDirection.Output);
|
|
|
List<T> ret = new List<T>();
|
|
ret = Conn.Query<T>("Proc_Paging", p, commandType: CommandType.StoredProcedure, commandTimeout: 0).ToList();
|
//ret = GetCJFDData(ret);
|
TotalCount = p.Get<int>("TotalCount");
|
|
return ret;
|
}
|
#endregion
|
}
|
public class GetPagingDBDAL : BaseDAL
|
{
|
#region 分页获取数据
|
/// <summary>
|
/// 分页
|
/// </summary>
|
/// <typeparam name="T"></typeparam>
|
/// <param name="selectStr">查询的列数</param>
|
/// <param name="tableName">查询的表名</param>
|
/// <param name="pageIndex">当前页</param>
|
/// <param name="pageSize">页面长度</param>
|
/// <param name="strWhere">查询条件</param>
|
/// <param name="orderName">排序条件</param>
|
/// <param name="RecordCount">返回条数</param>
|
/// <returns></returns>
|
public List<T> GetUserAccess<T>(string selectStr, string tableName, int pageIndex, int pageSize, string strWhere, string orderName, ref int TotalCount)
|
{
|
var p = new DynamicParameters();
|
p.Add("@TableFields", selectStr);
|
p.Add("@TableName", tableName);
|
p.Add("@SqlWhere", strWhere);
|
p.Add("@OrderBy", orderName);
|
p.Add("@PageIndex", pageIndex);
|
p.Add("@PageSize", pageSize);
|
p.Add("@TotalCount", dbType: DbType.Int32, direction: ParameterDirection.Output);
|
|
|
List<T> ret = new List<T>();
|
|
ret = Conn.Query<T>("Proc_Paging", p, commandType: CommandType.StoredProcedure, commandTimeout: 0).ToList();
|
//ret = GetCJFDData(ret);
|
TotalCount = p.Get<int>("TotalCount");
|
|
return ret;
|
}
|
#endregion
|
}
|
public class GetPagingZdDAL : BaseZdwDAL
|
{
|
#region 分页获取数据
|
/// <summary>
|
/// 分页
|
/// </summary>
|
/// <typeparam name="T"></typeparam>
|
/// <param name="selectStr">查询的列数</param>
|
/// <param name="tableName">查询的表名</param>
|
/// <param name="pageIndex">当前页</param>
|
/// <param name="pageSize">页面长度</param>
|
/// <param name="strWhere">查询条件</param>
|
/// <param name="orderName">排序条件</param>
|
/// <param name="RecordCount">返回条数</param>
|
/// <returns></returns>
|
public List<T> GetUserAccess<T>(string selectStr, string tableName, int pageIndex, int pageSize, string strWhere, string orderName, ref int TotalCount)
|
{
|
var p = new DynamicParameters();
|
p.Add("@TableFields", selectStr);
|
p.Add("@TableName", tableName);
|
p.Add("@SqlWhere", strWhere);
|
p.Add("@OrderBy", orderName);
|
p.Add("@PageIndex", pageIndex);
|
p.Add("@PageSize", pageSize);
|
p.Add("@TotalCount", dbType: DbType.Int32, direction: ParameterDirection.Output);
|
List<T> ret = new List<T>();
|
ret = Conn.Query<T>("Proc_Paging", p, commandType: CommandType.StoredProcedure, buffered: true,commandTimeout: 0).ToList();
|
//ret = GetCJFDData(ret);
|
TotalCount = p.Get<int>("TotalCount");
|
|
return ret;
|
}
|
#endregion
|
}
|
public class GetPagingDBAlarmDAL : BaseAlarmDAL
|
{
|
#region 分页获取数据
|
/// <summary>
|
/// 分页
|
/// </summary>
|
/// <typeparam name="T"></typeparam>
|
/// <param name="selectStr">查询的列数</param>
|
/// <param name="tableName">查询的表名</param>
|
/// <param name="pageIndex">当前页</param>
|
/// <param name="pageSize">页面长度</param>
|
/// <param name="strWhere">查询条件</param>
|
/// <param name="orderName">排序条件</param>
|
/// <param name="RecordCount">返回条数</param>
|
/// <returns></returns>
|
public List<T> GetUserAccess<T>(string selectStr, string tableName, int pageIndex, int pageSize, string strWhere, string orderName, ref int TotalCount)
|
{
|
var p = new DynamicParameters();
|
p.Add("@TableFields", selectStr);
|
p.Add("@TableName", tableName);
|
p.Add("@SqlWhere", strWhere);
|
p.Add("@OrderBy", orderName);
|
p.Add("@PageIndex", pageIndex);
|
p.Add("@PageSize", pageSize);
|
p.Add("@TotalCount", dbType: DbType.Int32, direction: ParameterDirection.Output);
|
List<T> ret = new List<T>();
|
ret = Conn.Query<T>("Proc_Paging", p, commandType: CommandType.StoredProcedure, buffered: true, commandTimeout: 0).ToList();
|
//ret = GetCJFDData(ret);
|
TotalCount = p.Get<int>("TotalCount");
|
|
return ret;
|
}
|
|
public List<T> GetUserAccess<T>( string tableName,string sqlStr,string condition, int pageIndex, int pageSize, string orderDesc,string orderAsc, string pkField,string searchField, ref int TotalCount)
|
{
|
var p = new DynamicParameters();
|
p.Add("@TableName", tableName);
|
p.Add("@SqlStr", sqlStr);
|
p.Add("@Condition", condition);
|
p.Add("@PageIndex", pageIndex);
|
p.Add("@PageSize", pageSize);
|
p.Add("@orderDESC", orderDesc);
|
p.Add("@orderASC", orderAsc);
|
p.Add("@PKField", pkField);
|
p.Add("@SearField", searchField);
|
p.Add("@RecordCount", dbType: DbType.Int32, direction: ParameterDirection.Output);
|
List<T> ret = new List<T>();
|
ret = Conn.Query<T>("Proc_PagingNew", p, commandType: CommandType.StoredProcedure, buffered: true, commandTimeout: 0).ToList();
|
//ret = GetCJFDData(ret);
|
TotalCount = p.Get<int>("RecordCount");
|
|
return ret;
|
}
|
#endregion
|
}
|
}
|