/// <summary> /// I mean come the hell on, this is very explanatory, well I guess I gotta put some effort here for a good grade: /// well this is to order a room, asks user for input and uses the DBAccess layer to order it /// </summary> private static void OrderRoomInput() { bool wrong = true; while (wrong) { try { Console.WriteLine(@"Room Types are as following:"); for (int i = 1; i <= 3; i++) { Console.WriteLine($" {i} - {ClubMedDBAccess.GetRoomType(i)}"); } int roomType = InputInt("Please Enter Room Type"); int id = InputInt("Please Enter Customer ID"); if (!ClubMedDBAccess.IsCustomer(id)) { if (InputBool("Seems like you're not an existing customer, would you like to add yourself to the database?")) { Console.WriteLine("Great, we need a few details first"); string first = InputString("What is your first name?"); string last = InputString("What is your last name?"); ClubMedDBAccess.InsertCustomer(new Customer(id, first, last)); Console.WriteLine("Customer Inserted Successfully! let's move on."); } else { Console.WriteLine("Oh well, come back when you can."); return; } } else { Console.WriteLine("Good! I see you're registered."); } ClubMedDBAccess.OrderRoom(InputInt("Please Enter Village ID"), id, InputInt("Please Enter Week"), roomType); Console.WriteLine("Your room has been successfully ordered!"); DanHelper.Say("chad1re2ahuz1man1behats1lacha"); wrong = false; } catch (Exception e) { Console.WriteLine(e); } } }
/// <summary> /// /// asks user for input, then searches the database for matching villages /// /// </summary> private static void SearchVillageInput() { string country = InputString("Enter the villages country").ToLower(); Console.WriteLine(@"Room Types are as following:"); for (int i = 1; i <= 3; i++) { Console.WriteLine($" {i} - {ClubMedDBAccess.GetRoomType(i)}"); } int roomType = InputInt("Please Enter Room Type"); int week = InputInt("Please enter week of stay (week is from 1 to 51)"); List <Village> list = ClubMedDBAccess.SearchVillage(country, week, roomType); Console.WriteLine($@" Room Type - {ClubMedDBAccess.GetRoomType(roomType)} Week Of Stay - {week} Country - {country} "); if (list.Count == 0) { Console.WriteLine("No Rooms Found"); DanHelper.Say("lonim1tsehuchadarim1"); } else { foreach (Village village in list) { Console.WriteLine(village); } } }
/// <summary> /// Asks user input for villageDetails /// </summary> /// <param name="roomType">type of room to give details for</param> /// <param name="id">village id</param> /// <returns>Village Details POCO</returns> private static VillageDetails GetDetails(int roomType, int id) { Console.WriteLine("Please enter the following details for the rooms of type \"" + ClubMedDBAccess.GetRoomType(roomType) + "\""); int rooms = InputInt("Please enter number of rooms"); int price = InputInt("Please enter price of room (per week)"); VillageDetails details = new VillageDetails(id, roomType, rooms, price); return(details); }