Exemple #1
0
        private void btnCastVote_Click(object sender, EventArgs e)
        {
            var check = VoterProcess.CheckIfVoted(lblVoterPin.Text, cmbElectionId.Text);

            if (check)
            {
                if (radioButton4.Checked)
                {
                    var saveVote = VoterProcess.SaveVote(lblVoterPin.Text, linkLabel1.Text, cmbElectionId.Text, 1);
                    if (saveVote > 0)
                    {
                        MetroMessageBox.Show(this, @"You have voted successfully", @"eVoting System", MessageBoxButtons.OK,
                                             MessageBoxIcon.Information);
                    }
                }
                else if (radioButton3.Checked)
                {
                    var saveVote = VoterProcess.SaveVote(lblVoterPin.Text, linkLabel2.Text, cmbElectionId.Text, 1);
                    if (saveVote > 0)
                    {
                        MetroMessageBox.Show(this, @"You have voted successfully", @"eVoting System", MessageBoxButtons.OK,
                                             MessageBoxIcon.Information);
                    }
                }
                else if (radioButton2.Checked)
                {
                    var saveVote = VoterProcess.SaveVote(lblVoterPin.Text, linkLabel3.Text, cmbElectionId.Text, 1);
                    if (saveVote > 0)
                    {
                        MetroMessageBox.Show(this, @"You have voted successfully", @"eVoting System", MessageBoxButtons.OK,
                                             MessageBoxIcon.Information);
                    }
                }
                else if (radioButton1.Checked)
                {
                    var saveVote = VoterProcess.SaveVote(lblVoterPin.Text, linkLabel4.Text, cmbElectionId.Text, 1);
                    if (saveVote > 0)
                    {
                        MetroMessageBox.Show(this, @"You have voted successfully", @"eVoting System", MessageBoxButtons.OK,
                                             MessageBoxIcon.Information);
                    }
                }
            }
            else
            {
                MetroMessageBox.Show(this, @"Sorry! You can only vote for this Position once ", @"eVoting System",
                                     MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }
        private void metroLink2_Click(object sender, EventArgs e)
        {
            var check = VoterProcess.CheckIfVoted(lblVoterPin.Text, Text);

            if (check)
            {
                var saveVote = VoterProcess.SaveVote(lblVoterPin.Text, lblCandidatePin.Text, Text, 1);
                if (saveVote > 0)
                {
                    var popup = new PopupNotifier();
                    popup.Image       = Properties.Resources.like;
                    popup.TitleText   = "Voter for " + Text;
                    popup.ContentText = "You have voted successfully. Thank you for voting. ";
                    popup.Popup();
                    MetroMessageBox.Show(this, @"You have voted successfully", @"eVoting System", MessageBoxButtons.OK,
                                         MessageBoxIcon.Information);
                }
            }
            else
            {
                lblDenied.Visible = true;
            }
        }