Example #1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (txtStudentID.Text.Trim() != string.Empty)
     {
         AddCandidate();
     }
     else
     {
         oFrmMsgBox             = new frmMessageBox("PLEASE SELECT CANDIDIATE.");
         oFrmMsgBox.MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
         oFrmMsgBox.ShowDialog();
     }
 }
Example #2
0
        private void btnVote_Click(object sender, EventArgs e)
        {
            oVotersLogin = new DataAccess.VotersLogin();
            string sStatus = oVotersLogin.GetVotersStatus(sVoters_ID, sPassword);

            if (sStatus.Trim() != "ACTIVE")
            {
                oFrmMsgBox             = new Forms.frmMessageBox("YOU HAVE ALREADY VOTED. PLEASE COME AGAIN THANK YOU.");
                oFrmMsgBox.MessageType = Forms.frmMessageBox.MESSAGE_TYPE.INFO;
                oFrmMsgBox.ShowDialog();
                return;
            }

            xFrm = new Forms.frmCandidate(sVoters_ID);
            Form_Load(xFrm);
        }
Example #3
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (oMVotedCandidatelstRes.Count > 0)
            {
                oFrmMsgBox             = new frmMessageBox("ARE YOU SURE YOU WANT TO PROCEED TO THE TRANSACTION");
                oFrmMsgBox.MessageType = frmMessageBox.MESSAGE_TYPE.QUERY;
                oFrmMsgBox.ShowDialog();

                if (oFrmMsgBox.sAnswer == "YES")
                {
                    foreach (var iTem in oMVotedCandidatelstRes)
                    {
                        oVotersLogin     = new DataAccess.VotersLogin();
                        oMVotedCandidate = new Model.VotedCandidate();

                        oMVotedCandidate.CANDIDATE_ID  = iTem.CANDIDATE_ID;
                        oMVotedCandidate.FIRST_NAME    = iTem.FIRST_NAME;
                        oMVotedCandidate.MIDDLE_NAME   = iTem.MIDDLE_NAME;
                        oMVotedCandidate.LAST_NAME     = iTem.LAST_NAME;
                        oMVotedCandidate.DOB           = iTem.DOB;
                        oMVotedCandidate.COURSE        = iTem.COURSE;
                        oMVotedCandidate.SECTION       = iTem.SECTION;
                        oMVotedCandidate.POSITION      = iTem.POSITION;
                        oMVotedCandidate.PARTY         = iTem.PARTY;
                        oMVotedCandidate.DATE_ADDED    = iTem.DATE_ADDED;
                        oMVotedCandidate.VOTERS_ID     = iTem.VOTERS_ID.ToUpper();
                        oMVotedCandidate.ELECTION_CODE = iTem.ELECTION_CODE;

                        oVotersLogin.VoteCandidate(oMVotedCandidate);
                    }

                    oFrmMsgBox             = new frmMessageBox("YOU HAVE SUCCESSFULLY VOTED. THANK YOU.");
                    oFrmMsgBox.MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();

                    oVotersLogin = new DataAccess.VotersLogin();
                    oVotersLogin.UpdateVotersKey(oMVotedCandidate);

                    frmCandidate oFrmCandidate = new frmCandidate();
                    oFrmCandidate.CloseApplication();
                    Close();

                    frmLogin oFrm = new frmLogin();
                    oFrm.ShowDialog();
                }
            }
        }
Example #4
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            oVotersLogin = new DataAccess.VotersLogin();
            if (lblStatus.Text == "OPEN")
            {
                if (oVotersLogin.IsLogin(txtUsername.Text.Trim(), txtPassword.Text.Trim()))
                {
                    string sStatus = oVotersLogin.GetVotersStatus(txtUsername.Text, txtPassword.Text);

                    if (sStatus.Trim() != "ACTIVE")
                    {
                        oFrmMsgBox             = new Forms.frmMessageBox("YOU HAVE ALREADY VOTED. PLEASE COME AGAIN THANK YOU.");
                        oFrmMsgBox.MessageType = Forms.frmMessageBox.MESSAGE_TYPE.INFO;
                        oFrmMsgBox.ShowDialog();
                        return;
                    }

                    this.ShowInTaskbar = false;
                    this.Hide();
                    oMainForm = new MAIN(txtUsername.Text, txtPassword.Text);
                    oMainForm.ShowDialog();
                }
                else
                {
                    oFrmMsgBox             = new Forms.frmMessageBox("PLEASE ENTER CORRECT USERNAME AND PASSWORD.");
                    oFrmMsgBox.MessageType = Forms.frmMessageBox.MESSAGE_TYPE.INFO;
                    oFrmMsgBox.ShowDialog();
                    txtUsername.Focus();
                }
            }
            else
            {
                oFrmMsgBox             = new Forms.frmMessageBox("VOTING SCHEDULE WAS CLOSE.");
                oFrmMsgBox.MessageType = Forms.frmMessageBox.MESSAGE_TYPE.INFO;
                oFrmMsgBox.ShowDialog();
            }
        }
Example #5
0
        void AddCandidate()
        {
            try
            {
                Boolean bFound = false;

                if (dgAddedList.Rows.Count > 0)
                {
                    foreach (DataGridViewRow row in dgAddedList.Rows)
                    {
                        if (row.Cells[2].Value.ToString() == txtPosition.Text)
                        {
                            bFound = true;
                            break;
                        }
                    }
                    if (bFound)
                    {
                        oFrmMsgBox             = new frmMessageBox("ONLY ONE CANDIDATE PER POSITION AT A TIME.");
                        oFrmMsgBox.MessageType = frmMessageBox.MESSAGE_TYPE.INFO;
                        oFrmMsgBox.ShowDialog();
                    }
                    else
                    {
                        oMVotedCandidate = new Model.VotedCandidate();

                        dgAddedList.Rows.Add(txtStudentID.Text, (txtLname.Text + ", " + txtFname.Text + " " + txtMname.Text).ToString(), txtPosition.Text, txtParty.Text);

                        oMVotedCandidate.ELECTION_CODE = sElectionCode;
                        oMVotedCandidate.CANDIDATE_ID  = txtStudentID.Text;
                        oMVotedCandidate.FIRST_NAME    = txtFname.Text;
                        oMVotedCandidate.MIDDLE_NAME   = txtMname.Text;
                        oMVotedCandidate.LAST_NAME     = txtLname.Text;
                        oMVotedCandidate.DOB           = Convert.ToDateTime(txtDOB.Text);
                        oMVotedCandidate.AGE           = txtAge.Text;
                        oMVotedCandidate.COURSE        = txtCourse.Text;
                        oMVotedCandidate.SECTION       = txtSection.Text;
                        oMVotedCandidate.POSITION      = txtPosition.Text;
                        oMVotedCandidate.PARTY         = txtParty.Text;
                        oMVotedCandidate.DATE_ADDED    = DateTime.Now;

                        oMVotedCandidate.VOTERS_ID = sVoters_ID;

                        oStringUtility = new CommonFunction.CommonFunction();
                        if (pImage.Image != null)
                        {
                            oMVotedCandidate.PROFILE_PIC = oStringUtility.CompressString(oImageConvert.ImageToBaseString(pImage.Image, ImageFormat.Png));
                        }
                        oMVotedCandidatelst.Add(oMVotedCandidate);
                    }
                }
                else
                {
                    oMVotedCandidate = new Model.VotedCandidate();

                    dgAddedList.Rows.Add(txtStudentID.Text, (txtLname.Text + ", " + txtFname.Text + " " + txtMname.Text).ToString(), txtPosition.Text, txtParty.Text);

                    oMVotedCandidate.ELECTION_CODE = sElectionCode;
                    oMVotedCandidate.CANDIDATE_ID  = txtStudentID.Text;
                    oMVotedCandidate.FIRST_NAME    = txtFname.Text;
                    oMVotedCandidate.MIDDLE_NAME   = txtMname.Text;
                    oMVotedCandidate.LAST_NAME     = txtLname.Text;
                    oMVotedCandidate.DOB           = Convert.ToDateTime(txtDOB.Text);
                    oMVotedCandidate.AGE           = txtAge.Text;
                    oMVotedCandidate.COURSE        = txtCourse.Text;
                    oMVotedCandidate.SECTION       = txtSection.Text;
                    oMVotedCandidate.POSITION      = txtPosition.Text;
                    oMVotedCandidate.PARTY         = txtParty.Text;
                    oMVotedCandidate.DATE_ADDED    = DateTime.Now;

                    oMVotedCandidate.VOTERS_ID = sVoters_ID;

                    if (pImage.Image != null)
                    {
                        oMVotedCandidate.PROFILE_PIC = oStringUtility.CompressString(oImageConvert.ImageToBaseString(pImage.Image, ImageFormat.Png));
                    }

                    oMVotedCandidatelst.Add(oMVotedCandidate);
                }
            }
            catch (Exception ex)
            {
            }
        }