Esempio n. 1
0
        /// <summary>
        /// build fun for class/window ,get parmeters to how to build the window
        /// </summary>
        /// <param name="mother">mother of child</param>
        /// <param name="num">num for choose the current option</param>
        /// <param name="id">id of nanny</param>
        public Results(Mother mother, int num, int id)
        {
            InitializeComponent();
            bl       = new BL.BL_imp();
            temp_mom = mother;

            try
            {
                if (num == 1)
                {
                    this.listNannies.DataContext = bl.properList(mother);
                }
                if (num == 0)
                {
                    this.listNannies.DataContext = bl.Nannies_around(mother);
                }
                if (num == 2)
                {
                    foreach (Contract item in bl.getNanny(id).MyContract)
                    {
                        new Contract_Menu(item).Show();
                    }
                }
            }
            catch (FormatException)
            {
                MessageBox.Show("בדוק את הקלט");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// button for see the contract, the tag identify the specific nanny
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void sign(object sender, RoutedEventArgs e)
 {
     try
     {
         Button b  = sender as Button;
         int    id = (int)b.Tag;
         new Contract_Menu(bl.getNanny(id), temp_mom).ShowDialog();
     }
     catch (Exception ex)
     { MessageBox.Show(ex.Message); }
 }
Esempio n. 3
0
        /// <summary>
        /// button for the many options we do regars to the string we get as parmeter
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button_Click(object sender, RoutedEventArgs e)
        {
            BE.Mother mother = new BE.Mother();
            int       _id;

            try
            {
                _id = int.Parse(this.textBox.Text);
                switch (mystr)
                {
                case "nanny":
                    bl.removeNanny(_id);
                    break;

                case "mother":
                    bl.removeMother(_id);
                    break;

                case "contract":
                    bl.removeContract(_id);
                    break;

                case "child":
                    bl.removeChild(_id);
                    break;

                case "updateChild":
                    new Add_child(bl.getChild(_id)).ShowDialog();
                    break;

                case "update_mother":
                    new Add_mother(bl.getMother(_id)).ShowDialog();
                    break;

                case "update_nanny":
                    new Nanny_Menu(bl.getNanny(_id)).ShowDialog();
                    break;

                case "search_nannies":
                    if (bl.NannyList().Count == 0)
                    {
                        throw new Exception("מצטערים אין כרגע מטפלות במערכת");
                    }
                    new Options(bl.getMother(_id)).ShowDialog();
                    break;

                case "check_con":
                    if (bl.getNanny(_id).MyContract.Count == 0)
                    {
                        throw new Exception("אין חוזים לחתימה בשלב זה");
                    }
                    new Results(null, 2, _id);
                    break;

                default:
                    break;
                }
                mystr = "";
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }