Ejemplo n.º 1
0
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            decimal fee           = 0;
            bool    feeAcceptable = decimal.TryParse(entryFeeValue.Text, out fee);

            if (!feeAcceptable)
            {
                MessageBox.Show("You need to enter valid entry fee",
                                "Invalid entry fee value",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return;
            }

            Tournament tm = new Tournament();

            tm.TournamentName = tournamentNameValue.Text;
            tm.EntryFee       = fee;
            tm.Prizes         = selectedPrizes;
            tm.EnteredTeams   = selectedTeams;

            TournamentLogic.CreateRounds(tm);

            GlobalConfig.Connection.CreateTournament(tm);
            tm.AlertUsersToNewRound();

            TournamentViewerForm form = new TournamentViewerForm(tm);

            form.Show();
            this.Close();
        }
Ejemplo n.º 2
0
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            // Validate data
            bool feeAcceptable = decimal.TryParse(entryFeeValue.Text, out decimal fee);

            if (!feeAcceptable)
            {
                MessageBox.Show("You need to enter a valid fee",
                                "Invalid Fee",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);

                return;
            }

            // Create our Tounrnament mode
            Tournament tm = new Tournament
            {
                TournamentName = tournamentNameValue.Text,
                EntryFee       = fee,
                Prizes         = selectedPrizes,
                EnteredTeams   = selectedTeams
            };


            // wire up Matchups
            TournamentLogic.CreateRounds(tm);

            // Create Tournament Entry
            // Create all of the PrizesEntrys
            // Create all of the TeamEntrys
            GlobalConfig.Connection.CreateTournament(tm);
            tm.AlertUsersToNewRound();

            TournamentViewerForm frm = new TournamentViewerForm(tm);

            frm.Show();
            this.Close();
        }