Esempio n. 1
0
        /// <summary>
        /// This method launches when user clicks the create prize button.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void createPrizeButton_Click(object sender, EventArgs e)
        {
            //Check if user has given valid prize data.
            if (isFormValid())
            {
                //Create the prize and pass in the info
                Prize prize = new Prize(
                    placeNumberValue.Text,
                    placeNameValue.Text,
                    amountValue.Text,
                    percentageValue.Text);

                //Upload the prize info to the database
                DataConfig.connection.CreatePrize(prize);
                MessageBox.Show("Prize Created SuccessFully!!");

                //Alert the requestor that prize has been created (In this app prize is saved in the relevant tournament which requested the prize)
                prizeRequester.prizeCreated(prize);
                this.Close();
            }

            //If prize fields are not valid, then show an error box.
            else
            {
                MessageBox.Show("The Form has Invalid Information. Please Check All The Fields", "Prize Form", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }