Example #1
0
        private void TDLoadTournamentButton_Click(object sender, EventArgs e)
        {
            TournamentModel  tm   = (TournamentModel)TDTournamentNameComboBox.SelectedItem;
            TournamentViewer form = new TournamentViewer(tm);

            form.Show();
        }
Example #2
0
        private void TECreateTournamentButton_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                TournamentModel t = new TournamentModel();
                t.TournamentName = TENameTextBox.Text;
                t.TeamsEntered   = selectedTeams;

                string formattedStartDateTime = TEStartDatePicker.Value.Year.ToString() + "-" + TEStartDatePicker.Value.Month.ToString() + "-" + TEStartDatePicker.Value.Day.ToString() + " " + TEScheduleGamesStartPicker.Value.Hour.ToString() + ":" + TEScheduleGamesStartPicker.Value.Minute.ToString();
                string formattedEndDateTime   = TEEndDatePicker.Value.Year.ToString() + "-" + TEEndDatePicker.Value.Month.ToString() + "-" + TEEndDatePicker.Value.Day.ToString() + " " + TEScheduleGamesEndPicker.Value.Hour.ToString() + ":" + TEScheduleGamesEndPicker.Value.Minute.ToString();

                DateTime StartTime = Convert.ToDateTime(formattedStartDateTime);
                DateTime EndTime   = Convert.ToDateTime(formattedEndDateTime);

                MessageBox.Show(StartTime.ToString());

                t.TournamentDateStart = StartTime;
                t.TournamentDateEnd   = EndTime;

                //var tournamentSwitch = TEStageOneComboBox.SelectedIndex;

                //switch (tournamentSwitch)
                //{
                //    case 0:
                //        t.Format = tournamentSwitch;
                //        TournamentSingleElimination.CreateRounds(t);
                //        break;
                //    case 1:
                //        t.Format = tournamentSwitch;
                //        TournamentDoubleElimination.CreateRounds(t);
                //        break;
                //    case 2:
                //        t.Format = tournamentSwitch;
                //        TournamentRoundRobin.CreateRounds(t);
                //        break;
                //    case 3:
                //        t.Format = tournamentSwitch;
                //        TournamentSwiss.CreateRounds(t);
                //        break;
                //    default:
                //        MessageBox.Show("Please choose a format!");
                //        break;
                //};
                TournamentRoundRobin.CreateRounds(t);

                GlobalConfiguration.Connection.CreateTournament(t);

                t.AlertPlayersToNewRound();

                TournamentViewer form = new TournamentViewer(t);
                form.Show();
                Close();
            }
        }