private void removeMatchListBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     TextBox[]       idBoxesAway       = { PlayerID1Away, PlayerID2Away, PlayerID3Away, PlayerID4Away, PlayerID5Away, PlayerID6Away, PlayerID7Away, PlayerID8Away, PlayerID9Away, PlayerID10Away, PlayerID11Away };
     TextBox[]       noBoxesAway       = { PlayerNo1Away, PlayerNo2Away, PlayerNo3Away, PlayerNo4Away, PlayerNo5Away, PlayerNo6Away, PlayerNo7Away, PlayerNo8Away, PlayerNo9Away, PlayerNo10Away, PlayerNo11Away };
     ComboBox[]      positionBoxesAway = { PlayerPosition1Away, PlayerPosition2Away, PlayerPosition3Away, PlayerPosition4Away, PlayerPosition5Away, PlayerPosition6Away, PlayerPosition7Away, PlayerPosition8Away, PlayerPosition9Away, PlayerPosition10Away, PlayerPosition11Away };
     MaskedTextBox[] goalBoxesAway     = { Goals1Away, Goals2Away, Goals3Away, Goals4Away, Goals5Away, Goals6Away, Goals7Away, Goals8Away, Goals9Away, Goals10Away, Goals11Away };
     TextBox[]       idBoxesHome       = { PlayerID1Home, PlayerID2Home, PlayerID3Home, PlayerID4Home, PlayerID5Home, PlayerID6Home, PlayerID7Home, PlayerID8Home, PlayerID9Home, PlayerID10Home, PlayerID11Home };
     TextBox[]       noBoxesHome       = { PlayerNo1Home, PlayerNo2Home, PlayerNo3Home, PlayerNo4Home, PlayerNo5Home, PlayerNo6Home, PlayerNo7Home, PlayerNo8Home, PlayerNo9Home, PlayerNo10Home, PlayerNo11Home };
     ComboBox[]      positionBoxesHome = { PlayerPosition1Home, PlayerPosition2Home, PlayerPosition3Home, PlayerPosition4Home, PlayerPosition5Home, PlayerPosition6Home, PlayerPosition7Home, PlayerPosition8Home, PlayerPosition9Home, PlayerPosition10Home, PlayerPosition11Home };
     MaskedTextBox[] goalBoxesHome     = { Goals1Home, Goals2Home, Goals3Home, Goals4Home, Goals5Home, Goals6Home, Goals7Home, Goals8Home, Goals9Home, Goals10Home, Goals11Home };
     try
     {
         if (!connectionWithDatabase.isConnected())
         {
             connectionWithDatabase.OpenConnection();
         }
         object[] tab = new object[2];
         tab = connectionWithDatabase.returnIdOfTeams(removeMatchListBox);
         connectionWithDatabase.loadMatch(matchDateBox, matchTimeBox, competitionID, removeMatchListBox);
         connectionWithDatabase.loadPlayersToBoxes(tab[0], idBoxesHome, noBoxesHome, positionBoxesHome, goalBoxesHome, removeMatchListBox);
         connectionWithDatabase.loadPlayersToBoxes(tab[1], idBoxesAway, noBoxesAway, positionBoxesAway, goalBoxesAway, removeMatchListBox);
         totalHome.Text = sumOfGoals(goalBoxesHome).ToString();
         totalAway.Text = sumOfGoals(goalBoxesAway).ToString();
     }
     catch (Exception es)
     {
         MessageBox.Show("Error 404 in adding Team. Check DataBaseConnection \r\n" + es.Message + "\r\n" + es.InnerException.Message);
     }
     finally
     {
         connectionWithDatabase.CloseConnection();
     }
 }
Example #2
0
 private void homeTeamComboBox_Click(object sender, EventArgs e)
 {
     try
     {
         if (!connectionWithDatabase.isConnected())
         {
             connectionWithDatabase.OpenConnection();
         }
         connectionWithDatabase.loadTeams(homeTeamComboBox);
     }
     catch (Exception es)
     {
         MessageBox.Show("Error 404 in adding Team. Check DataBaseConnection \r\n" + es.Message + "\r\n" + es.InnerException.Message);
     }
     finally
     {
         connectionWithDatabase.CloseConnection();
     }
 }
Example #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (!connectionWithDatabase.isConnected())
         {
             connectionWithDatabase.OpenConnection();
         }
         if (searchForMatchByTeams.Checked)
         {
             connectionWithDatabase.searchForMatchByTeamNames(dataGridView1, textBox1, textBox2);
         }
         else if (SearchForMatchByDate.Checked)
         {
             connectionWithDatabase.searchForMatchByDate(dataGridView1, matchDateBox);
         }
         else if (searchForMatchByCompetition.Checked)
         {
             connectionWithDatabase.searchForMatchByCompetition(dataGridView1, competitionID);
         }
         else if (searchForBestScorers.Checked)
         {
             connectionWithDatabase.searchForBestScorers(dataGridView1, comboBox3, comboBox4);
         }
         else if (SearchForTeamsMostGoals.Checked)
         {
             connectionWithDatabase.searchForTeamsMostGoals(dataGridView1, comboBox2);
         }
         else if (SearchForTeamsWithMostWins.Checked)
         {
             connectionWithDatabase.searchForTeamsMostWins(dataGridView1, comboBox6);
         }
         else if (SearchForTeamsWithMostDraws.Checked)
         {
             connectionWithDatabase.searchForTeamsMostDraws(dataGridView1, comboBox1);
         }
         else if (SearchForTeamsWithMostLoses.Checked)
         {
             connectionWithDatabase.searchForTeamsMostLoses(dataGridView1, comboBox5);
         }
     }
     catch (Exception es)
     {
         MessageBox.Show("Error 404 in adding Team. Check DataBaseConnection \r\n" + es.Message + "\r\n" + es.InnerException.Message);
     }
     finally
     {
         connectionWithDatabase.CloseConnection();
     }
 }
Example #4
0
 private void loginButton_Click(object sender, EventArgs e)
 {
     connectionWithDatabase = new DBConnect();
     if (connectionWithDatabase.isConnected())
     {
         this.Hide();
         MessageBox.Show("Succesfully connected to database");
         defaultMenu form = new defaultMenu();
         form.ShowDialog();
         connectionWithDatabase.CloseConnection();
         this.Show();
     }
     else
     {
         MessageBox.Show("Error with connecting to Database. \nCheck if it's available, your username and password.");
     }
 }
Example #5
0
 private void button1_Click(object sender, EventArgs e)
 {
     TextBox[]  idBoxes       = { PlayerID1, PlayerID2, PlayerID3, PlayerID4, PlayerID5, PlayerID6, PlayerID7, PlayerID8, PlayerID9, PlayerID10, PlayerID11 };
     TextBox[]  noBoxes       = { PlayerNo1, PlayerNo2, PlayerNo3, PlayerNo4, PlayerNo5, PlayerNo6, PlayerNo7, PlayerNo8, PlayerNo9, PlayerNo10, PlayerNo11 };
     ComboBox[] positionBoxes = { PlayerPosition1, PlayerPosition2, PlayerPosition3, PlayerPosition4, PlayerPosition5, PlayerPosition6, PlayerPosition7, PlayerPosition8, PlayerPosition9, PlayerPosition10, PlayerPosition11 };
     try
     {
         if (!connectionWithDatabase.isConnected())
         {
             connectionWithDatabase.OpenConnection();
         }
         for (int i = 0; i < 11; i++)
         {
             if (idBoxes[i].Text == "" || noBoxes[i].Text == "" || addTeamBox.Text == "" || positionBoxes[i].SelectedItem == null || !maskedTextBox1.MaskCompleted)
             {
                 MessageBox.Show("Error. Boxes cant be empty");
                 return;
             }
         }
         connectionWithDatabase.addPlayersToDatabase(addTeamBox, maskedTextBox1, idBoxes, noBoxes, positionBoxes);
         MessageBox.Show("Team " + addTeamBox.Text + " has been added.");
     }
     catch (Exception es)
     {
         MessageBox.Show("Error 404 in adding Team. Check DataBaseConnection \r\n" + es.Message + "\r\n" + es.InnerException.Message);
     }
     finally
     {
         connectionWithDatabase.CloseConnection();
     }
     addTeamBox.Text = "";
     for (int i = 0; i < 11; i++)
     {
         idBoxes[i].Text = "";
         noBoxes[i].Text = "";
         positionBoxes[i].SelectedIndex = -1;
     }
 }