Example #1
0
        // Show dialog and insert row in to DB
        private void Button_ClickInsert(object sender, RoutedEventArgs e)
        {
            Window window = null;

            switch (tabControlRoot.SelectedIndex)
            {
            case 0:
                window = new WindowShooters(WindowOpenMode.Insert, dBManager, dataGridShooters, dataGridClubs);
                break;

            case 1:
                window = new WindowCompetitions(WindowOpenMode.Insert, dBManager, dataGridPCompetitions, dataGridRanges);
                break;

            case 2:
                window = new WindowRanges(WindowOpenMode.Insert, dBManager, dataGridRanges, dataGridPlaces);
                break;

            case 3:
                window = new WindowClubs(WindowOpenMode.Insert, dBManager, dataGridClubs, dataGridPlaces);
                break;

            case 4:
                window = new WindowPlaces(WindowOpenMode.Insert, dBManager, dataGridPlaces);
                break;
            }
            window.ShowDialog();
            window = null;
        }
Example #2
0
        // Show dialog and update row in DB
        private void buttonUpdate_Click(object sender, RoutedEventArgs e)
        {
            Window window = null;

            try
            {
                switch (tabControlRoot.SelectedIndex)
                {
                case 0:
                    window = new WindowShooters(WindowOpenMode.Update, dBManager, dataGridShooters, dataGridClubs);
                    break;

                case 1:
                    window = new WindowCompetitions(WindowOpenMode.Update, dBManager, dataGridPCompetitions, dataGridRanges);
                    break;

                case 2:
                    window = new WindowRanges(WindowOpenMode.Update, dBManager, dataGridRanges, dataGridPlaces);
                    break;

                case 3:
                    window = new WindowClubs(WindowOpenMode.Update, dBManager, dataGridClubs, dataGridPlaces);
                    break;

                case 4:
                    window = new WindowPlaces(WindowOpenMode.Update, dBManager, dataGridPlaces);
                    break;
                }
                window.ShowDialog();
                window = null;
            }
            catch (System.NullReferenceException)
            {
                // System.NullReferenceException ex
                // \n\n + ex.ToString() omitted
                System.Windows.MessageBox.Show("PICK A ROW THAT YOU WANT TO UPDATE!", "ERROR!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }