Пример #1
0
 private void addTeamButton_Click(object sender, EventArgs e)
 {
     if (teamNameTextBox.Text != "" && teamSymbolTextBox.Text != "")
     {
         DialogResult dr = MessageBox.Show(string.Format("Are you sure to add team '{0}' with symbol '{1}' to the database?", teamNameTextBox.Text, teamSymbolTextBox.Text), "Confirm?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dr == DialogResult.Yes)
         {
             if (TeamHandler.AddTeam(teamNameTextBox.Text, teamSymbolTextBox.Text))
             {
                 MessageBox.Show("Successfully added team.");
             }
             else
             {
                 MessageBox.Show("Unique team name and symbols should be entered.");
             }
             teamSymbolTextBox.Text = "";
             teamNameTextBox.Text   = "";
             teamGrid.DataSource    = TeamHandler.GetViewAbleTeams();
         }
     }
     else
     {
         MessageBox.Show("Enter team name and symbol.");
     }
 }