private void BtnCreate_Click(object sender, RoutedEventArgs e) { AddReport dialog = new AddReport(sub, auth); dialog.ShowDialog(); try { dtgSubject.ItemsSource = db.GetReportsBySubject(sub.Id); } catch (Exception) { //try catch in case a new report was not created, and the query still returns 0; } }
public Reports(Person subject, Person author) { InitializeComponent(); sub = subject; auth = author; db = new DBHandler(); lblIntro.Content = "Reports about " + sub.Name; try { dtgSubject.ItemsSource = db.GetReportsBySubject(sub.Id); } catch (Exception) { //Empty catch, because the query returned no results } }