private void BtnSections_Click(object sender, RoutedEventArgs e) { try { var g = (Button)sender; //var itm = (SmokeTestDBClassLibrary.Report)g.SelectedItem; var id = (int)g.Tag; var itm = TheReports.Single(a => a.Id == id); var report = new NewReport(ste, itm, CurrentRelease); report.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void BtnAdd_Click(object sender, RoutedEventArgs e) { string currentUser = System.Security.Principal.WindowsIdentity.GetCurrent().Name; var newReport = new Report { AddedBy = currentUser, DateAdded = DateTime.Now, DateModified = DateTime.Now, ModifiedBy = currentUser }; var newSectionEval = new Report_Evaluation { Evaluator_ID = 1, Status_ID = 1, Release_ID = CurrentRelease.Id, Report_ID = newReport.Id, AddedBy = currentUser, DateAdded = DateTime.Now, DateModified = DateTime.Now, ModifiedBy = currentUser }; ste.Report_Evaluations.Add(newSectionEval); var newRpt = new NewReport(ste, newReport, CurrentRelease); newRpt.Show(); }