// submit button click event private void submit_Click(object sender, RoutedEventArgs e) { try { // get the address nanny.Address = addressTextBox.Text; bl.AddNanny(nanny.Clone()); nanny = new Nanny(); NannyDeatails.DataContext = nanny; Close(); } catch (BLException ex) { MessageBox.Show(ex.Message, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error); } }
// delete nanny button click event private void Delete_Click(object sender, RoutedEventArgs e) { if (nanny != null) { try { bl.DeleteNanny(nanny.Clone()); Close(); } catch (BLException ex) { MessageBox.Show(ex.Message, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error); } } else { MessageBox.Show("ther is no such nanny", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error); } }