Ejemplo n.º 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.");
     }
 }
Ejemplo n.º 2
0
        private void CandidateForm_Load(object sender, EventArgs e)
        {
            List <ViewAbleTeams>     vTeams = TeamHandler.GetViewAbleTeams();
            List <ViewAbleDistricts> vDists = DistrictHandler.GetViewAbleDistricts();

            foreach (ViewAbleTeams vteam in vTeams)
            {
                teamComboBox.Items.Add(vteam.TeamName);
            }
            foreach (ViewAbleDistricts vdist in vDists)
            {
                selectDistrictComboBox.Items.Add(vdist.DistrictName);
                districtComboBox.Items.Add(vdist.DistrictName);
            }
        }
Ejemplo n.º 3
0
 private void deleteTeamButton_Click(object sender, EventArgs e)
 {
     if (teamGrid.DataSource != null)
     {
         int          rowIndex = teamGrid.CurrentRow.Index;
         string       teamName = teamGrid.Rows[rowIndex].Cells[0].Value.ToString();
         DialogResult dr       = MessageBox.Show(string.Format("Are you sure to delete '{0}' from the database?", teamName), "Confirm?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dr == DialogResult.Yes)
         {
             TeamHandler.DeleteTeam(teamName);
             MessageBox.Show("Deleted");
             teamGrid.DataSource = TeamHandler.GetViewAbleTeams();
         }
     }
 }
Ejemplo n.º 4
0
 private void showTeamsButton_Click(object sender, EventArgs e)
 {
     teamGrid.DataSource = TeamHandler.GetViewAbleTeams();
 }