Exemplo n.º 1
0
        /// <summary>
        /// Creator: Ben Hanna
        /// Created: 3/7/2020
        /// Approver: Carl Davis, 3/13/2020
        /// Approver:
        ///
        /// Toggles the animal's Housed state.
        /// detail view
        /// </summary>
        /// <remarks>
        /// Updater:
        /// Updated:
        /// Update:
        /// </remarks>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ChkEditCurrentlyHoused_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string caption = (bool)chkEditCurrentlyHoused.IsChecked ? "Set Housed" :
                                 "Set Non-Housed";
                if (MessageBox.Show("Are you sure?", caption,
                                    MessageBoxButton.YesNo, MessageBoxImage.Warning)
                    == MessageBoxResult.No)
                {
                    chkEditCurrentlyHoused.IsChecked = !(bool)chkEditCurrentlyHoused.IsChecked;
                    return;
                }

                if (_animalManager.SetAnimalHousedState((bool)chkEditCurrentlyHoused.IsChecked, (int)lblEditAnimalID.Content))
                {
                    MessageBox.Show("Record Edited Successfully.", "Result");
                }

                if ((bool)chkEditActive.IsChecked)
                {
                    refreshActiveData();
                }
                else
                {
                    refreshInactiveData();
                }
            }
            catch (Exception ex)
            {
                LogicLayerErrorHandler.ActivateDeactivateErrorMessage(ex.Message + "\n\n" + ex.InnerException);
            }
        }