//void init() //{ // Nanny nan1 = new Nanny() // { // Id = 111111111, // Family_Name = "choen", // First_Name = "rachel", // Birth_Date = new DateTime(1996, 01, 01), // Phone_Number = 123, // Country = "isreal", // City = "metula", // Street = "halevanon", // Elevator = true, // Floor = 5, // Years_Experience = 3, // Max_Children = 2, // Min_Kid_Age = 4, // Max_Kid_Age = 24, // Is_Hour_Salary = true, // Hour_Salary=20, // Month_Salary = 1000, // Vacation_By_Education = true, // Vacation_By__Tmt = false, // Recommendations = "very good", // Is_Religious = true, // Is_OutDoors = false, // Comfort_With_Pets = false, // Smoking = true, // Gives_Food = true // }; // nan1.Work_Day[(int)Days.Sunday] = true; // nan1.Work_Hours[0, 0] = new DateTime(2000, 01, 01, 10, 00, 00); // nan1.Work_Hours[1, 0] = new DateTime(2000, 01, 01, 13, 00, 00); // nan1.Spoken_Languages[(int)Languages.Hebrew] = true; // nan1.Spoken_Languages[(int)Languages.Yiddish] = true; // Add_Nanny(nan1); // Nanny nan2 = new Nanny() // { // Id = 222222222, // Family_Name = "choen", // First_Name = "shira", // Birth_Date = new DateTime(1990, 01, 01), // Phone_Number = 456, // Country = "isreal", // City = "metula", // Street = "halevanon", // Elevator = false, // Floor = 3, // Years_Experience = 1, // Max_Children = 2, // Min_Kid_Age = 2, // Max_Kid_Age = 24, // Is_Hour_Salary = true, // Hour_Salary = 30, // Month_Salary = 800, // Vacation_By_Education = true, // Vacation_By__Tmt = false, // Recommendations = "very good", // Is_Religious = false, // Is_OutDoors = false, // Comfort_With_Pets = false, // Smoking = false, // Gives_Food = false // }; // nan2.Work_Day[(int)Days.Monday] = true; // nan2.Work_Day[(int)Days.Tuesday] = true; // nan2.Work_Hours[0, 1] = new DateTime(2000, 01, 01, 08, 00, 00); // nan2.Work_Hours[1, 1] = new DateTime(2000, 01, 01, 13, 00, 00); // nan2.Work_Hours[0, 2] = new DateTime(2000, 01, 01, 10, 00, 00); // nan2.Work_Hours[1, 2] = new DateTime(2000, 01, 01, 14, 00, 00); // nan2.Spoken_Languages[(int)Languages.Hebrew] = true; // nan2.Spoken_Languages[(int)Languages.English] = true; // Add_Nanny(nan2); // Mother mom = new Mother() // { // Id = 333333333, // Family_Name = "lev", // First_Name = "sheli", // Phone_Number = 111, // Home_Country = "isreal", // Home_City = "metula", // Home_Street = "halevanon", // Min_Years_Experience = 1, // Want_Hour_Salary = true, // Food_From_Nanny = true, // Take_By_Car = true, // Religious_Nanny = true, // Smoking_Nanny = true, // Comments = "hello" // }; // mom.Wanted_Days[(int)Days.Monday] = true; // mom.Wanted_Hours[0, 1] = new DateTime(2000, 01, 01, 11, 00, 00); // mom.Wanted_Hours[1, 1] = new DateTime(2000, 01, 01, 12, 30, 00); // Add_Mother(mom); // Mother mom2 = new Mother() // { // Id = 444444444, // Family_Name = "levi", // First_Name = "shira", // Phone_Number = 333, // Home_Country = "isreal", // Home_City = "Yafo", // Home_Street = "bbb", // Min_Years_Experience = 2, // Food_From_Nanny = false, // Want_Hour_Salary = false, // Take_By_Car = false, // Religious_Nanny = false, // Smoking_Nanny = true, // Comments = "hello" // }; // mom2.Wanted_Days[(int)Days.Sunday] = true; // mom2.Wanted_Hours[0, 0] = new DateTime(2000, 01, 01, 11, 00, 00); // mom2.Wanted_Hours[1, 0] = new DateTime(2000, 01, 01, 12, 30, 00); // Add_Mother(mom2); // Add_Child(new Child() // { // Id = 555555555, // First_Name = "bobi", // Mother_Id = 444444444, // Birth_Date = new DateTime(2017, 01, 01), // Allergy = "milk", // Without_Diapers = true // }); // Add_Child(new Child() // { // Id = 666666666, // First_Name = "shimshon", // Mother_Id = 333333333, // Birth_Date = new DateTime(2016, 01, 01), // Without_Diapers = true // }); // Add_Child(new Child() // { // Id = 777777777, // First_Name = "ori", // Mother_Id = 333333333, // Birth_Date = new DateTime(2017, 11, 01), // Without_Diapers = true // }); // Add_Contract(new Contract() // { // Nanny_Id = 111111111, // Child_Id = 666666666, // Meeting = true, // Contract_Was_Signed = true, // Is_Month_Salary = false, // Hour_Salary = Get_Nanny(111111111).Hour_Salary // }); //} #region child_func public void Add_Child(Child child1) { Mother mom = Get_Mother(child1.Mother_Id); if (mom == null)//didnt find his mom { throw new Exception("cant be child without mother"); } int age = (DateTime.Now.Subtract(child1.Birth_Date).Days);//we make minus between now and birth date and take all the days that she lives if (age < 0) { throw new Exception("wrong birth date"); } my_dal.Add_Child(child1); }