예제 #1
0
        /// <summary>
        /// updates the information in the connected database by
        /// using the update method from the database class then
        /// window closes once game has been successfully updated
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (game != null)
                {
                    game.Name              = txtName.Text;
                    game.Platform          = txtPlatform.Text;
                    game.Genre             = txtGenre.Text;
                    game.Price             = Convert.ToDecimal(txtPrice.Text);
                    game.AgeClassification = Convert.ToInt32(txtPegi.Text);
                    game.Description       = txtDesc.Text;
                    game.Rating            = Convert.ToInt32(txtRating.Text);
                    game.Quantity          = Convert.ToInt32(txtQuantity.Text);
                    game.ProductCode       = txtCode.Text;

                    GameDatabase d = new GameDatabase();
                    d.updateGame(game);
                    MessageBox.Show("Game Successfully Updated!");
                }
                Close();
                chooseEdit choose = new chooseEdit();
                choose.Show();
            }
            catch
            {
                MessageBox.Show("Something went wrong, Please make sure all boxes are filled in and then try again");
            }
        }//end of method
예제 #2
0
        }//end of method

        /// <summary>
        /// prompts the user to confirm deletion and if yes clicked
        /// the entry will be deleted from the connected database and
        /// the editGame 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 game?", "Confirm Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                {
                    if (game != null)
                    {
                        GameDatabase d = new GameDatabase();
                        d.deleteGame(game);
                        MessageBox.Show("Game Deleted");
                    }
                    Close();
                    chooseEdit choose = new chooseEdit();
                    choose.Show();
                }
            }
            catch
            {
                MessageBox.Show("Item Doesn't Exist");
            }
        }//end of method
예제 #3
0
        private void btnEditGame_Click(object sender, RoutedEventArgs e)
        {
            chooseEdit edit = new chooseEdit();

            edit.Show();
        }
예제 #4
0
        private void btnEditWindow_Click(object sender, RoutedEventArgs e)
        {
            chooseEdit choose = new chooseEdit();

            choose.Show();
        }