Exemple #1
0
 public void receiveTime(OrderClass orderObj, Double amountOfCharge)
 {
     orderObj.setReceiveTime(DateTime.Now);
     Console.WriteLine();
     Console.WriteLine("Order ID: {0}, Agency ID: {1}, UnitPrice of Room: {2}, Amount of Room: {3}, Amount of Charge: {4}, Start Time: {5}, Completed Time: {6}, Time to process the order: {7}", orderObj.getOrderId(), orderObj.getSenderId() + 1, orderObj.getUnitPrice().ToString("f0"), orderObj.getAmt(), amountOfCharge.ToString("f0"), orderObj.getSenderTime(), orderObj.getReceiveTime(), (orderObj.getReceiveTime() - orderObj.getSenderTime()));
     pricecutLockCounter++;
     if (pricecutLockCounter == 10)
     {
         pricecutLock.Event.Set();
         pricecutLockCounter = 0;
         //            Console.WriteLine("Order ID: {0}, Agency ID: {1}, Unit Price: {3}, Amount of Room: {2}, Amount of Charge: {4}, Start Time: {5}, Completed Time: {6}, Time to process the order: {7}", orderObj.getOrderId(), orderObj.getSenderId() + 1, orderObj.getAmt(), roomPrice.price, amountOfCharge, orderObj.getSenderTime(), orderObj.getReceiveTime(), (orderObj.getReceiveTime() - orderObj.getSenderTime()));
         //            if (orderObj.getPriceCutId()<10)
         //                Console.WriteLine("No.{8} Price-cut, Order ID: {0}, Agency ID: {1}, Unit Price: {3}, Amount of Room: {2}, Amount of Charge: {4}, Start Time: {5}, Completed Time: {6}, Time to process the order: {7}", orderObj.getOrderId(), orderObj.getSenderId() + 1, orderObj.getAmt(), roomPrice.price, amountOfCharge, orderObj.getSenderTime(), orderObj.getReceiveTime(), (orderObj.getReceiveTime() - orderObj.getSenderTime()), orderObj.getPriceCutId() + 1);
     }
 }
Exemple #2
0
        public void orderProcessing()
        {
            String orderString;

            while (true)
            {
                orderString = Program.mcb.getOneCell();
                OrderClass orderObj = Coder.decoder(orderString);
                Monitor.Enter(roomPrice);
                if (HotelSupplier.checkCreditCardNumber(orderObj.getCardNo()))
                {
                    double amountOfCharge = orderObj.getUnitPrice() * orderObj.getAmt() + taxRate * orderObj.getUnitPrice() * orderObj.getAmt() + locationCharge;
                    orderObj.setReceiveTime(DateTime.Now);
                    if (orderCompleted != null)
                    {
                        orderCompleted(orderObj, amountOfCharge);
                    }
                }
                Monitor.Exit(roomPrice);
            }
        }