Esempio n. 1
0
 //start thread here
 public void PlantFunc()
 {
     plantName2 = Thread.CurrentThread.Name;
     for (Int32 i = 0; i < 5; i++)
     {
         Thread.Sleep(1500);
         //// mod ////
         double stockprice = CarProject.stockmarket2.getstockprice();
         Int32  p          = PricingModel(orderstaken, carsAvailable, stockprice);
         //// mod ////
         //Console.WriteLine("{0} new price is {1}", Thread.CurrentThread.Name, p);
         Plant2.carPriceChange(p);
         //Thread.Sleep(3000);
         order = CarProject.Cellbuffer.getOneCell(Thread.CurrentThread.Name);
         //Decoder(order);
         if (!"0".Equals(order))
         {
             lock (locker)
             {
                 carsAvailable--;
                 orderstaken++;
             }
             Console.WriteLine("edward received the order {0}", order);
             orderprocessing = new OrderProcessing(Decoder(order));
         }
     }
 }
Esempio n. 2
0
 //start thread here
 public void PlantFunc()
 {
     plantName1 = Thread.CurrentThread.Name;
     Console.WriteLine("The default price is {0}", priceSaleToDealers);
     for (Int32 i = 0; i < 5; i++)
     {
         //Plant links to the stockmarket for stock price for calculation
         //on the price
         Thread.Sleep(1500);
         double stockprice = CarProject.stockmarket.getstockprice();
         Int32  p          = PricingModel(orderstaken, carsAvailable, stockprice);
         Console.WriteLine("{0} new price is {1}", Thread.CurrentThread.Name, p);
         Plant.carPriceChange(p);
         order = CarProject.Cellbuffer.getOneCell(Thread.CurrentThread.Name);
         if (!"0".Equals(order))
         {
             lock (locker)
             {
                 carsAvailable--;
                 orderstaken++;
             }
             Console.WriteLine("brian received the order {0} ", order);
             orderprocessing = new OrderProcessing(Decoder(order));
         }
     }
 }