Ejemplo n.º 1
0
        public void OrderProcessingFun(OrderClass obj_1)
        {
            Encoder encode = new Encoder();

            senderId   = obj_1.get_senderId();
            cardNo     = obj_1.get_cardNo();
            receiverId = obj_1.get_receiverId();
            amount     = obj_1.get_amount();
            unitprice  = obj_1.get_unitprice();

            string encodedString;

            if (!IsValidCardNo(cardNo) || amount == 0)
            {
                obj_1.set_confirmationstatus(false);
                obj_1.set_totalamount(0);
                encodedString = encode.encryptString(obj_1);
                //  ConfirmationBuffer.setOneCell(encodedString);
            }
            else
            {
                CalculatePrice();
                obj_1.set_confirmationstatus(true);
                obj_1.set_totalamount(TotalAmount);

                encodedString = encode.encryptString(obj_1);
                //    ConfirmationBuffer.setOneCell(encodedString);
            }
            if (encodedString != null)
            {
                OrderConfirmation(encodedString);
            }
        }
Ejemplo n.º 2
0
        public void EventHandler_ConfirmationStatus(string message)
        {
            Decoder decode_test = new Decoder();
            OrderClass obj = new OrderClass();
            obj = decode_test.decryptString(message);

            if (obj.get_senderId() == this.name)
            {
                Console.WriteLine("\n\n\n***************  ORDER STATUS  ***************");
                Console.WriteLine("Travel {0} placed an order of {1} ticktes to Airline {2}", obj.get_senderId(), obj.get_amount(), obj.get_receiverId());
                Console.WriteLine("The price of each ticket is ${0}", obj.get_unitprice());
                Console.WriteLine("The total amount charged is : ${0}", obj.get_totalamount());
                Console.WriteLine("The order is charged to card number  : {0}", obj.get_cardNo());

                if (obj.get_confirmationstatus())
                {
                    Console.WriteLine("Congratulations !! the order has been processed. Have a safe Flight !");
                }
                else
                {
                    Console.WriteLine("No Tickets Available. Your order could not be processed at this time !");
                }

                stopWatch.Stop();
                timeSpan = stopWatch.Elapsed;
                Console.WriteLine("Total time taken for order confirmation: " + timeSpan.Milliseconds);

                Console.WriteLine("**************************************************");
                Console.WriteLine("\n\n\n");

            }
        }
        public void EventHandler_ConfirmationStatus(string message)
        {
            Decoder    decode_test = new Decoder();
            OrderClass obj         = new OrderClass();

            obj = decode_test.decryptString(message);


            if (obj.get_senderId() == this.name)
            {
                Console.WriteLine("\n\n\n***************  ORDER STATUS  ***************");
                Console.WriteLine("Travel {0} placed an order of {1} ticktes to Airline {2}", obj.get_senderId(), obj.get_amount(), obj.get_receiverId());
                Console.WriteLine("The price of each ticket is ${0}", obj.get_unitprice());
                Console.WriteLine("The total amount charged is : ${0}", obj.get_totalamount());
                Console.WriteLine("The order is charged to card number  : {0}", obj.get_cardNo());

                if (obj.get_confirmationstatus())
                {
                    Console.WriteLine("Congratulations !! the order has been processed. Have a safe Flight !");
                }
                else
                {
                    Console.WriteLine("No Tickets Available. Your order could not be processed at this time !");
                }

                stopWatch.Stop();
                timeSpan = stopWatch.Elapsed;
                Console.WriteLine("Total time taken for order confirmation: " + timeSpan.Milliseconds + "milliseconds");

                Console.WriteLine("**************************************************");
                Console.WriteLine("\n\n\n");
            }
        }
        public void OrderProcessingFun(OrderClass obj_1)
        {
            Encoder encode = new Encoder();
            senderId = obj_1.get_senderId();
            cardNo = obj_1.get_cardNo();
            receiverId = obj_1.get_receiverId();
            amount = obj_1.get_amount();
            unitprice = obj_1.get_unitprice();

            string encodedString;

            if (!IsValidCardNo(cardNo) || amount == 0)
            {
                obj_1.set_confirmationstatus(false);
                obj_1.set_totalamount(0);
                encodedString = encode.encryptString(obj_1);
              //  ConfirmationBuffer.setOneCell(encodedString);

            }
            else
            {
                CalculatePrice();
                obj_1.set_confirmationstatus(true);
                obj_1.set_totalamount(TotalAmount);

                encodedString = encode.encryptString(obj_1);
            //    ConfirmationBuffer.setOneCell(encodedString);

            }
            if (encodedString != null)
            {
                OrderConfirmation(encodedString);
            }
        }
Ejemplo n.º 5
0
        public string encryptString(OrderClass order)
        {
            try
            {
                temp = (order.get_senderId()) + "," + Convert.ToString(order.get_cardNo()) + "," + (order.get_receiverId())
                    + "," + Convert.ToString(order.get_amount()) + "," + Convert.ToString(order.get_unitprice()) + "," +
                    Convert.ToString(order.get_totalamount()) + "," + Convert.ToString(order.get_confirmationstatus());

                encryptedString = client.Encrypt(temp);
            }
            catch(Exception e)
            {
                Console.WriteLine("Exception Occured while Encoding" + e.Message.ToString());
            }

            return encryptedString;
        }
Ejemplo n.º 6
0
        public string encryptString(OrderClass order)
        {
            try
            {
                temp = (order.get_senderId()) + "," + Convert.ToString(order.get_cardNo()) + "," + (order.get_receiverId())
                       + "," + Convert.ToString(order.get_amount()) + "," + Convert.ToString(order.get_unitprice()) + "," +
                       Convert.ToString(order.get_totalamount()) + "," + Convert.ToString(order.get_confirmationstatus());

                encryptedString = client.Encrypt(temp);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception Occured while Encoding" + e.Message.ToString());
            }

            return(encryptedString);
        }