private WinningBid DetermineWinnerFromProxyBidding(WinningBid winningBid, Bid newbid)
        {
            WinningBid nextIncrement;

            if (winningBid.MaxBidCanBeExceededBy(newbid.MaximumBid))
            {
                nextIncrement = CreateNewBid(this.Bidder, this.MaximumBid, this.MaximumBid, this.TimeOfBid);

                if (nextIncrement.CanMeetOrExceedBidIncrement(newbid.MaximumBid))
                {
                    return(CreateNewBid(newbid.Bidder, nextIncrement.CurrentAuctionPrice.BidIncrement(), newbid.MaximumBid, newbid.TimeOfOffer));
                }
                else
                {
                    return(CreateNewBid(newbid.Bidder, newbid.MaximumBid, newbid.MaximumBid, newbid.TimeOfOffer));
                }
            }
            else
            {
                nextIncrement = CreateNewBid(newbid.Bidder, newbid.MaximumBid, newbid.MaximumBid, newbid.TimeOfOffer);

                if (nextIncrement.CanMeetOrExceedBidIncrement(winningBid.MaximumBid))
                {
                    return(CreateNewBid(winningBid.Bidder, nextIncrement.CurrentAuctionPrice.BidIncrement(), winningBid.MaximumBid, winningBid.TimeOfBid));
                }
                else
                {
                    return(CreateNewBid(winningBid.Bidder, winningBid.MaximumBid, winningBid.MaximumBid, winningBid.TimeOfBid));
                }
            }
        }
Ejemplo n.º 2
0
 public void PlaceBidFor(Bid bid, DateTime currentTime)
 {
     if (StillInProgress(currentTime))
     {
         if (IsFirstBid())
         {
             RegisterFirst(bid);
         }
         else if (BidderIsIncreasingMaximumBid(bid))
         {
             WinningBid = WinningBid.RaiseMaximumBidTo(bid.MaximumBid);
         }
         else if (WinningBid.CanMeetOrExceedBidIncrement(bid.MaximumBid))
         {
             Place(WinningBid.DetermineWinningBidIncrement(bid));
         }
     }
 }
Ejemplo n.º 3
0
        private WinningBid DetermineWinnerFromProxyBidding(WinningBid winningBid, Bid newbid)
        {
            WinningBid nextIncrement;

            if (winningBid.MaxBidCanBeExceededBy(newbid.MaximumBid))
            {
                nextIncrement = CreateNewBid(this.Bidder, this.MaximumBid, this.MaximumBid, this.TimeOfBid);

                if (nextIncrement.CanMeetOrExceedBidIncrement(newbid.MaximumBid))
                    return CreateNewBid(newbid.Bidder, nextIncrement.CurrentAuctionPrice.BidIncrement(), newbid.MaximumBid, newbid.TimeOfOffer);
                else
                    return CreateNewBid(newbid.Bidder, newbid.MaximumBid, newbid.MaximumBid, newbid.TimeOfOffer);
            }
            else
            {
                nextIncrement = CreateNewBid(newbid.Bidder, newbid.MaximumBid, newbid.MaximumBid, newbid.TimeOfOffer);

                if (nextIncrement.CanMeetOrExceedBidIncrement(winningBid.MaximumBid))
                    return CreateNewBid(winningBid.Bidder, nextIncrement.CurrentAuctionPrice.BidIncrement(), winningBid.MaximumBid, winningBid.TimeOfBid);
                else
                    return CreateNewBid(winningBid.Bidder, winningBid.MaximumBid, winningBid.MaximumBid, winningBid.TimeOfBid);
            }
        }
Ejemplo n.º 4
0
 private void Place(WinningBid newBid)
 {
     Bids.Add(new HistoricalBid(newBid.Bidder, newBid.MaximumBid, newBid.TimeOfBid));
     WinningBid = newBid;            
 }
Ejemplo n.º 5
0
 private bool BidderIsIncreasingMaximumBid(Bid bid)
 {
     return(WinningBid.WasMadeBy(bid.Bidder) && bid.MaximumBid.IsGreaterThan(WinningBid.MaximumBid));
 }
Ejemplo n.º 6
0
 private void Place(WinningBid newBid)
 {
     Bids.Add(new HistoricalBid(newBid.Bidder, newBid.MaximumBid, newBid.TimeOfBid));
     WinningBid = newBid;
 }