private void Add(object sender, RoutedEventArgs ev) { try { wndAddCompany newCompany = new wndAddCompany(); newCompany.admin = admin; newCompany.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Company", MessageBoxButton.OK, MessageBoxImage.Information); } }
private void Edit(object sender, RoutedEventArgs ev) { try { if (dgCompanies.SelectedItem != null) { wndAddCompany newCompany = new wndAddCompany(); company selectedCompany = (company)dgCompanies.SelectedItem; newCompany.Company = admin.GetCompany(selectedCompany.ID); newCompany.admin = admin; newCompany.isEdit = true; newCompany.ShowDialog(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Company", MessageBoxButton.OK, MessageBoxImage.Information); } }