示例#1
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);
            }
        }