예제 #1
0
 public void GetIncomingBids(Bidder bidder)
 {
     try
     {
         decimal bid;
         while (true)
         {
             bool correctformat = decimal.TryParse(bidder.Read(), out bid);
             if (correctformat == false)
             {
                 bidder.Write("Not a Number!");
             }
             if (bid <= AuctionHouseRepo.Instance.CurrentBid && bid < AuctionHouseRepo.Instance.CurrentItem.StartingPrice)
             {
                 bidder.Write("Bid must be higher than current bid.");
             }
             else
             {
                 AuctionHouseRepo.Instance.HighestBidder = bidder;
                 AuctionHouseRepo.Instance.NextBid       = bid;
             }
         }
     }
     catch (Exception)
     {
         bidder = null;
     }
 }
예제 #2
0
        public void On_New_Connection(Socket socket)
        {
            Bidder bidder = new Bidder(socket);

            bidder.Write("Enter Name to join Auction: ");
            bidder.Name = bidder.Read();
            bidders.Add(bidder);
            handler.AuctionStart(bidder);
        }
예제 #3
0
        public void AuctionStart(Bidder bidder)
        {
            bidder.Write("Welcome to the Auction, current status is: ");
            AuctionHouseRepo.Instance.itemList.ForEach(item => bidder.Write(item.ToString()));

            bidder.Write($"Current item is {AuctionHouseRepo.Instance.CurrentItem.ToString()} Starting at  " +
                         $"{AuctionHouseRepo.Instance.CurrentItem.StartingPrice.ToString()} " +
                         $"Current bid for Item is {AuctionHouseRepo.Instance.CurrentBid.ToString()}");

            GetIncomingBids(bidder);
        }