private void openwindowActionFunction() { switch (flag) { case 1: //nanny selectedNanny = IDComboBox.SelectedItem as Nanny; Window addNannyWindow = new AddNannyWindow(selectedNanny); addNannyWindow.Show(); this.Close(); break; case 2: //mother selectedMother = IDComboBox.SelectedItem as Mother; Window addMotherWindow = new AddMotherWindow(selectedMother); //make cunstruter that gets parameter update addMotherWindow.Show(); this.Close(); break; case 3: //child selectedChild = IDComboBox.SelectedItem as Child; Window updateTC = new AddChildWindow(selectedChild); updateTC.Show(); //so will keep this window open that means this.Close(); break; case 4: selectedContract = IDComboBox.SelectedItem as Contract; Window addContractWindow = new AddContractWindow(selectedContract); addContractWindow.Show(); this.Close(); break; default: //for numbers 5-8 break; } }
public static void initialize(BL_imp bl) { #region nanny 1 definition Nanny n1 = new Nanny(); n1.Address = "21, havaad haleumi, jerusalem, israel"; n1.First_Name = "Zelda P."; n1.Family_Name = "Tzudkevotsky"; n1.Birth_Date = DateTime.Now.AddYears(-23); n1.Elevator_Exists = true; n1.Id = 234234564; n1.Hourly_Price = 23; n1.Hourly_Price_Exists = true; n1.Max_Children = 20; n1.Max_Child_Age = 18; n1.Min_Child_Age = 5; n1.Vacation_Like_Tamat = true; n1.Works_On_Day = new bool[] { true, true, true, true, true, false, false }; n1.Work_Hours = new TimeSpan[2, 6] { { new TimeSpan(8, 0, 0), new TimeSpan(8, 0, 0), new TimeSpan(8, 0, 0), new TimeSpan(8, 0, 0), new TimeSpan(8, 0, 0), new TimeSpan(8, 0, 0) } , { new TimeSpan(15, 0, 0), new TimeSpan(15, 0, 0), new TimeSpan(15, 0, 0), new TimeSpan(15, 0, 0), new TimeSpan(15, 0, 0), new TimeSpan(15, 0, 0) } }; n1.Experience_Years = 1; n1.Lang = Language.YIDDISH; n1.Recommendations = "Zelda is the Besat! We love her! from Pesha"; n1.Telephone_Number = "058-432-1109"; n1.Rating = 5; bl.add_nanny(n1); #endregion #region nanny 2 definition Nanny n2 = new Nanny(); n2.Address = "27, Hapisga St., jerusalem, israel"; n2.First_Name = "Fruma Tova"; n2.Family_Name = "Bombalovski"; n2.Birth_Date = DateTime.Now.AddYears(-19).AddMonths(-5).AddDays(19); n2.Elevator_Exists = true; n2.Id = 312509871; n2.Hourly_Price = 26; n2.Hourly_Price_Exists = true; n2.Monthly_Price = 1400; n2.Max_Children = 15; n2.Max_Child_Age = 12; n2.Min_Child_Age = 3; n2.Vacation_Like_Tamat = true; n2.Works_On_Day = new bool[] { false, true, true, true, true, true, false }; n2.Work_Hours = new TimeSpan[2, 6] { { new TimeSpan(8, 30, 0), new TimeSpan(8, 30, 0), new TimeSpan(8, 30, 0), new TimeSpan(8, 30, 0), new TimeSpan(8, 30, 0), new TimeSpan(8, 30, 0) } , { new TimeSpan(14, 0, 0), new TimeSpan(14, 0, 0), new TimeSpan(14, 0, 0), new TimeSpan(14, 0, 0), new TimeSpan(14, 0, 0), new TimeSpan(14, 0, 0) } }; n2.Experience_Years = 3; n2.Lang = Language.YIDDISH; n2.Recommendations = "Fruma Fruma , What we do without her! She is the #1 ganenet!"; n2.Telephone_Number = "052-987-1908"; n2.Rating = 4; bl.add_nanny(n2); #endregion #region nanny 3 definition Nanny n3 = new Nanny(); n3.Address = "35, Nahal Dolev, Beit Shemesh, israel"; n3.First_Name = "Tova"; n3.Family_Name = "Cohen"; n3.Birth_Date = DateTime.Now.AddYears(-52).AddDays(100); n3.Elevator_Exists = false; n3.Id = 112324543; n3.Hourly_Price = 32; n3.Monthly_Price = 1700; n3.Hourly_Price_Exists = true; n3.Max_Children = 26; n3.Max_Child_Age = 24; n3.Min_Child_Age = 10; n3.Vacation_Like_Tamat = false; n3.Works_On_Day = new bool[] { true, true, true, true, true, true, false }; n3.Work_Hours = new TimeSpan[2, 6] { { new TimeSpan(7, 15, 0), new TimeSpan(7, 15, 0), new TimeSpan(7, 15, 0), new TimeSpan(7, 15, 0), new TimeSpan(7, 15, 0), new TimeSpan(7, 15, 0) } , { new TimeSpan(17, 0, 0), new TimeSpan(17, 0, 0), new TimeSpan(17, 0, 0), new TimeSpan(017, 0, 0), new TimeSpan(17, 0, 0), new TimeSpan(17, 0, 0) } }; n3.Experience_Years = 31; n3.Lang = Language.HEBREW; n3.Recommendations = "Tova was my grandmothers ganenet, my ganent and now my daughters ganenet. She loves the children like her own. We highly recommend her!"; n3.Telephone_Number = "02-995-1128"; n3.Rating = 4.7; bl.add_nanny(n3); #endregion #region child 1 definition Child c1 = new Child(); c1.Birth_Date = DateTime.Now.AddDays(-450); c1.First_Name = "Moishy"; c1.Id = 311478632; c1.Mother_Id = 334151678; c1.Special_Needs = true; c1.Needs = "Is being toilet trained. needs special care!"; bl.add_child(c1); #endregion #region child 2 definition Child c2 = new Child(); c2.Birth_Date = DateTime.Now.AddDays(-250); c2.First_Name = "Shmuley"; c2.Id = 313486930; c2.Mother_Id = 334151678; c2.Special_Needs = true; c2.Needs = "Is jeleous of his brother who is being toilet trained. needs special care!"; bl.add_child(c2); #endregion #region child 3 definition Child c3 = new Child(); c3.Birth_Date = DateTime.Now.AddDays(-292); c3.First_Name = "Hassan"; c3.Id = 345908476; c3.Mother_Id = 245674839; c3.Special_Needs = false; bl.add_child(c3); #endregion #region child 4 definition Child c4 = new Child(); c4.Birth_Date = DateTime.Now.AddDays(-387); c4.First_Name = "Dora"; c4.Id = 345987610; c4.Mother_Id = 142365876; c4.Special_Needs = false; bl.add_child(c4); #endregion #region child 5 definition Child c5 = new Child(); c5.Birth_Date = DateTime.Now.AddDays(-123); c5.First_Name = "Shirli"; c5.Id = 388765612; c5.Mother_Id = 339876879; c5.Special_Needs = true; c5.Needs = "Shirli is elergic to penuts"; bl.add_child(c5); #endregion #region child 6 definition Child c6 = new Child(); c6.Birth_Date = DateTime.Now.AddDays(-388); c6.First_Name = "Sasha"; c6.Id = 389765429; c6.Mother_Id = 339876879; c6.Special_Needs = false; bl.add_child(c6); #endregion #region child 7 definition Child c7 = new Child(); c7.Birth_Date = DateTime.Now.AddDays(-448); c7.First_Name = "Problematic_kid"; c7.Id = 338490123; c7.Mother_Id = 123412341; c7.Special_Needs = true; c7.Needs = "I need to be watched all day!"; bl.add_child(c7); #endregion #region mother 1 definition Mother m1 = new Mother(); m1.Id = 334151678; m1.First_Name = "Sarah"; m1.Family_Name = "Levi"; m1.Home_Address = "Nahal Refaim 38, Beit Shemesh, Israel"; m1.Max_Travel_Distance = 10; m1.Needs_On_Day = new bool[] { true, true, true, true, true, false, false }; m1.Needs_Hours = new TimeSpan[2, 6] { { new TimeSpan(8, 0, 0), new TimeSpan(8, 0, 0), new TimeSpan(8, 0, 0), new TimeSpan(8, 0, 0), new TimeSpan(8, 0, 0), new TimeSpan(8, 0, 0) } , { new TimeSpan(15, 0, 0), new TimeSpan(15, 0, 0), new TimeSpan(15, 0, 0), new TimeSpan(15, 0, 0), new TimeSpan(15, 0, 0), new TimeSpan(15, 0, 0) } }; m1.Searching_Address = "Nahal Refaim 38, Beit Shemesh, Israel"; m1.Telephone_Number = "02-991-3245"; bl.add_mother(m1); #endregion #region mother 2 definition Mother m2 = new Mother(); m2.Id = 245674839; m2.First_Name = "Shrik"; m2.Family_Name = "Abu Hamda"; m2.Home_Address = "21 Yafo St., Jerusalem, Israel"; m2.Max_Travel_Distance = 100; m2.Needs_On_Day = new bool[] { false, false, true, true, false, false, false }; m2.Needs_Hours = new TimeSpan[2, 6] { { new TimeSpan(8, 0, 0), new TimeSpan(8, 0, 0), new TimeSpan(10, 0, 0), new TimeSpan(10, 0, 0), new TimeSpan(8, 0, 0), new TimeSpan(8, 0, 0) } , { new TimeSpan(15, 0, 0), new TimeSpan(15, 0, 0), new TimeSpan(15, 0, 0), new TimeSpan(15, 0, 0), new TimeSpan(15, 0, 0), new TimeSpan(15, 0, 0) } }; m2.Searching_Address = "21 Yafo St., Jerusalem, Israel"; m2.Telephone_Number = "055-253-9487"; bl.add_mother(m2); #endregion #region mother 3 definition Mother m3 = new Mother(); m3.Id = 142365876; m3.First_Name = "Tohar"; m3.Family_Name = "Mizrachi"; m3.Home_Address = "10 Beit Hadfus, Jerusalem, Israel"; m3.Max_Travel_Distance = 50; m3.Needs_On_Day = new bool[] { false, true, true, true, true, true, false }; m3.Needs_Hours = new TimeSpan[2, 6] { { new TimeSpan(8, 0, 0), new TimeSpan(8, 0, 0), new TimeSpan(8, 0, 0), new TimeSpan(8, 0, 0), new TimeSpan(8, 0, 0), new TimeSpan(8, 0, 0) } , { new TimeSpan(16, 0, 0), new TimeSpan(16, 0, 0), new TimeSpan(0, 16, 0), new TimeSpan(16, 0, 0), new TimeSpan(16, 0, 0), new TimeSpan(16, 0, 0) } }; m3.Searching_Address = "10 King George, Jerusalem, Israel"; m3.Telephone_Number = "02-553-3981"; bl.add_mother(m3); #endregion #region mother 4 definition Mother m4 = new Mother(); m4.Id = 123412341; m4.First_Name = "Shula"; m4.Family_Name = "Zaken"; m4.Home_Address = "22 Kanfei Nesharim, Jerusalem, Israel"; m4.Max_Travel_Distance = 100; m4.Needs_On_Day = new bool[] { true, true, true, true, true, true, true }; m4.Needs_Hours = new TimeSpan[2, 6] { { new TimeSpan(0, 0, 0), new TimeSpan(0, 0, 0), new TimeSpan(0, 0, 0), new TimeSpan(0, 0, 0), new TimeSpan(0, 0, 0), new TimeSpan(0, 0, 0) } , { new TimeSpan(23, 59, 59), new TimeSpan(23, 59, 59), new TimeSpan(23, 59, 59), new TimeSpan(23, 59, 59), new TimeSpan(23, 59, 59), new TimeSpan(23, 59, 59) } }; m4.Home_Address = "20 Malchei Yisrael, Jerusalem, Israel"; m4.Telephone_Number = "02-544-9475"; bl.add_mother(m4); #endregion #region mother 4 definition Mother m5 = new Mother(); m5.Id = 339876879; m5.First_Name = "Nafta"; m5.Family_Name = "Shluk"; m5.Home_Address = "20 Malchei Yisrael, Jerusalem, Israel"; m5.Max_Travel_Distance = 30; m5.Needs_On_Day = new bool[] { true, true, true, true, true, false, false }; m5.Needs_Hours = new TimeSpan[2, 6] { { new TimeSpan(8, 0, 0), new TimeSpan(8, 0, 0), new TimeSpan(8, 0, 0), new TimeSpan(8, 0, 0), new TimeSpan(8, 0, 0), new TimeSpan(8, 0, 0) } , { new TimeSpan(15, 0, 0), new TimeSpan(15, 0, 0), new TimeSpan(15, 0, 0), new TimeSpan(15, 0, 0), new TimeSpan(15, 0, 0), new TimeSpan(15, 0, 0) } }; m5.Home_Address = "20 Malchei Yisrael, Jerusalem, Israel"; m5.Telephone_Number = "02-543-0781"; bl.add_mother(m5); #endregion }
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"); } } }
static void Main(string[] args) { bl = new BL.BL_imp(); initialization(); int choice; string ID = null; do { Console.WriteLine("Enter option:"); Console.WriteLine("0: Exit"); Console.WriteLine("1: Add nanny"); Console.WriteLine("2: Add mother"); Console.WriteLine("3: Add child"); Console.WriteLine("4: Add contract"); Console.WriteLine("5: Print nanny list"); Console.WriteLine("6: Print mother list"); Console.WriteLine("7: Print child list"); Console.WriteLine("8: Print contract list"); Console.WriteLine("9: Update nanny details"); Console.WriteLine("10: Update mother details"); Console.WriteLine("11: Update child details"); Console.WriteLine("12: Update contract details"); Console.WriteLine("13: Delete nanny"); Console.WriteLine("14: Delete mother"); Console.WriteLine("15: Delete child"); Console.WriteLine("16: Delete contract"); Console.WriteLine("17: All good nannies for mother"); choice = Convert.ToInt32(Console.ReadLine()); int index = 0; List <Nanny> bestNanny = new List <Nanny>(); try { switch (choice) { #region case 1: Add_nanny(); break; case 2: Add_Mother(); break; case 3: Add_Child(); break; case 4: Add_Contract(); break; case 5: index = 0; foreach (var item in bl.getNannyList()) { Console.WriteLine("Nanny number" + index + "\n"); Console.WriteLine(item.ToString()); index++; } break; case 6: index = 0; foreach (var item in bl.getMotherList()) { Console.WriteLine("Mother number" + index + "\n"); Console.WriteLine(item.ToString()); index++; } break; case 7: index = 0; foreach (var item in bl.getChildList()) { Console.WriteLine("Child number" + index + "\n"); Console.WriteLine(item.ToString()); index++; } break; case 8: index = 0; foreach (var item in bl.getContractList()) { Console.WriteLine("Contract number" + index + "\n"); Console.WriteLine(item.ToString()); index++; } break; case 9: Console.WriteLine("enter update details of the nanny"); #region Console.WriteLine("Enter ID:"); string id = Console.ReadLine(); Console.WriteLine("Enter family name:"); string family_name = Console.ReadLine(); Console.WriteLine("Enter first name:"); string name = Console.ReadLine(); Console.WriteLine("Enter birth date: (xx/yy/zzzz)"); DateTime bitrh_date = Convert.ToDateTime(Console.ReadLine()); Console.WriteLine("Enter telephone number:"); string telephone = Console.ReadLine(); Console.WriteLine("Enter address:"); string address = Console.ReadLine(); Console.WriteLine("Enter if has elevator (y/n)"); bool has_elevator = yes_or_no(Convert.ToChar(Console.ReadLine())); Console.WriteLine("Enter floor:"); int floor = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter years of practice:"); int years_of_practice = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter maximum number of children:"); int max_number_childern = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter minimum age:"); int min_age = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter maximum age:"); int max_age = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter if works by hours:(y/n)"); bool works_by_hours = yes_or_no(Convert.ToChar(Console.ReadLine())); Console.WriteLine("Enter rate per hour:"); float rate_per_hour = float.Parse(Console.ReadLine()); Console.WriteLine("Enter rate per month:"); float rate_per_month = float.Parse(Console.ReadLine()); Console.WriteLine("Enter days of word (6 days, y/n for each day):"); bool[] days_of_work = new bool[6]; for (int i = 0; i < 6; i++) { days_of_work[i] = yes_or_no(Convert.ToChar(Console.ReadLine())); } Console.WriteLine("Enter hours of work (xx.yy)"); float[,] hours_of_work = new float[6, 2]; float time = 0; for (int i = 0; i < 6; i++) { if (days_of_work[i]) { Console.WriteLine(Enum.GetName(typeof(DayOfWeek), i)); for (int j = 0; j < 2; j++) { hours_of_work[i, j] = float.Parse(Console.ReadLine()); } } else { hours_of_work[i, 0] = (float)00.00; hours_of_work[i, 1] = (float)00.00; } } Console.WriteLine("Enter if gets days off the the education ministry:"); bool days_off_by_education_ministry = yes_or_no(Convert.ToChar(Console.ReadLine())); Console.WriteLine("Enter recomondations:"); string recommendations = Console.ReadLine(); #endregion BE.Nanny the_nanny = new BE.Nanny(id, family_name, name, telephone, address, bitrh_date, has_elevator, floor, years_of_practice, max_number_childern, min_age , max_age, works_by_hours, rate_per_hour, rate_per_month, days_of_work, hours_of_work, days_off_by_education_ministry, recommendations); bl.updateNanny(the_nanny); break; case 10: Console.WriteLine("enter update details of the Mother"); #region Console.WriteLine("Enter Mother ID:"); string motherID = Console.ReadLine(); Console.WriteLine("Enter Mother first name:"); string motherFirstName = Console.ReadLine(); Console.WriteLine("Enter Mother last name:"); string motherLasttName = Console.ReadLine(); Console.WriteLine("Enter Mother phone nunber:"); string motherPhoneNumber = Console.ReadLine(); Console.WriteLine("Enter Mother address:"); string motherAddress = Console.ReadLine(); Console.WriteLine("Enter area address of nanny for mother:"); string motherAreaNanny = Console.ReadLine(); Console.WriteLine("Enter y/n for days when needs nanny: (y-yes,n-no)"); bool[] motherNeedNanny = new bool[6]; for (int i = 0; i < 6; ++i) { Console.WriteLine(" day: {0}", i + 1); motherNeedNanny[i] = yes_or_no(Convert.ToChar(Console.ReadLine())); } Console.WriteLine("Enter start hour and end hour for days when needs nanny: (xx.yy)"); float[,] workHours = new float[6, 2]; for (int i = 0; i < 6; ++i) { Console.WriteLine(" day: {0}", i + 1); Console.WriteLine("start hour: "); workHours[i, 0] = float.Parse(Console.ReadLine()); Console.WriteLine("end hour: "); workHours[i, 1] = float.Parse(Console.ReadLine()); } Console.WriteLine("enter notes if you wants:"); string motherNotes = Console.ReadLine(); BE.Mother mom = new Mother(motherID, motherLasttName, motherFirstName, motherPhoneNumber, motherAddress, motherAreaNanny, motherNeedNanny, workHours, motherNotes); #endregion bl.updateMother(mom); break; case 11: Console.WriteLine("enter update details of the Child"); #region Console.WriteLine("Enter ID:"); id = Console.ReadLine(); Console.WriteLine("Enter first name:"); string firstName = Console.ReadLine(); Console.WriteLine("Enter last name:"); string LasttName = Console.ReadLine(); Console.WriteLine("Enter Mother ID:"); motherID = Console.ReadLine(); Console.WriteLine("Enter birth date: (xx/yy/zzzz)"); bitrh_date = Convert.ToDateTime(Console.ReadLine()); Console.WriteLine("had special needs? (y/n)"); bool specialNeeds = yes_or_no(Convert.ToChar(Console.ReadLine())); Console.WriteLine("explan:"); string infoSpecialNeeds = Console.ReadLine(); BE.Child child = new Child(id, firstName, LasttName, motherID, bitrh_date, specialNeeds, infoSpecialNeeds); bl.updateChild(child); break; case 12: Console.WriteLine("Enter BabySitter ID:"); string babySitterID = Console.ReadLine(); Console.WriteLine("Enter Child ID:"); string ChildID = Console.ReadLine(); Console.WriteLine("first meeting has done? (y/n)"); bool firsMeating = yes_or_no(Convert.ToChar(Console.ReadLine())); Console.WriteLine("which type of salary (y-hour rate/n-month rate)"); bool type = yes_or_no(Convert.ToChar(Console.ReadLine())); Console.WriteLine("start day (xx/yy/zzzz)"); DateTime start = Convert.ToDateTime(Console.ReadLine()); Console.WriteLine("end day (xx/yy/zzzz)"); DateTime end = Convert.ToDateTime(Console.ReadLine()); BE.Contract con = new Contract(babySitterID, ChildID, firsMeating, type, start, end); #endregion bl.updateContract(con); break; case 13: Nanny Todelete3 = new Nanny(); Console.WriteLine("enret Nanny ID to delete"); ID = Console.ReadLine(); foreach (var item in bl.getNannyList()) { if (item.Id == ID) { Todelete3 = item; } } bl.removeNanny(Todelete3); break; case 14: Mother Todelete2 = new Mother(); Console.WriteLine("enret Mother ID to delete"); ID = Console.ReadLine(); foreach (var item in bl.getMotherList()) { if (item.Id == ID) { Todelete2 = item; } } bl.removeMother(Todelete2); break; case 15: Child Todelete1 = new Child(); Console.WriteLine("enret Child ID to delete"); ID = Console.ReadLine(); foreach (var item in bl.getChildList()) { if (item.Id == ID) { Todelete1 = item; } } bl.removeChild(Todelete1); break; case 16: Contract Todelete = new Contract(); Console.WriteLine("enret contract ID to delete"); ID = Console.ReadLine(); foreach (var item in bl.getContractList()) { if (item.ContractID == ID) { Todelete = item; } } bl.removeContract(Todelete); break; case 17: Console.WriteLine("enret Mother ID to find Nanny's"); ID = Console.ReadLine(); foreach (var item in bl.getMotherList()) { if (item.Id == ID) { bestNanny = bl_functions.InitialCoordination(item); if (bestNanny.Count == 0) { Console.WriteLine("dont found Match Nanny (try press 24)\n"); } } } index = 0; foreach (var item in bestNanny) { Console.WriteLine("Nanny number" + index + "\n"); Console.WriteLine(item.ToString()); index++; } break; default: break; #endregion } } catch (Exception exc) { Console.WriteLine(exc.Message); } } while (choice != 0); }
static void Main(string[] args) { BL.IBL bl = BL.FactoryBl.getBl(); Bl_imp aaa = new BL.Bl_imp(); try { Mother mom1 = new Mother(1234, "dora1", "coen", 0, "אוהב ישראל 3,ביתר עילית,ישראל", null, false); Mother mom2 = new Mother(1235, "dora2", "coen", 0, "אוהב ישראל 3,ביתר עילית,ישראל", "קדושת לוי 115,ביתר עילית,ישראל", true); Mother mom3 = new Mother(1236, "dora3", "coen", 0, "אוהב ישראל 3,ביתר עילית,ישראל", null, false); for (int i = 0; i < 6; i++) { Work_information temp = new Work_information(); if (r.Next(0, 2) == 1) { temp.day_work = true; temp.start = TimeSpan.Parse("8:30"); temp.end = TimeSpan.Parse("16:00"); } else { temp.day_work = false; } mom3.list.Add(temp); } Mother mom4 = new Mother(1237, "dora4", "coen", 0, "אוהב ישראל 3,ביתר עילית,ישראל", null, true); Mother mom5 = new Mother(1238, "dora5", "coen", 0, "אוהב ישראל 3,ביתר עילית,ישראל", null, false); Mother mom6 = new Mother(1239, "dora6", "coen", 0, "אוהב ישראל 3,ביתר עילית,ישראל", null, true); bl.addMother(mom1); bl.addMother(mom2); bl.addMother(mom3); bl.addMother(mom4); bl.addMother(mom5); bl.addMother(mom6); foreach (var item in bl.getListMothers()) { Console.WriteLine(item); Console.WriteLine(); } bl.deleteMother(1234); bl.deleteMother(1239); Console.WriteLine("after delete 2 mothers" + '\n'); foreach (var item in bl.getListMothers()) { Console.WriteLine(item); Console.WriteLine(); } Child ch1 = new Child(12345, 1235, "moshe1", "1/10/2017"); Child ch2 = new Child(12346, 1235, "moshe2", "1/10/2017"); Child ch3 = new Child(12347, 1236, "moshe3", "1/5/2017"); Child ch4 = new Child(12348, 1236, "moshe4", "1/10/2017"); Child ch5 = new Child(12349, 1236, "moshe5", "1/10/2017"); Child ch6 = new Child(123410, 1237, "moshe6", "1/4/2017"); Child ch7 = new Child(123411, 1237, "moshe7", "1/10/2017"); Child ch8 = new Child(123412, 1237, "moshe8", "1/10/2017"); Child ch9 = new Child(123413, 1237, "moshe9", "1/10/2017"); Child ch10 = new Child(123414, 1238, "moshe10", "1/10/2017"); Child ch11 = new Child(123415, 1238, "moshe11", "1/10/2017"); Child ch12 = new Child(123416, 1238, "moshe12", "1/10/2017"); Child ch13 = new Child(123417, 1238, "moshe13", "1/10/2017"); Child ch14 = new Child(123418, 1238, "moshe14", "1/10/2017"); Child ch15 = new Child(123419, 1238, "moshe15", "1/10/2017"); bl.addChild(ch1); bl.addChild(ch2); bl.addChild(ch3); bl.addChild(ch4); bl.addChild(ch5); bl.addChild(ch6); bl.addChild(ch7); bl.addChild(ch8); bl.addChild(ch9); bl.addChild(ch10); bl.addChild(ch11); bl.addChild(ch12); bl.addChild(ch13); bl.addChild(ch14); bl.addChild(ch15); Console.WriteLine("mom2's children"); foreach (var item in bl.getListChilds(mom2)) { Console.WriteLine(item); Console.WriteLine(); } Console.WriteLine("mom4's children"); foreach (var item in bl.getListChilds(mom4)) { Console.WriteLine(item); Console.WriteLine(); } bl.deleteMother(1235); Nanny nan1 = new Nanny(123, "sara1", "levi", "1/1/1993", 123456, "קדושת לוי 115,ביתר עילית,ישראל", true, 2, 2, 5, 3, 12, false, 25, 4000, true, null); for (int j = 0; j < 6; j++) { Work_information temp = new Work_information(); temp.day_work = true; temp.start = TimeSpan.Parse("8:30"); temp.end = TimeSpan.Parse("16:00"); nan1.work[j] = temp; } Nanny nan2 = new Nanny(124, "sara2", "levi", "1/1/1993", 123456, "דרכי איש 10,ביתר עילית,ישראל", false, 2, 2, 3, 3, 12, false, 25, 4000, true, null); Nanny nan3 = new Nanny(125, "sara3", "levi", "1/1/1993", 123456, "קדושת לוי 10,ביתר עילית,ישראל", false, 3, 2, 10, 5, 10, false, 25, 4000, true, null); Nanny nan4 = new Nanny(126, "sara4", "levi", "1/1/1993", 123456, "באבא סאלי 10,ביתר עילית,ישראל", false, 4, 2, 2, 6, 9, false, 25, 4000, true, null); Nanny nan5 = new Nanny(127, "sara5", "levi", "1/1/1993", 123456, "רבי עקיבא 11,ביתר עילית,ישראל", true, 5, 2, 6, 5, 8, false, 25, 4000, true, null); bl.addNanny(nan1); bl.addNanny(nan2); bl.addNanny(nan3); bl.addNanny(nan4); bl.addNanny(nan5); Contract con1 = new Contract(123, 12347, false, false, contracPer.perHour); Contract con2 = new Contract(124, 123410, false, false, 0); Contract con3 = new Contract(); Contract con4 = new Contract(); Contract con5 = new Contract(); Contract con6 = new Contract(); Contract con7 = new Contract(); Contract con8 = new Contract(); Contract con9 = new Contract(); bl.addContract(con1); bl.addContract(con2); foreach (var item in bl.getListContracts()) { Console.WriteLine(item); Console.WriteLine(); } bl.deleteMother(1236); foreach (var item in bl.getListContracts()) { Console.WriteLine(item); Console.WriteLine(); } } catch (Exception e) { Console.WriteLine(e.Message); } Console.ReadKey(); }
public AddNannyWindow(Nanny selectedNanny) { this.selectedNanny = selectedNanny; }
static void Main(string[] args) { IBL bl = Bl_Singleton.GetBl(); Console.WriteLine(@"to add child / nanny / mother / contract enter 1, to remove child / nanny / mother / contract enter 2, to update child / nanny / mother /contract enter 3, to print all childrens / nanneis / mothers / contract enter 4, to end enter zero"); string choice = Console.ReadLine(); while (int.Parse(choice) != 0) { try { switch (int.Parse(choice)) { case 1: Console.WriteLine("to add child enter 1,to add nanny enter 2,to add mother enter 3,to add contract enter 4"); string choice1 = Console.ReadLine(); switch (int.Parse(choice1)) { case 1: Child child = new Child(); Console.WriteLine(); Console.WriteLine("enter id of child"); child._IdOfChild = int.Parse(Console.ReadLine()); Console.WriteLine("enter id of mother"); child._IdOfMather = int.Parse(Console.ReadLine()); Console.WriteLine("enter first name of child"); child._FitstName = Console.ReadLine(); Console.WriteLine("enter year Of Birth "); int yearChild = int.Parse(Console.ReadLine());; Console.WriteLine("enter month Of Birth"); int monthChild = int.Parse(Console.ReadLine());; Console.WriteLine("enter day Of Birth"); int dayChild = int.Parse(Console.ReadLine());; child._DateOfBirth = new DateTime(yearChild, monthChild, dayChild); Console.WriteLine("enter if has Disabilities (true or false)"); child._Disabilities = bool.Parse(Console.ReadLine()); Console.WriteLine("enter the Disabilities kind or enter"); child._TypeOfDisabilities = Console.ReadLine(); bl.AddChild(child); break; case 2: Nanny nanny = new Nanny(); Address addre1 = new Address(); Console.WriteLine("enter id of nanny"); nanny._id = int.Parse(Console.ReadLine()); Console.WriteLine("enter last name of nanny"); nanny._LastName = Console.ReadLine(); Console.WriteLine("enter first name of nanny"); nanny._FitstName = Console.ReadLine(); int yearNanny = int.Parse(Console.ReadLine());; Console.WriteLine("enter year Of Birth"); int monthNanny = int.Parse(Console.ReadLine());; Console.WriteLine("enter mounth Of Birth"); int dayNanny = int.Parse(Console.ReadLine());; nanny._DateOfBirth = new DateTime(yearNanny, monthNanny, dayNanny); Console.WriteLine("enter phone number of nanny(for xample: 058-780-6-771"); nanny._NumberOfphone = Console.ReadLine(); Console.WriteLine("enter addresss of nanny:citi street buildingNumber "); addre1.city = Console.ReadLine(); addre1.Street = Console.ReadLine(); addre1.buildingNumber = Console.ReadLine(); nanny._Address = addre1.ToString(); Console.WriteLine("enter if has elevator (true or false)"); nanny._Elevators = bool.Parse(Console.ReadLine()); Console.WriteLine("enter floor number "); nanny._FloorNumber = int.Parse(Console.ReadLine()); Console.WriteLine("enter Years Of Experience "); nanny._YearsOfExperience = int.Parse(Console.ReadLine()); Console.WriteLine("enter Max Child "); nanny._MaxChild = int.Parse(Console.ReadLine()); Console.WriteLine("enter Max Age "); nanny._MaxAge = int.Parse(Console.ReadLine()); Console.WriteLine("enter Min Age "); nanny._MinAge = int.Parse(Console.ReadLine()); Console.WriteLine("enter if get Hourly Payment (true or false) "); nanny._HourlyPayment = bool.Parse(Console.ReadLine()); if (nanny._HourlyPayment) { Console.WriteLine("enter Hourly Wage"); nanny._HourlyWage = int.Parse(Console.ReadLine()); } else { Console.WriteLine("enter Month Wage"); nanny._MonthWage = int.Parse(Console.ReadLine()); } Console.WriteLine("enter if take free of TMT (true or false) "); nanny._VacationKind = bool.Parse(Console.ReadLine()); nanny.NumOfStars = 0; bl.AddNanny(nanny); break; case 3: Mother mother = new Mother(); Address addre = new Address(); Console.WriteLine("enter id of mother "); mother._id = int.Parse(Console.ReadLine()); Console.WriteLine("enter last name of mother"); mother._LastName = Console.ReadLine(); Console.WriteLine("enter first name of mother"); mother._FitstName = Console.ReadLine(); Console.WriteLine("enter number fon of mother (for xample: 058-780-6-771"); mother._NumberOfphone = Console.ReadLine(); Console.WriteLine("enter addresss of mother:citi street buildingNumber "); addre.city = Console.ReadLine(); addre.Street = Console.ReadLine(); addre.buildingNumber = Console.ReadLine(); mother._Address = addre.ToString(); Console.WriteLine("if you want area address enter 1 else 0"); if (bool.Parse(Console.ReadLine())) { Console.WriteLine("enter area addresss :citi street buildingNumber "); addre.city = Console.ReadLine(); addre.Street = Console.ReadLine(); addre.buildingNumber = Console.ReadLine(); mother._AreaAddres = addre.ToString(); } else { mother._AreaAddres = null; } Console.WriteLine("enter mother notes"); mother._Notes = Console.ReadLine(); Console.WriteLine("enter if mother want Hourly Payment (true or false) "); mother._HourlyPayment = bool.Parse(Console.ReadLine()); Console.WriteLine("enter range"); mother._Range = int.Parse(Console.ReadLine()); bl.AddMother(mother); break; case 4: Contract contract = new Contract(); Console.WriteLine("enter id of nanny to add "); int IdOfNanny = int.Parse(Console.ReadLine()); Console.WriteLine("enter id of mother to add "); int IdOfMother = int.Parse(Console.ReadLine()); Console.WriteLine("enter id of child to add "); int IdOfChild = int.Parse(Console.ReadLine()); Console.WriteLine("enter year Of start"); int YearStart = int.Parse(Console.ReadLine()); Console.WriteLine("enter mounth Of start"); int MonthStart = int.Parse(Console.ReadLine()); Console.WriteLine("enter day Of start"); int dayStart = int.Parse(Console.ReadLine()); contract._StartDate = new DateTime(YearStart, MonthStart, dayStart); Console.WriteLine("enter if was mitting (true or false) "); contract._WasMitting = bool.Parse(Console.ReadLine()); Console.WriteLine("enter if was _Signed(true or false) "); contract._SignedContract = bool.Parse(Console.ReadLine()); Console.WriteLine("enter year Of end"); int YearEnd = int.Parse(Console.ReadLine()); Console.WriteLine("enter mounth Of end"); int MonthEnd = int.Parse(Console.ReadLine()); Console.WriteLine("enter day Of end"); int dayEnd = int.Parse(Console.ReadLine()); contract._EndDate = new DateTime(YearEnd, MonthEnd, dayEnd); bl.AddContract(contract); break; default: break; } break; case 2: Console.WriteLine(@"to remove child enter 1, to remove nanny enter 2, to remove mother enter 3, to remove contract enter 4"); string choice2 = Console.ReadLine(); switch (int.Parse(choice2)) { case 1: Console.WriteLine("enter id of child to remove "); int idChild = int.Parse(Console.ReadLine()); if (bl.RemoveChild(idChild)) { Console.WriteLine("remove succeeded "); } else { Console.WriteLine("remove unsuccessful "); } break; case 2: Console.WriteLine("enter id of nanny to remove "); int idNanny = int.Parse(Console.ReadLine()); if (bl.RemoveNanny(idNanny)) { Console.WriteLine("remove succeeded "); } else { Console.WriteLine("remove unsuccessful "); } break; case 3: Console.WriteLine("enter id of mother to remove "); int idMother = int.Parse(Console.ReadLine()); if (bl.RemoveMother(idMother)) { Console.WriteLine("remove succeeded "); } else { Console.WriteLine("remove unsuccessful "); } break; case 4: Console.WriteLine("enter number of contract to remove "); int number = int.Parse(Console.ReadLine()); if (bl.RemoveContract(number)) { Console.WriteLine("remove succeeded "); } else { Console.WriteLine("remove unsuccessful "); } break; default: break; } break; case 3: Console.WriteLine(@"to update child enter 1, to update nanny enter 2, to update mother enter 3, to update contract enter 4"); string choice3 = Console.ReadLine(); switch (int.Parse(choice3)) { case 1: Console.WriteLine("enter id of child to updating "); Child child1 = bl.GetChild(int.Parse(Console.ReadLine())); if (child1 == null) { throw new Exception("not found child with the same id..."); } Console.WriteLine("enter if has Disabilities (true or false)"); child1._Disabilities = bool.Parse(Console.ReadLine()); Console.WriteLine("enter the Disabilities kind or enter"); child1._TypeOfDisabilities = Console.ReadLine(); bl.UpdatingChild(child1); break; case 2: Console.WriteLine("enter id of nanny to updating "); Nanny nanny = bl.GetNanny(int.Parse(Console.ReadLine())); if (nanny == null) { throw new Exception("not found nanny with the same id..."); } Address addre1 = new Address(); Console.WriteLine("enter if you want change phone number of nanny (true or false)"); if (bool.Parse(Console.ReadLine())) { Console.WriteLine("enter phone number of nanny(for xample: 058-780-6-771"); nanny._NumberOfphone = Console.ReadLine(); } Console.WriteLine("enter if you want changeaddress of nanny (true or false)"); if (bool.Parse(Console.ReadLine())) { Console.WriteLine("enter addresss of nanny:citi street buildingNumber "); addre1.city = Console.ReadLine(); addre1.Street = Console.ReadLine(); addre1.buildingNumber = Console.ReadLine(); nanny._Address = addre1.ToString(); } Console.WriteLine("enter if you want change if has elevato (true or false)"); if (bool.Parse(Console.ReadLine())) { Console.WriteLine("enter if has elevator (true or false)"); nanny._Elevators = bool.Parse(Console.ReadLine()); } Console.WriteLine("enter floor number "); nanny._FloorNumber = int.Parse(Console.ReadLine()); Console.WriteLine("enter Years Of Experience "); nanny._YearsOfExperience = int.Parse(Console.ReadLine()); Console.WriteLine("enter Max Child "); nanny._MaxChild = int.Parse(Console.ReadLine()); Console.WriteLine("enter Max Age "); nanny._MaxAge = int.Parse(Console.ReadLine()); Console.WriteLine("enter Min Age "); nanny._MinAge = int.Parse(Console.ReadLine()); Console.WriteLine("enter if get Hourly Payment (true or false) "); nanny._HourlyPayment = bool.Parse(Console.ReadLine()); if (nanny._HourlyPayment) { Console.WriteLine("enter Hourly Wage"); nanny._HourlyWage = int.Parse(Console.ReadLine()); } else { Console.WriteLine("enter Month Wage"); nanny._MonthWage = int.Parse(Console.ReadLine()); } Console.WriteLine("enter if take free of TMT (true or false) "); nanny._VacationKind = bool.Parse(Console.ReadLine()); bl.UpdatingNanny(nanny); break; case 3: Address addre = new Address(); Console.WriteLine("enter id of mother to updating "); Mother mother = bl.GetMother(int.Parse(Console.ReadLine())); if (mother == null) { throw new Exception("not found mother with the same id..."); } Console.WriteLine("enter number fon of mother (for xample: 058-780-6-771"); mother._NumberOfphone = Console.ReadLine(); Console.WriteLine("enter addresss of mother:citi street buildingNumber "); addre.city = Console.ReadLine(); addre.Street = Console.ReadLine(); addre.buildingNumber = Console.ReadLine(); mother._Address = addre.ToString(); Console.WriteLine("if you want area address enter 1 else 0"); if (bool.Parse(Console.ReadLine())) { Console.WriteLine("enter area addresss :citi street buildingNumber "); addre.city = Console.ReadLine(); addre.Street = Console.ReadLine(); addre.buildingNumber = Console.ReadLine(); mother._AreaAddres = addre.ToString(); } else { mother._AreaAddres = null; } Console.WriteLine("enter mother notes"); mother._Notes = Console.ReadLine(); Console.WriteLine("enter if mother want Hourly Payment (true or false) "); mother._HourlyPayment = bool.Parse(Console.ReadLine()); Console.WriteLine("enter range"); mother._Range = int.Parse(Console.ReadLine()); bl.UpdatingMother(mother); break; case 4: Console.WriteLine("enter number of contract to updating "); Contract contract = bl.Getcontract(int.Parse(Console.ReadLine())); if (contract == null) { throw new Exception("not found contract with the same number..."); } int YearEnd = int.Parse(Console.ReadLine()); Console.WriteLine("enter mounth Of end"); int MonthEnd = int.Parse(Console.ReadLine()); Console.WriteLine("enter day Of end"); int dayEnd = int.Parse(Console.ReadLine()); contract._EndDate = new DateTime(YearEnd, MonthEnd, dayEnd); bl.UpdatingContract(contract); break; default: break; } break; case 4: Console.WriteLine(@"to print all the childrens enter 1, to print all the nanneis enter 2, to print all the mothers enter 3, to add contracts enter 4"); string choice4 = Console.ReadLine(); switch (int.Parse(choice4)) { case 1: int x = 0; foreach (Child child in bl.GetChildList()) { x++; Console.WriteLine(@"child nuber {0} :,IdOfChild {1}, IdOfMather {2}, FitstName {3},_DateOfBirth {4} ,_Disabilities {5},_TypeOfDisabilitie {6}", x, child._IdOfChild, child._IdOfMather, child._FitstName , child._DateOfBirth, child._Disabilities, child._TypeOfDisabilities); Console.WriteLine(); } break; case 2: x = 0; // foreach (var nannny in bl.GetChildList()) // { // x++; // Console.WriteLine(@"child number {0} :,IdOfChild {1}, IdOfMather {2}, FitstName {3},_DateOfBirth {4} //,_Disabilities {5},_TypeOfDisabilitie {6}", x, nannny._IdOfChild, nannny._IdOfMather, nannny._FitstName // , nannny._DateOfBirth, nannny._Disabilities, child._TypeOfDisabilities); // Console.WriteLine(); // } break; case 3: x = 0; foreach (var child in bl.GetChildList()) { x++; Console.WriteLine(@"mother number {0} :,IdOfmother {1}, IdOfMather {2}, FitstName {3},_DateOfBirth {4} ,_Disabilities {5},_TypeOfDisabilitie {6}", x, child._IdOfChild, child._IdOfMather, child._FitstName , child._DateOfBirth, child._Disabilities, child._TypeOfDisabilities); Console.WriteLine(); } break; case 4: break; default: break; } break; } } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.WriteLine(@"to add child/nanny/mother/contract enter 1, to remove child/nanny/mother/contract ente 2, to update child/nanny/mother/contract 3, to print all child/nanny/mother/contract 4, to end enter zero"); choice = Console.ReadLine(); } IEnumerable <IGrouping <int, Contract> > v = bl.GroupingByDistance(); foreach (IGrouping <int, Contract> item in v) { switch (item.Key) { case 5: foreach (Contract it in item) { Console.WriteLine(it); } break; default: break; } } }
private void button_Copy_Click(object sender, RoutedEventArgs e) { var nann = new Nanny(); nann.ShowDialog(); }
static void Main(string[] args) { #region introduction Console.WriteLine("Welcome to our program!\nwe will present the initial stage of our project via this console app."); Console.WriteLine("To start the program, please press \"Enter\":\n"); Console.ReadKey(); #endregion #region peoples Console.WriteLine("Here we will introduce the people that participate in this program:"); System.Threading.Thread.Sleep(4000); Nanny Sarit = new Nanny("Friedman", "Sarit", "Tal Institute - College of Technology", 758556411, new DateTime(1995, 7, 15), "508494561", true, 40, 1700, 12, 4, 24); Console.WriteLine(Sarit); System.Threading.Thread.Sleep(2500); Nanny Chagit = new Nanny("Cohen", "Chagit", "jaffa street 31 Jerusalem", 647859321, new DateTime(1992, 11, 2), "504741121", true, 75, 1400, 6, 10, 36); Console.WriteLine(Chagit); System.Threading.Thread.Sleep(2500); Nanny Avigail = new Nanny("Morad", "Avigail", "Haneviaim street 25 Jerusalem", 812535224, new DateTime(1996, 3, 28), "509822451", false, 0, 1660, 9, 4, 32); Console.WriteLine(Avigail); System.Threading.Thread.Sleep(2500); Nanny Chaya = new Nanny("Scholssberg", "Chaya", "Nikanor street 15, Jerualem", 316525442, new DateTime(2002, 10, 25), "528494531", true, 45, 1300, 12, 7, 32); Console.WriteLine(Chaya); System.Threading.Thread.Sleep(2500); Console.WriteLine("**********"); Mother Rivka = new Mother("Aflalo", "Rivka", "Lev Academic Center", 456223300, "502283470"); Console.WriteLine(Rivka); System.Threading.Thread.Sleep(2500); Mother Hadasa = new Mother("Hadasa", "Weiss", "King George 20 Jerusalem", 316522107, "523566464"); Console.WriteLine(Hadasa); System.Threading.Thread.Sleep(2500); Mother Yael = new Mother("Adler", "Yael", "Yermiyahu street 14 Jerusalem", 316522488, "523578461"); Console.WriteLine(Yael); System.Threading.Thread.Sleep(2500); Console.WriteLine("**********"); Child Dudi = new Child("Dudi", 212235799, 456223300, new DateTime(2016, 5, 18)); Console.WriteLine(Dudi); System.Threading.Thread.Sleep(2500); Child Yossi = new Child("Yossi", 212277899, 316522107, new DateTime(2015, 11, 11)); Console.WriteLine(Yossi); System.Threading.Thread.Sleep(2500); Child Alon = new Child("Alon", 214566512, 316522107, new DateTime(2017, 1, 18)); Console.WriteLine(Alon); System.Threading.Thread.Sleep(2500); Child Dani = new Child("Dani", 714565899, 316522488, new DateTime(2017, 8, 11)); Console.WriteLine(Dani); System.Threading.Thread.Sleep(2500); Child Miryam = new Child("Miryam", 263255119, 456223300, new DateTime(2016, 12, 24)); Console.WriteLine(Miryam); System.Threading.Thread.Sleep(2500); Console.WriteLine("**********\nnow lets make some contracts! to do so please press \"Enter\":\n"); Console.ReadKey(); #endregion #region contracts Contract Sarit_and_Dudi = new Contract(Sarit, Dudi, false); Console.WriteLine(Sarit_and_Dudi); System.Threading.Thread.Sleep(2500); Contract Avigail_and_Dani = new Contract(Avigail, Dani, false); Console.WriteLine(Avigail_and_Dani); System.Threading.Thread.Sleep(2500); Contract Chaya_and_Miryam = new Contract(Chaya, Miryam, true); Console.WriteLine(Chaya_and_Miryam); System.Threading.Thread.Sleep(2500); Contract Chagit_and_Yossi = new Contract(Chagit, Yossi, true); Console.WriteLine(Chagit_and_Yossi); System.Threading.Thread.Sleep(2500); Contract Chagit_and_Alon = new Contract(Chagit, Alon, true); Console.WriteLine(Chagit_and_Alon); System.Threading.Thread.Sleep(2500); Console.WriteLine("**********\nas you can see, all the contracts number are -1. this mean that the contract is not signed."); Console.WriteLine("also note that the two last contracts are two brothers with the same nanny, but the salary is the same, for now."); Console.WriteLine("the second contract salary is 0, interesting..."); Console.WriteLine("in order to sign the contracts, we need to send the contracts all the way to data source. please press \"Enter\" to continue:\n"); Console.ReadKey(); #endregion #region bl_calls Console.WriteLine("sending to data source all the objects... \nstay in focus, there are few errors in the data and exceptions will appear!\n\n"); System.Threading.Thread.Sleep(5000); IBL_imp program_bl = new IBL_imp(); program_bl.addNanny(Sarit); program_bl.addNanny(Chagit); program_bl.addNanny(Avigail); try { program_bl.addNanny(Chaya); } catch (Exception first_teenNanny) { Console.WriteLine(first_teenNanny.Message); Console.WriteLine("as you can see, the BL detect that Chaya is too young. lets continue, press \"Enter\"\n\n:"); Console.ReadKey(); } program_bl.addMother(Rivka); program_bl.addMother(Hadasa); program_bl.addMother(Yael); program_bl.addChild(Dudi); program_bl.addChild(Yossi); program_bl.addChild(Alon); program_bl.addChild(Dani); program_bl.addContract(Sarit_and_Dudi); try { program_bl.addContract(Avigail_and_Dani); } catch (Exception second_wrongTypeContract) { Console.WriteLine(second_wrongTypeContract.Message); Console.WriteLine("as you can see, the BL detect that Avigail works only per month but the contract was per hour! lets continue, press \"Enter\"\n\n:"); Console.ReadKey(); } program_bl.addContract(Chagit_and_Yossi); program_bl.addContract(Chagit_and_Alon); try { program_bl.addContract(Chaya_and_Miryam); } catch (Exception third_missingNanny) { Console.WriteLine(third_missingNanny.Message); Console.WriteLine("as you can see, the BL detect that Chaya not in DS. remember that she was too young? lets continue, press \"Enter\"\n\n:"); Console.ReadKey(); } #endregion #region print signed contract Console.WriteLine("*************\nwell, lets see the contracts that survive the BL. we are abut to call and print them:\n\n"); Console.WriteLine("List of all signed contract:\n"); System.Threading.Thread.Sleep(2500); List <Contract> currentListOfContracts = program_bl.getListOfContract().ToList <Contract>(); foreach (Contract temp in currentListOfContracts) { Console.WriteLine(temp); System.Threading.Thread.Sleep(2500); } Console.WriteLine("\nnotice that now the brothers contracts are different, the second got a discount!\n"); Console.WriteLine("to continue press Enter!"); Console.ReadKey(); #endregion #region googleApi Console.WriteLine("************\nlets examine the googleApi tool, and ask for the distance between Sarit and Dani:\n"); int distance = program_bl.distanceBetweenAddresses(Sarit.address, Rivka.address); Console.WriteLine("Sarit lives in: " + Sarit.address + "and dudi in his mother house: " + Rivka.address + "\n the distance is: " + distance + " meters!"); #endregion Console.WriteLine("to continue press Enter!"); Console.ReadKey(); Console.WriteLine("\nprogram finished!"); }
static void Main(string[] args) { IBL bl = FactoryBL.GetBL(); #region ido data #region Mothers #region Mom1 Mother m1 = new Mother(); m1.MomID = 2111; m1.MomFirstName = "Noa"; m1.MomFamilyName = "Cohen"; m1.MomPhoneNum = 0542161798; m1.MomAdress = "bazel, jerusalem, israel"; m1.MomSearchAdress = "Basel, jerusalem, israel"; m1.MomDaysNannyNeeds[0] = false; m1.MomDaysNannyNeeds[1] = false; m1.MomDaysNannyNeeds[2] = false; m1.MomDaysNannyNeeds[3] = false; m1.MomDaysNannyNeeds[4] = true; m1.MomDaysNannyNeeds[5] = false; for (int i = 0; i < 6; i++) { m1.MomHoursNannyNeeds.Add(null); m1.MomHoursNannyNeeds[i] = new WeeklyWorkSchedule(); } m1.MomHoursNannyNeeds[0].StartTime = new TimeSpan(8, 30, 00); m1.MomHoursNannyNeeds[0].EndTime = new TimeSpan(16, 30, 00); m1.MomHoursNannyNeeds[1].StartTime = new TimeSpan(8, 30, 00); m1.MomHoursNannyNeeds[1].EndTime = new TimeSpan(16, 30, 00); m1.MomHoursNannyNeeds[2].StartTime = new TimeSpan(8, 30, 00); m1.MomHoursNannyNeeds[2].EndTime = new TimeSpan(16, 30, 00); m1.MomHoursNannyNeeds[3].StartTime = new TimeSpan(8, 30, 00); m1.MomHoursNannyNeeds[3].EndTime = new TimeSpan(16, 30, 00); m1.MomHoursNannyNeeds[4].StartTime = new TimeSpan(8, 30, 00); m1.MomHoursNannyNeeds[4].EndTime = new TimeSpan(15, 30, 00); m1.MomHoursNannyNeeds[5].StartTime = new TimeSpan(8, 30, 00); m1.MomHoursNannyNeeds[5].EndTime = new TimeSpan(16, 30, 00); bl.AddMom(m1); #endregion #region Mom2 Mother m2 = new Mother(); m2.MomID = 2112; m2.MomFirstName = "Tirtza"; m2.MomFamilyName = "Herst"; m2.MomPhoneNum = 0548522454; m2.MomAdress = "shoshana, jerusalem, israel"; m2.MomSearchAdress = "yaffo, jerusalem, israel"; m2.MomDaysNannyNeeds[0] = false; m2.MomDaysNannyNeeds[1] = false; m2.MomDaysNannyNeeds[2] = false; m2.MomDaysNannyNeeds[3] = true; m2.MomDaysNannyNeeds[4] = false; m2.MomDaysNannyNeeds[5] = true; for (int i = 0; i < 6; i++) { m2.MomHoursNannyNeeds.Add(null); m2.MomHoursNannyNeeds[i] = new WeeklyWorkSchedule(); } m2.MomHoursNannyNeeds[0].StartTime = new TimeSpan(8, 30, 00); m2.MomHoursNannyNeeds[0].EndTime = new TimeSpan(16, 30, 00); m2.MomHoursNannyNeeds[1].StartTime = new TimeSpan(8, 30, 00); m2.MomHoursNannyNeeds[1].EndTime = new TimeSpan(16, 30, 00); m2.MomHoursNannyNeeds[2].StartTime = new TimeSpan(8, 30, 00); m2.MomHoursNannyNeeds[2].EndTime = new TimeSpan(16, 30, 00); m2.MomHoursNannyNeeds[3].StartTime = new TimeSpan(8, 30, 00); m2.MomHoursNannyNeeds[3].EndTime = new TimeSpan(16, 30, 00); m2.MomHoursNannyNeeds[4].StartTime = new TimeSpan(8, 30, 00); m2.MomHoursNannyNeeds[4].EndTime = new TimeSpan(16, 30, 00); m2.MomHoursNannyNeeds[5].StartTime = new TimeSpan(8, 30, 00); m2.MomHoursNannyNeeds[5].EndTime = new TimeSpan(16, 30, 00); bl.AddMom(m2); #endregion #region Mom3 Mother m3 = new Mother(); m3.MomID = 2113; m3.MomFirstName = "Stav"; m3.MomFamilyName = "Havakook"; m3.MomPhoneNum = 0548774141; m3.MomAdress = "avizohar, jerusalem, israel"; m3.MomSearchAdress = "avizohar, jerusalem, israel"; m3.MomDaysNannyNeeds[0] = false; m3.MomDaysNannyNeeds[1] = false; m3.MomDaysNannyNeeds[2] = false; m3.MomDaysNannyNeeds[3] = true; m3.MomDaysNannyNeeds[4] = false; m3.MomDaysNannyNeeds[5] = true; for (int i = 0; i < 6; i++) { m3.MomHoursNannyNeeds.Add(null); m3.MomHoursNannyNeeds[i] = new WeeklyWorkSchedule(); } m3.MomHoursNannyNeeds[0].StartTime = new TimeSpan(8, 30, 00); m3.MomHoursNannyNeeds[0].EndTime = new TimeSpan(16, 30, 00); m3.MomHoursNannyNeeds[1].StartTime = new TimeSpan(8, 30, 00); m3.MomHoursNannyNeeds[1].EndTime = new TimeSpan(16, 30, 00); m3.MomHoursNannyNeeds[2].StartTime = new TimeSpan(8, 30, 00); m3.MomHoursNannyNeeds[2].EndTime = new TimeSpan(16, 30, 00); m3.MomHoursNannyNeeds[3].StartTime = new TimeSpan(8, 30, 00); m3.MomHoursNannyNeeds[3].EndTime = new TimeSpan(16, 30, 00); m3.MomHoursNannyNeeds[4].StartTime = new TimeSpan(8, 30, 00); m3.MomHoursNannyNeeds[4].EndTime = new TimeSpan(16, 30, 00); m3.MomHoursNannyNeeds[5].StartTime = new TimeSpan(8, 30, 00); m3.MomHoursNannyNeeds[5].EndTime = new TimeSpan(16, 30, 00); bl.AddMom(m3); #endregion #region Mom4 Mother m4 = new Mother(); m4.MomID = 2114; m4.MomFirstName = "Galit"; m4.MomFamilyName = "Melikovski"; m4.MomPhoneNum = 0548774141; m4.MomAdress = "avizohar, jerusalem, israel"; m4.MomSearchAdress = "avizohar, jerusalem, israel"; m4.MomDaysNannyNeeds[0] = false; m4.MomDaysNannyNeeds[1] = false; m4.MomDaysNannyNeeds[2] = false; m4.MomDaysNannyNeeds[3] = true; m4.MomDaysNannyNeeds[4] = false; m4.MomDaysNannyNeeds[5] = true; for (int i = 0; i < 6; i++) { m4.MomHoursNannyNeeds.Add(null); m4.MomHoursNannyNeeds[i] = new WeeklyWorkSchedule(); } m4.MomHoursNannyNeeds[0].StartTime = new TimeSpan(8, 30, 00); m4.MomHoursNannyNeeds[0].EndTime = new TimeSpan(16, 30, 00); m4.MomHoursNannyNeeds[1].StartTime = new TimeSpan(8, 30, 00); m4.MomHoursNannyNeeds[1].EndTime = new TimeSpan(16, 30, 00); m4.MomHoursNannyNeeds[2].StartTime = new TimeSpan(8, 30, 00); m4.MomHoursNannyNeeds[2].EndTime = new TimeSpan(16, 30, 00); m4.MomHoursNannyNeeds[3].StartTime = new TimeSpan(8, 30, 00); m4.MomHoursNannyNeeds[3].EndTime = new TimeSpan(16, 30, 00); m4.MomHoursNannyNeeds[4].StartTime = new TimeSpan(8, 30, 00); m4.MomHoursNannyNeeds[4].EndTime = new TimeSpan(16, 30, 00); m4.MomHoursNannyNeeds[5].StartTime = new TimeSpan(8, 30, 00); m4.MomHoursNannyNeeds[5].EndTime = new TimeSpan(16, 30, 00); bl.AddMom(m4); #endregion #region Mom5 Mother m5 = new Mother(); m5.MomID = 2115; m5.MomFirstName = "Danit"; m5.MomFamilyName = "Yeshayahu"; m5.MomPhoneNum = 0548774141; m5.MomAdress = "avizohar, jerusalem, israel"; m5.MomSearchAdress = "avizohar, jerusalem, israel"; m5.MomDaysNannyNeeds[0] = false; m5.MomDaysNannyNeeds[1] = false; m5.MomDaysNannyNeeds[2] = false; m5.MomDaysNannyNeeds[3] = true; m5.MomDaysNannyNeeds[4] = false; m5.MomDaysNannyNeeds[5] = true; for (int i = 0; i < 6; i++) { m5.MomHoursNannyNeeds.Add(null); m5.MomHoursNannyNeeds[i] = new WeeklyWorkSchedule(); } m5.MomHoursNannyNeeds[0].StartTime = new TimeSpan(8, 30, 00); m5.MomHoursNannyNeeds[0].EndTime = new TimeSpan(16, 30, 00); m5.MomHoursNannyNeeds[1].StartTime = new TimeSpan(8, 30, 00); m5.MomHoursNannyNeeds[1].EndTime = new TimeSpan(16, 30, 00); m5.MomHoursNannyNeeds[2].StartTime = new TimeSpan(8, 30, 00); m5.MomHoursNannyNeeds[2].EndTime = new TimeSpan(16, 30, 00); m5.MomHoursNannyNeeds[3].StartTime = new TimeSpan(8, 30, 00); m5.MomHoursNannyNeeds[3].EndTime = new TimeSpan(16, 30, 00); m5.MomHoursNannyNeeds[4].StartTime = new TimeSpan(8, 30, 00); m5.MomHoursNannyNeeds[4].EndTime = new TimeSpan(16, 30, 00); m5.MomHoursNannyNeeds[5].StartTime = new TimeSpan(8, 30, 00); m5.MomHoursNannyNeeds[5].EndTime = new TimeSpan(16, 30, 00); bl.AddMom(m5); #endregion #endregion #region childs #region Child1 Child c1 = new Child(); c1.ChildID = 1111; c1.ChildMomID = 2111; c1.ChildAge = new DateTime(2017, 8, 26); c1.ChildName = "David"; c1.ChildIsSpecialNeeds = false; //c1.ChildTypesOfSpecialNeeds = " "; c1.IsHaveNanny = false; bl.AddChild(c1); #endregion #region child2 Child c2 = new Child(); c2.ChildID = 1112; c2.ChildMomID = 2112; c2.ChildAge = new DateTime(2017, 3, 2); c2.ChildName = "Reuven"; c2.ChildIsSpecialNeeds = true; c2.ChildTypesOfSpecialNeeds = "need to eat something every 2 hours"; c2.IsHaveNanny = false; bl.AddChild(c2); #endregion #region child3 Child c3 = new Child(); c3.ChildID = 1113; c3.ChildMomID = 2113; c3.ChildAge = new DateTime(2017, 1, 29); c3.ChildName = "Moshe"; c3.ChildIsSpecialNeeds = false; //c3.ChildTypesOfSpecialNeeds = " "; c3.IsHaveNanny = false; bl.AddChild(c3); #endregion #region child4 Child c4 = new Child(); c4.ChildID = 1114; c4.ChildMomID = 2114; c4.ChildAge = new DateTime(2017, 11, 15); c4.ChildName = "Yosef"; c4.ChildIsSpecialNeeds = false; //c4.ChildTypesOfSpecialNeeds = " "; c4.IsHaveNanny = false; bl.AddChild(c4); #endregion #region child5 Child c5 = new Child(); c5.ChildID = 1115; c5.ChildMomID = 2114; c5.ChildAge = new DateTime(2016, 11, 15); c5.ChildName = "Shimon"; c5.ChildIsSpecialNeeds = false; //c5.ChildTypesOfSpecialNeeds = " "; c5.IsHaveNanny = false; bl.AddChild(c5); #endregion #region child6 Child c6 = new Child(); c6.ChildID = 1116; c6.ChildMomID = 2114; c6.ChildAge = new DateTime(2017, 10, 15); c6.ChildName = "Levi"; c6.ChildIsSpecialNeeds = true; c6.ChildTypesOfSpecialNeeds = "please dont put him much time under sun"; c6.IsHaveNanny = false; bl.AddChild(c6); #endregion #region child7 Child c7 = new Child(); c7.ChildID = 1117; c7.ChildMomID = 2114; c7.ChildAge = new DateTime(2016, 4, 24); c7.ChildName = "Yehuda"; c7.ChildIsSpecialNeeds = false; //c7.ChildTypesOfSpecialNeeds = " "; c7.IsHaveNanny = false; bl.AddChild(c7); #endregion #region child8 Child c8 = new Child(); c8.ChildID = 1118; c8.ChildMomID = 2114; c8.ChildAge = new DateTime(2016, 8, 14); c8.ChildName = "Isaschar"; c8.ChildIsSpecialNeeds = false; //c8.ChildTypesOfSpecialNeeds = " "; c8.IsHaveNanny = false; bl.AddChild(c8); #endregion #region child9 Child c9 = new Child(); c9.ChildID = 1119; c9.ChildMomID = 2114; c9.ChildAge = new DateTime(2015, 12, 8); c9.ChildName = "Zevulun"; c9.ChildIsSpecialNeeds = false; //c9.ChildTypesOfSpecialNeeds = " "; c9.IsHaveNanny = false; bl.AddChild(c9); #endregion #region child10 Child c10 = new Child(); c10.ChildID = 1120; c10.ChildMomID = 2114; c10.ChildAge = new DateTime(2015, 8, 19); c10.ChildName = "Dan"; c10.ChildIsSpecialNeeds = false; //c10.ChildTypesOfSpecialNeeds = " "; c10.IsHaveNanny = false; bl.AddChild(c10); #endregion #endregion #region Nannies #region nanny1 Nanny nanny1 = new Nanny(); nanny1.NannyId = 3111; nanny1.NannyPrivateName = "Sara"; nanny1.NannyFamilyName = "Berkovich"; nanny1.NannyMaxInfantAge = 36; nanny1.NannyMinInfantAge = 3; nanny1.NannyMaxInfants = 10; nanny1.NannyDateOfBirth = new DateTime(1989, 12, 12); nanny1.NannyPhoneNum = 0502535656; nanny1.NannyIsElevator = true; nanny1.NannyFloor = 2; nanny1.NannyYearsOfExperience = 0; nanny1.NannyIsHourlySalary = true; nanny1.NannyHourlySalary = 29.5; nanny1.NannyMonthlySalary = 2360; nanny1.NannyIsMOE = true; nanny1.IsNannyHaveRecommendations = true; nanny1.NannyRecommendations = "very dedicated to the child"; nanny1.NannyAdress = "Shoshana Polyakov, Jerusalem, Israel"; nanny1.NannyWorkingDays = new bool[6] { false, true, true, true, true, true }; nanny1.NannyWorkingHours = new List <WeeklyWorkSchedule>(6); for (int i = 0; i < 6; i++) { nanny1.NannyWorkingHours.Add(null); nanny1.NannyWorkingHours[i] = new WeeklyWorkSchedule(); } nanny1.NannyWorkingHours[0].StartTime = new TimeSpan(7, 30, 00); nanny1.NannyWorkingHours[0].EndTime = new TimeSpan(16, 30, 00); nanny1.NannyWorkingHours[1].StartTime = new TimeSpan(7, 30, 00); nanny1.NannyWorkingHours[1].EndTime = new TimeSpan(16, 30, 00); nanny1.NannyWorkingHours[3].StartTime = new TimeSpan(7, 30, 00); nanny1.NannyWorkingHours[3].EndTime = new TimeSpan(16, 30, 00); nanny1.NannyWorkingHours[4].StartTime = new TimeSpan(7, 30, 00); nanny1.NannyWorkingHours[4].EndTime = new TimeSpan(16, 30, 00); nanny1.NannyWorkingHours[5].StartTime = new TimeSpan(7, 30, 00); nanny1.NannyWorkingHours[5].EndTime = new TimeSpan(16, 30, 00); bl.AddNanny(nanny1); #endregion #region nanny2 Nanny nanny2 = new Nanny(); nanny2.NannyId = 3112; nanny2.NannyPrivateName = "Rivka"; nanny2.NannyFamilyName = "Birs"; nanny2.NannyMaxInfantAge = 23; nanny2.NannyMinInfantAge = 3; nanny2.NannyMaxInfants = 10; nanny2.NannyDateOfBirth = new DateTime(1985, 12, 12); nanny2.NannyPhoneNum = 0572213656; nanny2.NannyIsElevator = false; nanny2.NannyFloor = 5; nanny2.NannyYearsOfExperience = 2; nanny2.NannyIsHourlySalary = false; nanny2.NannyHourlySalary = 29.5; nanny2.NannyMonthlySalary = 2900; nanny2.NannyIsMOE = false; nanny2.IsNannyHaveRecommendations = true; nanny2.NannyRecommendations = "good nanny"; nanny2.NannyAdress = "David Remez, Jerusalem, Israel"; nanny2.NannyWorkingDays = new bool[6] { false, true, true, true, true, true }; nanny2.NannyWorkingHours = new List <WeeklyWorkSchedule>(6); for (int i = 0; i < 6; i++) { nanny2.NannyWorkingHours.Add(null); nanny2.NannyWorkingHours[i] = new WeeklyWorkSchedule(); } nanny2.NannyWorkingHours[0].StartTime = new TimeSpan(6, 30, 00); nanny2.NannyWorkingHours[0].EndTime = new TimeSpan(17, 30, 00); nanny2.NannyWorkingHours[1].StartTime = new TimeSpan(6, 30, 00); nanny2.NannyWorkingHours[1].EndTime = new TimeSpan(17, 30, 00); nanny2.NannyWorkingHours[2].StartTime = new TimeSpan(6, 30, 00); nanny2.NannyWorkingHours[2].EndTime = new TimeSpan(17, 30, 00); nanny2.NannyWorkingHours[3].StartTime = new TimeSpan(6, 30, 00); nanny2.NannyWorkingHours[3].EndTime = new TimeSpan(17, 30, 00); nanny2.NannyWorkingHours[4].StartTime = new TimeSpan(6, 30, 00); nanny2.NannyWorkingHours[4].EndTime = new TimeSpan(17, 30, 00); nanny2.NannyWorkingHours[5].StartTime = new TimeSpan(6, 30, 00); nanny2.NannyWorkingHours[5].EndTime = new TimeSpan(17, 30, 00); bl.AddNanny(nanny2); #endregion #region nanny3 Nanny nanny3 = new Nanny(); nanny3.NannyId = 3113; nanny3.NannyPrivateName = "Rachel"; nanny3.NannyFamilyName = "Buzaglo"; nanny3.NannyMaxInfantAge = 13; nanny3.NannyMinInfantAge = 4; nanny3.NannyMaxInfants = 10; nanny3.NannyDateOfBirth = new DateTime(1978, 2, 20); nanny3.NannyPhoneNum = 0545232625; nanny3.NannyIsElevator = false; nanny3.NannyFloor = 2; nanny3.NannyYearsOfExperience = 5; nanny3.NannyIsHourlySalary = false; nanny3.NannyHourlySalary = 29.5; nanny3.NannyMonthlySalary = 3500; nanny3.NannyIsMOE = true; nanny3.IsNannyHaveRecommendations = false; nanny3.NannyRecommendations = "good nanny"; nanny3.NannyAdress = "Karmon , Jerusalem, Israel"; nanny3.NannyWorkingDays = new bool[6] { false, true, false, false, false, false }; nanny3.NannyWorkingHours = new List <WeeklyWorkSchedule>(6); for (int i = 0; i < 6; i++) { nanny3.NannyWorkingHours.Add(null); nanny3.NannyWorkingHours[i] = new WeeklyWorkSchedule(); } nanny3.NannyWorkingHours[0].StartTime = new TimeSpan(7, 30, 00); nanny3.NannyWorkingHours[0].EndTime = new TimeSpan(16, 30, 00); nanny3.NannyWorkingHours[1].StartTime = new TimeSpan(7, 30, 00); nanny3.NannyWorkingHours[1].EndTime = new TimeSpan(16, 30, 00); nanny3.NannyWorkingHours[3].StartTime = new TimeSpan(7, 30, 00); nanny3.NannyWorkingHours[3].EndTime = new TimeSpan(16, 30, 00); nanny3.NannyWorkingHours[4].StartTime = new TimeSpan(7, 30, 00); nanny3.NannyWorkingHours[4].EndTime = new TimeSpan(16, 30, 00); nanny3.NannyWorkingHours[5].StartTime = new TimeSpan(07, 30, 00); nanny3.NannyWorkingHours[5].EndTime = new TimeSpan(16, 30, 00); bl.AddNanny(nanny3); #endregion #region nanny4 Nanny nanny4 = new Nanny(); nanny4.NannyId = 3114; nanny4.NannyPrivateName = "Tal"; nanny4.NannyFamilyName = "Leybovich"; nanny4.NannyMaxInfantAge = 23; nanny4.NannyMinInfantAge = 4; nanny4.NannyMaxInfants = 10; nanny4.NannyDateOfBirth = new DateTime(1991, 7, 5); nanny4.NannyPhoneNum = 0535488987; nanny4.NannyIsElevator = true; nanny4.NannyFloor = 8; nanny4.NannyYearsOfExperience = 0; nanny4.NannyIsHourlySalary = true; nanny4.NannyHourlySalary = 35; nanny4.NannyMonthlySalary = 2900; nanny4.NannyIsMOE = false; nanny4.IsNannyHaveRecommendations = false; nanny4.NannyRecommendations = "good nanny"; nanny4.NannyAdress = "Ya'akov Eliav , Jerusalem, Israel"; nanny4.NannyWorkingDays = new bool[6] { false, true, false, true, true, true }; nanny4.NannyWorkingHours = new List <WeeklyWorkSchedule>(6); for (int i = 0; i < 6; i++) { nanny4.NannyWorkingHours.Add(null); nanny4.NannyWorkingHours[i] = new WeeklyWorkSchedule(); } nanny4.NannyWorkingHours[0].StartTime = new TimeSpan(7, 30, 00); nanny4.NannyWorkingHours[0].EndTime = new TimeSpan(16, 30, 00); nanny4.NannyWorkingHours[1].StartTime = new TimeSpan(7, 30, 00); nanny4.NannyWorkingHours[1].EndTime = new TimeSpan(16, 30, 00); nanny4.NannyWorkingHours[3].StartTime = new TimeSpan(7, 30, 00); nanny4.NannyWorkingHours[3].EndTime = new TimeSpan(16, 30, 00); nanny4.NannyWorkingHours[4].StartTime = new TimeSpan(7, 30, 00); nanny4.NannyWorkingHours[4].EndTime = new TimeSpan(16, 30, 00); nanny4.NannyWorkingHours[5].StartTime = new TimeSpan(09, 30, 00); nanny4.NannyWorkingHours[5].EndTime = new TimeSpan(16, 30, 00); bl.AddNanny(nanny4); #endregion #region nanny5 Nanny nanny5 = new Nanny(); nanny5.NannyId = 3115; nanny5.NannyPrivateName = "Gila"; nanny5.NannyFamilyName = "Gadasi"; nanny5.NannyMaxInfantAge = 13; nanny5.NannyMinInfantAge = 4; nanny5.NannyMaxInfants = 10; nanny5.NannyDateOfBirth = new DateTime(1971, 3, 15); nanny5.NannyPhoneNum = 0572213656; nanny5.NannyIsElevator = true; nanny5.NannyFloor = 1; nanny5.NannyYearsOfExperience = 6; nanny5.NannyIsHourlySalary = false; nanny5.NannyHourlySalary = 29.5; nanny5.NannyMonthlySalary = 2500; nanny5.NannyIsMOE = true; nanny5.IsNannyHaveRecommendations = true; nanny5.NannyRecommendations = "great nanny, i'm very happy because of her"; nanny5.NannyAdress = "Mazkeret Moshe St, Jerusalem, Israel"; nanny5.NannyWorkingDays = new bool[6] { false, true, false, false, false, false }; nanny5.NannyWorkingHours = new List <WeeklyWorkSchedule>(6); for (int i = 0; i < 6; i++) { nanny5.NannyWorkingHours.Add(null); nanny5.NannyWorkingHours[i] = new WeeklyWorkSchedule(); } nanny5.NannyWorkingHours[0].StartTime = new TimeSpan(7, 30, 00); nanny5.NannyWorkingHours[0].EndTime = new TimeSpan(16, 30, 00); nanny5.NannyWorkingHours[1].StartTime = new TimeSpan(7, 30, 00); nanny5.NannyWorkingHours[1].EndTime = new TimeSpan(16, 30, 00); nanny5.NannyWorkingHours[3].StartTime = new TimeSpan(7, 30, 00); nanny5.NannyWorkingHours[3].EndTime = new TimeSpan(16, 30, 00); nanny5.NannyWorkingHours[4].StartTime = new TimeSpan(7, 30, 00); nanny5.NannyWorkingHours[4].EndTime = new TimeSpan(16, 30, 00); nanny5.NannyWorkingHours[5].StartTime = new TimeSpan(07, 30, 00); nanny5.NannyWorkingHours[5].EndTime = new TimeSpan(16, 30, 00); bl.AddNanny(nanny5); #endregion #region nanny6 Nanny nanny6 = new Nanny(); nanny6.NannyId = 3116; nanny6.NannyPrivateName = "Fatma"; nanny6.NannyFamilyName = "Salah"; nanny6.NannyMaxInfantAge = 23; nanny6.NannyMinInfantAge = 6; nanny6.NannyMaxInfants = 10; nanny6.NannyDateOfBirth = new DateTime(1967, 6, 25); nanny6.NannyPhoneNum = 0535244545; nanny6.NannyIsElevator = false; nanny6.NannyFloor = 5; nanny6.NannyYearsOfExperience = 10; nanny6.NannyIsHourlySalary = false; nanny6.NannyHourlySalary = 29.5; nanny6.NannyMonthlySalary = 4500; nanny6.NannyIsMOE = false; nanny6.IsNannyHaveRecommendations = false; nanny6.NannyRecommendations = "good nanny"; nanny6.NannyWorkingDays = new bool[6] { false, true, false, false, false, false }; nanny6.NannyAdress = "Ha-Kimronim St , Jerusalem, Israel"; nanny6.NannyWorkingHours = new List <WeeklyWorkSchedule>(6); for (int i = 0; i < 6; i++) { nanny6.NannyWorkingHours.Add(null); nanny6.NannyWorkingHours[i] = new WeeklyWorkSchedule(); } nanny6.NannyWorkingHours[0].StartTime = new TimeSpan(7, 30, 00); nanny6.NannyWorkingHours[0].EndTime = new TimeSpan(16, 30, 00); nanny6.NannyWorkingHours[1].StartTime = new TimeSpan(7, 30, 00); nanny6.NannyWorkingHours[1].EndTime = new TimeSpan(16, 30, 00); nanny6.NannyWorkingHours[3].StartTime = new TimeSpan(7, 30, 00); nanny6.NannyWorkingHours[3].EndTime = new TimeSpan(16, 30, 00); nanny6.NannyWorkingHours[4].StartTime = new TimeSpan(7, 30, 00); nanny6.NannyWorkingHours[4].EndTime = new TimeSpan(16, 30, 00); nanny6.NannyWorkingHours[5].StartTime = new TimeSpan(07, 30, 00); nanny6.NannyWorkingHours[5].EndTime = new TimeSpan(16, 30, 00); bl.AddNanny(nanny6); #endregion #region nanny7 Nanny nanny7 = new Nanny(); nanny7.NannyId = 3117; nanny7.NannyPrivateName = "Tova"; nanny7.NannyFamilyName = "Glazer"; nanny7.NannyMaxInfantAge = 23; nanny7.NannyMinInfantAge = 4; nanny7.NannyMaxInfants = 10; nanny7.NannyDateOfBirth = new DateTime(1988, 7, 16); nanny7.NannyPhoneNum = 0526633232; nanny7.NannyIsElevator = false; nanny7.NannyFloor = 3; nanny7.NannyYearsOfExperience = 0; nanny7.NannyIsHourlySalary = true; nanny7.NannyHourlySalary = 33; nanny7.NannyMonthlySalary = 2900; nanny7.NannyIsMOE = false; nanny7.IsNannyHaveRecommendations = false; nanny7.NannyRecommendations = "good nanny"; nanny7.NannyWorkingDays = new bool[6] { false, true, false, true, true, true }; nanny7.NannyAdress = "Tel Khai St, Jerusalem, Israel"; nanny7.NannyWorkingHours = new List <WeeklyWorkSchedule>(6); for (int i = 0; i < 6; i++) { nanny7.NannyWorkingHours.Add(null); nanny7.NannyWorkingHours[i] = new WeeklyWorkSchedule(); } nanny7.NannyWorkingHours[0].StartTime = new TimeSpan(7, 30, 00); nanny7.NannyWorkingHours[0].EndTime = new TimeSpan(16, 30, 00); nanny7.NannyWorkingHours[1].StartTime = new TimeSpan(7, 30, 00); nanny7.NannyWorkingHours[1].EndTime = new TimeSpan(16, 30, 00); nanny7.NannyWorkingHours[3].StartTime = new TimeSpan(7, 30, 00); nanny7.NannyWorkingHours[3].EndTime = new TimeSpan(16, 30, 00); nanny7.NannyWorkingHours[4].StartTime = new TimeSpan(7, 30, 00); nanny7.NannyWorkingHours[4].EndTime = new TimeSpan(16, 30, 00); nanny7.NannyWorkingHours[5].StartTime = new TimeSpan(07, 30, 00); nanny7.NannyWorkingHours[5].EndTime = new TimeSpan(16, 30, 00); bl.AddNanny(nanny7); #endregion #region nanny8 Nanny nanny8 = new Nanny(); nanny8.NannyId = 3118; nanny8.NannyPrivateName = "Neta"; nanny8.NannyFamilyName = "Shimoni"; nanny8.NannyMaxInfantAge = 52; nanny8.NannyMinInfantAge = 10; nanny8.NannyMaxInfants = 10; nanny8.NannyDateOfBirth = new DateTime(1990, 5, 16); nanny8.NannyPhoneNum = 0526651232; nanny8.NannyIsElevator = false; nanny8.NannyFloor = 1; nanny8.NannyYearsOfExperience = 3; nanny8.NannyIsHourlySalary = true; nanny8.NannyHourlySalary = 31; nanny8.NannyMonthlySalary = 2650; nanny8.NannyIsMOE = false; nanny8.IsNannyHaveRecommendations = false; nanny8.NannyRecommendations = "good nanny"; nanny8.NannyWorkingDays = new bool[6] { false, true, false, true, true, true }; nanny8.NannyAdress = "Tel Khai St, Jerusalem, Israel"; nanny8.NannyWorkingHours = new List <WeeklyWorkSchedule>(6); for (int i = 0; i < 6; i++) { nanny8.NannyWorkingHours.Add(null); nanny8.NannyWorkingHours[i] = new WeeklyWorkSchedule(); } nanny8.NannyWorkingHours[0].StartTime = new TimeSpan(7, 30, 00); nanny8.NannyWorkingHours[0].EndTime = new TimeSpan(16, 30, 00); nanny8.NannyWorkingHours[1].StartTime = new TimeSpan(7, 30, 00); nanny8.NannyWorkingHours[1].EndTime = new TimeSpan(16, 30, 00); nanny8.NannyWorkingHours[3].StartTime = new TimeSpan(7, 30, 00); nanny8.NannyWorkingHours[3].EndTime = new TimeSpan(16, 30, 00); nanny8.NannyWorkingHours[4].StartTime = new TimeSpan(7, 30, 00); nanny8.NannyWorkingHours[4].EndTime = new TimeSpan(16, 30, 00); nanny8.NannyWorkingHours[5].StartTime = new TimeSpan(07, 30, 00); nanny7.NannyWorkingHours[5].EndTime = new TimeSpan(16, 30, 00); bl.AddNanny(nanny8); #endregion #endregion #region Contracts #region Contract1 Contract co1 = new Contract(); co1.ChildID = 1111; co1.NannyID = 3111; co1.IsIntroductoryMeeting = true; co1.IsContractSigned = false; co1.PaymentMethod = Payment_method.hourly; co1.HourlySalary = 30.5; co1.MonthlySalary = 3500; co1.StartDate = new DateTime(2017, 5, 9); co1.EndDate = new DateTime(2018, 5, 9); bl.AddContract(co1); #endregion #region Contract2 Contract co2 = new Contract(); co2.ChildID = 1112; co2.NannyID = 3112; co2.IsIntroductoryMeeting = true; co2.IsContractSigned = false; co2.PaymentMethod = Payment_method.monthly; co2.HourlySalary = 34.5; co2.MonthlySalary = 3900; co2.StartDate = new DateTime(2016, 5, 9); co2.EndDate = new DateTime(2017, 5, 9); bl.AddContract(co2); #endregion #region Contract3 Contract co3 = new Contract(); co3.ChildID = 1113; co3.NannyID = 3113; co3.IsIntroductoryMeeting = false; co3.IsContractSigned = false; co3.PaymentMethod = Payment_method.monthly; co3.HourlySalary = 29; co3.MonthlySalary = 2900; co3.StartDate = new DateTime(2017, 9, 7); co3.EndDate = new DateTime(2018, 9, 7); bl.AddContract(co3); #endregion #region Contract4 Contract co4 = new Contract(); co4.ChildID = 1114; co4.NannyID = 3114; co4.IsIntroductoryMeeting = false; co4.IsContractSigned = true; co4.PaymentMethod = Payment_method.monthly; co4.HourlySalary = 39.5; co4.MonthlySalary = 3900; co4.StartDate = new DateTime(2016, 5, 9); co4.EndDate = new DateTime(2017, 5, 9); bl.AddContract(co4); #endregion #region Contract5 Contract co5 = new Contract(); co5.ChildID = 1115; co5.NannyID = 3115; co5.IsIntroductoryMeeting = true; co5.IsContractSigned = true; co5.PaymentMethod = Payment_method.hourly; co5.HourlySalary = 31; co5.MonthlySalary = 3700; co5.StartDate = new DateTime(2016, 3, 24); co5.EndDate = new DateTime(2017, 9, 7); bl.AddContract(co5); #endregion #endregion #endregion #region main Console.WriteLine("******************************************************************************"); Console.WriteLine("Hello! Welcome to the Baby-nannies-Mediation system, please enter your choice:"); Console.WriteLine("******************************************************************************"); int choice; bool logOff = false; do { Console.WriteLine("1. The mother's options"); Console.WriteLine("2. The nannie's options"); Console.WriteLine("3. The child's options"); Console.WriteLine("4. The contract's options"); Console.WriteLine("5. Exit"); choice = int.Parse(Console.ReadLine()); Console.WriteLine("\n"); try { switch (choice) { case 1: MotherOptions.MomMain(); break; case 2: NannyOptions.NannyMain(); break; case 3: ChildOptions.ChildMain(); break; case 4: ContractOptions.ContractMain(); break; case 5: Console.WriteLine("GoodBye!"); logOff = true; break; default: throw new Exception("Error, Your choice does not exist, please enter a number between 1 and 5"); } } catch (Exception c) { Console.WriteLine(c.Message); } Console.WriteLine(); } while (!logOff); #endregion }