Exemple #1
0
        private void featureS()
        {
            this.Invoke(new Function(delegate()
            {
                MemoryStream fingerprintData = new MemoryStream();
                Template.Serialize(fingerprintData);
                byted         = fingerprintData.ToArray();
                string base64 = System.Convert.ToBase64String(byted);
                //dbHandle.ExecuteQuery("INSERT INTO t_employee(`name`,`fingercode`) VALUES('" + txtnama.Text + "','" + byted + "')");


                //MySqlConnection conn = new MySqlConnection("Your connection string");
                dbHandle.openConn();
                MySqlCommand cmd = new MySqlCommand();



                string CmdString = "INSERT INTO t_employee(name, fingercode) VALUES(@FirstName, @Image)";
                cmd = new MySqlCommand(CmdString, dbHandle.con);
                cmd.Parameters.Add("@FirstName", MySqlDbType.VarChar, 45);
                cmd.Parameters.Add("@Image", MySqlDbType.Blob);
                cmd.Parameters["@FirstName"].Value = txtnama.Text;
                cmd.Parameters["@Image"].Value     = byted;

                dbHandle.openConn();
                int RowsAffected = cmd.ExecuteNonQuery();
                if (RowsAffected > 0)
                {
                    MessageBox.Show("Image saved sucessfully!");
                }
                dbHandle.closeConn();
                //insert your mysql command here then
            }));
        }
        protected override void Process(DPFP.Sample Sample)
        {
            //base.Process(Sample);
            //
            //// Process the sample and create a feature set for the enrollment purpose.
            //DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification);
            //
            //// Check quality of the sample and start verification if it's good
            //// TODO: move to a separate task
            //if (features != null)
            //{
            //    // Compare the feature set with our template
            //    DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
            //
            //    DPFP.Template template = new DPFP.Template();
            //    Stream stream;
            //
            //    foreach (var emp in contexto.t_employee)
            //    {
            //        stream = new MemoryStream(emp.fingercode);
            //        template = new DPFP.Template(stream);
            //
            //        Verificator.Verify(features, template, ref result);
            //        UpdateStatus(result.FARAchieved);
            //        if (result.Verified)
            //        {
            //            MakeReport("The fingerprint was VERIFIED. " + emp.name);
            //            break;
            //        }
            //    }
            //
            //
            //
            //
            //
            //}


            db dbHandle = new db();

            dbHandle.openConn();
            //MySqlConnection conn = new MySqlConnection("Your connection string");
            //conn.Open();
            MySqlCommand     cmd = new MySqlCommand("select * from t_employee", dbHandle.con);
            MySqlDataAdapter sd  = new MySqlDataAdapter(cmd);
            DataTable        dt  = new DataTable();

            sd.Fill(dt);



            base.Process(Sample);

            // Process the sample and create a feature set for the enrollment purpose.
            DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification);

            // Check quality of the sample and start verification if it's good
            // TODO: move to a separate task
            if (features != null)
            {
                // Compare the feature set with our template
                DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();

                DPFP.Template template = new DPFP.Template();
                Stream        stream;

                foreach (DataRow dr in dt.Rows)
                {
                    string nama = dr["name"].ToString();

                    byte[] _img = (byte[])dr["fingercode"];
                    stream   = new MemoryStream(_img);
                    template = new DPFP.Template(stream);

                    Verificator.Verify(features, template, ref result);
                    UpdateStatus(result.FARAchieved);
                    if (result.Verified)
                    {
                        MakeReport("The fingerprint was VERIFIED.+" + nama + "");
                        break;
                    }
                }
            }

            dbHandle.closeConn();
        }