public override AuctionBidInfo GetMyAuctionBid(int userId, int auctionId, int stageId) { using (SqlQuery query = new SqlQuery()) { query.CommandText = "SELECT TOP 1 * FROM Chinaz_AuctionBids WHERE UserID = @UserID AND AuctionID = @AuctionID AND StageID = @StageID ORDER BY BidID DESC"; query.CreateParameter <int>("@UserID", userId, SqlDbType.Int); query.CreateParameter <int>("@AuctionID", auctionId, SqlDbType.Int); query.CreateParameter <int>("@StageID", stageId, SqlDbType.Int); AuctionBidInfo bid = null; using (XSqlDataReader reader = query.ExecuteReader()) { while (reader.Next) { bid = new AuctionBidInfo(reader); } return(bid); } } }
public override AuctionBidInfo GetAuctionBidResult(int auctionID, int stageID) { using (SqlQuery query = new SqlQuery()) { query.CommandText = "SELECT * FROM Chinaz_AuctionBids WHERE Successful = 1 AND AuctionID = @AuctionID AND StageID"; query.CreateParameter <int>("@AuctionID", auctionID, SqlDbType.Int); query.CreateParameter <int>("@StageID", stageID, SqlDbType.Int); using (XSqlDataReader reader = query.ExecuteReader()) { AuctionBidInfo bidInfo = null; while (reader.Next) { bidInfo = new AuctionBidInfo(reader); } return(bidInfo); } } }
public override AuctionBidInfo GetLastBid(int auctionID, int stageID) { using (SqlQuery query = new SqlQuery()) { query.CommandText = "SELECT TOP 1 * FROM Chinaz_AuctionBids WHERE AuctionID = @AuctionID AND StageID = @StageID ORDER BY Price DESC;"; query.CreateParameter <int>("@AuctionID", auctionID, SqlDbType.Int); query.CreateParameter <int>("@StageID", stageID, SqlDbType.Int); using (XSqlDataReader reader = query.ExecuteReader()) { AuctionBidInfo bid = null; while (reader.Next) { bid = new AuctionBidInfo(reader); } return(bid); } } }
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 AuctionBidInfo GetMyAuctionBid(int userId, int auctionId, int stageId) { using (SqlQuery query = new SqlQuery()) { query.CommandText = "SELECT TOP 1 * FROM Chinaz_AuctionBids WHERE UserID = @UserID AND AuctionID = @AuctionID AND StageID = @StageID ORDER BY BidID DESC"; query.CreateParameter<int>("@UserID", userId, SqlDbType.Int); query.CreateParameter<int>("@AuctionID", auctionId, SqlDbType.Int); query.CreateParameter<int>("@StageID", stageId, SqlDbType.Int); AuctionBidInfo bid = null; using (XSqlDataReader reader = query.ExecuteReader()) { while (reader.Next) bid = new AuctionBidInfo(reader); return bid; } } }
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 AuctionBidInfo GetAuctionBidResult(int auctionID, int stageID) { using (SqlQuery query = new SqlQuery()) { query.CommandText = "SELECT * FROM Chinaz_AuctionBids WHERE Successful = 1 AND AuctionID = @AuctionID AND StageID"; query.CreateParameter<int>("@AuctionID", auctionID, SqlDbType.Int); query.CreateParameter<int>("@StageID", stageID, SqlDbType.Int); using( XSqlDataReader reader = query.ExecuteReader() ) { AuctionBidInfo bidInfo = null; while (reader.Next) bidInfo = new AuctionBidInfo(reader); return bidInfo; } } }
public override AuctionBidInfo GetLastBid( int auctionID, int stageID ) { using (SqlQuery query = new SqlQuery()) { query.CommandText = "SELECT TOP 1 * FROM Chinaz_AuctionBids WHERE AuctionID = @AuctionID AND StageID = @StageID ORDER BY Price DESC;"; query.CreateParameter<int>("@AuctionID", auctionID, SqlDbType.Int); query.CreateParameter<int>("@StageID", stageID, SqlDbType.Int); using (XSqlDataReader reader = query.ExecuteReader()) { AuctionBidInfo bid = null; while (reader.Next) bid = new AuctionBidInfo(reader); return bid; } } }