public List <OrderInfo> GetOrderPagerByRule(OrderSearchEntity serach, PagerInfo pager) { List <OrderInfo> result = new List <OrderInfo>(); StringBuilder builder = new StringBuilder(); if (serach.CustomerID > 0) { builder.Append(" AND CustomerID=@CustomerID "); } if (serach.SupplierID > 0) { builder.Append(" AND SupplierID =@SupplierID "); } if (!string.IsNullOrEmpty(serach.OrderID)) { builder.Append(" AND OrderID=@OrderID "); } if (serach.Status > -2) { builder.Append(" AND Status =@Status "); } string sql = OrderStatement.GetOrderPagerHeader + builder.ToString() + OrderStatement.GetOrderPagerFooter; DataCommand command = new DataCommand(ConnectionString, GetDbCommand(sql, "Text")); if (serach.CustomerID > 0) { command.AddInputParameter("@CustomerID", DbType.Int64, serach.CustomerID); } if (serach.SupplierID > 0) { command.AddInputParameter("@SupplierID", DbType.Int64, serach.SupplierID); } if (!string.IsNullOrEmpty(serach.OrderID)) { command.AddInputParameter("@OrderID", DbType.String, serach.OrderID); } if (serach.Status > -2) { command.AddInputParameter("@Status", DbType.Int32, serach.Status); } command.AddInputParameter("@PageIndex", DbType.Int32, pager.PageIndex); command.AddInputParameter("@PageSize", DbType.Int32, pager.PageSize); command.AddInputParameter("@recordCount", DbType.Int32, pager.SumCount); result = command.ExecuteEntityList <OrderInfo>(); return(result); }