//update mother private void update_Click(object sender, RoutedEventArgs e) { try { if (errorMessages.Any()) //errorMessages.Count > 0 { string err = "Exception:"; foreach (var item in errorMessages) { err += "\n" + item; } MessageBox.Show(err); return; } else { updateData(); bl.reMother(mother); MessageBox.Show(mother.ToString(), "successfully update!", MessageBoxButton.OK, MessageBoxImage.Information); refreshData(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Button_Click(object sender, RoutedEventArgs e) { try { if (mother != null) { bl.deleteMother(mother); MessageBox.Show(mother.ToString()); refreshData(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void idCombobox_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { string id = IDComboBox.SelectedValue.ToString(); mother = this.bl.GetMotherByID(id); MessageBox.Show(mother.ToString()); } catch (FormatException) { MessageBox.Show("Incorrect input"); } catch (Exception ex) { MessageBox.Show(ex.Message, "", MessageBoxButton.OK, MessageBoxImage.Error); } }