private void createTournamentButton_Click(object sender, EventArgs e)
        {
            //Validate data

            if (ValidateForm())
            {
                //Create our tournament model
                TournamentModel tm = new TournamentModel();
                tm.TournamentName = tournamentNameValue.Text;
                tm.EntryFee       = decimal.Parse(entryFeeValue.Text);

                tm.Prizes       = selectedPrizes;
                tm.EnteredTeams = selectedTeams;

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


                //Create tournament entry, using tournamentName, EntryFee,
                //Create all of the prizes entries
                //Create all of the team entries
                GlobalConfig.Connection.CreateTournament(tm);

                tm.AlertUsersToNewRound();

                TournamentLogic.UpdateTournamentResults(tm);

                TournamentViewer frm = new TournamentViewer(tm);
                frm.Show();
                callingForm.TournamentComplete(tm);
                Close();
            }
        }
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            //Create matchups
            if (ValidateForm())
            {
                TournamentModel tournament = new TournamentModel(
                    tournamentNameValue.Text,
                    entryFeeValue.Text,
                    selectedTeams,
                    selectedPrizes);

                //Wire up Matchups
                TournamentLogic.CreateRounds(tournament);



                GlobalConfig.Connection.CreateTournament(tournament);

                callingForm.TournamentComplete(tournament);

                this.Close();
            }
            else
            {
                MessageBox.Show("This form has invalid information. Please check and try again.",
                                "Invalid Information",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
Beispiel #3
0
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            //Validate entryFeePerTeamValue.Text
            decimal fee       = 0;
            bool    feeAccept = decimal.TryParse(entryFeePerTeamValue.Text, out fee);

            if (!feeAccept)
            {
                MessageBox.Show("Enter a valid Entry Fee", "Invalid data", MessageBoxButtons.OK, MessageBoxIcon.Error);//Control + Shift + Space to check all overloads
            }
            //Control and Click to open a full window of overloads
            Tournament tm = new Tournament();

            tm.TournamentName = tournamentNameValue.Text;
            tm.EntryFee       = 0;
            if (feeAccept)
            {
                tm.EntryFee = fee;
            }

            tm.EnteredTeams = selectedTeams;
            tm.Prizes       = selectedPrizes;
            tm.Active       = 1;

            foreach (Team team in tm.EnteredTeams)
            {
                if (tm.TournamentTeamsString != null)
                {
                    tm.TournamentTeamsString = tm.TournamentTeamsString + $"|{team.Id}";
                }
                else
                {
                    tm.TournamentTeamsString = tm.TournamentTeamsString + $"{team.Id}";
                }
            }

            foreach (Prize prize in tm.Prizes)
            {
                if (tm.TournamentPrizesString != null)
                {
                    tm.TournamentPrizesString = tm.TournamentPrizesString + $"|{prize.Id}";
                }
                else
                {
                    tm.TournamentPrizesString = tm.TournamentPrizesString + $"{prize.Id}";
                }
            }
            MatchupLogic.CreateRounds(tm);


            GlobalConfig.Connections.CreateTournament(tm);
            receiver.TournamentComplete(tm);
            MessageBox.Show("Tournament created", "Attention");
            //TournamentOperator op = new TournamentOperator(tm);
            //op.Show();
            this.Close();
        }
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            // Validate data
            decimal fee = 0;

            bool feeAcceptable = decimal.TryParse(entryFeeTextBox.Text, out fee);

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

            // Create our tournament model
            TournamentModel tm = new TournamentModel();

            tm.TournamentName = tournamentNameTextBox.Text;
            tm.EntryFee       = fee;

            tm.Prizes       = selectedPrizes;
            tm.EnteredTeams = selectedTeams;

            // Create our matchups
            // Order our list randomly
            // Check if it is big enough and if not, add in byes
            // Create or first round of matchups
            // Create every round after that - 8 matchups -> 4 matchups -> 2 matchups -> 1 matchup
            TournamentLogic.CreateRounds(tm);


            // Create Tournament Entry
            // Create all of the prizes entries
            // Create all of the team entries
            GlobalConfig.Connection.CreateTournament(tm);

            callingForm.TournamentComplete(tm);

            tm.AlertUsersToNewRound();

            Close();
        }
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            if (DataIsValid())
            {
                TournamentModel tm = new TournamentModel();

                tm.TournamentName = tournamentNameValue.Text;
                tm.EntryFee       = Decimal.Parse(entryFeeValue.Text);
                tm.Teams          = selectedTeams;
                tm.Prizes         = selectedPrizes;

                TournamentLogic.CreateRounds(tm);

                GlobalConfig.Connection.CreateTournament(tm);

                callerForm.TournamentComplete(tm);
                this.Close();
            }
        }
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            // Validate data

            bool feeAcceptable = decimal.TryParse(entryFeeValue.Text, out decimal fee);

            if (!feeAcceptable)
            {
                MessageBox.Show(
                    "Entry fee Invalid",
                    "Invalid fee",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                    );
                return;
            }

            // Create oturnament model
            TournamentModel tm = new TournamentModel();

            tm.TournamentName = tournamentNameValue.Text;
            tm.EntryFee       = fee;

            tm.Prizes       = selectedPrizes;
            tm.EnteredTeams = selectedTeams;

            // TODO - Wire our matchups
            TournamentLogic.CreateRounds(tm);

            // Create tournament ID
            // Create all of the prizes entries
            // Create all of the team entries

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

            callingForm.TournamentComplete();
            TournamentViewerForm frm = new TournamentViewerForm(tm, callingForm);

            frm.Show();
            this.Close();
        }
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            //create tournament entry
            TournamentModel tm = new TournamentModel();

            decimal fee        = 0;
            bool    feeIsValid = decimal.TryParse(entryFeeValueTextbox.Text, out fee);

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



            tm.TournamentName = tournamentNameVallueTextbox.Text;
            //tm.EntreeFee = decimal.Parse(entryFeeValueTextbox.Text);
            tm.EntreeFee = fee;

            tm.EnteredTeams = selectedTeams;
            tm.Prizes       = selectedPrizes;

            //TODO - Wire up matchups
            TournamentLogic.CreateRounds(tm);



            GlobalConfig.Connection.CreateTournament(tm);

            callingForm.TournamentComplete(tm);

            this.Close();

            //create all of the prizes entries
            //create all of the team entries
        }
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            // validate form
            bool feeValid = decimal.TryParse(entryFeeValue.Text, out decimal fee);

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

            if (string.IsNullOrEmpty(tournamentNameValue.Text))
            {
                MessageBox.Show("You need to enter a valid tournament name", "Invalid Name", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // create tournament model
            TournamentModel tm = new TournamentModel();
            tm.TournamentName = tournamentNameValue.Text;
            tm.EntryFee = decimal.Parse(entryFeeValue.Text);

            tm.Prizes = selectedPrizes;
            tm.EnteredTeams = selectedTeams;

            TournamentLogic.CreateRounds(tm);

            GlobalConfig.Connection.CreateTournament(tm);

            tm.AlertUsersToNewRound();

            callingForm.TournamentComplete(tm);

            TournamentViewerForm frm = new TournamentViewerForm(tm);
            frm.Show();
            this.Close();
        }
Beispiel #9
0
 private void Tournament_OnTournamentComplete(object sender, DateTime e)
 {
     callingForm.TournamentComplete();
     this.Close();
 }