static void Main(string[] args) { BL_imp bl = new BL_imp(); initialize(bl); Console.WriteLine("\n\n\n"); Console.WriteLine("***************************************************************************"); Console.WriteLine("****************** WELCOME TO NANNY - CHILD MATCHER APP *******************"); Console.WriteLine("***************************************************************************"); Console.WriteLine("\n\n\n"); int menuchoice = 1; while (menuchoice != 0) { try { Console.WriteLine("\n" + "MENU"); Console.WriteLine("1. Add a nanny"); Console.WriteLine("2. Delete a nanny"); Console.WriteLine("3. Update a nanny"); Console.WriteLine("4. Add a mother"); Console.WriteLine("5. Delete a mother"); Console.WriteLine("6. Update a mother"); Console.WriteLine("7. Add a child"); Console.WriteLine("8. Delete a child"); Console.WriteLine("9. Update a child"); Console.WriteLine("10. Add a contract"); Console.WriteLine("11. Delete a contract"); Console.WriteLine("12. Update a contract"); Console.WriteLine("13. Get a list of all nannys"); Console.WriteLine("14. Get a list of all mothers"); Console.WriteLine("15. Get a list of all children"); Console.WriteLine("16. Get a list of all contracts"); Console.WriteLine("0. Exit"); Console.WriteLine(""); menuchoice = int.Parse(Console.ReadLine()); Console.Clear(); switch (menuchoice) { case 0: break; case 1: Console.WriteLine("1. Add a nanny"); Console.WriteLine(""); Console.WriteLine("Enter the new nanny data"); Nanny temp = new Nanny(); Console.WriteLine("Id: "); temp.Id = int.Parse(Console.ReadLine()); Console.WriteLine("First Name: "); temp.First_Name = Console.ReadLine(); Console.WriteLine("Family Name: "); temp.Family_Name = Console.ReadLine(); Console.WriteLine("Address: "); temp.Address = Console.ReadLine(); Console.WriteLine("Birth date: "); temp.Birth_Date = Convert.ToDateTime(Console.ReadLine()); Console.WriteLine("Telephone Number: "); temp.Telephone_Number = Console.ReadLine(); Console.WriteLine("Is Elevator? Enter true or false "); temp.Elevator_Exists = (Console.ReadLine().ToLower() == "true"); Console.WriteLine("Experience years: "); temp.Experience_Years = int.Parse(Console.ReadLine()); Console.WriteLine("Floor: "); temp.floor = int.Parse(Console.ReadLine()); Console.WriteLine("Hourly price exists? Enter true or false "); temp.Hourly_Price_Exists = (Console.ReadLine() == "true"); if (temp.Hourly_Price_Exists) { Console.WriteLine("Enter the hourly price"); temp.Hourly_Price = double.Parse(Console.ReadLine()); } else { Console.WriteLine("Enter the monthly price"); temp.Monthly_Price = double.Parse(Console.ReadLine()); } Console.WriteLine("Language: "); string language = Console.ReadLine(); Language l = (Language)Enum.Parse(typeof(Language), language.ToUpper()); Console.WriteLine("How many children she can take?: "); temp.Max_Children = int.Parse(Console.ReadLine()); Console.WriteLine("Maximum children age she can take: "); temp.Max_Child_Age = int.Parse(Console.ReadLine()); Console.WriteLine("Minimum children age she can take: "); temp.Min_Child_Age = int.Parse(Console.ReadLine()); Console.WriteLine("Recomendations: "); temp.Recommendations = Console.ReadLine(); for (int i = 0; i < 6; i++) { Week w = (Week)i + 1; Console.Write("Dos she works in "); Console.Write(w); Console.WriteLine("? Enter true or false"); string choice = Console.ReadLine(); if (choice.ToLower() == "true") { temp.Works_On_Day[i] = true; } if (choice.ToLower() == "false") { temp.Works_On_Day[i] = false; } if (temp.Works_On_Day[i]) { Console.Write("Enter the hour she begins to work in "); Console.Write(w); Console.WriteLine("? Enter hh:mm"); temp.Work_Hours[i, 0] = TimeSpan.Parse(Console.ReadLine()); Console.Write("Enter the hour she finishes to work in "); Console.Write(w); Console.WriteLine("? Enter hh:mm"); temp.Work_Hours[i, 1] = TimeSpan.Parse(Console.ReadLine()); } } bl.add_nanny(temp); break; case 2: Console.WriteLine("2. Delete a nanny"); Console.WriteLine(""); Console.WriteLine("Enter the id of the nanny you want to delete"); int id = int.Parse(Console.ReadLine()); bl.delete_nanny(id); break; case 3: Console.WriteLine("3. Update a nanny"); Console.WriteLine(""); UpdatingNanny(bl); break; case 4: Console.WriteLine("4. Add a mother"); Console.WriteLine(""); Console.WriteLine("Enter the new mother data"); Mother addMother = new Mother(); Console.WriteLine("Id: "); addMother.Id = int.Parse(Console.ReadLine()); Console.WriteLine("First Name: "); addMother.First_Name = Console.ReadLine(); Console.WriteLine("Family Name: "); addMother.Family_Name = Console.ReadLine(); Console.WriteLine("Home Address: "); addMother.Home_Address = Console.ReadLine(); Console.WriteLine("Second Address: "); addMother.Second_Address = Console.ReadLine(); Console.WriteLine("Max travel distance: "); addMother.Max_Travel_Distance = (int)double.Parse(Console.ReadLine()); Console.WriteLine("Telephone Number: "); addMother.Telephone_Number = Console.ReadLine(); for (int i = 0; i < 6; i++) { Week w = (Week)i + 1; Console.Write("Dos she needs in "); Console.Write(w); Console.WriteLine("? Enter true or false"); string s = Console.ReadLine(); if ((s.ToLower() == "true")) { addMother.Needs_On_Day[i] = true; } else { addMother.Needs_On_Day[i] = false; } if (addMother.Needs_On_Day[i]) { Console.Write("Enter the hour she brings the child in "); Console.Write(w); Console.WriteLine("? Enter hh:mm"); addMother.Needs_Hours[i, 0] = TimeSpan.Parse(Console.ReadLine()); Console.Write("Enter the hour she takes the child in "); Console.Write(w); Console.WriteLine("? Enter hh:mm"); addMother.Needs_Hours[i, 1] = TimeSpan.Parse(Console.ReadLine()); } } bl.add_mother(addMother); break; case 5: Console.WriteLine("5. Delete a mother"); Console.WriteLine(""); Console.WriteLine("Enter the id of the mother you want to delete"); int idMother = int.Parse(Console.ReadLine()); bl.delete_mother(idMother); break; case 6: Console.WriteLine("6. Update a mother"); Console.WriteLine(""); UpdatingMother(bl); break; case 7: Console.WriteLine("7. Add a child"); Console.WriteLine(""); Console.WriteLine("Enter the new child data"); Child addChild = new Child(); Console.WriteLine("Id: "); addChild.Id = int.Parse(Console.ReadLine()); Console.WriteLine("Mother id: "); addChild.Mother_Id = int.Parse(Console.ReadLine()); Console.WriteLine("First Name: "); addChild.First_Name = Console.ReadLine(); Console.WriteLine("Birth date: "); addChild.Birth_Date = Convert.ToDateTime(Console.ReadLine()); Console.WriteLine("Does the child need special needs? Enter true or false "); string b = Console.ReadLine().ToLower(); if (b == "true") { addChild.Special_Needs = true; } else { addChild.Special_Needs = false; } if (addChild.Special_Needs) { Console.WriteLine("What is the child's special needs? "); addChild.Needs = Console.ReadLine(); } bl.add_child(addChild); break; case 8: Console.WriteLine("8. Delete a child"); Console.WriteLine(""); Console.WriteLine("Enter the id of the child you want to delete"); int idChild = int.Parse(Console.ReadLine()); bl.delete_child(idChild); break; case 9: Console.WriteLine("9. Update a child"); Console.WriteLine(""); UpdatingChild(bl); break; case 10: Console.WriteLine("10. Add a contract"); Console.WriteLine(""); AddContract(bl); break; case 11: Console.WriteLine("11. Delete a contract"); Console.WriteLine(""); Console.WriteLine("Enter the id of the contract you want to delete"); int idContract = int.Parse(Console.ReadLine()); bl.delete_contract(idContract); break; case 12: Console.WriteLine("12. Update a contract"); Console.WriteLine(""); UpdatingContract(bl); break; case 13: Console.WriteLine("13. Get a list of all nannys"); Console.WriteLine(""); List <Nanny> all_nannys = new List <Nanny>(); all_nannys = bl.get_nanny_list(); if (all_nannys.Count != 0) { foreach (Nanny n in all_nannys) { string print = n.ToString(); Console.WriteLine(print); } } else { Console.WriteLine("There are no nannys registered."); } break; case 14: Console.WriteLine("14. Get a list of all mothers"); Console.WriteLine(""); List <Mother> all_mothers = new List <Mother>(); all_mothers = bl.get_mother_list(); if (all_mothers.Count != 0) { foreach (Mother m in all_mothers) { Console.WriteLine(m.ToString()); } } else { Console.WriteLine("There are no mothers registered."); } break; case 15: Console.WriteLine("15. Get a list of all children"); Console.WriteLine(""); List <Child> all_children = new List <Child>(); all_children = bl.get_child_list(); if (all_children.Count != 0) { foreach (Child c in all_children) { Console.WriteLine(c.ToString()); } } else { Console.WriteLine("There are no children registered."); } break; case 16: Console.WriteLine("16. Get a list of all contracts"); Console.WriteLine(""); List <Contract> all_contracts = new List <Contract>(); all_contracts = bl.get_contract_list(); if (all_contracts.Count != 0) { foreach (Contract c in all_contracts) { Console.WriteLine(c.ToString()); } } else { Console.WriteLine("There are no contracts registered."); } break; default: Console.WriteLine("Sorry, invalid selection!"); break; } } catch (Exception exception) { Console.WriteLine("\nError: " + exception.Message + "\nTry again...\n"); } } }