示例#1
0
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            //createNewButton tournament model
            if (ValidateTournamentModel())
            {
                TournamentModel tournament = new TournamentModel
                {
                    TournamentName = tournamentNameText.Text,
                    Prizes         = SelectedPrizeList,
                    EnteredTeams   = SelectedTeamList,
                    EntryFee       = decimal.Parse(entryFeeText.Text)
                };

                //TODO- try to clone the tournament list in CreateRoundOne method
                TournamentLogic.CreateRoundOne(tournament);
                TournamentModel model = GlobalConfig.Connection.CreateTrounament(tournament);

                if (model != null)
                {
                    MessageBox.Show("Record created in the database", "Success Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Record wasnt created in the database", "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show(outputString, "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }