Example #1
0
        /// <summary>
        /// This takes an OrderObject to be confirmed, and creates a timestamp of when this is called as well as writing to Console
        /// </summary>
        /// <param name="order_confirm">The OrderObject retreived from the ProcessedOrder MultiCellBuffer.</param>
        private void confirmOrder(OrderObject order_confirm)
        {
            string timeStamp = DateTime.Now.ToString(); //Create a time stamp for when order is confirmed

            //Print Order Confirmation received message:
            Console.WriteLine("Travel Agency {0} received a new order confirmation:", this.agency_id);

            //Print header and Body of Order Confirmation Receipt:
            Console.WriteLine("---------------------------------");
            Console.WriteLine("Order Confirmation:");
            Console.WriteLine("Agency ID: {0}", order_confirm.getSenderID());
            Console.WriteLine("Hotel ID: {0}", order_confirm.getReceiverID());
            Console.WriteLine("Rooms Ordered: {0}", order_confirm.getNumberOfRoomsOrdered());
            Console.WriteLine("Room Price: {0}", order_confirm.getUnitPrice());
            Console.WriteLine("Total(+tax): {0}", order_confirm.getAmount());
            if (order_confirm.isValid())
            {
                Console.WriteLine("Order Confirmation: VALID");
            }
            else
            {
                Console.WriteLine("Order Confirmation: NOT VALID");
            }

            //Footer of the Order Confirmation Receipt:
            Console.WriteLine("TimeStamp: {0}", timeStamp);
            Console.WriteLine("---------------------------------");
            Console.WriteLine();
        }
Example #2
0
        /// <summary>
        /// This function takes in an OrderObject and "encodes" it into a string format.
        /// </summary>
        /// <param name="orderObj">The OrderObject to encode into a string.</param>
        /// <returns>The "encoded" string representation of the OrderObject passed in.</returns>
        public static String Encode(OrderObject orderObj)
        {
            //Generate the new string to be the "encoded" orderObject:
            string orderObj_toString = orderObj.getSenderID();

            orderObj_toString += (" " + orderObj.getReceiverID());
            orderObj_toString += (" " + orderObj.getCardNo());
            orderObj_toString += (" " + orderObj.getAmount());
            orderObj_toString += (" " + orderObj.getUnitPrice());
            orderObj_toString += (" " + orderObj.isValid());
            orderObj_toString += (" " + orderObj.getNumberOfRoomsOrdered());
            //Return the encoded String of the orderObject passed in:
            return(orderObj_toString);
        }