Exemple #1
0
        /// <summary>
        /// Decodes the Order Information String and re-constructs it into a object of type Order Class
        /// </summary>
        /// <param name="CurrentOrder"></param>
        /// <returns></returns>
        private OrderClass Decoder(String CurrentOrder)
        {
            OrderClass OrderObject = new OrderClass();

            if (CurrentOrder != null)
            {
                String[] arr = CurrentOrder.Split('-');

                OrderObject.setSenderID(arr[0]);
                OrderObject.setNoOfRooms(Convert.ToInt32(arr[1]));
                OrderObject.setCardNo(arr[2]);
                OrderObject.setReceieverID(arr[3]);
                OrderObject.setNoOfDays(Convert.ToInt32(arr[4]));
            }
            return(OrderObject);
        }
Exemple #2
0
        public void RoomsPriceCut(Int32 price, String HotelName)
        {
            Console.WriteLine();
            Console.WriteLine("{0} rooms are on sale with a low price  ${1} ", HotelName, price);
            Console.WriteLine("No. of Rooms Available at {0} are: {1}", HotelName, HotelSupplier.getRoomsAvailable(HotelName));
            Console.WriteLine();

            if (HotelName.Equals("HotelSupplier1"))
            {
                OrderClass CurrentOrder1 = new OrderClass();
                CurrentOrder1.setSenderID("TravelAgency1");
                CurrentOrder1.setReceieverID(HotelName);
                CurrentOrder1.setNoOfRooms(calculateNoOfRooms(price));//Calulates Rooms Required
                CurrentOrder1.setNoOfDays(2);
                CurrentOrder1.setCardNo(CreditCards[0]);
                CardinalMain.TravelAgency1.setCurrentOrder(CurrentOrder1);

                OrderClass CurrentOrder2 = new OrderClass();
                CurrentOrder2.setSenderID("TravelAgency2");
                CurrentOrder2.setReceieverID(HotelName);
                CurrentOrder2.setNoOfRooms(calculateNoOfRooms(price));//Calulates Rooms Required
                CurrentOrder2.setNoOfDays(4);
                CurrentOrder2.setCardNo(CreditCards[1]);
                CardinalMain.TravelAgency2.setCurrentOrder(CurrentOrder2);


                OrderClass CurrentOrder3 = new OrderClass();
                CurrentOrder3.setSenderID("TravelAgency3");
                CurrentOrder3.setReceieverID(HotelName);
                CurrentOrder3.setNoOfRooms(calculateNoOfRooms(price));//Calulates Rooms Required
                CurrentOrder3.setNoOfDays(3);
                CurrentOrder3.setCardNo(CreditCards[2]);
                CardinalMain.TravelAgency3.setCurrentOrder(CurrentOrder3);


                OrderClass CurrentOrder4 = new OrderClass();
                CurrentOrder4.setSenderID("TravelAgency4");
                CurrentOrder4.setReceieverID(HotelName);
                CurrentOrder4.setNoOfRooms(calculateNoOfRooms(price));//Calulates Rooms Required
                CurrentOrder4.setNoOfDays(4);
                CurrentOrder4.setCardNo(CreditCards[3]);
                CardinalMain.TravelAgency4.setCurrentOrder(CurrentOrder4);

                OrderClass CurrentOrder5 = new OrderClass();
                CurrentOrder5.setSenderID("TravelAgency5");
                CurrentOrder5.setReceieverID(HotelName);
                CurrentOrder5.setNoOfRooms(calculateNoOfRooms(price));//Calulates Rooms Required
                CurrentOrder5.setNoOfDays(5);
                CurrentOrder5.setCardNo(CreditCards[4]);
                CardinalMain.TravelAgency5.setCurrentOrder(CurrentOrder5);
                i = 1;
            }
            else if (HotelName.Equals("HotelSupplier2"))
            {
                OrderClass CurrentOrder1 = new OrderClass();
                CurrentOrder1.setSenderID("TravelAgency1");
                CurrentOrder1.setReceieverID(HotelName);
                CurrentOrder1.setNoOfRooms(calculateNoOfRooms(price));//Calulates Rooms Required
                CurrentOrder1.setNoOfDays(4);
                CurrentOrder1.setCardNo(CreditCards[0]);
                CardinalMain.HTravelAgency1.setCurrentOrder(CurrentOrder1);


                OrderClass CurrentOrder2 = new OrderClass();
                CurrentOrder2.setSenderID("TravelAgency2");
                CurrentOrder2.setReceieverID(HotelName);
                CurrentOrder2.setNoOfRooms(calculateNoOfRooms(price));//Calulates Rooms Required
                CurrentOrder2.setNoOfDays(2);
                CurrentOrder2.setCardNo(CreditCards[1]);
                CardinalMain.HTravelAgency2.setCurrentOrder(CurrentOrder2);

                OrderClass CurrentOrder3 = new OrderClass();
                CurrentOrder3.setSenderID("TravelAgency3");
                CurrentOrder3.setReceieverID(HotelName);
                CurrentOrder3.setNoOfRooms(calculateNoOfRooms(price));//Calulates Rooms Required
                CurrentOrder3.setNoOfDays(4);
                CurrentOrder3.setCardNo(CreditCards[2]);
                CardinalMain.HTravelAgency3.setCurrentOrder(CurrentOrder3);

                OrderClass CurrentOrder4 = new OrderClass();
                CurrentOrder4.setSenderID("TravelAgency4");
                CurrentOrder4.setReceieverID(HotelName);
                CurrentOrder4.setNoOfRooms(calculateNoOfRooms(price));//Calulates Rooms Required
                CurrentOrder4.setNoOfDays(3);
                CurrentOrder4.setCardNo(CreditCards[3]);
                CardinalMain.HTravelAgency4.setCurrentOrder(CurrentOrder4);

                OrderClass CurrentOrder5 = new OrderClass();
                CurrentOrder5.setSenderID("TravelAgency5");
                CurrentOrder5.setReceieverID(HotelName);
                CurrentOrder5.setNoOfRooms(calculateNoOfRooms(price));//Calulates Rooms Required
                CurrentOrder5.setNoOfDays(3);
                CurrentOrder5.setCardNo(CreditCards[4]);
                CardinalMain.HTravelAgency5.setCurrentOrder(CurrentOrder5);
                i = 2;
            }
            else if (HotelName.Equals("HotelSupplier3"))
            {
                OrderClass CurrentOrder1 = new OrderClass();
                CurrentOrder1.setSenderID("TravelAgency1");
                CurrentOrder1.setReceieverID(HotelName);
                CurrentOrder1.setNoOfRooms(calculateNoOfRooms(price));//Calulates Rooms Required
                CurrentOrder1.setNoOfDays(5);
                CurrentOrder1.setCardNo(CreditCards[0]);
                CardinalMain.STravelAgency1.setCurrentOrder(CurrentOrder1);

                OrderClass CurrentOrder2 = new OrderClass();
                CurrentOrder2.setSenderID("TravelAgency2");
                CurrentOrder2.setReceieverID(HotelName);
                CurrentOrder2.setNoOfRooms(calculateNoOfRooms(price));//Calulates Rooms Required
                CurrentOrder2.setNoOfDays(2);
                CurrentOrder2.setCardNo(CreditCards[1]);
                CardinalMain.STravelAgency2.setCurrentOrder(CurrentOrder2);

                OrderClass CurrentOrder3 = new OrderClass();
                CurrentOrder3.setSenderID("TravelAgency3");
                CurrentOrder3.setReceieverID(HotelName);
                CurrentOrder3.setNoOfRooms(calculateNoOfRooms(price));//Calulates Rooms Required
                CurrentOrder3.setNoOfDays(6);
                CurrentOrder3.setCardNo(CreditCards[2]);
                CardinalMain.STravelAgency3.setCurrentOrder(CurrentOrder3);

                OrderClass CurrentOrder4 = new OrderClass();
                CurrentOrder4.setSenderID("TravelAgency4");
                CurrentOrder4.setReceieverID(HotelName);
                CurrentOrder4.setNoOfRooms(calculateNoOfRooms(price));//Calulates Rooms Required
                CurrentOrder4.setNoOfDays(3);
                CurrentOrder4.setCardNo(CreditCards[3]);
                CardinalMain.STravelAgency4.setCurrentOrder(CurrentOrder4);

                OrderClass CurrentOrder5 = new OrderClass();
                CurrentOrder5.setSenderID("TravelAgency5");
                CurrentOrder5.setReceieverID(HotelName);
                CurrentOrder5.setNoOfRooms(calculateNoOfRooms(price));//Calulates Rooms Required
                CurrentOrder5.setNoOfDays(5);
                CurrentOrder5.setCardNo(CreditCards[4]);
                CardinalMain.STravelAgency5.setCurrentOrder(CurrentOrder5);
                i = 3;
            }
            {
                //All Travel Agencies Start Placing Orders to the Hotel Supplier which generated an Event
                CardinalMain.startOrders(i);
            }
        }