Example #1
0
        private void ButtonRemoveJournalEntry_OnClick(object sender, RoutedEventArgs e)
        {
            if (ListBoxJournalEntries.SelectedItem != null)
            {
                DataAccessZoo dataAccess = new DataAccessZoo();

                var journalEntry = (JournalEntry)ListBoxJournalEntries.SelectedItem;

                try
                {
                    dataAccess.RemoveJournalEntry(journalEntry);
                    PopulateOrUpdateJournalEntryList(dataAccess, journalEntry.AnimalId);
                }
                catch (DbObjectNotFoundException exception)
                {
                    MessageBox.Show(exception.Message);
                }
            }
            else
            {
                MessageBox.Show("Ingen journalanteckning är vald");
            }
        }