示例#1
0
 private void BindOrderGifts()
 {
     OrderGiftQuery query = new OrderGiftQuery();
     query.PageSize = 10;
     query.PageIndex = pagerOrderGifts.PageIndex;
     query.OrderId = orderId;
     DbQueryResult orderGifts = SubsiteSalesHelper.GetOrderGifts(query);
     dlstOrderGifts.DataSource = orderGifts.Data;
     dlstOrderGifts.DataBind();
     pagerOrderGifts.TotalRecords = orderGifts.TotalRecords;
 }
示例#2
0
 public override DbQueryResult GetOrderGifts(OrderGiftQuery query)
 {
     DbQueryResult result = new DbQueryResult();
     StringBuilder builder = new StringBuilder();
     builder.AppendFormat("select top {0} * from Hishop_OrderGifts where OrderId=@OrderId", query.PageSize);
     if (query.PageIndex == 1)
     {
         builder.Append(" ORDER BY GiftId ASC");
     }
     else
     {
         builder.AppendFormat(" and GiftId > (select max(GiftId) from (select top {0} GiftId from Hishop_OrderGifts where 0=0 and OrderId=@OrderId ORDER BY GiftId ASC ) as tbltemp) ORDER BY GiftId ASC", (query.PageIndex - 1) * query.PageSize);
     }
     if (query.IsCount)
     {
         builder.AppendFormat(";select count(GiftId) as Total from Hishop_OrderGifts where OrderId=@OrderId", new object[0]);
     }
     DbCommand sqlStringCommand = database.GetSqlStringCommand(builder.ToString());
     database.AddInParameter(sqlStringCommand, "OrderId", DbType.String, query.OrderId);
     using (IDataReader reader = database.ExecuteReader(sqlStringCommand))
     {
         result.Data = DataHelper.ConverDataReaderToDataTable(reader);
         if (query.IsCount && reader.NextResult())
         {
             reader.Read();
             result.TotalRecords = reader.GetInt32(0);
         }
     }
     return result;
 }
示例#3
0
 public static DbQueryResult GetOrderGifts(OrderGiftQuery query)
 {
     return SalesProvider.Instance().GetOrderGifts(query);
 }
示例#4
0
 public abstract DbQueryResult GetOrderGifts(OrderGiftQuery query);