public ChildDetailes(Child c)
        {
            InitializeComponent();
            Detailes.DataContext = c;
            if (c.special)
            {
                Needs.Visibility = Visibility.Visible;
            }
            else
            {
                Needs.Visibility = Visibility.Hidden;
            }
            Needs.Text += c.specialNeeds;
            List <Contract> t   = BL_imp.GetInstance().getContract();
            Contract        con = t.Find(x => x.idChild == c.ID);
            Nanny           n   = BL_imp.GetInstance().getNanny().Find(x => x.ID == con.idNanny);

            if (n != null)
            {
                his_Nanny.Name    = String.Format("ID" + con.idNanny);
                his_Nanny.Content = n.name.ToString();
            }
            for (int i = 0; i < c.stars; i++)
            {
                Rating.Children.Add(new Star(1, c.ID));
            }
            for (int i = c.stars; i < 5; i++)
            {
                Rating.Children.Add(new Star(0, c.ID));
            }
            childStars   = c.stars;
            BeforeUpdate = n.Stars - c.stars;
        }
        protected override void OnClosed(EventArgs e)
        {
            Child           c   = BL_imp.GetInstance().getChild().Find(x => x.ID == (Detailes.DataContext as Child).ID);
            List <Contract> t   = BL_imp.GetInstance().getContract();
            Contract        con = t.Find(x => x.idChild == c.ID);
            Mother          m   = BL_imp.GetInstance().getMother().Find(x => x.ID == c.idMother);
            Nanny           n   = BL_imp.GetInstance().getNanny().Find(x => x.ID == con.idNanny);

            n.Stars = BeforeUpdate + c.stars;
            if (c.stars > 0 && childStars == 0)
            {
                n.peopleThatRating++;
            }
            if (c.stars == 0 && childStars != 0)
            {
                n.peopleThatRating--;
            }
            BL_imp.GetInstance().updateNanny(n);
            BL_imp.GetInstance().updateChild(c);
            Window w = Application.Current.Windows.OfType <MotherOptions>().First();

            Application.Current.Windows.OfType <DetailesWindow>().First().Close();
            Application.Current.Windows.OfType <MotherOptions>().First().Close();
            Window MotherOptions = new MotherOptions(m.ID);

            MotherOptions.Show();
            Window DetailesWindow = new DetailesWindow(m);

            DetailesWindow.Show();
        }
Example #3
0
        public DetailesWindow(Mother m)
        {
            InitializeComponent();
            mam                = m;
            myName.Content    += String.Format(m.name.FirstName + " " + m.name.LastName);
            myAddress.Content += m.address;
            SelfDetailes.Text += m.print();
            for (int i = 0; i < 6; i++)
            {
                Days.Items.Add(new
                {
                    day   = mam.wh.days[i],
                    work  = mam.wh.DayThatIWork[i],
                    begin = mam.wh.WorkHours[i].begin,
                    end   = mam.wh.WorkHours[i].end
                });
            }
            List <Child> childs = BL_imp.GetInstance().getChild().FindAll(x => x.idMother == m.ID);

            foreach (Child c in childs)
            {
                ComboBoxItem item = new ComboBoxItem();
                item.Content = c.FirstName;
                myChild.Items.Add(item);
                item.Selected += Item_Selected;
            }
            myChild.SelectedItem = "Defaulte";
        }
        private void his_Nanny_Click(object sender, RoutedEventArgs e)
        {
            Button   b   = (sender as Button);
            Contract con = BL_imp.GetInstance().getContract().Find(x => x.idNanny == int.Parse(b.Name.Substring(2)));
            Window   ContractDetailes = new ContractDetailes(con);

            ContractDetailes.Show();
        }
        private void More_Click(object sender, RoutedEventArgs e)
        {
            Button       b       = (sender as Button);
            Grid         g       = (b.Parent as Grid);
            List <Label> t       = g.Children.OfType <Label>().ToList();
            int          id      = int.Parse(t.Find(x => x.Name.ToString() == "ID").Content.ToString());
            Nanny        forMore = BL_imp.GetInstance().getNanny().Find(x => x.ID == id);
            Window       more    = new MoreNannyDetailes(forMore);

            more.Show();
        }
        private void Finish_Click(object sender, RoutedEventArgs e)
        {
            Child    c   = (Detailes.DataContext as Child);
            Contract con = BL_imp.GetInstance().getContract().Find(x => x.idChild == c.ID);
            Nanny    n   = BL_imp.GetInstance().getNanny().Find(x => x.ID == con.idNanny);
            Mother   m   = BL_imp.GetInstance().getMother().Find(x => x.ID == c.idMother);

            n.Recommendations += String.Format(m.name.ToString() + ": " + Recommend.Text);
            n.numberRecommendations++;
            BL_imp.GetInstance().updateNanny(n);
            ToAdd.Visibility     = Visibility.Collapsed;
            Title.Visibility     = Visibility.Collapsed;
            Recommend.Visibility = Visibility.Collapsed;
            Finish.Visibility    = Visibility.Collapsed;
        }
Example #7
0
 private void myStar_Click(object sender, RoutedEventArgs e)
 {
     Child c = new Child();
     if(idChild != 0)
         c = BL_imp.GetInstance().getChild().Find(x=>x.ID == idChild);
     if (myStar.Background==Brushes.Yellow)
     {
         myStar.Background = Brushes.White;
         c.stars--;
         BL_imp.GetInstance().updateChild(c);
     }
     else
     {
         myStar.Background = Brushes.Yellow;
         c.stars++;
         BL_imp.GetInstance().updateChild(c);
     }
 }
Example #8
0
        private void Item_Selected(object sender, RoutedEventArgs e)
        {
            ComboBoxItem cbI = new ComboBoxItem();

            cbI = (sender as ComboBoxItem);
            Child    c   = BL_imp.GetInstance().getChild().Find(x => x.FirstName == cbI.Content.ToString());
            Contract con = BL_imp.GetInstance().getContract().Find(x => x.idChild == c.ID);

            if (con != null)
            {
                ChildDetailes myChild = new ChildDetailes(c);
                myChild.Show();
            }
            else
            {
                MessageBox.Show("your Child have no Nannny");
            }
        }
        public MotherOptions(int id)
        {
            InitializeComponent();
            instance    = BL_imp.GetInstance();//singelton
            r           = new Random();
            tofunctions = instance.getMother().Find(x => x.ID == id);
            idM         = tofunctions.ID;
            Selected    = instance.getNanny();

            Element_of_Nanny_Detailes = new NannyDetailes();
            foreach (Nanny item in Selected)
            {
                Grid_Detailes.Children.Add(Element_of_Nanny_Detailes.AddNannyDetailesGrid(item));
            }

            Number_of_nannies.Text += String.Format("We Find " + Selected.Count + " Nannies suit for you");
            lastClicked             = new Button();

            detailes.Content = String.Format(tofunctions.name.FirstName + " " + tofunctions.name.LastName);
        }
Example #10
0
 public MainWindow()
 {
     InitializeComponent();
     IBL instance = BL_imp.GetInstance();//singelton
     //DefaultInitilize d = new DefaultInitilize();//its operate one time
 }