Пример #1
0
        }//end of method

        /// <summary>
        /// asks the user to confirm the deletion and if yes is selected
        /// the database entry will be removed from the connected database
        /// then the Adminraces window will close
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (MessageBox.Show("do you wish to delete the selected race?", "Confirm Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                {
                    if (race != null)
                    {
                        RacesDatabase d = new RacesDatabase();
                        d.deleteRaces(race);
                        MessageBox.Show("Race Deleted");

                        txtRaceName.Clear();
                        txtRaceLocation.Clear();
                        txtRaceDistance.Clear();
                        txtRaceDate.Clear();
                        txtJuniorMaleTime.Clear();
                        txtJuniorFemaleTime.Clear();
                        txtSeniorMaleTime.Clear();
                        txtSeniorFemaleTime.Clear();
                    }
                }
            }
            catch
            {
                MessageBox.Show("Race Doesn't Exist");
            }
        }