Esempio n. 1
0
        //Test method to verify encode/decode service with orderclass
        static Boolean testOrder()
        {
            OrderClass order = new OrderClass();
            order.setAmt(123);
            order.setID("test");
            order.setCardNo(456418);

            Encoder enc = new Encoder(order);
            String encoded = enc.getOrder();
            Decoder dec = new Decoder(encoded);

            return order == dec.getOrder();
        }
Esempio n. 2
0
        //Process a recieved order
        public void setOrder(String[] orderString)
        {
            // get encoder - did we want to use a singleton here?
            Decoder    d = new Decoder();
            OrderClass order;
            Thread[] thread = new Thread[orderString.Length];

            // decode all orders
            for (int i = 0; i < orderString.Length; ++i)
            {

            // set the order an decrypt
            d.setOrder(orderString[i]);

            // get the decrypeted order
            order = d.getOrder();

            // need to call OrderProcessing
            thread[i] = new Thread(new ParameterizedThreadStart(Worker));
            thread[i].Start(order);

            //Increment order counter
            counter++;

            }
        }
Esempio n. 3
0
        // Need an event handler to catch a buffer event for new order
        public void notifyHotelOfOrder(bool cellsOccupied)
        {
            String[] orderString = new String[1];
            //get an order from the buffer, and then release the semaphore
            orderString[0] = buffer.getOneCell();
            MultiCellBuffer._cells.Release();
            Decoder dec = new Decoder(orderString[0]);

            price_model.scalePrice(Convert.ToInt32(dec.getOrder().getPrice()));
            this.setOrder(orderString);

            // trace events caught
            Console.WriteLine("({0}) Received By Hotel Supplier", dec.getOrder().ToString());
            waitHandle[0].Set();
        }