Exemple #1
0
        public void startingOrder(MultiCellBuffer obj)         //start order will start
        {
            Console.WriteLine("Starting Order");
            Decoder dobj = new Decoder();
            //MultiCellBuffer cellbuff = new MultiCellBuffer(2);
            //Console.WriteLine("axxx");
            string multiCellString = obj.getTheCell();
            //Console.Write("bxxxx");
            OrderClass orderdecode           = dobj.decode(multiCellString);
            Thread     OrderProcessingThread = new Thread(() => OrderProcessing.processOrder(orderdecode, getPrice()));

            OrderProcessingThread.Start();
        }
Exemple #2
0
        public OrderClass decode(string seperate)

        {
            String[] dataString = seperate.Split('-');
            string   id         = Convert.ToString(dataString[0]);
            int      card       = Convert.ToInt32(dataString[1]);
            int      amount     = Convert.ToInt32(dataString[2]);
            double   unitprice  = Convert.ToDouble(dataString[3]);


            OrderClass orderBook = new OrderClass(id, card, amount, unitprice);

            return(orderBook);
        }
Exemple #3
0
        public static string encode(OrderClass OrderObject)

        {
            //Console.WriteLine("in encoder");


            string data = OrderObject.getSenderId() + "-" + OrderObject.getcardNo().ToString()


                          + "-" + OrderObject.getAmount().ToString() + "-" + OrderObject.getunitPrice().ToString();


            return(data);
        }
Exemple #4
0
        public static void processOrder(OrderClass obj, double p)         //initialize a new instance
        {
            Console.WriteLine("Order Processing");

            Console.WriteLine("Credit Card Valid");


            double total = (obj.getunitPrice() * obj.getAmount()) + obj.getTax() + obj.getLocationCharge();



            Console.WriteLine("Order from {0} ", obj.getSenderId(),
                              "ordered ", obj.getAmount(),
                              "book(s).\nCredit Card Number:", obj.getcardNo(),
                              "\nPrice:", obj.getunitPrice());
            Console.WriteLine("The total is:" + total);
        }
Exemple #5
0
        public void createsOrder(string senderId, double finalprice)         //creating order passing sender id and the final price thast has changed
        {
            Console.WriteLine("\nCreating Order for id {0}", senderId);

            string sender = senderId;
            //Console.WriteLine(senderId);
            Int32  cardNumber = rnd.Next(5000, 7000);
            Int32  amount     = rnd.Next(20, 100);
            double unitPrice  = finalprice;

            //gather info into order object
            OrderClass order = new OrderClass(sender, cardNumber, amount, unitPrice);

            //pass order into encoder and return a string
            string bookOrderString = Encoder.encode(order);

            //Console.WriteLine(bookOrderString);
            //pass string into multicellbuffer

            cellbuff.setTheCell(bookOrderString);
            Publisher pobj = new Publisher();

            pobj.startingOrder(cellbuff);
        }