public AuctionItem(int ID, string itemDescription, DateTime closeAt, float startAmount, string imagePath) { //creates an AuctionItem object with id, description, closing time, starting amount and path to items image try { this.m_ItemID = ID; this.m_ItemDescription = itemDescription; this.m_ClosingTime = closeAt; this.m_ItemPath = imagePath; this.m_CurrentHighestBid = new Bid(this, startAmount); // creates a starting bid to beat (with no client) this.m_Closed = false; } catch (ArgumentNullException ane) { System.Windows.Forms.MessageBox.Show("ArgumentNullException in AuctionItem constructor by: " + ane.TargetSite + "\rwith: " + ane.Message); } catch (Exception e) { System.Windows.Forms.MessageBox.Show("Exception in AuctionItem constructor by: " + e.TargetSite + "\rwith: " + e.Message); } }
public bool setCurrentHighBid(Bid newHighBid) { //sets the current high bid (checks if bid is actually higher than current bid and that auction is not closed) //and returns un/success of operation if (newHighBid.getAmount() <= this.m_CurrentHighestBid.getAmount() || this.m_ClosingTime < DateTime.Now) return false; else { this.m_CurrentHighestBid = newHighBid; return true; } }