private void showCandidateButton_Click(object sender, EventArgs e)
 {
     if (selectSeatComboBox.SelectedItem != null)
     {
         candidateGrid.DataSource = CandidateHandler.GetViewAbleCandidatesAdmin(selectSeatComboBox.SelectedItem.ToString());
     }
     else
     {
         MessageBox.Show("Please select seat.");
     }
 }
 private void deleteCandidateButton_Click(object sender, EventArgs e)
 {
     if (candidateGrid.DataSource != null)
     {
         int          rowIndex      = candidateGrid.CurrentRow.Index;
         string       candidateName = candidateGrid.Rows[rowIndex].Cells[1].Value.ToString();
         string       seatName      = candidateGrid.Rows[rowIndex].Cells[2].Value.ToString();
         string       teamName      = candidateGrid.Rows[rowIndex].Cells[3].Value.ToString();
         DialogResult dr            = MessageBox.Show(string.Format("Are you sure to delete candidate '{0}' from team '{1}'from the database?", candidateName, teamName), "Confirm?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dr == DialogResult.Yes)
         {
             CandidateHandler.DeleteCandidate(candidateName, seatName, teamName);
             MessageBox.Show("Deleted");
             candidateGrid.DataSource = CandidateHandler.GetViewAbleCandidatesAdmin(seatName);
         }
     }
 }
 private void addCandidateButton_Click(object sender, EventArgs e)
 {
     if (candidateNameTextBox.Text != "" && teamComboBox.SelectedItem != null && districtComboBox.SelectedItem != null && seatComboBox.SelectedItem != null)
     {
         DialogResult dr = MessageBox.Show(string.Format("Are you sure to add candidate '{0}' from team '{1}' in seat '{2}'?", candidateNameTextBox.Text, teamComboBox.SelectedItem.ToString(), seatComboBox.SelectedItem.ToString()), "Confirm?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dr == DialogResult.Yes)
         {
             if (CandidateHandler.AddCandidate(candidateNameTextBox.Text, seatComboBox.SelectedItem.ToString(), teamComboBox.SelectedItem.ToString()))
             {
                 MessageBox.Show("Successfully added candidate.");
             }
             else
             {
                 MessageBox.Show("Candidate from the team already present.");
             }
             candidateNameTextBox.Text = "";
             candidateGrid.DataSource  = CandidateHandler.GetViewAbleCandidatesAdmin(seatComboBox.SelectedItem.ToString());
         }
     }
     else
     {
         MessageBox.Show("Enter the values properly.");
     }
 }