private void BindOrderGifts()
 {
     PurchaseOrderGiftQuery query = new PurchaseOrderGiftQuery();
     query.PageSize = 10;
     query.PageIndex = pagerOrderGifts.PageIndex;
     query.PurchaseOrderId = purchaseOrderId;
     DbQueryResult purchaseOrderGifts = SubsiteSalesHelper.GetPurchaseOrderGifts(query);
     dlstOrderGifts.DataSource = purchaseOrderGifts.Data;
     dlstOrderGifts.DataBind();
     pagerOrderGifts.TotalRecords = purchaseOrderGifts.TotalRecords;
 }
Exemple #2
0
 public override DbQueryResult GetPurchaseOrderGifts(PurchaseOrderGiftQuery query)
 {
     DbQueryResult result = new DbQueryResult();
     StringBuilder builder = new StringBuilder();
     builder.AppendFormat("select top {0} * from Hishop_PurchaseOrderGifts where PurchaseOrderId=@PurchaseOrderId", 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_PurchaseOrderGifts where PurchaseOrderId=@PurchaseOrderId 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_PurchaseOrderGifts where PurchaseOrderId=@PurchaseOrderId", new object[0]);
     }
     DbCommand sqlStringCommand = database.GetSqlStringCommand(builder.ToString());
     database.AddInParameter(sqlStringCommand, "PurchaseOrderId", DbType.String, query.PurchaseOrderId);
     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;
 }
Exemple #3
0
 public static DbQueryResult GetPurchaseOrderGifts(PurchaseOrderGiftQuery query)
 {
     return SubsiteSalesProvider.Instance().GetPurchaseOrderGifts(query);
 }