示例#1
0
        private void button3_Click(object sender, EventArgs e)
        {
            sqlcon.Open();

            string         query = "SELECT * FROM Total_Attendance_db WHERE Student_RegNo ='" + txtReg.Text.Trim() + "' ";
            SqlDataAdapter SDA   = new SqlDataAdapter(query, sqlcon);
            DataTable      dtb   = new DataTable();

            SDA.Fill(dtb);
            sqlcon.Close();



            if (dtb.Rows.Count > 0)
            {
                //sqlcon.Open();
                //string name = label6.Text;
                //SqlCommand cmd = new SqlCommand();
                //cmd = new SqlCommand("UPDATE EXamination_db set " + name + " = '1' WHERE Student_RegNo = '" + txtReg.Text.Trim() + "'", sqlcon);
                //cmd.ExecuteNonQuery();
                //sqlcon.Close();
                //MessageBox.Show("Attendance Recorded");



                string fullname   = dtb.Rows[0]["Student_Fullname"].ToString();
                string Number     = dtb.Rows[0]["Student_RegNo"].ToString();
                string attendance = dtb.Rows[0]["Percentage"].ToString();
                string total      = dtb.Rows[0]["Total"].ToString();


                string paths = Application.StartupPath.Substring(0, (Application.StartupPath.Length - 10));
                picBox.Image = Image.FromFile(paths + dtb.Rows[0]["SImagePath"].ToString());

                Image        picture = picBox.Image;
                StudentPopup stp     = new StudentPopup(fullname, Number, attendance, total, picture, label6.Text);
                stp.Show();
            }
        }
示例#2
0
        protected void Process(DPFP.Sample Sample)
        {
            DrawPicture(FingerPrintUtility.ConvertSampleToBitmap(Sample));

            DPFP.FeatureSet features = FingerPrintUtility.ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification);


            if (features != null)
            {
                try
                {
                    bool verified = false;
                    foreach (DPFP.Template template in this.Samples.Keys)
                    {
                        DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();

                        Verificator.Verify(features, template, ref result);

                        if (result.Verified)
                        {
                            this.VerifiedObject = Samples[template];
                            verified            = true;
                            //MessageBox.Show("verified.");
                            sqlcon.Open();
                            string     name = SessionName.Text;
                            SqlCommand cmd  = new SqlCommand();
                            cmd = new SqlCommand("UPDATE Examination_db set Attendance = '1' WHERE Student_RegNo = '" + txtRegNo.Text.Trim() + "'", sqlcon);
                            cmd.ExecuteNonQuery();
                            sqlcon.Close();
                            //MessageBox.Show("Attendance Recorded");

                            //SET(" + colName + ") = ('1') WHERE Student_RegNo = '" + txtRegNo.Text.Trim() +"'
                            //cmd.Parameters.AddWithValue("+ colName +", 1);
                            //MessageBox.Show("Scan successful!");


                            string         query = "SELECT * FROM Total_Attendance_db WHERE Student_RegNo = '" + txtRegNo.Text.Trim() + "'";
                            SqlDataAdapter SDA   = new SqlDataAdapter(query, sqlcon);
                            DataTable      dtb   = new DataTable();
                            SDA.Fill(dtb);

                            if (dtb.Rows.Count == 1)
                            {
                                string fullname   = dtb.Rows[0]["Student_Fullname"].ToString();
                                string Number     = dtb.Rows[0]["Student_RegNo"].ToString();
                                string attendance = dtb.Rows[0]["Percentage"].ToString();
                                string total      = dtb.Rows[0]["Total"].ToString();


                                string paths = Application.StartupPath.Substring(0, (Application.StartupPath.Length - 10));
                                picBox.Image = Image.FromFile(paths + dtb.Rows[0]["SImagePath"].ToString());

                                Image picture = picBox.Image;


                                StudentPopup SPO = new StudentPopup(fullname, Number, attendance, total, picture, SessionName.Text);
                                SPO.Show();
                            }
                        }
                    }
                    this.IsVerificationComplete = verified;
                    if (!verified)
                    {
                        MessageBox.Show("Fingerprint not recognised.");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
            else
            {
                MessageBox.Show("Cant recognize as a fingerprint.");
            }

            //Template = new DPFP.Template();
            //Template.DeSerialize(MS);
            //if (features != null)
            //{
            //    DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
            //    DPFP.Template template = new DPFP.Template();
            //}

            //Template.DeSerialize(MS);
            //DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification);

            //SqlDataAdapter SDA = new SqlDataAdapter(query, sqlcon);
            //DataTable dtb = new DataTable();
            //SDA.Fill(dtb);

            //if (dtb.Rows.Count == 1)
            //{
            //    imgs = (Byte[])dtb.Rows[0]["Student_Fingerprint_LTB"];

            //this.Hide();
            //MainForm MF = new MainForm(newImage, "Welcome " + label2.Text);
            //MF.Show();
            //}
            //else
            //{
            //    MessageBox.Show("Ooops somethings wong!");
            //}
        }