示例#1
0
        public static void TakeInput()
        {
            Console.Write("Enter the type of Customer : ");
            var type = Console.ReadLine().ToLower();

            if (!HotelReservation.ValidateCustomerType(type))
            {
                throw new HotelReservationException(ExceptionType.INVALID_CUSTOMER_TYPE, "Customer Type is invalid");
            }

            customerType = HotelReservation.GetCustomerType(type);
            Console.Write("Enter the date range : ");
            var input = Console.ReadLine();

            string[] dates = input.Split(',');
            startDate = Convert.ToDateTime(dates[0]);
            endDate   = Convert.ToDateTime(dates[1]);
        }
        public static void inputFromUserserInput()
        {
            Console.Write("Enter the type of Customer : ");                                         //Enter the Type of Customer
            var type = Console.ReadLine().ToLower();

            if (!HotelReservation.ValidateCustomerType(type))
            {
                throw new HotelReservationException(ExceptionType.INVALID_CUSTOMER_TYPE, "Customer Type is invalid"); //Check Validation to return Exception
            }
            customerType = HotelReservation.GetCustomerType(type);                                                    //Set the type of Customer

            Console.Write("Enter the date range : ");
            var input = Console.ReadLine();                                                          //Insert Date in dd/mm/yyyy form with , seoartator

            string[] dates = input.Split(',');

            startDate = Convert.ToDateTime(dates[0]);
            endDate   = Convert.ToDateTime(dates[1]);
        }