Esempio n. 1
0
 private void castYourVoteToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (_cast == null)
     {
         _cast = new FrmCastVote {MdiParent = this};
         _cast.FormClosed += Cast_FormClosed;
         _cast.Show();
     }
     else
     {
         _cast.Activate();
         _cast.WindowState = FormWindowState.Normal;
     }
 }
        private void btnGetLiveImage_Click(object sender, EventArgs e)
        {
            Int32 iError;
            Int32 timeout;
            Int32 quality;
            Byte[] fpImage;
            Int32 elapTime;

            timeout = Convert.ToInt32(textTimeout.Text);
            quality = Convert.ToInt32(textImgQuality.Text);
            fpImage = new Byte[_mImageWidth * _mImageHeight];
            elapTime = Environment.TickCount;

            iError = _mFpm.GetImageEx(fpImage, timeout, this.pictureBox1.Handle.ToInt32(), quality);
            DrawImage(fpImage, pictureBox1);
            iError = _mFpm.CreateTemplate(fpImage, _mRegMin1);

            var voterId = new FrmCastVote();

            using (_cnn = new SqlConnection (Properties.Settings.Default.DBConn))
            {
                _cnn.Open();
                var verifyVoters = Verify(_mRegMin1, _mRegMin1, _mRegMin1);
                FrmCastVote.VoterId = verifyVoters;
                if (verifyVoters == -1)
                {
                    MessageBox.Show(@"You're not ilegible to vote", @"Nacoss eVoting System");
                }
                else
                {
                    using (_cmd = new SqlCommand("select *from VotersRegistration where VoterID = @voterID", _cnn))
                    {
                        _cmd.Parameters.AddWithValue("@voterID", verifyVoters);
                        using (_dr = _cmd.ExecuteReader())
                        {
                            _dr.Read();
                            txtFullName.Text = _dr["FirstName"] + @" " + _dr["LastName"];
                            txtLevel.Text = _dr["LevelID"].ToString();
                            txtMatricNumber.Text = _dr["MatricNumber"].ToString();
                            txtVoterID.Text = _dr["VoterId"].ToString();
                            VoterId = (int)_dr["VoterId"];

                            var data = (byte[])_dr["Image"];
                            var ms = new MemoryStream(data);
                            imgPassport.Image = Image.FromStream(ms);
                            imgPassport.SizeMode = PictureBoxSizeMode.StretchImage;
                        }
                    }
                }
            }
            if (iError == 0)
            {
                elapTime = Environment.TickCount - elapTime;
                Status.Text = @" Capture Time : " + elapTime + @"millisec";
            }
            else
                Status.Text = _error.DisplayError("GetLiveImageEx()", iError);
        }
Esempio n. 3
0
 private void Cast_FormClosed(object sender, FormClosedEventArgs e)
 {
     _cast = null;
 }
 private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     Close();
     var castVote = new FrmCastVote();
     castVote.MdiParent = (FrmIndexForm)ParentForm;
     castVote.Show();
 }