示例#1
0
        public static event orderCreatedEvent orderCreated; //event for the ticket agency about the availability of a new order

        //function to start a new thread which runs until the park thread runs
        public void ticketAgencyFunc()
        {
            while (Program.parkThreadRunning)
            {
                Thread.Sleep(RandomClass.getNext(2000, 4000));
                createOrderFunc(Thread.CurrentThread.Name);
            }
        }
示例#2
0
文件: Park.cs 项目: Lokeshwar0304/445
        //method that calls PricingModel to determine the ticket price
        public void parkFunc()
        {
            while (p <= MAX_P)
            {
                Thread.Sleep(RandomClass.getNext(1000, 2000)); // to generate a new price every 1-5 seconds
                changePrice(PricingModel.getPrice());
            }

            Program.parkThreadRunning = false;
        }
示例#3
0
        //function to create a new order
        private void createOrderFunc(string senderId)
        {
            int cardNo = RandomClass.getNext(5000, 7000);                                         //to generate a random card number
            int amount = RandomClass.getNext(10, 200);                                            //to generate a random number of tickets

            OrderClass order = new OrderClass(senderId, cardNo, amount, PricingModel.getPrice()); // new order object

            Console.WriteLine("{0}'s order with {1} tickets has been created at {2}", senderId, amount, DateTime.Now.ToString("hh:mm:ss"));

            Program.multiCellBuffer.setOneCell(order); // insert the new order into multicellbuffer

            orderCreated();
        }