Example #1
0
        public void runOrder()                                   //event handler
        {
            string     order       = Program.mcb.getOneCell();   //retrieves the order from the MultiCellBuffer
            OrderClass orderObject = encodeDecode.decode(order); //decodes the string
            Thread     thread      = new Thread(() => OrderProcessing.processOrder(orderObject, getPrice()));

            thread.Start(); //starts the order processing thread
        }
Example #2
0
        public void runOrder()                                   //event handler
        {
            string order = Program.mcb.getOneCell();             //retrieves the order from the MultiCellBuffer

            var        output      = order.Split(new[] { ':' }); //splits the string with the colons
            OrderClass orderObject = new OrderClass(output[0], Convert.ToInt32(output[1]), Convert.ToInt32(output[2]), Convert.ToInt32(output[3]));

            Thread thread = new Thread(() => OrderProcessing.processOrder(orderObject, getPrice()));

            thread.Start(); //starts the order processing thread
        }
Example #3
0
        public void Order(string customerId)
        {
            //This causes the orders to be processed asynchronously.
            //Commenting out the Thread.Sleep function will cause orders to be evaluated in order and instantly
            Console.WriteLine("ORDER PLACED FOR CUSTOMER #{0} \n\n", customerId);
            Thread.Sleep(rand.Next(500, 1000));
            OrderObject order  = Program.orderBuffer.getBuffer();       //Get the order from the buffer and start an order processing thread.
            Thread      thread = new Thread(() => OrderProcessing.processOrderFunc(order));

            thread.Start();
        }