public override void EndAuction(int auctionID, int stageID, DateTime showBeginTime, DateTime showEndTime, AuctionStage nextStage) { if (nextStage != null) { BuildAuctionStage(new AuctionStage[] { nextStage }); } using (SqlQuery query = new SqlQuery()) { query.CommandText = "Chinaz_EndAuction"; query.CommandType = CommandType.StoredProcedure; query.CreateParameter <int>("@AuctionID", auctionID, SqlDbType.Int); query.CreateParameter <int>("@StageID", stageID, SqlDbType.Int); query.CreateParameter <DateTime>("@ShowBeginTime", showBeginTime, SqlDbType.DateTime); query.CreateParameter <DateTime>("@ShowEndTime", showEndTime, SqlDbType.DateTime); query.ExecuteNonQuery(); } }
public override void EndAuction(int auctionID, int stageID,DateTime showBeginTime, DateTime showEndTime, AuctionStage nextStage ) { if (nextStage != null) BuildAuctionStage(new AuctionStage[] { nextStage }); using (SqlQuery query = new SqlQuery()) { query.CommandText = "Chinaz_EndAuction"; query.CommandType = CommandType.StoredProcedure; query.CreateParameter<int>("@AuctionID", auctionID, SqlDbType.Int); query.CreateParameter<int>("@StageID", stageID, SqlDbType.Int); query.CreateParameter<DateTime>("@ShowBeginTime", showBeginTime, SqlDbType.DateTime); query.CreateParameter<DateTime>("@ShowEndTime", showEndTime, SqlDbType.DateTime); query.ExecuteNonQuery(); } }
public override AuctionCollection GetAuctions(bool openOnly, bool getLastStage) { using (SqlQuery query = new SqlQuery()) { query.CommandText = "Chinaz_LoadAuctions"; query.CommandType = CommandType.StoredProcedure; query.CreateParameter <bool>("@GetLastStage", getLastStage, SqlDbType.Bit); AuctionCollection auctions = new AuctionCollection(); using (XSqlDataReader reader = query.ExecuteReader()) { auctions = new AuctionCollection(reader); if (getLastStage && reader.NextResult()) { while (reader.Next) { AuctionStage stage = new AuctionStage(reader); foreach (Auction auc in auctions) { if (auc.AuctionID == stage.AuctionID) { auc.LastStage = stage; } } } if (reader.NextResult()) { AuctionBidInfo bid; while (reader.Next) { bid = new AuctionBidInfo(reader); foreach (Auction auc in auctions) { if (auc.LastStage != null && auc.LastStage.StageID == bid.StageID && auc.AuctionID == bid.AuctionID) { if (auc.LastStage.LastBid == null) { auc.LastStage.LastBid = bid; } else if (auc.LastStage.LastBid.Price < bid.Price) { auc.LastStage.LastBid = bid; } if (auc.LastStage.EndTime > DateTimeUtil.Now) { auc.LastStage.BidList.Add(bid); } } } } } } return(auctions); } } }
public override AuctionCollection GetAuctions(bool openOnly,bool getLastStage) { using (SqlQuery query = new SqlQuery()) { query.CommandText = "Chinaz_LoadAuctions"; query.CommandType = CommandType.StoredProcedure; query.CreateParameter<bool>("@GetLastStage",getLastStage, SqlDbType.Bit); AuctionCollection auctions = new AuctionCollection(); using (XSqlDataReader reader = query.ExecuteReader()) { auctions = new AuctionCollection(reader); if (getLastStage && reader.NextResult()) { while (reader.Next) { AuctionStage stage = new AuctionStage(reader); foreach (Auction auc in auctions) { if (auc.AuctionID == stage.AuctionID) { auc.LastStage = stage; } } } if (reader.NextResult()) { AuctionBidInfo bid; while (reader.Next) { bid = new AuctionBidInfo(reader); foreach (Auction auc in auctions) { if (auc.LastStage != null && auc.LastStage.StageID == bid.StageID && auc.AuctionID == bid.AuctionID) { if (auc.LastStage.LastBid == null) { auc.LastStage.LastBid = bid; } else if (auc.LastStage.LastBid.Price < bid.Price) { auc.LastStage.LastBid = bid; } if (auc.LastStage.EndTime > DateTimeUtil.Now) auc.LastStage.BidList.Add(bid); } } } } } return auctions; } } }