Example #1
0
        //Event handler for order confirmation
        public void orderConfirmationEvent(OrderClass confirmedOrder)
        {
            //only attempt to move order from sent to confirmed after making sure
            //the order sender id matches the thread sender id
            //otherwise it is someonelse's order
            if (confirmedOrder.getID() == senderId.ToString())
            {
                //search for the confirmed order
                for (int s = 0; s < sentOrders.Count; s++)
                {
                    if (sentOrders.ElementAt(s).getOrderId() == confirmedOrder.getOrderId())
                    {
                        Console.WriteLine("Order ({0}) Confirmation Received", confirmedOrder.ToString());

                        orderFinish[s] = DateTime.Now;
                        //move from sent orders to confirmed orders
                        confirmedOrders.Add(confirmedOrder);


                        // trace events caught

                        //sentOrders.RemoveAt(s); i will not remove the confirmed order from s in order to
                        //maintain the correct order in which the orders were submitted so i can use
                        //that index for the finish time stamp
                        //TimeStamp for end of order s
                    }
                }
            }
        }
Example #2
0
        public void setOrder(OrderClass s)
        {
            StringBuilder temp = new StringBuilder();
            temp.Append(s.getAmt().ToString());  //Appends amount to string
            temp.Append(" ");
            temp.Append(s.getCardNo().ToString()); //Appends card number to string
            temp.Append(" ");
            temp.Append(s.getID().ToString()); //Appends ID to string
            temp.Append(" ");
            temp.Append(s.getOrderId().ToString()); //Appends orderId to string
            temp.Append(" ");
            temp.Append(s.getnoRooms().ToString()); //Appends number of rooms to string
            temp.Append(" ");
            temp.Append(s.getPrice().ToString());  //Appends price per room to string
            temp.Append(" ");

            order = temp.ToString(); //builds string
            EncryptionService.ServiceClient serviceClient = new EncryptionService.ServiceClient(); //Instantiates encryption service
            order = serviceClient.Encrypt(order);  //encrypts string
        }
Example #3
0
        public void setOrder(OrderClass s)
        {
            StringBuilder temp = new StringBuilder();

            temp.Append(s.getAmt().ToString());     //Appends amount to string
            temp.Append(" ");
            temp.Append(s.getCardNo().ToString());  //Appends card number to string
            temp.Append(" ");
            temp.Append(s.getID().ToString());      //Appends ID to string
            temp.Append(" ");
            temp.Append(s.getOrderId().ToString()); //Appends orderId to string
            temp.Append(" ");
            temp.Append(s.getnoRooms().ToString()); //Appends number of rooms to string
            temp.Append(" ");
            temp.Append(s.getPrice().ToString());   //Appends price per room to string
            temp.Append(" ");


            order = temp.ToString();                                                               //builds string
            EncryptionService.ServiceClient serviceClient = new EncryptionService.ServiceClient(); //Instantiates encryption service
            order = serviceClient.Encrypt(order);                                                  //encrypts string
        }
Example #4
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            OrderClass o = obj as OrderClass;

            if ((System.Object)o == null)
            {
                return(false);
            }


            return((amount == o.getAmt()) && (cardNo == o.getCardNo()) && senderId.Equals(o.getID()));
        }
        //Event handler for order confirmation
        public void orderConfirmationEvent(OrderClass confirmedOrder)
        {
            //only attempt to move order from sent to confirmed after making sure
            //the order sender id matches the thread sender id
            //otherwise it is someonelse's order
            if (confirmedOrder.getID() == senderId.ToString())
            {

                //search for the confirmed order
                for (int s = 0; s < sentOrders.Count; s++)
                {

                    if (sentOrders.ElementAt(s).getOrderId() == confirmedOrder.getOrderId())
                    {
                        Console.WriteLine("Order ({0}) Confirmation Received", confirmedOrder.ToString());

                        orderFinish[s] = DateTime.Now;
                        //move from sent orders to confirmed orders
                        confirmedOrders.Add(confirmedOrder);

                        // trace events caught

                        //sentOrders.RemoveAt(s); i will not remove the confirmed order from s in order to
                        //maintain the correct order in which the orders were submitted so i can use
                        //that index for the finish time stamp
                        //TimeStamp for end of order s
                    }

                }
            }
        }