private void Button_Click_4(object sender, RoutedEventArgs e) { Button cmd = (Button)sender; Data_Model.PA_INDIVIDUALS editme = (Data_Model.PA_INDIVIDUALS)cmd.DataContext; Decimal SelectedIndividual = editme.OFFICEUSE; Portable_Traps_Individuals_Window IndividualsWindow = new Portable_Traps_Individuals_Window(SelectedID, SelectedIndividual); IndividualsWindow.DataChanged += IndividualsWindow_DataChanged; IndividualsWindow.Show(); }
private void Button_Click_3(object sender, RoutedEventArgs e) { Button cmd = (Button)sender; if (cmd.DataContext is Data_Model.PA_INDIVIDUALS) { Data_Model.PA_INDIVIDUALS deleteme = (Data_Model.PA_INDIVIDUALS)cmd.DataContext; String SelectedSpecies = deleteme.SPECIES.ToString(); MessageBoxResult result = MessageBox.Show("Are you sure you want to delete Species " + SelectedSpecies + "?", "Portable Traps", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { PA_INDIVIDUALS_CONTEXT.PA_INDIVIDUALS.Remove(deleteme); PA_INDIVIDUALS_CONTEXT.SaveChanges(); pA_INDIVIDUALSListView.Items.Refresh(); } } }