private void ResultUI_Load(object sender, EventArgs e) { StatusManager aStatusManager = new StatusManager(); if (aStatusManager.CheckPublishStatus()) { CandidateManager aCandidateManager = new CandidateManager(); winnerNameTextBox.Text = aCandidateManager.CheckWinner(); List <ManageCandidate> candidateList = new List <ManageCandidate>(); candidateList = aCandidateManager.LoadCandidateGridview(); resultDataGridView.Rows.Clear(); int SerialNumber = 1; foreach (var candidate in candidateList) { resultDataGridView.Rows.Add(SerialNumber, candidate.CandidateName, candidate.NumberOfVote); SerialNumber++; } } else { MessageBox.Show("Result is not published yet"); } }
private void AdminUI_Load(object sender, EventArgs e) { CandidateManager aCandidateManager = new CandidateManager(); winnerTextBox.Text = aCandidateManager.CheckWinner(); LoadCandidateGridview(); LoadVoterGridView(); if (aStatusManager.CheckSystemStatus()) { systemOnButton.Enabled = false; } else { systemOffButton.Enabled = false; } if (aStatusManager.CheckPublishStatus()) { publishButton.Enabled = false; } else { withdrawButton.Enabled = false; } }