Exemplo n.º 1
0
        /// <summary>
        /// Creator: Chuck Baxter
        /// Created: 3/18/2020
        /// Approver: Carl Davis, 3/18/2020
        /// Approver:
        ///
        /// The method when the submit delete species button is clicked, calls the animal manager
        /// to delete it from the database
        /// <remarks>
        /// Updater:
        /// Updated:
        /// Update:
        /// </remarks>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnSubmitAnimalDeleteSpecies_Click(object sender, RoutedEventArgs e)
        {
            if (String.IsNullOrEmpty(cmbDeleteSpecies.Text))
            {
                MessageBox.Show("Please enter the animal species that you wish to delete");
                return;
            }

            try
            {
                if (_animalManager.DeleteAnimalSpecies(cmbDeleteSpecies.Text))
                {
                    WPFErrorHandler.SuccessMessage("Animal Species Successfully Deleted");

                    canEditAnimalSpecies.Visibility = Visibility.Hidden;
                }
            }
            catch (Exception ex)
            {
                WPFErrorHandler.ErrorMessage(ex.Message + "\n\n" + "no animals can be this species before deletion" + "\n\n" + ex.InnerException.Message);
                canEditAnimalSpecies.Visibility = Visibility.Hidden;
            }
        }