private void loadTournamentButton_Click(object sender, EventArgs e) { Tournament tm = loadTournamentDropdown.SelectedItem as Tournament; TournamentViewerForm frm = new TournamentViewerForm(tm); frm.Show(); }
private void LoadTournamentButton_Click(object sender, EventArgs e) { TournamentModel tm = (TournamentModel)loadTournamentDropDown.SelectedItem; TournamentViewerForm tvf = new TournamentViewerForm(tm); tvf.Show(); }
private void createTournamentButton_Click(object sender, EventArgs e) { var tournament = new TournamentModel(); if (!ValidateForm()) { return; } var fee = decimal.Parse(entryFeeValue.Text); tournament.TournamentName = tournamentNameValue.Text; tournament.EntryFee = fee; tournament.EnteredTeams = new List <TeamModel>(selectedTeams); tournament.Prizes = new List <PrizeModel>(prizesList); TournamentLogic.CreateRounds(tournament); GlobalConfig.Connection.CreateTournament(tournament); tournament.AlertUsersToNewRound(); var form = new TournamentViewerForm(tournament); form.Show(); this.Close(); }
private void createTournamentButton_Click(object sender, EventArgs e) { if (_selectedPrizes.Count == 0 || _selectedTeams.Count == 0) { return; } decimal fee = decimal.Parse(entryFeeTextBox.Text); TournamentModel tournament = new TournamentModel { TournamentName = tournamentNameTextBox.Text, EntryFee = fee, EnteredTeams = _selectedTeams, Prizes = _selectedPrizes }; TournamentLogic.CreateRounds(tournament); GlobalConfig.Connection.CreateTournament(tournament); TournamentViewerForm viewerForm = new TournamentViewerForm(tournament); viewerForm.Show(); this.Close(); }
private void createTournamentButton_Click(object sender, EventArgs e) { //ensure fee is valid decimal. decimal fee = 0; bool feeValid = decimal.TryParse(entryFeeValue.Text, out fee); if (!feeValid) { MessageBox.Show("Please enter a valid Entry Fee", "Invalid Fee", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Create a tournament model. TournamentModel tm = new TournamentModel(); tm.TournamentName = tournamentNameValue.Text; tm.Entryfee = fee; tm.Prizes = selectedPrizes; tm.EnteredTeams = selectedTeams; // Create the matchups. TournamentLogic.CreateRounds(tm); // Create the tournament entry. // Create the prize entries. // Create the team entries. (in this specific order so they work with the database) GlobalConfig.Connection.CreateTournament(tm); TournamentViewerForm frm = new TournamentViewerForm(tm); frm.Show(); this.Close(); }
private void BtnLoadTournament_Click(object sender, EventArgs e) { TournamentModel tm = (TournamentModel)ddLoadExistingTournament.SelectedItem; TournamentViewerForm frm = new TournamentViewerForm(tm); frm.Show(); }
private void CreateTournamentButton_Click(object sender, EventArgs e) { if (ValidateTournamentInfo()) { TournamentModel tm = new TournamentModel { TournamentName = tournamentNameValue.Text, EntryFee = decimal.Parse(entryFeeValue.Text), EnteredTeams = tournamentPlayersListBox.Items.Cast <TeamModel>().ToList(), Prizes = prizesListBox.Items.Cast <PrizeModel>().ToList() }; TournamentLogic.CreateRounds(tm); GlobalConfig.Connections.CreateTournament(tm); // add tm to the database TournamentLogic.AlertUsersToNewRound(tm); // alert users of first round matchups // Show the tournament that was just created TournamentViewerForm viewerForm = new TournamentViewerForm(tm); viewerForm.Show(); this.Close(); } else { MessageBox.Show("You have invalid tournament information. Please check and try again.", "Error: Invalid Tournament", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void createTournamentButton_Click(object sender, EventArgs e) { //Validate data decimal fee = 0; bool feeAcceptable = decimal.TryParse(entryFeeValue.Text, out fee); if (!feeAcceptable) { 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 = tournamentNameValue.Text; tm.EntryFee = fee; tm.Prizes = selectedPrizes; tm.EnteredTeams = selectedTeams; //Create our matchups TournamentLogic.CreateRounds(tm); //Create tournament entry //Create all of the prizes entries //Create all of the team entries GlobalConfig.Connection.CreateTournament(tm); TournamentViewerForm frm = new TournamentViewerForm(tm); frm.Show(); this.Close(); }
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 entry fee!", "Invalid fee", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } TournamentModel tm = new TournamentModel(); tm.TournamentName = tournamentNameValue.Text; tm.EntryFee = fee; tm.Prizes = selectedPrizes; tm.EnteredTeams = selectedTeams; TournamentLogic.CreateRounds(tm); GlobalConfig.Connection.CreateTournament(tm); tm.AlertUsersToNewRound(); TournamentViewerForm frm = new TournamentViewerForm(tm); frm.Show(); this.Close(); }
private void loadTournamentButton_Click(object sender, EventArgs e) { TournamentModel tm = (TournamentModel)loadExistingTournamentDropDown.SelectedItem; TournamentViewerForm frm = new TournamentViewerForm(tm); frm.Show(); }
private void loadTournamentButton_Click(object sender, EventArgs e) { //take selected list item and pass the model into the tournament viewer form. TournamentModel tm = (TournamentModel)loadExistingTournamentDropDown.SelectedItem; TournamentViewerForm frm = new TournamentViewerForm(tm); frm.Show(); }
private void btnLoadTournament_Click(object sender, EventArgs e) { TournamentModel tournamentModel = (TournamentModel)cboLoadExistingTournament.SelectedItem; TournamentViewerForm tournamentViewerForm = new TournamentViewerForm(tournamentModel); tournamentViewerForm.MdiParent = ActiveForm; tournamentViewerForm.Show(); }
private void btnCreateTournament_Click(object sender, System.EventArgs e) { // Validate Data bool feeValid = decimal.TryParse(textBoxEntryFee.Text, out decimal fee); if (!feeValid) { MessageBox.Show("Please enter a valid entry fee.", "Invalid Fee", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (textBoxTournamentName.Text.Length < 1) { MessageBox.Show("Please enter a valid tournament name.", "Invalid Name", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (selectedTeams.Count < 1) { MessageBox.Show("At least 1 team must be entered.", "Invalid Teams", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Create tournament model TournamentModel tm = new TournamentModel(); tm.TournamentName = textBoxTournamentName.Text; tm.EntryFee = fee; tm.Prizes = selectedPrizes; tm.EnteredTeams = selectedTeams; //Wireup / Create Matchups TournamentLogic.CreateRounds(tm); // Create Tournament Entry // Create all of the prizes entries // Create all of the team entries GlobalConfig.Connection.CreateTournament(tm); tm.AlertUsersToNewRound(); TournamentViewerForm frm = new TournamentViewerForm(tm); frm.Show(); this.Close(); }
private void LoadTournamentButton_Click(object sender, EventArgs e) { TournamentModel tm = (TournamentModel)LoadingExitTourDropDown.SelectedItem; if (tm != null) { TournamentViewerForm frm = new TournamentViewerForm(tm); frm.Show(); } }
private void createTournamentButton_Click(object sender, EventArgs e) { // Validate data string tournamentName = tournamentNameValue.Text; if (tournamentName == Tournament_Resource.TournamentNamePlaceholder) { MessageBox.Show(Tournament_Resource.InvalidNameDescription, Tournament_Resource.InvalidNameCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); tournamentNameValue.Focus(); return; } decimal fee = 0; bool feeAceptable = decimal.TryParse(entryFeeValue.Text, out fee); if (!feeAceptable) { MessageBox.Show(Tournament_Resource.InvalidFeeDescription, Tournament_Resource.InvalidFeeCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); entryFeeValue.Focus(); return; } // Create our tournament model TournamentModel tm = new TournamentModel(); tm.TournamentName = tournamentNameValue.Text; tm.EntryFee = fee; tm.Prizes = selectedPrizes; tm.EnteredTeams = selectedTeams; // Wire our matchups TournamentLogic.CreateRounds(tm); // Create Tournament entry // Create all of the prizes entries // Create all of team entries GlobalConfig.Connection.CreateTournament(tm); tm.AlertUsersToNewRound(); TournamentViewerForm frm = new TournamentViewerForm(tm); frm.Show(); this.Close(); }
/// <summary> /// Load the tournament viewer /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void loadTournamentButton_Click(object sender, EventArgs e) { TournamentModel tm = (TournamentModel)selectTournamentDropDown.SelectedItem; if (tm == null) { return; } TournamentViewerForm tvf = new TournamentViewerForm(tm); tvf.FormClosed += Tvf_FormClosed; tvf.Show(); }
private void loadTournamentButton_Click(object sender, EventArgs e) { if (loadExistingTournamentDropDown.SelectedItem != null) { TournamentModel tm = (TournamentModel)loadExistingTournamentDropDown.SelectedItem; TournamentViewerForm frm = new TournamentViewerForm(tm); frm.ShowDialog(); } else { MessageBox.Show(Tournament_Resource.InvalidInformation, Tournament_Resource.InvalidCaption); } }
private void CreateTournamentButton_Click(object sender, EventArgs e) { TournamentModel tm = new TournamentModel(); decimal fee = 0; bool FeeAccaptable = decimal.TryParse(EntryFeeTextBox.Text, out fee); tm.TournamentName = EnterTournamentNameTextBox.Text; tm.EntryFee = fee; tm.Prizes = SelectedPrizes; tm.EnterdTeams = selectedTeams; TournamentValidator validation = new TournamentValidator(); var result = validation.Validate(tm); string message = ""; if (!result.IsValid) { foreach (ValidationFailure res in result.Errors) { message += $"{res}\n"; } MessageBox.Show(message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!FeeAccaptable) { MessageBox .Show("entry fee is not a valid number ", "error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } TournamentLogic.CreateRounds(tm); GlobalConfig.Connaction.CreateTournament(tm); tm.AlertUsersToNewRound(); TournamentViewerForm frm = new TournamentViewerForm(tm); frm.Show(); this.Close(); }
private void loadTournamentButton_Click(object sender, EventArgs e) { try { TournamentModel tm = (TournamentModel)loadExistingTournamentDropDown.SelectedItem; TournamentViewerForm frm = new TournamentViewerForm(tm); frm.Show(); this.Hide(); } catch { MessageBox.Show("Nothing to load. Create a tournament first!"); } }
/// <summary> /// Retrieve selected Tournament and open TournamentViewer Form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void LoadTournamentButton_Click(object sender, EventArgs e) { TournamentModel selectedModel = (TournamentModel)selectTournamentDropDown.SelectedItem; if (selectedModel == null) { Helper.ShowMessage("There is no selected tournament", true); return; } TournamentViewerForm viewerForm = new TournamentViewerForm(selectedModel); viewerForm.Show(); }
private void loadTournamentButton_Click(object sender, EventArgs e) { Tournament tm = (Tournament)loadExistingTournamentDropDown.SelectedItem; if (tm != null) { TournamentViewerForm form = new TournamentViewerForm(tm); form.Show(); } else { MessageBox.Show("You have to select existing tournament"); } }
private void loadTournamentButton_Click(object sender, EventArgs e) { TournamentModel tm = (TournamentModel)loadExistingTournamentComboBox.SelectedItem; if (tm != null) { TournamentViewerForm frm = new TournamentViewerForm(tm); frm.ShowDialog(); } else { MessageBox.Show("Please select a tournament to load"); } }
private void createTournamentButton_Click(object sender, EventArgs e) { // Validate form data decimal fee = 0; bool feeAcceptable = decimal.TryParse(entryFeeValue.Text, out fee); if (!feeAcceptable) { // TODO: This is a template for the other message boxes MessageBox.Show("Entry fee is not a valid number", "Invalid fee", MessageBoxButtons.OK, MessageBoxIcon.Error); } // Create tournament model TournamentModel tm = new TournamentModel(); tm.TournamentName = tournamentNameValue.Text; tm.EntryFee = fee; /* The selectedPrizes is a list and the tm.prizes expects a list * a foreach could be used to put everything form one list * into the other or ... * foreach (PrizeModel prize in selectedPrizes) *{ * tm.Prizes.Add(prize); *} * ... just set the list equal to the each other */ tm.Prizes = selectedPrizes; tm.EnteredTeams = selectedTeams; // Wire up matchups TournamentLogic.CreateRounds(tm); // Create Tournament entry // Create all of the prize entries // Create all of the team entries GlobalConfig.Connection.CreateTournament(tm); // Email on the creation of the first round tm.AlertUsersToNewRound(); TournamentViewerForm frm = new TournamentViewerForm(tm); frm.Show(); this.Close(); }
private void loadTournamentButton_Click(object sender, EventArgs e) { TournamentModel tm = (TournamentModel)existingTournamentsDropdown.SelectedItem; if (tm == null) { return; } tm.OnTournamentComplete += Tm_OnTournamentComplete; TournamentViewerForm frm = new TournamentViewerForm(tm); frm.Show(); }
private void createTournamentButton_Click(object sender, EventArgs e) { using (var frm = new CreateTournamentForm(this)) { frm.ShowDialog(); } if (createdTournament != null) { using (var frm = new TournamentViewerForm(createdTournament)) { frm.ShowDialog(); } } }
private void createTournamentButton_Click(object sender, EventArgs e) { //Validate data if (string.IsNullOrWhiteSpace(tournamentNameTextBox.Text)) { MessageBox.Show("Please, enter the tournament name", "Invalid Tournament name.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); tournamentNameTextBox.Focus(); return; } decimal fee = 0; bool validFee = decimal.TryParse(entryFeeTextBox.Text, out fee); if (!validFee) { MessageBox.Show("You need to enter a valid 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; tm.Active = 1; TournamentLogic.CreateRounds(tm); //Create Tournament Entry //Create all of the Prizes Entries //Create all of the Team Entries GlobalConfig.Connection.CreateTournament(tm); tm.AlertUsersToNewRownd(); MessageBox.Show("Tournament Created."); TournamentViewerForm frm = new TournamentViewerForm(tm, _frm); frm.Show(); this.Close(); }
private void createTournamentButton_Click(object sender, EventArgs e) { decimal fee = 0; bool feeAcceptable = decimal.TryParse(entryFeeValue.Text, out fee); if (!feeAcceptable) { MessageBox.Show("Please enter a valid entry fee", "Invalid Fee", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } TournamentModel tm = new TournamentModel(); tm.TournamentName = tournamentNameValue.Text; tm.EntryFee = fee; tm.Prizes = selectedPrizes; tm.EnteredTeams = selectedTeams; // Wire up the matchups TournamentLogic.CreateRounds(tm); // 1. To create an initial Round, randomize all teams // 2. Check if we have enough teams to have an even, 2 teams each, bracket // 2, 4, 8, 16, 32. // If the we don't have (2, 4, 8, 16 or 32) teams, add in a byeweek or byeteam // 14 teams we'll need an additional 2 bye weeks // We have the correct number of teams if 2, to the N works // 3. Create a 1st round of matchups since it's already from a randomized list of even teams. We already have the information // 4. Create every round after the 1st round. We're dividing by 2 now. 8/2 = 4, 4/2 = 2 // Next we need to save the tournament model or data to a SQL database! GlobalConfig.Connection.CreateTournament(tm); tm.AlertUsersToNewRound(); TournamentViewerForm frm = new TournamentViewerForm(tm); frm.Show(); this.Close(); }
private void createTournamentButton_Click(object sender, EventArgs e) { //Provjera podataka decimal fee = 0; bool feeAcceptable = decimal.TryParse(entryFeeTextbox.Text, out fee); if (!feeAcceptable) { MessageBox.Show("Unesite validan iznos uloga!", "Netacan iznos uloga", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //Napravi CreateTournament Unos TournamentModel tm = new TournamentModel(); tm.TournamentName = tournamentNameTextbox.Text; tm.EntryFee = fee; tm.Prizes = selectedPrizes; tm.EnteredTeams = selectedTeams; // Spoji meceve sa bazom // Promjesaj listu sa timova // Provjerimo da li imamo dovoljan broj timova za kompletnu rundu. // 2*2*2*2 = 2^4 => 2^n gdje je n broj rundi datog turnira. // Kreiramo za pocetak prvu rundu jer ce da se razlikuje od svih ostalih jer u njoj imamo "prazne" timove. // Kreiramo sve ostale runde po sablonu TournamentLogic.CreateRounds(tm); //Napravi unos za sve nagrade //Napravi unos za sve timove //Napraviti parove ( Ko sa kim igra) GlobalConfig.Connection.CreateTournament(tm); tm.AlertUsersToNewRound(); TournamentViewerForm frm = new TournamentViewerForm(tm); frm.Show(); this.Close(); }
private void CreateTournamentButton_Click_1(object sender, EventArgs e) { //Validate data decimal fee = 0; bool feeAcceptable = decimal.TryParse(EntryFeeValue.Text, out fee); if (fee < 0) { feeAcceptable = false; } if (!feeAcceptable) { MessageBox.Show("You need to enter a valid Entry Fee.", "Invalid Fee", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Create our Tournament TournamentModel tm = new TournamentModel { TournamentName = TournamentNameValue.Text, EntryFee = fee, Prizes = selectedPrizes, EnteredTeams = selectedTeams }; //Wire up matchups TournamentLogic.CreateRounds(tm); //create tournament entry //create all of the prize entries //create all of the team entires GlobalConfig.Connection.CreateTournament(tm); //TournamentLogic.UpdateTournamentResults(tm); tm.AlertUsersToNewRound(); TournamentViewerForm frm = new TournamentViewerForm(tm); frm.Show(); this.Close(); }
private void createTournamentButton_Click(object sender, EventArgs e) { // Validate data decimal fee = 0; bool feeAcceptable = decimal.TryParse(entryFeeValue.Text, out fee); if (!feeAcceptable) { MessageBox.Show("You need to enter a valid Entry Fee.", "Invalid Fee", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } TournamentModel tm = new TournamentModel(); tm.TournamentName = tournamentNameValue.Text; tm.EntryFee = fee; tm.Prizes = selectedPrizes; tm.EnteredTeams = selectedTeams; // Create all of the matchups TournamentLogic.CreateRounds(tm); // Order the list randomly of teams // check if it is big enough - if not, add in byes // 2^4 teams // Create every round after that - 8 matchups - 4 matchups - 1 matchup // Create Tournament entry // Create all of the prizes entries // Create all of the team entries GlobalConfig.Connection.CreateTournament(tm); tm.AlertUsersToNewRound(); TournamentViewerForm frm = new TournamentViewerForm(tm); frm.Show(); this.Close(); }