private void buttonTestTournamentLoad_Click(object sender, EventArgs e) { FormTournament form = new FormTournament(); form.Owner = this; form.ShowDialog(); }
private void buttonLogin_Click(object sender, EventArgs e) { try { if (textBoxUsername.Text == "") { MessageBox.Show("Username can't be empty."); } else if (textBoxServer.Text == "") { MessageBox.Show("Server name can't be empty."); } else if (textBoxDatabase.Text == "") { MessageBox.Show("Database name can't be empty."); } else { // Connect to database Connection connection = new Connection(textBoxServer.Text, textBoxDatabase.Text, textBoxUsername.Text, textBoxPassword.Text); // Hide FormLogin this.Hide(); // Show FormTournament FormTournament formTournament = new FormTournament(); formTournament.ShowDialog(); } } // Login credentials invalid catch (Exception ex) { MessageBox.Show(ex.Message, "Fail to connect!"); } }
private void buttonDelete_Click(object sender, EventArgs e) { // Confirm delete message DialogResult konfirmasi = MessageBox.Show("Current tournament will be deleted , Are you sure?", "Konfirmasi", MessageBoxButtons.YesNo); // Confirm deletion if (konfirmasi == System.Windows.Forms.DialogResult.Yes) { bool sucess = Tournaments.DeleteTournament(selectedTournament, out string exceptionMessage); if (sucess) { MessageBox.Show("Tournament has been deleted.", "information"); FormTournament form = new FormTournament(); form.Owner = this; this.Hide(); form.ShowDialog(); } else { MessageBox.Show("Fail to delete tournament: " + exceptionMessage); } } }
private void buttonLogin_Click(object sender, EventArgs e) { try { if (textBoxUsername.Text == "") { MessageBox.Show("Username can't be empty."); } else if (textBoxServer.Text == "") { MessageBox.Show("Server name can't be empty."); } else if (textBoxDatabase.Text == "") { MessageBox.Show("Database name can't be empty."); } else { Connection connection = new Connection(textBoxServer.Text, textBoxDatabase.Text, textBoxUsername.Text, textBoxPassword.Text); this.Hide(); FormTournament formTournament = new FormTournament(); formTournament.ShowDialog(); //FormMenu formMenu = new FormMenu(); //formMenu.ShowDialog(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Fail to connect!"); } }
private void loadAnotherTournamentFromDatabaseToolStripMenuItem_Click(object sender, EventArgs e) { FormTournament form = new FormTournament(); form.Owner = this; this.Hide(); form.ShowDialog(); }
private void buttonCreateTournament_Click(object sender, EventArgs e) { try { int newCode = Tournaments.GenerateCode(); Tournaments t = new Tournaments(newCode, textBoxTournamentName.Text, decimal.Parse(textBoxEntryFee.Text)); Tournaments.AddTournament(t); FormTournament form = (FormTournament)this.Owner; form.selectedTournament = t; this.Hide(); form.buttonLoadTournament_Click(buttonCreateTournament, e); } catch (Exception ex) { MessageBox.Show("Tournament cannot be created: " + ex.Message, "Error"); } }
private void FormMenu_Load(object sender, EventArgs e) { // Get selectedTournament from FormTournament.cs formTournament = (FormTournament)this.Owner; selectedTournament = formTournament.selectedTournament; // Change selected tournament label with the proper one labelTournamentValue.Text = selectedTournament.Name; // Get info int totalTeam = Teams.CountTeams(selectedTournament); int totalPlayer = Players.CountPlayer(selectedTournament); listBoxInfo.Items.Add("Total participating teams: " + totalTeam); listBoxInfo.Items.Add("Total participating player: " + totalPlayer); // Get data from db teamList = Teams.Leaderboard(FormMenu.selectedTournament); // Show data to datagridteams ShowDataGridTeams(); }
private void buttonDelete_Click(object sender, EventArgs e) { DialogResult konfirmasi = MessageBox.Show("Current tournament will be deleted , Are you sure?", "Konfirmasi", MessageBoxButtons.YesNo); if (konfirmasi == System.Windows.Forms.DialogResult.Yes) { string add = Tournaments.DeleteTournament(selectedTournament); if (add == "1") { MessageBox.Show("Tournament has been deleted.", "information"); FormTournament form = new FormTournament(); form.Owner = this; this.Hide(); form.ShowDialog(); } else { MessageBox.Show("Fail to delete tournament. Message error: ", add); } } }
private void FormMenu_Load(object sender, EventArgs e) { formTournament = (FormTournament)this.Owner; selectedTournament = formTournament.selectedTournament; labelTournamentName.Text = selectedTournament.Name; }