private void btnSearch_Click(object sender, EventArgs e) { var voter = new Voters(); string msg = ""; var searchVoter = new VoterRegistration(); voter = searchVoter.SearchVoters(txtSearch.Text, out msg); if (!string.IsNullOrWhiteSpace(txtSearch.Text)) { if (!string.IsNullOrWhiteSpace(msg)) { MetroMessageBox.Show(this, msg, @"Voting System", MessageBoxButtons.OK, MessageBoxIcon.Error); //btnDelete.Enabled = false; } else { txtFirstname.Text = voter.Firstname; txtLastname.Text = voter.Lastname; cmbGender.SelectedIndex = voter.Gender == "Male" ? 0 : 1; txtEmail.Text = voter.Email; txtPhoneNumber.Text = voter.Phonenumber; picImage.Image = voter.VoterImg; voterPin = voter.VoterPin; btnDelete.Enabled = true; btnUpdate.Enabled = true; btnSubmit.Enabled = false; panel2.Enabled = false; } } }
private void FrmVoteWithPincs_Load(object sender, EventArgs e) { #region Populate the Candidate List var candidateList = LoadElection.ElectionList(); var list = candidateList.First(x => x.CandidatePin == CandidatePin); lblCandidatePin.Text = list.CandidatePin; lblFullname.Text = list.Firstname + " " + list.Lastname; lblPhonenumber.Text = list.Phonenumber; lblEmail.Text = list.Email; //lblManifesto.Text = list.Manifesto; Text = list.Post; var data = list.Img; var ms = new MemoryStream(data); picImage.Image = Image.FromStream(ms); #endregion #region Populating the Voters List string msg = ""; var voter = new VoterRegistration(); var getVoter = new Voters(); getVoter = voter.SearchVoters(VoterPin, out msg); lblVoterPin.Text = getVoter.VoterPin; lblVoterFullname.Text = getVoter.Firstname + @" " + getVoter.Lastname; lblVoterEmail.Text = getVoter.Email; picVoterImg.Image = getVoter.VoterImg; #endregion }