Пример #1
0
        /// <summary>
        /// Initilize & addtion to list 4 Childs
        /// </summary>
        void ChildInitilize()
        {
            Child nadav = new Child("215790254", "213840176", "nadav", new DateTime(2017, 8, 26), false, "nothing");
            Child moty  = new Child("215718255", "211318175", "moty", new DateTime(2017, 9, 8), false, "nothing");
            Child eti   = new Child("211378252", "211318175", "eti", new DateTime(2017, 5, 29), false, "nothing");
            Child miri  = new Child("212378251", "213840176", "miri", new DateTime(2017, 1, 22), false, "nothing");

            bl.AddChild(nadav);
            bl.AddChild(moty);
            bl.AddChild(miri);
            bl.AddChild(eti);
        }
Пример #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                newChild.ChildID             = int.Parse(ID_TextBox.Text);
                newChild.ChildName           = Name_TextBox.Text;
                newChild.ChildMomID          = int.Parse(MotherId_TextBox.Text);
                newChild.ChildAge            = new DateTime(birth_DatePicker.SelectedDate.Value.Year, birth_DatePicker.SelectedDate.Value.Month, birth_DatePicker.SelectedDate.Value.Day);
                newChild.ChildIsSpecialNeeds = (bool)SpecialNeeds_CheckBox.IsChecked;
                if (newChild.ChildIsSpecialNeeds)
                {
                    newChild.ChildTypesOfSpecialNeeds = SpecialNeeds_TextBox.Text;
                }

                bl.AddChild(newChild);
                dataGridToRefresh.ItemsSource = bl.GetAllChilds();
                MessageBox.Show("addition successful");
                this.IsEnabled = false;
                newChild       = new Child();
            }
            catch (Exception c)
            {
                MessageBox.Show(c.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Пример #3
0
        static void Main(string[] args)
        {
            try
            {
                //               MyBl s = new MyBl();
                BL.IBL bl = BL.FactoryIBL.getIBL();           //FactoryIBL
                                                              //List<Mother> mam = bl.ReceiveMothers();
                                                              //List<Nanny> nan = bl.FitDistanceNannys(mam[0]);


                for (int i = 0; i < 10; i++)
                {
                    Child s = new Child {
                        ChildId = i, ChildFirstName = "first" + i, ChildLastName = "last" + i
                    };
                    bl.AddChild(s);
                }
                int a = 7;
                bl.RemoveChild(5);
                bl.UpdateChild(new Child {
                    ChildId = 2, ChildFirstName = "oshri", ChildLastName = "cohen"
                });
                bl.GetChildIEnumerable();
                IEnumerable <Child> aa   = bl.GetChildIEnumerable();
                List <Child>        list = bl.ReceiveChild();

                foreach (var item in list)
                {
                    Console.WriteLine("id:{0,-5} name:{1} {2}", item.ChildId, item.ChildFirstName, item.ChildLastName);
                }

                foreach (var item in aa)
                {
                    Console.WriteLine("id:{0,-5} name:{1} {2}", item.ChildId, item.ChildFirstName, item.ChildLastName);
                }


                Console.ReadKey();

                //Contract co = new Contract();
                //co.ChildId = 20000000;
                //co.NannyId = 40000000;

                ////               co.MotherId = 20000000;
                //try
                //{
                //   bl.AddContract(co);
                //}
                //catch (Exception)
                //{
                //    bl.AddContract(co);
                //}


                //                Child a = new Child();                     //tests
                //                a.ChildId = 12345678;
                //                a.MotherId = 23456789;
                ////               Console.WriteLine( a.ToString());
                //                bl.AddChild(a);
                ////              bl.AddChild(a);
                List <Child> q = bl.ReceiveChild();
                foreach (var item in q)
                {
                    Console.WriteLine(item.ToString());
                }
                //                a.ChildId = 888;
                //                a.MotherId = 888;
                //                bl.UpdateChild(a);
                ////                bl.RemoveChild(a.ChildId);
                //                List<Child> p = bl.ReceiveChild();
                //                foreach (var item in p)
                //                {
                //                    Console.WriteLine(item.ToString());
                //                }
                //List<Mother> l = bl.ReceiveMothers();
                //foreach (var item in l)
                //{
                //    Console.WriteLine(item.ToString());
                //}
                //                //List<Contract> m = bl.ReceiveContracts();
                //                //foreach (var item in m)
                //                //{
                //                //    Console.WriteLine(item.ToString());
                //                //}
                //                //List<Nanny> n = bl.ReceiveNannys();
                //                //foreach (var item in n)
                //                //{
                //                //    Console.WriteLine(item.ToString());
                //                //}
                //                bl.AddChild(a);
                //                a.ChildFirstName = "dadada";
                //                bl.UpdateChild(a);
                //                //List<Child> q = bl.ReceiveChild();


                //Console.WriteLine("child 1, Contract 2, Mother 3,Nanny 4");
                //int v = int.Parse(Console.ReadLine());
                //if (v == 1)
                //{

                //    Child a1 = new Child();
                //    Console.WriteLine("ChildId");
                //    a1.ChildId = int.Parse(Console.ReadLine());
                //    Console.WriteLine("MotherId");
                //    a1.MotherId = int.Parse(Console.ReadLine());
                //    Console.WriteLine("ChildFirstName");
                //    a1.ChildFirstName = Console.ReadLine();
                //    Console.WriteLine("ChildLastName");
                //    a1.ChildLastName = Console.ReadLine();
                //    Console.WriteLine("ChildDate");
                //    a1.ChildDate = DateTime.Parse(Console.ReadLine());
                //    bl.AddChild(a1);
                //}

                List <Child> m = bl.ReceiveChild();
                foreach (var item in q)
                {
                    Console.WriteLine(item.ToString());
                }
            }
            catch (Exception e)
            {
                string str = e.Message;
                Console.WriteLine(str);
            }
        }
Пример #4
0
 private void initFordebugs()
 {
     mybl.AddMother(new BE.Mother
     {
         ID            = "123",
         Lastname      = "choen",
         FirstName     = "Sarah",
         Tel           = "01233477",
         PersonAddress = new BE.Address {
             City = "Jerusalem", Country = "Israel", Number = 7, Street = "Beit Ha-Defus"
         },
         TelHome     = "67767678",
         GoalAddress = new BE.Address {
             City = "Jerusalem", Country = "Israel", Number = 12, Street = "Kiryat Moshe"
         },
         HoursNeed = 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) },
         },
         MotherAccount = new BE.BankAccount
         {
             AccountNumber = 222,
             BankAdress    = new BE.Address
             {
                 City    = "jer",
                 Country = "dd",
                 Number  = 3,
                 Street  = "gf",
             }
         }
     });
     mybl.AddMother(new BE.Mother
     {
         ID            = "456",
         Lastname      = "garbi",
         FirstName     = "inbal",
         Tel           = "09934235",
         PersonAddress = new BE.Address {
             City = "Jerusalem", Country = "Israel", Number = 10, Street = "Beit Ha-Defus"
         },
         TelHome     = "67767678",
         GoalAddress = new BE.Address {
             City = "Jerusalem", Country = "Israel", Number = 20, Street = "Kiryat Moshe"
         },
         HoursNeed = 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) },
         },
         MotherAccount = new BE.BankAccount
         {
             AccountNumber = 222,
             BankAdress    = new BE.Address
             {
                 City    = "jer",
                 Country = "dd",
                 Number  = 3,
                 Street  = "gf",
             }
         }
     });
     mybl.AddMother(new BE.Mother
     {
         ID            = "789",
         Lastname      = "kirsh",
         FirstName     = "orly",
         Tel           = "0794332",
         PersonAddress = new BE.Address {
             City = "Jerusalem", Country = "Israel", Number = 12, Street = "Beit Ha-Defus"
         },
         TelHome     = "02994853",
         GoalAddress = new BE.Address {
             City = "Jerusalem", Country = "Israel", Number = 22, Street = "Kiryat Moshe"
         },
         HoursNeed = 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) },
         },
         MotherAccount = new BE.BankAccount
         {
             AccountNumber = 222,
             BankAdress    = new BE.Address
             {
                 City    = "jer",
                 Country = "dd",
                 Number  = 3,
                 Street  = "gf",
             }
         }
     });
     mybl.AddMother(new BE.Mother
     {
         ID            = "1954",
         Lastname      = "shpiner",
         FirstName     = "chani",
         Tel           = "02842114",
         PersonAddress = new BE.Address {
             City = "Jerusalem", Country = "Israel", Number = 24, Street = "Kiryat Moshe"
         },
         TelHome     = "32400",
         GoalAddress = new BE.Address {
             City = "Jerusalem", Country = "Israel", Number = 18, Street = "Kiryat Moshe"
         },
         HoursNeed = 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) },
         },
         MotherAccount = new BE.BankAccount
         {
             AccountNumber = 222,
             BankAdress    = new BE.Address
             {
                 City    = "jer",
                 Country = "dd",
                 Number  = 3,
                 Street  = "gf",
             }
         }
     });
     mybl.AddNanny(new BE.Nanny
     {
         ID            = "208493965",
         Lastname      = "bar",
         FirstName     = "chaya",
         Tel           = "025800856",
         PersonAddress = new BE.Address {
             City = "Jerusalem", Country = "Israel", Number = 12, Street = "Beit Ha-Defus"
         },
         Birthday        = new DateTime(1988, 2, 2),
         Elevator        = true,
         Experience      = 5,
         MaxChildrens    = 2,
         MinChildrensAge = 3,
         MaxChildrensAge = 24,
         RateForHour     = 30,
         SalaryForMonth  = 5000,
         WorkHours       = 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) },
         },
         VacationDays      = true,
         MyRecommendations = "good",
         MyBankAccount     = new BE.BankAccount
         {
             AccountNumber = 222,
             BankAdress    = new BE.Address
             {
                 City    = "d",
                 Country = "dd",
                 Number  = 3,
                 Street  = "gf",
             }
         },
         Floor = 8,
         range = "3-24"
     });
     mybl.AddChild(new BE.Child
     {
         ID           = "6789",
         FirstName    = "chanan",
         Birthday     = new DateTime(2017, 8, 1),
         MyMotherID   = "123",
         Allergy      = true,
         MyAllergy    = "Peanuts",
         MyNutrition  = "Materna",
         SpecialNeeds = true,
         Needs        = "Hyperactive",
     });
     mybl.AddChild(new BE.Child
     {
         ID           = "770",
         FirstName    = "menachem",
         Birthday     = new DateTime(2016, 6, 1),
         MyMotherID   = "123",
         Allergy      = true,
         MyAllergy    = "Peanuts",
         MyNutrition  = "Materna",
         SpecialNeeds = true,
         Needs        = "Hyperactive",
     });
     mybl.AddContract(new BE.Contract
     {
         MotherID        = "123",
         NannyID         = "208493965",
         ChildID         = "6789",
         AnotherChild    = true,
         ContractSigned  = true,
         Interview       = true,
         StartEmployment = new DateTime(2018, 1, 1),
         EndEmployment   = new DateTime(2018, 3, 1),
         EmploymentHours = 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) },
         },
         Payment = false,
     });
     mybl.AddContract(new BE.Contract
     {
         MotherID        = "123",
         NannyID         = "208493965",
         ChildID         = "770",
         AnotherChild    = true,
         ContractSigned  = true,
         Interview       = true,
         StartEmployment = new DateTime(2018, 2, 1),
         EndEmployment   = new DateTime(2018, 8, 1),
         EmploymentHours = 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) },
         },
         Payment = true,
     });
 }