using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Dapper;
using DapperExtensions;
using DapperExtensions.SqlServerExt;
using HH.AMS.Ex.Interface;
using HH.AMS.Ex.Model;
using HH.AMS.Ex.Factroy;
using Hanhe.iWCS.Common;
namespace HH.AMS.Ex.MSSQLServices
{
public class TN_AM_REQ_INF_LOGServices : TN_AM_REQ_INF_LOGInterface
{
///
///
///
///
///
public List GetList(int pageIndex, int pageSize, string strWhere, string orderBy, out long total, out long totalPage)
{
List list = new List();
try
{
using (var dapper = Connections.Instance.GetConnection(DBConnetctionString.GetDBConnetctionString))
{
int iTotal = 0;
DateTime oldDate = DateTime.Now;
list = dapper.GetByPage(pageIndex, pageSize, out iTotal, null, strWhere, null, orderBy, null, null).ToList();
total = (long)iTotal;
DateTime newDate = DateTime.Now;
TimeSpan timeSpan = newDate - oldDate;
double totalSeconds = timeSpan.TotalSeconds;
if (total <= pageSize)
totalPage = 1;
else if (total % pageSize > 0)
totalPage = (long)Math.Floor(Convert.ToDouble((total / pageSize))) + 1;
else
totalPage = (long)(Math.Floor(Convert.ToDouble(total / pageSize)));
return list;
}
}
catch (Exception ex)
{
total = 0;
totalPage = 0;
CMMLog.Error("SQL Script ---errMsg=" + ex.ToString());
return new List();
}
}
}
}