private void Add_Button_Click(object sender, RoutedEventArgs e) { try { contract.EmploymentHours = mother.HoursNeed; if (monthCheckBox.IsChecked == true) { contract.Payment = true; } else { contract.Payment = false; } myBL.AddContract(contract); MessageBox.Show(contract.ToString()); contract = new Contract(); DataContext = contract; this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Button_Click(object sender, RoutedEventArgs e) { try { if (introduce_meeting.IsChecked == false || is_signed.IsChecked == false) { throw new Exception("One of the checkboxes was not clicked!!"); } /*Contract contract = new Contract(((PriorityNanny)(nannysoptiongrid.SelectedItem)).ID, listofMothers.SelectedValue, listofChildren.SelectedValue, introduce_meeting.IsChecked, * is_signed.IsChecked, ((PriorityNanny)(nannysoptiongrid.SelectedItem)).Hourly_rate, * ((PriorityNanny)(nannysoptiongrid.SelectedItem)).Monthly_rate, * (MyEnum.Paymentmethode)Enum.Parse(typeof(MyEnum.Paymentmethode),paymentmethod.Text), * Convert.ToDateTime(workbegindate.SelectedDate), Convert.ToDateTime(workenddate.SelectedDate), * ((PriorityNanny)(nannysoptiongrid.SelectedItem)).Salary, ((PriorityNanny)(nannysoptiongrid.SelectedItem)).Distance, * bl.checkForDiscunt((Nanny)(nannysoptiongrid.SelectedItem), bl.GetMotherById((int)listofMothers.SelectedValue))); */ if (isUpdate) { bl.UpdateContract(contr); } else { bl.AddContract(contr); } fr.Close(); } catch (Exception w) { MessageBox.Show(w.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void AddContractbutton_Click_1(object sender, RoutedEventArgs e) { try { // contract.ContractId = int.Parse(this.contractIdTextBox.Text); this.grid1.DataContext = contract; string str = "Are you sure you want to add?\n" + "contract with this details:\n"; if (UpdateFlag) str = "Are you sure you Update?\n" + "contract with this details:\n"; if (MessageBox.Show(str + contract.ToString(), " message to user ", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes) { if (this.UpdateFlag) { bl.UpdateContract(contract); } else { bl.AddContract(contract); } } // grid1.DataContext = bl.GetContractIEnumerable(); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, " message to user ", MessageBoxButton.OK, MessageBoxImage.Information); } }
void ContractInitialize() { ibl.AddContract(contract1); ibl.AddContract(contract2); ibl.AddContract(contract3); //ibl.AddContract(contract4); ibl.AddContract(contract5); ibl.AddContract(contract6); //ibl.AddContract(contract7); ibl.AddContract(TestContract); ibl.AddContract(aa); ibl.AddContract(bb); ibl.AddContract(cc); }
private void BackgroundWorker_DoWork(object sender, DoWorkEventArgs e) { try { BL.AddContract(contract); e.Result = false; } catch (Exception exc) { e.Result = exc; } }
private void SaveButton_Click(object sender, RoutedEventArgs e) { try { bl.AddContract(contract); MessageBox.Show(bl.GetContractList().LastOrDefault().ToString(), "This contract has been added:"); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Button_Click(object sender, RoutedEventArgs e) { try { bl.AddContract(contract); contract = new Contract(); this.ContractDetails.DataContext = contract; this.Close(); } catch (FormatException) { MessageBox.Show("check your input and try again"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void AddBtn_OnClick(object sender, RoutedEventArgs e) { try { if (CurrentContract.StartDate.CompareTo(CurrentContract.EndDate) > 0) { throw new Exception("Start date must be before end date!"); } var btnresult = MessageBox.Show("Add Contract?", "Confirmation", MessageBoxButton.OKCancel, MessageBoxImage.Information); if (btnresult == MessageBoxResult.OK) { CurrentContract.Signed = true; bl.AddContract(CurrentContract); } this.Close(); } catch (Exception exception) { MessageBox.Show($"Error - {exception.Message}", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void Button_Click(object sender, RoutedEventArgs e) { try { newContract.ChildID = (All_Childs_ComboBox.SelectedItem as Child).ChildID; newContract.NannyID = (All_Nannies_ComboBox.SelectedItem as Nanny).NannyId; newContract.IsIntroductoryMeeting = (bool)IntroductoryMeeting_CheckBox.IsChecked; newContract.SpeicalDetailsOfMeeting = SpecialDetailsOfMeeting_TextBox.Text; if (Contract_Signed_CheckBox.IsChecked == true) { if (Start_DatePicker.Text != "" && End_DatePicker.Text != "") { newContract.StartDate = new DateTime(Start_DatePicker.SelectedDate.Value.Year, Start_DatePicker.SelectedDate.Value.Month, Start_DatePicker.SelectedDate.Value.Day); newContract.EndDate = new DateTime(End_DatePicker.SelectedDate.Value.Year, End_DatePicker.SelectedDate.Value.Month, End_DatePicker.SelectedDate.Value.Day); } else { throw new Exception("contract must have start and end valid dates"); } if (newContract.StartDate > newContract.EndDate) { throw new Exception("contract start must be before end"); } } bl.AddContract(newContract); dataGridToRefresh.ItemsSource = null; dataGridToRefresh.ItemsSource = bl.GetAllContracts(); //shlomi MessageBox.Show("Succesfuly Added", "Succesfuly Add", MessageBoxButton.OK, MessageBoxImage.Information); this.IsEnabled = false; newContract = new Contract(); } catch (Exception c) { MessageBox.Show(c.Message); } }
private void AddContract_Click(object sender, RoutedEventArgs e) { if (nanny != null && mother != null && child != null) { contract.NannyID = nanny.ID; contract.HourlyFee = nanny.HourlyFee; contract.MonthlyFee = nanny.MonthlyFee; contract.IsPaymentByHour = nanny.IsHourlyFee; contract.MotherID = mother.ID; contract.ChildID = child.ID; Console.WriteLine(contract); try { bl.AddContract(contract); Close(); } catch (BLException ex) { MessageBox.Show(ex.Message, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error); } } }
// add contract click button event private void AddContract_Click(object sender, RoutedEventArgs e) { if (nanny != null && mother != null && child != null) { // get contract details contract.NannyID = nanny.ID; contract.HourlyFee = nanny.HourlyFee; contract.MonthlyFee = nanny.MonthlyFee; contract.IsPaymentByHour = nanny.IsHourlyFee; contract.MotherID = mother.ID; contract.ChildID = child.ID; try { bl.AddContract(contract.Clone()); string message = "The contract was successfully added\n The contract number is: " + (bl.getContractNumber() - 1); MessageBox.Show(message, "Success", MessageBoxButton.OK, MessageBoxImage.Information); Close(); } catch (BLException ex) { MessageBox.Show(ex.Message, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error); } } }
private void initFordebugs() { bl.AddMother(new BE.Mother { ID = "123", Lastname = "Sarah", FirstName = "Imeinu", Tel = "01233477", Address = new BE.Address { City = "Jerusalem", Country = "Israel", Number = 11, Street = "beit hadfus", ZipCode = "208" }, HomePhone = "67767678", BabbySitterAdress = new BE.Address { City = "Jerusalem", Country = "Israel", Number = 11, Street = "beit hadfus", ZipCode = "208" }, Workhours = new Dictionary <DayOfWeek, KeyValuePair <int, int> > { { DayOfWeek.Sunday, new KeyValuePair <int, int> (0700, 1900) }, { DayOfWeek.Monday, new KeyValuePair <int, int> (0700, 1900) }, { DayOfWeek.Tuesday, new KeyValuePair <int, int> (0700, 1900) }, { DayOfWeek.Wednesday, new KeyValuePair <int, int> (0700, 1900) }, { DayOfWeek.Thursday, new KeyValuePair <int, int> (0700, 1900) }, { DayOfWeek.Friday, new KeyValuePair <int, int> (0700, 1900) }, }, MonthPayment = false }); bl.AddNanny(new BE.Nanny { ID = "208493965", Lastname = "bar", FirstName = "chaya", Tel = "025800856", Address = new BE.Address { City = "Jerusalem", Country = "Israel", Number = 22, Street = "Herzl", ZipCode = "Nj208" }, NannyD_of_B = new DateTime(1988, 2, 2), IsElevator = true, YearsOfExperience = 3, MaxKids = 5, MinimunmAge = 3, MaximumAge = 24, RateforHour = 30, RateforMonth = 5000, AvailableTime = new Dictionary <DayOfWeek, KeyValuePair <int, int> > { { DayOfWeek.Sunday, new KeyValuePair <int, int> (0600, 1900) }, { DayOfWeek.Monday, new KeyValuePair <int, int> (0600, 1900) }, { DayOfWeek.Tuesday, new KeyValuePair <int, int> (0700, 1900) }, { DayOfWeek.Wednesday, new KeyValuePair <int, int> (0700, 2000) }, { DayOfWeek.Thursday, new KeyValuePair <int, int> (0700, 1900) }, { DayOfWeek.Friday, new KeyValuePair <int, int> (0700, 1900) }, }, IsBasedonTMTorEdu = true, Recommendation = "good", NannyBank = new BE.BankAccount { BankAdress = "jerusalem" } }); bl.AddChild(new BE.Child { ChildID = "6789", ChildName = "chanan", DateOfBirth = new DateTime(2017, 8, 1), IsSpacialNeeds = false, MotherID = "123" }); bl.AddContract(new BE.Contract { NunnyID = "208493965", MotherID = "123", ChildID = "6789", IsInterview = true, IsContract = true, RateforHour = 35, RateforMonth = 4500, IsMorechilds = false, WorkTime = new Dictionary <DayOfWeek, KeyValuePair <int, int> > { { DayOfWeek.Sunday, new KeyValuePair <int, int> (0700, 1900) }, { DayOfWeek.Monday, new KeyValuePair <int, int> (0700, 1900) }, { DayOfWeek.Tuesday, new KeyValuePair <int, int> (0700, 1900) }, { DayOfWeek.Wednesday, new KeyValuePair <int, int> (0700, 1900) }, { DayOfWeek.Thursday, new KeyValuePair <int, int> (0700, 1900) }, { DayOfWeek.Friday, new KeyValuePair <int, int> (0700, 1900) }, }, DateStart = new DateTime(2017, 07, 21), DateEnd = new DateTime(2017, 09, 21), HoursOfContractMonth = 50 }); }
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; } } }
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 }