77 lines
2.4 KiB
C#
77 lines
2.4 KiB
C#
![]() |
using Epost.Common;
|
|||
|
using Epost.Model;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Data;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace Epost.DAL
|
|||
|
{
|
|||
|
public class PalletinfoDAL
|
|||
|
{
|
|||
|
|
|||
|
|
|||
|
DataBaseOpration.OprationSqlDAL db = DB_DLL.GetInstance();
|
|||
|
#region 分页获取订单表列表
|
|||
|
|
|||
|
public List<PalletinfoModel> GetPalletListByPage(string strWhere, string orderby, int startIndex, int endIndex, out int recordCount)
|
|||
|
{
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
StringBuilder strSql = new StringBuilder();
|
|||
|
strSql.Append("SELECT * FROM ( ");
|
|||
|
strSql.Append(" SELECT ROW_NUMBER() OVER (");
|
|||
|
if (!string.IsNullOrEmpty(orderby.Trim()))
|
|||
|
{
|
|||
|
strSql.Append("order by T." + orderby);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
strSql.Append("order by id desc");
|
|||
|
}
|
|||
|
strSql.Append(")AS Row, T.* from Palletinfo T WITH(NOLOCK) ");
|
|||
|
if (!string.IsNullOrEmpty(strWhere.Trim()))
|
|||
|
{
|
|||
|
strSql.Append(" WHERE 1=1 " + strWhere);
|
|||
|
}
|
|||
|
strSql.Append(" ) TT");
|
|||
|
strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
|
|||
|
List<PalletinfoModel> list = ModelConvertHelper<PalletinfoModel>.ConvertToList(db.GetsqlForDT(strSql.ToString()));
|
|||
|
|
|||
|
strSql.Remove(0, strSql.Length);
|
|||
|
strSql.Append("SELECT COUNT(*) FROM Palletinfo AS T ");
|
|||
|
if (!string.IsNullOrEmpty(strWhere.Trim()))
|
|||
|
{
|
|||
|
strSql.AppendFormat(" WHERE 1=1 {0}", strWhere);
|
|||
|
}
|
|||
|
|
|||
|
object obj = db.GetsqlForDT(strSql.ToString()).Rows[0][0];
|
|||
|
if (obj != null)
|
|||
|
recordCount = Convert.ToInt32(obj);
|
|||
|
else
|
|||
|
recordCount = 0;
|
|||
|
|
|||
|
return list;
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
LogHelper.WriteLog(GetType(), ex.Message);
|
|||
|
recordCount = 0;
|
|||
|
return new List<PalletinfoModel>();
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 添加订单
|
|||
|
public bool InsertPallet(DataTable dt, Dictionary<string, string> diclist)
|
|||
|
{
|
|||
|
return db.UpdateData(dt, "Palletinfo", diclist);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|