Пример #1
0
 //thread to check and close auctions when their close date is met
 public void threadedCheckAucClose()
 {
     Thread.Sleep(1000);
     foreach (Auction Auc in Auctions)
     {
         if (Auc.getIsRunning() == true)
         {
             Auc.checkToClose(); // check to close the auction
         }
     }
     threadedCheckAucClose();
 }
Пример #2
0
        public void browseAuction()
        {
#if DEBUG
            Console.WriteLine("Entered Browse Auction method");
#endif
            int i = 1;
            Console.WriteLine("Current Auctions: \n");
            //loop through and show all auctions
            foreach (Auction Auc in Auctions)
            {
                if (Auc.getIsRunning() == true)
                {
                    Auc.setStatus('R');
                    Console.WriteLine("     Auction {0} : {1} - Current Price £{2}", i, Auc.getName(), Auc.getCurrentPrice());
                    Console.WriteLine("     Auction closes: {0}", Auc.getCloseDate().ToString("h:mm:ss tt"));
                    Console.WriteLine("     Reserve Price: £{0}", Auc.getReservePrice());
                    Console.WriteLine("     Status: {0}", Auc.getStatus());
                    Console.WriteLine("     Current Highest Bidder: {0}", Auc.getCurrentBidder());
                    Auc.checkToClose(); // check to close the auction
                    Console.WriteLine("---------------------------------------------------------------------------");
                }
                i++;
                Auc.setID(i - 1); // needed to deduct 1 from i to get correct id
            }

            Console.WriteLine("Finished Auctions: \n");
            foreach (Auction Auc in Auctions)
            {
                if (Auc.getIsRunning() == false)
                {
                    //string finished = DateTime.Now.ToString("h:mm:ss tt");
                    Console.WriteLine("     Auction : {0} - Final Price £{1}", Auc.getName(), Auc.getCurrentPrice());
                    Console.WriteLine("     Auction closed at: {0}", Auc.getFinishTime().ToString("h:mm:ss tt"));
                    Console.WriteLine("     Bought by: {0}", Auc.getBuyerName());
                    Console.WriteLine("---------------------------------------------------------------------------");
                }
            }
            makeBid();
        }