Exemple #1
1
        public static bool Verify(DPFP.Sample _sample, DPFP.Template _template)
        {
            try
            {
                bool _result = false;
                DPFP.Verification.Verification Verificator = new DPFP.Verification.Verification();
                DPFP.FeatureSet features = zsi.dtrs.Util.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();
                    Verificator.Verify(features, _template, ref result);

                    if (result.Verified)
                    {
                        _result = true;
                    }
                    else
                    {
                        _result = false;
                    }
                }
                return(_result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void verify(DPFP.Sample Sample)
        {
            DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification);

            byte[] fpbyte = getFTemplate();
            if (fpbyte != null)
            {
                Stream        stream = new MemoryStream(fpbyte);
                DPFP.Template tmpObj = new DPFP.Template(stream);


                DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
                // Compare the feature set with our template
                Verificator.Verify(features, tmpObj, ref result);
                if (result.Verified)
                {
                    MessageBox.Show("The fingerprint was VERIFIED.");
                    client.Send("desktop-verify-verified");
                }
                else
                {
                    MessageBox.Show("The fingerprint was NOT VERIFIED.");
                    client.Send("desktop-verify-notverified");
                }
            }


            hideForm();
        }
        private void OnTemplateCollect(DPFP.Template template)
        {
            if (template != null)
            {
                this.Invoke(new Function(delegate()
                {
                    MemoryStream s = new MemoryStream();
                    template.Serialize(s);
                    this.FingerPrint            = s.ToArray();
                    this.IsRegistrationComplete = true;


                    using (SqlConnection con = new SqlConnection(Helper.GetConnection()))
                    {
                        con.Open();
                        string query = @"INSERT INTO Users VALUES (@FirstName,
                            @LastName, @Thumb, @DateAdded)";
                        using (SqlCommand cmd = new SqlCommand(query, con))
                        {
                            cmd.Parameters.AddWithValue("@FirstName", "");
                            cmd.Parameters.AddWithValue("@LastName", "");
                            cmd.Parameters.AddWithValue("@Thumb", FingerPrint);
                            cmd.Parameters.AddWithValue("@DateAdded", DateTime.Now);
                            cmd.ExecuteNonQuery();
                            MessageBox.Show("Added!");
                        }
                    }
                }));
            }
        }
        private void OnTemplate(DPFP.Template template)
        {
            this.Invoke(new Function(delegate()
            {
                if (template != null)
                {
                    if (action == "enrolPerson")
                    {
                        LLTemplate = template;

                        btnCapturePersonFP.Enabled = false;
                        btnCapturePersonFP.Text    = "Captured";
                    }
                    else if (action == "enrolNOK")
                    {
                        NoKTemplate = template;

                        btnCaptureNokFP.Enabled = false;
                        btnCaptureNokFP.Text    = "Captured";
                    }
                    MessageBox.Show("The fingerprint template is ready for fingerprint verification.", "Fingerprint Enrollment");
                }
                else
                {
                    MessageBox.Show("The fingerprint template is not valid. Repeat fingerprint enrollment.", "Fingerprint Enrollment");
                }
            }));
        }
Exemple #5
0
        private void OnTemplateCollect(DPFP.Template template)
        {
            if (template != null)
            {
                this.Invoke(new Function(delegate()
                {
                    MemoryStream s = new MemoryStream();
                    template.Serialize(s);
                    this.FingerPrint            = s.ToArray();
                    this.IsRegistrationComplete = true;
                    // string constring = @"Server=localhost; Database=sdtestdb; UID =root; PWD=1234;";

                    using (MySqlConnection con = new MySqlConnection(Helper.GetConnection()))
                    {
                        con.Open();
                        string query = @"UPDATE employee SET rightThumb=@rightThumb WHERE employeeID=@empID ";
                        using (MySqlCommand cmd = new MySqlCommand(query, con))
                        {
                            // MessageBox.Show(Model.employeeNo);
                            cmd.Parameters.AddWithValue("@rightThumb", FingerPrint);
                            cmd.Parameters.AddWithValue("@empID", Model.employeeNo);
                            cmd.ExecuteNonQuery();
                            MessageBox.Show("Enrolment successful!");
                        }
                    }
                }));
            }
        }
Exemple #6
0
        protected virtual void Process(DPFP.Sample Sample)
        {
            DrawPicture(ConvertSampleToBitmap(Sample));
            DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification);

            if (features != null)
            {
                byte[] bytes = new byte[1632];
                features.Serialize(ref bytes);

                for (int x = 0; x < List_Usuarios.Count; x++)
                {
                    DPFP.Template templeate = new DPFP.Template();
                    templeate.DeSerialize(List_Usuarios[x].fingerPrint);

                    DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
                    Verificator.Verify(features, templeate, ref result);

                    if (result.Verified)
                    {
                        int id_usuario = List_Usuarios[x].id_Cliente;
                        var usuario    = (from cliente in contexto.tb_Usuarios where cliente.id_usuario == id_usuario select cliente).Single();
                        MessageBox.Show("VERIFICADO  " + usuario.nombre_usuario);
                        return;
                    }
                }

                MessageBox.Show("NO ENCONTRADO");
            }
        }
 private DPFP.Template convertTemplate(string p)
 {
     byte[]        decByte3 = Convert.FromBase64String(p);
     DPFP.Template tmp      = new DPFP.Template();
     tmp.DeSerialize(decByte3);
     return(tmp);
 }
Exemple #8
0
        private void chkButton_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                if (txtMatric.Text != "")
                {
                    fingerPrint = txtMatric.Text.Trim();
                    string[] wordArray = fingerPrint.Split('/');
                    fingerPrint = String.Join("_", wordArray);

                    location = "C:\\fingerprints\\" + fingerPrint + ".fpt";

                    if (File.Exists(location) == true)
                    {
                        FileStream fs = File.OpenRead(location);

                        DPFP.Template template = new DPFP.Template(fs);
                        OnTemplate(template);
                    }
                    else
                    {
                        MessageBox.Show("Matriculation Number does not exist!");
                        chkButton.Checked = false;
                    }
                }
                else
                {
                    MessageBox.Show("Matric Number is empty!", "Error");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("An Error has occurred!", "Error");
            }
        }
Exemple #9
0
        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.Empleadoes)
                {
                    stream   = new MemoryStream(emp.Huella);
                    template = new DPFP.Template(stream);

                    Verificator.Verify(features, template, ref result);
                    UpdateStatus(result.FARAchieved);
                    if (result.Verified)
                    {
                        MakeReport("The fingerprint was VERIFIED. " + emp.Nombre);
                        break;
                    }
                }
            }
        }
Exemple #10
0
        private void btnsimpan_Click(object sender, EventArgs e)
        {
            try
            {
                byte[]     streamHuella = Template.Bytes;
                t_employee empleado     = new t_employee()
                {
                    id         = Convert.ToInt16(txtid.Text),
                    name       = txtnama.Text,
                    fingercode = streamHuella
                };

                featureS();
                contexto.t_employee.Add(empleado);
                contexto.SaveChanges();
                MessageBox.Show("Record added successfully Bro");
                Limpiar();
                Listar();
                Template          = null;
                btnsimpan.Enabled = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #11
0
        // event handling
        public void EnrollmentControl_OnEnroll(Object Control, int Finger, DPFP.Template Template, ref DPFP.Gui.EventHandlerStatus Status)
        {
            if (Data.IsEventHandlerSucceeds)
            {
                Data.Templates[Finger - 1] = Template;      // store a finger template
                ExchangeData(true);                         // update other data

                //save to the db
                const string filename = "biometricverification.sqlite";
                var          conn     = new SQLiteConnection("Data Source=" + filename + ";");

                try
                {
                    conn.Open();
                    using (var command = new SQLiteCommand("UPDATE fingerprint SET fingerprint = @finger_print WHERE finger = @fingerD", conn))
                    {
                        command.Parameters.Add("@finger_print", DbType.Binary).Value = Template.Bytes;
                        command.Parameters.Add("@fingerD", DbType.Int16).Value       = Finger;
                        command.ExecuteNonQuery();
                        MessageBox.Show("successfully updated to db");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                ListEvents.Items.Insert(0, String.Format("OnEnroll: finger {0}", Finger));
            }
            else
            {
                Status = DPFP.Gui.EventHandlerStatus.Failure; // force a "failure" status
            }
        }
Exemple #12
0
        protected virtual void Process(DPFP.Sample Sample)
        {
            DrawPicture(ConvertSampleToBitmap(Sample));
            DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification);

            if (features != null)
            {
                byte[] bytes = new byte[1632];
                features.Serialize(ref bytes);

                for (int x = 0; x < List_Usuarios.Count; x++)
                {
                    DPFP.Template templeate = new DPFP.Template();
                    templeate.DeSerialize(List_Usuarios[x].fingerPrint);

                    DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
                    Verificator.Verify(features, templeate, ref result);


                    if (result.Verified)
                    {
                        _idCliente = List_Usuarios[x].id_Cliente;

                        return;
                    }
                }

                //videoSourcePlayer1.BackgroundImage = Properties.Resources.Desconocido;
                MessageBox.Show("Cliente no encontrado", "Information", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }
Exemple #13
0
        private DPFP.Template getTemplate(byte[] fingerBuffer)
        {
            MemoryStream ms = new MemoryStream(fingerBuffer);

            DPFP.Template template = new DPFP.Template(ms);
            return(template);
        }
Exemple #14
0
        private void enrollmentControl_OnEnroll(object control, int fingerNbr, DPFP.Template template, ref EventHandlerStatus eventHandlerStatus)
        {
            if (eventHandlerStatus == EventHandlerStatus.Failure)
            {
                MessageBox.Show("Finger enrollment failed.", "Enrollment Failure", MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
                return;
            }

            var fingerIndex = DpfpFingerNbrToFingerIndex[fingerNbr];

            string base64EncodedTemplate = FingerprintReader.EncodeBase64Template(template);

            var ctx = RemoteDatabase.GetDbContext();
            {
                ctx.Fingerprints.Add(new SmartDrawerDatabase.DAL.Fingerprint
                {
                    Index         = (int)fingerIndex,
                    GrantedUserId = _currentUser.GrantedUserId,
                    Template      = base64EncodedTemplate
                });

                ctx.SaveChanges();
                ctx.Database.Connection.Close();
                ctx.Dispose();
            }
        }
Exemple #15
0
        public bool ProcesarChecado(DPFP.Sample Sample, DPFP.Template templateGuardado, frmChecarEntradaSalida FrmChecar)
        {
            try
            {
                DrawPictureChecar(ConvertSampleToBitmapLogin(Sample), FrmChecar);
                DPFP.FeatureSet features = ExtractFeaturesChecar(Sample, DPFP.Processing.DataPurpose.Verification);
                if (features != null)
                {
                    DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
                    Verificator.Verify(features, templateGuardado, ref result);

                    if (result.Verified)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                LogError.AddExcFileTxt(ex, "LectorHuella ~ ProcesarChecado");
                return(false);
            }
        }
Exemple #16
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable table = search.getDataWithTwoFingers(textBox1.Text);
                dataGridView1.Rows.Clear();
                ListTemplate.Clear();

                int i = table.Rows.Count;
                for (int items = 0; items < i; items++)
                {
                    if (!Convert.IsDBNull(table.Rows[items]["fingerOne"]))
                    {
                        byte[]          fingerBufferOne = (byte[])table.Rows[items]["fingerOne"];
                        byte[]          fingerBufferTwo = (byte[])table.Rows[items]["fingerTwo"];
                        DPFP.Template[] arrayTemplate   = new DPFP.Template[2];
                        arrayTemplate[0] = getTemplate(fingerBufferOne);
                        arrayTemplate[1] = getTemplate(fingerBufferTwo);
                        ListTemplate.Add(table.Rows[items]["Id"].ToString(), arrayTemplate);
                        dataGridView1.Rows.Add(table.Rows[items]["Name"].ToString());
                    }
                }
                button1.Text = "Buscando...";
            }
            catch
            {
                button1.Text = "Buscar por Nombre";
                MessageBox.Show("ERROR", "Cargando jugadores");
            }
        }
Exemple #17
0
        private void button2_Click_1(object sender, EventArgs e)
        {
            int           row     = 0;
            CaptureHuella capture = new CaptureHuella();

            capture.OnTemplate += this.OnTemplate;
            capture.ShowDialog();
            try
            {
                byte[] streamHuella = Template.Bytes;

                MessageBox.Show("Record saved successfully");
                Students.PrintBinary                       = streamHuella;
                SelectedName["Id", row].Value              = Students.Id;
                SelectedName["Name", row].Value            = Students.StudentName;
                SelectedName["GuardianName", row].Value    = Students.GuardianName;
                SelectedName["Address", row].Value         = Students.Address;
                SelectedName["ContactInfo", row].Value     = Students.ContactInfo;
                SelectedName["Status", row].Value          = Students.Status;
                SelectedName["AdmissionDate", row].Value   = Students.AddmissionDate;
                SelectedName["ClassId", row].Value         = Students.ClassId;
                SelectedName["ProgramId", row].Value       = Students.ProgramId;
                SelectedName["CurrentSemclass", row].Value = Students.CurrentSemclass;
                SelectedName["PrintBinary", row].Value     = Students.PrintBinary;
                SelectedName["AddedOn", row].Value         = Students.AddedOn;
                SelectedName["Image", row].Value           = Students.Uploadimage;

                Template = null;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #18
0
        private void EnrollmentControl_OnEnroll(object Control, int FingerMask, DPFP.Template Template, ref DPFP.Gui.EventHandlerStatus EventHandlerStatus)
        {
            byte[]      bytes = null;
            RN_Personal obj   = new RN_Personal();

            if (Template is null)
            {
                Template.Serialize(ref bytes);
                MessageBox.Show("No se puede Realizar la Operacion", "Aviso del Sistema", MessageBoxButtons.OK, MessageBoxIcon.Error);
                lbl_idperso.Text    = "";
                lbl_nomPersona.Text = "";
                lbl_nroDni.Text     = "";
                picFoto.Image       = null;
                this.Tag            = "";
                this.Close();
            }
            else
            {
                Template.Serialize(ref bytes);
                obj.RN_Registrar_Huella_Personal(lbl_idperso.Text, bytes);
                lbl_idperso.Text    = "";
                lbl_nomPersona.Text = "";
                lbl_nroDni.Text     = "";
                picFoto.Image       = null;

                if (BD_Personal.Huella == true)
                {
                    MessageBox.Show("la Huella Dactilar del Personal, Fue Registrada con Exito", "Aviso del Sistema", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    this.Tag = "A";
                    this.Close();
                }
            }
        }
Exemple #19
0
 private void OnTemplate(DPFP.Template template)
 {
     try
     {
         Template = template;
         if (Template != null)
         {
             this.FrmCapturaHuella.Invoke(new Function(delegate()
             {
                 FrmCapturaHuella.lblInstrucciones.Text      = "La plantilla de huellas dactilares está preparado para la verificación de huellas dactilares.";
                 FrmCapturaHuella.lblInstrucciones.BackColor = Color.GreenYellow;
             }));
         }
         else
         {
             this.FrmCapturaHuella.Invoke(new Function(delegate()
             {
                 FrmCapturaHuella.lblInstrucciones.Text      = "La plantilla de huella digital no es válida. Repita el registro de huellas dactilares.";
                 FrmCapturaHuella.lblInstrucciones.BackColor = Color.Red;
             }));
         }
     }
     catch (Exception ex)
     {
         LogError.AddExcFileTxt(ex, "LectorHuella ~ OnTemplate");
     }
 }
Exemple #20
0
 private void btnBuscar_Click(object sender, EventArgs e)
 {
     byte[] buffer = new byte[8000];
     using (var conn = new System.Data.SqlClient.SqlConnection(Properties.Settings.Default.ConnectionString))
     {
         var cmd = new System.Data.SqlClient.SqlCommand(
             "select nombre, puestos, huella from Personas where NumeroControl = @NumeroControl"
             , conn);
         try
         {
             cmd.Parameters.AddWithValue("@NumeroControl", int.Parse(txtNumeroControl.Text));
             conn.Open();
             SqlDataReader Reader = cmd.ExecuteReader();
             while (Reader.Read())
             {
                 txtNombre.Text = Reader.GetString(0);
                 txtPuesto.Text = Reader.GetString(1);
                 Reader.GetBytes(2, 0, buffer, 0, 8000);
                 DPFP.Template template = new DPFP.Template(new MemoryStream(buffer));
                 OnTemplate(template);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }//using
 }
        public void OnComplete(object Capture, string ReaderSerialNumber, DPFP.Sample Sample)
        {
            //Process(Sample);
            try
            {
                Connection con = new Connection();
                con.Connect();
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = " select * from resident ";
                cmd.Connection  = Connection.con;
                SqlDataAdapter sd = new SqlDataAdapter(cmd);
                DataTable      dt = new DataTable();
                sd.Fill(dt);

                foreach (DataRow dr in dt.Rows)
                {
                    byte[] _img = (byte[])dr["resident_fingerprint"];
                    //string id = dr["RESIDENT_ID"].ToString();
                    MemoryStream  ms       = new MemoryStream(_img);
                    DPFP.Template Template = new DPFP.Template();
                    Template.DeSerialize(ms);
                    DPFP.Verification.Verification Verificator = new DPFP.Verification.Verification();

                    //  Process(Sample);

                    DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification);
                    if (features != null)
                    {
                        DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
                        Verificator.Verify(features, Template, ref result);
                        // UpdateStatus(result.FARAchieved);
                        if (result.Verified)
                        {
                            MessageBox.Show("This Resident is already Registered!!!");
                            Reset();
                            FMPIclear();
                            break;
                        }
                        else
                        {
                            MakeReport("fingerprint captured.");
                            SetPrompt("Scan fingerprint again");
                            Process(Sample);
                            if (scans.Text == "0 scans left")
                            {
                                cp.StopCapture();
                            }
                            break;
                        }
                    }
                    else
                    {
                    }
                }
            }
            catch
            {
            }
        }
        public void Verify(DPFP.Template template)
        {
            //List<Record> result = await VerifyFingerPrint();


            Template = template;
            ShowDialog();
        }
Exemple #23
0
 public void UpdateTemplates(int FingerPosition, DPFP.Template Template)
 {
     this.Templates[FingerPosition] = Template;
     if (DataChanged != null)
     {
         this.DataChanged();
     }
 }
 private void btn_agregar_Click(object sender, EventArgs e)
 {
     btn_agregarHuella();
     Template            = null;
     txt_huella.Text     = "";
     txt_nombre.Text     = "";
     btn_agregar.Enabled = false;
 }
Exemple #25
0
        public static Employee VerifyBiometricsData(int FingNo, DPFP.Sample Sample)
        {
            OracleConnection conn  = new OracleConnection(ConStr);
            Employee         _info = new Employee();

            try
            {
                string        _result   = string.Empty;
                string        _Finger   = Util.GetFingerDesc(FingNo);
                DPFP.Template _template = null;
                string        sql       = string.Format("select Empl_Id_No, {0} from EMPTSI", _Finger);;
                OracleCommand command   = new OracleCommand(sql, conn);
                command.CommandType = CommandType.Text;
                conn.Open();
                OracleDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);

                bool IsFound = false;
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        if (reader[0] != DBNull.Value)
                        {
                            _template = Util.ProcessDBTemplate((byte[])reader[_Finger]);
                            IsFound   = Util.Verify(Sample, _template);
                        }
                        if (IsFound == true)
                        {
                            string        sqlEmp = "select * from employees where Empl_Id_No=" + reader["Empl_Id_No"];
                            OracleCommand cmd2   = new OracleCommand(sqlEmp, conn);
                            cmd2.CommandType = CommandType.Text;
                            OracleDataReader reader2 = cmd2.ExecuteReader(CommandBehavior.CloseConnection);
                            if (reader2.HasRows)
                            {
                                _info.Empl_Id_No    = Convert.ToInt32(reader["Empl_Id_No"]);
                                _info.Empl_Name     = (string)reader2["Empl_Name"];
                                _info.Empl_Deptname = (string)reader2["Empl_Deptname"];
                                _info.Shift_Id      = Convert.ToInt32(reader2["Shift_Id"]);
                            }
                            reader2.Dispose();
                            reader.Dispose();
                            cmd2.Dispose();
                            command.Dispose();
                            break;
                        }
                    }
                }
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                return(_info);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
		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();
                string[] flist = Directory.GetFiles("c:/finger");
                int mx = flist.Length;
                int cnt = 0;
                bool found = false;
               
                 DPFP.Template templates;
                while (cnt < mx && !found)
                {
                   // MessageBox.Show(flist[cnt]);
                    using (FileStream fs = File.OpenRead(flist[cnt]))
                    {
                         templates = new DPFP.Template(fs);
                        Verificator.Verify(features, templates, ref result);
                        UpdateStatus(result.FARAchieved);
                    }
                    if (result.Verified)
                    {
                        found = true;
                        FileInfo nfo = new FileInfo(flist[cnt]);
                        fname = nfo.Name;                        
                        break;
                    }
                    else
                    {
                        found = false;
                        cnt++;
                    }
                }
              
            
                    if (found)
                    {
                        MakeReport("The fingerprint was VERIFIED. "+fname);
                        MessageBox.Show("Verified!!");
                        
                    
                        
                    }
                    else
                    {
                        MakeReport("The fingerprint was NOT VERIFIED.");
                        MessageBox.Show("Not Verified!!");
                    }
                
            }
		}
            public void Add(string ID, DPFP.Template template, byte[] picture, string FIngerTable, Int16 Dpi = 700)
            {
                SqlConnection sqlcon = new SqlConnection(DPData.Database.ConnectionString);

                try
                {
                    string InsertStatement = "Insert into " + FIngerTable + " (Features, FingerID,Picture ) Values (@Features, @FingerID, @Pictures)";
                    // Connection = New SqlConnection(ConnectionString)
                    // Connection.Open()
                    // 'Dim Features As Byte() = DirectCast(template.Bytes, Byte())
                    // If owner.Connection Is Nothing Then
                    // owner .Connection =
                    // End If
                    sqlcon.Open();
                    SqlCommand InsertCommand = new SqlCommand(InsertStatement, sqlcon);
                    InsertCommand.Parameters.Add("@Features", SqlDbType.VarBinary).Value = template.Bytes;
                    InsertCommand.Parameters.Add("@FingerID", SqlDbType.VarChar).Value   = ID;
                    InsertCommand.Parameters.Add("@Pictures", SqlDbType.VarBinary).Value = picture;

                    int cnt = InsertCommand.ExecuteNonQuery();
                    InsertCommand.Dispose();

                    if (UseIdentityProcess)
                    {
                    }
                    else
                    {
                        Record record = new Record(ID, template);
                        Items.Add(record);
                    }

                    //return true;
                }
                catch (SqlException seex)
                {
                    throw seex;
                }
                catch (Exception ex)
                {
                    try
                    {
                        logger.WriteLog(ex);
                    }
                    catch (Exception exx)
                    {
                    }
                    throw ex;
                }
                finally
                {
                    if (sqlcon.State == ConnectionState.Open)
                    {
                        sqlcon.Close();
                    }
                }
                //  return true;
            }
Exemple #28
0
        private void OnTemplate(DPFP.Template template)
        {
            this.Invoke(new Function(async delegate()
            {
                if (template != null)
                {
                    StaffTemplate = template;

                    SetPrompt("The fingerprint template has been captured successfully. \n\n Please wait while the template is being proccessed.");

                    Cursor = Cursors.WaitCursor;


                    using (var HC = new HttpClient())
                    {
                        var file = new byte[] { };
                        StaffTemplate.Serialize(ref file);

                        var fp = new Fingerprint()
                        {
                            DateAdded  = DateTime.Now,
                            StafftabId = Staff.Id,
                            FPfile     = file
                        };

                        var hc = new StringContent(JsonConvert.SerializeObject(fp), Encoding.UTF8, "application/json");

                        var response = await HC.PostAsync(Constants.baseUrl + "Staff/Fingerprint", hc);
                        if (response.IsSuccessStatusCode)
                        {
                            var rtnString = await response.Content.ReadAsStringAsync();
                            var rtn       = JsonConvert.DeserializeObject <ApiReturnObject <Fingerprint> >(rtnString);
                            MessageBox.Show(rtn.Message);

                            if (rtn.Status)
                            {
                                this.Enabled = false;
                            }
                            else
                            {
                            }
                        }
                        else
                        {
                            MessageBox.Show("An error occured. Please Try again.");
                            Start();
                        }
                    }

                    Cursor = Cursors.Default;
                }
                else
                {
                    MessageBox.Show("The fingerprint template is not valid. Repeat fingerprint enrollment.", "Fingerprint Enrollment");
                }
            }));
        }
Exemple #29
0
        public string ConvertirHuellaAString(DPFP.Template Template)
        {
            string HuellaString = null;

            foreach (byte SS in Template.Bytes)
            {
                HuellaString += SS.ToString() + "-";
            }
            return(HuellaString);
        }
Exemple #30
0
        public static DPFP.Template ProcessDBTemplate(byte[] _data)
        {
            DPFP.Template _template = null;
            Stream        _ms       = new MemoryStream(_data);

            _template = new DPFP.Template();
            //deserialize
            _template.DeSerialize(_ms);
            return(_template);
        }
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     if (this.CacheFingerPrinter != null)
     {
         this.Template = new DPFP.Template();
         this.Template.DeSerialize(this.CacheFingerPrinter);
         this.UIFullName_Finger.Text = UserData.getFullName(cacheName);
         this.UILoginForm.Animation_Translate_Frame(double.NaN, double.NaN, 400, double.NaN, 500);
         this.UILoginFinger.Animation_Translate_Frame(-400, double.NaN, 0, double.NaN, 500);
         this.Start();
     }
 }
        public void OnComplete(object Control, DPFP.FeatureSet FeatureSet, ref DPFP.Gui.EventHandlerStatus Status)
        {
            DPFP.Verification.Verification ver = new DPFP.Verification.Verification();
            DPFP.Verification.Verification.Result res = new DPFP.Verification.Verification.Result();

            //string conStr = "Data Source=.; Initial Catalog=Registration; Integrated Security=true";

            //SqlConnection con = new SqlConnection(conStr);
            //SqlCommand cmd = new SqlCommand("Select FingerPrintData from FingerPrints where Id = 11", con);

            //con.Open();

            //byte[] userFingerPrintData = new byte[0];

            //using (con)
            //{
            //    userFingerPrintData = cmd.ExecuteScalar() as byte[];
            //}

            //byte[] fingerPrintCode = new StudentDAC().GetFingerCodeById(2);

            List<Guardian> guardians = new GuardianDAC().SelectAllGuardians();
           
            if (guardians != null && guardians.Count > 0)
            {
                foreach (var item in guardians)
                {
                    ver = new DPFP.Verification.Verification();
                    res = new DPFP.Verification.Verification.Result();
                    DPFP.Template temp = new DPFP.Template();

                    if (item.FingerCode != null)
                    {
                        temp.DeSerialize(item.FingerCode);

                        if (temp != null)
                        {
                            // Compare feature set with particular template.

                            ver.Verify(FeatureSet, temp, ref res);

                            if (res.Verified)
                            {
                                guardiansTakeAwayForm.guardian = item;

                                this.Close();
                                break;
                            }
                        }
                    }
                    
                }
            }

            
            
            if (!res.Verified)
                Status = DPFP.Gui.EventHandlerStatus.Failure;

        }
 public static DPFP.Template ProcessDBTemplate(byte[] _data)
 {
     DPFP.Template _template = null;
     Stream _ms = new MemoryStream(_data);
     _template = new DPFP.Template();
     //deserialize
     _template.DeSerialize(_ms);
     return _template;
 }
    public void OnComplete(object Control, DPFP.FeatureSet FeatureSet, ref DPFP.Gui.EventHandlerStatus Status) {
      DPFP.Verification.Verification ver = new DPFP.Verification.Verification();
      DPFP.Verification.Verification.Result res = new DPFP.Verification.Verification.Result();

            string conStr = "Data Source=.; Initial Catalog=Registration; Integrated Security=true";

            SqlConnection con = new SqlConnection(conStr);
            SqlCommand cmd = new SqlCommand("Select FingerPrintData from FingerPrints where Id = 6", con);

            con.Open();

            byte[] userFingerPrintData = new byte[0];

            using (con)
            {
                userFingerPrintData = cmd.ExecuteScalar() as byte[];
            }

            DPFP.Template temp = new DPFP.Template();
            temp.DeSerialize(userFingerPrintData);

            if (temp != null)
            {
                // Compare feature set with particular template.

                ver.Verify(FeatureSet, temp, ref res);
                Data.IsFeatureSetMatched = res.Verified;
                Data.FalseAcceptRate = res.FARAchieved;
            }


            // Compare feature set with all stored templates.
            foreach (DPFP.Template template in Data.Templates) {
        // Get template from storage.
        //if (template != null) {
        //  // Compare feature set with particular template.
          
        //  ver.Verify(FeatureSet, template, ref res);
        //  Data.IsFeatureSetMatched = res.Verified;
        //  Data.FalseAcceptRate = res.FARAchieved;
        //  if (res.Verified)
        //    break; // success
        //}
      }

      if (!res.Verified)
        Status = DPFP.Gui.EventHandlerStatus.Failure;

      Data.Update();
    }
 void UIFingerPrinter_OnTemplateEvent(object sender, DPFP.Template e)
 {
     if (e != null)
     {
         this.Dispatcher.Invoke(() =>
         {
             this.Dim.Animation_Opacity_View_Frame(false, () => { this.Dim.Visibility = System.Windows.Visibility.Hidden; });
         });
         this.Template = e;
     }
 }
        protected void Process(DPFP.Sample Sample)
        {
            MemSample = Sample;
            // Draw fingerprint sample image.
            DrawPicture(ConvertSampleToBitmap(Sample));

            DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Enrollment);
            // Check quality of the sample and add to enroller if it's good
            if (features != null)
            {
                try
                {
                    MakeReport("The fingerprint feature set was created.");
                    Enroller.AddFeatures(features);		// Add feature set to template.
                }
                finally
                {
                    //UpdateStatus();

                    // Check if template has been created.
                    switch (Enroller.TemplateStatus)
                    {
                        case DPFP.Processing.Enrollment.Status.Ready:	// report success and stop capturing
                            MemTemplate = Enroller.Template;
                            EnabledDisabledButton(true);
                            //OnTemplate(Enroller.Template);
                            //SetPrompt("Click Close, and then click Fingerprint Verification.");
                            //Stop();
                            break;

                        case DPFP.Processing.Enrollment.Status.Failed:	// report failure and restart capturing

                            SetStatus(string.Format("Faltan {0} Muestras!", Enroller.FeaturesNeeded));
                            Enroller.Clear();
                            MemTemplate = null;
                            EnabledDisabledButton(false);
                            //Stop();
                            //UpdateStatus();
                            //OnTemplate(null);
                            //Start();
                            break;
                        case DPFP.Processing.Enrollment.Status.Insufficient:
                            SetStatus(string.Format("Faltan {0} Muestras!", Enroller.FeaturesNeeded));
                            EnabledDisabledButton(false);
                            break;
                    }
                }
            }
        }