/// <summary>
        /// Actually creates the tournament.
        /// </summary>
        /// <param name="sender">The object that initiated the event.</param>
        /// <param name="e">The arguments of the event.</param>
        private void CreateTournamentBtn_Click(object sender, EventArgs e)
        {
            // Validate data.
            decimal fee         = 0;
            bool    feeAccepted = decimal.TryParse(this.EntryFreeValue.Text, out fee);

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

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

            model.TournamentName = this.TournamentNameValue.Text;
            model.EntryFee       = fee;

            model.Prizes       = this.SelectedPrizes;
            model.EnteredTeams = this.SelectedTeams;

            // Wire up matchups.
            TournamentLogic.CreateRounds(model);

            // Create tournament entries.
            GlobalConfig.Connection.CreateTournament(model);

            TournamentViewForm fvfrm = new TournamentViewForm(model);

            fvfrm.Show();
            this.Close();
        }
示例#2
0
        private void loadTournamentButton_Click(object sender, EventArgs e)
        {
            TournamentModel    tm  = (TournamentModel)loadExistingTournamentDropdown.SelectedItem;
            TournamentViewForm frm = new TournamentViewForm(tm);

            frm.Show();
        }
示例#3
0
        /// <summary>
        /// Loads the selected tournament.
        /// </summary>
        /// <param name="sender">The object that initiated the event.</param>
        /// <param name="e">The arguments of the event.</param>
        private void LoadTournamentButton_Click(object sender, EventArgs e)
        {
            TournamentModel    tm  = this.LoadExisitingTournamentDropDown.SelectedItem as TournamentModel;
            TournamentViewForm frm = new TournamentViewForm(tm);

            frm.Show();
        }