private void remove_Click(object sender, RoutedEventArgs e) { try { MessageBoxResult result = MessageBox.Show("Are you sure that you want delete your card?", "Remove nanny", MessageBoxButton.YesNo); switch (result) { case MessageBoxResult.Yes: bl.removeNanny(nanny); MessageBox.Show("removed succeeded", "Remove nanny"); this.Close(); break; case MessageBoxResult.No: break; } } catch (Exception r) { MessageBox.Show(r.Message); } }
/// <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); } }