private void LoadTournamentButton_Click(object sender, EventArgs e)
        {
            TournamentModel  tournament = (TournamentModel)loadExistingTournamentDropDown.SelectedItem;
            TournamentViewer tvf        = new TournamentViewer(tournament);

            tvf.Show();
        }
예제 #2
0
        private void loadTournamentButton_Click(object sender, EventArgs e)
        {
            TournamentModel  tm  = (TournamentModel)loadExistingTournamentDropDown.SelectedItem;
            TournamentViewer frm = new TournamentViewer(tm);

            frm.Show();
        }
        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 entry fee", "Invalid fee",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Create tournament model
            TournamentModel myTournament = new TournamentModel();

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

            TournamentLogic.CreateRounds(myTournament);

            // Create Tournaments entry
            // Create all of the prizes entries relations
            // Create all of the team entries relations
            GlobalConfig.Connection.CreateTournament(myTournament);

            // Alret users by sending them mail and informing of new round start
            myTournament.AlertUsersToNewRound();

            TournamentViewer tvf = new TournamentViewer(myTournament);

            tvf.Show();
            this.Close();
        }
예제 #4
0
        private void CreateTournamentButton_Click(object sender, EventArgs e)
        {
            // validate data
            decimal fee           = 0;
            bool    feeAcceptable = decimal.TryParse(entryFeeValueTextbox.Text, out fee);

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

            // create a tournament model
            TournamentModel tm = new TournamentModel();

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

            // wire out matchups
            TournamentLogic.CreateRounds(tm);

            // create a tournament entry
            // create all of the prizes entries
            // create all of the team entries
            GlobalConfig.Connection.CreateTournament(tm);

            tm.AlertUsersToNewRound();

            TournamentViewer frm = new TournamentViewer(tm);

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