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

            try
            {
                if (_animalManager.AddNewAnimalSpecies(txtNewAnimalSpecies.Text, txtNewAnimalSpeciesDescription.Text))
                {
                    WPFErrorHandler.SuccessMessage("Animal Species Successfully Added");

                    canEditAnimalSpecies.Visibility = Visibility.Hidden;
                }
            }
            catch (Exception ex)
            {
                WPFErrorHandler.ErrorMessage(ex.Message + "\n\n" + ex.InnerException.Message);
                canEditAnimalSpecies.Visibility = Visibility.Hidden;
            }
        }