/// <summary> /// /// Sends the Yearly Report. /// /// </summary> public static void YearlyReport() { ClubMedDBAccess.YearlyReport().ForEach(report => { Console.WriteLine(report); }); }
/// <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> /// This is once again pretty self explanatory /// </summary> private static void InsertVillageInput() { bool wrong = true; while (wrong) { try { int villageID = InputInt("Please enter the Village's ID"); string villageName = InputString("Please enter the villages name."); string country = InputString("Enter the villages country").ToLower(); string city = InputString("Enter the villages city"); string street = InputString("Enter the villages street"); int houseNumber = InputInt("Enter the house number"); Console.WriteLine(ClubMedDBAccess.GetActivities()); int mainActivityID = InputInt("Enter the villages main activity"); int startingTime = InputInt("Enter Starting Time"); if (startingTime < 1 || startingTime > 51) { throw new InvalidTimeExeption(); } int endingTime = InputInt("Enter Ending Time"); if ((endingTime > 52 || endingTime < 2) || endingTime < startingTime) { throw new InvalidTimeExeption(); } double rating = InputDouble("Enter Village Rating"); if (rating > 5 || rating < 1) { throw new InvalidRatingExeption(); } wrong = false; VillageDetails[] details = new VillageDetails[3]; for (int i = 1; i <= 3; i++) { details[i - 1] = GetDetails(i, villageID); } ClubMedDBAccess.InsertVillage(new Village(villageID, villageName, country, city, street, houseNumber, mainActivityID, startingTime, endingTime, rating), details); DanHelper.Say("k1far1chahit1vasef1behats1lacha"); Console.WriteLine("Village Added Successfully"); } catch (Exception e) { Console.WriteLine(e.Message); } } }
/// <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); }