Пример #1
0
        protected virtual void Process(DPFP.Sample Sample /*, DPFP.Processing.DataPurpose Purpose*/)
        {
            DrawPicture(FingerPrintUtility.ConvertSampleToBitmap(Sample));
            try
            {
                DPFP.FeatureSet features = FingerPrintUtility.ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Enrollment);

                if (features != null)
                {
                    try
                    {
                        Enroller.AddFeatures(features);
                    }
                    catch
                    {
                        MessageBox.Show("Template error");
                    }
                    finally
                    {
                        UpdateSamplesNeeded();
                        switch (Enroller.TemplateStatus)
                        {
                        case DPFP.Processing.Enrollment.Status.Ready:
                            OnTemplateCollect(Enroller.Template);
                            Stop();
                            MessageBox.Show("Enrolled Successfuly");
                            break;

                        case DPFP.Processing.Enrollment.Status.Failed:
                            Enroller.Clear();
                            Stop();
                            OnTemplateCollect(null);
                            UpdateSamplesNeeded();
                            Start();
                            MessageBox.Show("Enroller Failed");
                            break;
                        }
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Cant recognize as a fingerprint.");
                UpdateSamplesNeeded();
            }
        }
Пример #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!");
            //}
        }
Пример #3
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;



                        sqlcon.Open();
                        string     name = sessionName.Text;
                        SqlCommand cmd  = new SqlCommand();
                        cmd = new SqlCommand("UPDATE Total_Attendance_db set " + name + " = '1' WHERE Student_RegNo = '" + txtRegNo.Text.Trim() + "'", sqlcon);
                        int N = cmd.ExecuteNonQuery();
                        sqlcon.Close();


                        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 > 0)
                        {
                            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());


                            //MessageBox.Show("Attendance Recorded. Press key c to clear!");

                            Image picture = picBox.Image;
                            ATTP  att     = new ATTP(fullname, Number, attendance, total, picture);
                            att.Show();
                        }
                    }
                }


                this.IsVerificationComplete = verified;
                if (!verified)
                {
                    MessageBox.Show("Fingerprint not recognised.");
                }
            }
            else
            {
                MessageBox.Show("Cant recognize as a fingerprint.");
            }
        }