Пример #1
0
        private void Identify()
        {
            GriauleFingerprintLibrary.DataTypes.FingerprintTemplate testTemplate = null;
            try
            {
                if ((_template != null) && (_template.Size > 0))
                {
                    fingerPrint.IdentifyPrepare(_template);

                    //DB.AEF.EnrollDAO dl = new DB.AEF.EnrollDAO();

                    BLL.mEnroll dl = new BLL.mEnroll();
                    //DB.AEF.EnrollDAO dl = new DB.AEF.EnrollDAO();
                    FingerprintTemplateDTO _templateDTO = new FingerprintTemplateDTO();

                    //IGRDal dl = DalFactory.GetDal(GrConnector.AccessDal);
                    List <FingerprintTemplateDTO> lst = dl.GetTemplates();
                    //IDataReader dataReader = dl.GetTemplates();
                    foreach (var item in lst)
                    {
                        int    tempId  = item.ID;
                        byte[] buff    = item.Buffer;
                        int    quality = item.Quality;

                        testTemplate = new GriauleFingerprintLibrary.DataTypes.FingerprintTemplate();

                        testTemplate.Size    = buff.Length;
                        testTemplate.Buffer  = buff;
                        testTemplate.Quality = quality;

                        int score;
                        if (Identify(testTemplate, out score))
                        {
                            SetMatchBar(score, Color.SeaGreen);
                            SetStatusMessage("Template Matched" + item.ID.ToString());
                            DisplayImage(_template, true);

                            return;
                        }
                        else
                        {
                            SetMatchBar(score, Color.LightCoral);
                            SetStatusMessage("Template Unmatched");
                        }
                    }

                    SetMatchBar(0, Color.Gray);
                    SetStatusMessage("Template Unmatched");
                }
            }
            catch (FingerprintException ge)
            {
                if (ge.ErrorCode == -8)
                {
                    System.IO.FileStream   dumpTemplate = System.IO.File.Create(@".\Dumptemplate.gt");
                    System.IO.StreamWriter stWriter     = new System.IO.StreamWriter(dumpTemplate);

                    stWriter.WriteLine(BitConverter.ToString(testTemplate.Buffer, 0));
                    stWriter.Close();
                }
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
Пример #2
0
        private void Identify()
        {
            GriauleFingerprintLibrary.DataTypes.FingerprintTemplate testTemplate = null;
            try
            {
                if ((_template != null) && (_template.Size > 0))
                {
                    fingerPrint.IdentifyPrepare(_template);

                    //DB.AEF.EnrollDAO dl = new DB.AEF.EnrollDAO();

                    BLL.mEnroll dl = new BLL.mEnroll();
                    //DB.AEF.EnrollDAO dl = new DB.AEF.EnrollDAO();
                    FingerprintTemplateDTO _templateDTO = new FingerprintTemplateDTO();

                    //IGRDal dl = DalFactory.GetDal(GrConnector.AccessDal);
                    List <FingerprintTemplateDTO> lst = dl.GetTemplates();
                    //IDataReader dataReader = dl.GetTemplates();
                    foreach (var item in lst)
                    {
                        int    tempId  = item.ID;
                        byte[] buff    = item.Buffer;
                        int    quality = item.Quality;

                        testTemplate = new GriauleFingerprintLibrary.DataTypes.FingerprintTemplate();

                        testTemplate.Size    = buff.Length;
                        testTemplate.Buffer  = buff;
                        testTemplate.Quality = quality;

                        int score;
                        if (Identify(testTemplate, out score))
                        {
                            SetMatchBar(score, Color.SeaGreen);
                            es_tercerosFotoDto tercero       = GetPersonaId(item.ID);
                            string             NombrePersona = tercero.nombre;
                            DateTime           hora          = DateTime.Now;
                            mEntradasSalidas   objES         = new mEntradasSalidas();
                            ByARpt             respuesta     = objES.NuevoRegistro(tercero.terceroid);
                            foto = tercero.foto;
                            ultimosEventos.Add(respuesta.Mensaje.Substring(0, 3) + ".: " + tercero.nombre + " - " + hora.ToString().Substring(10));
                            setMostrar(tercero.nombre, respuesta.Mensaje, hora.ToString());
                            //SetStatusMessage(respuesta.Mensaje + ": " + NombrePersona + " Hora: " + hora);
                            DisplayImage(_template, true);



                            return;
                        }
                        else
                        {
                            SetMatchBar(score, Color.LightCoral);
                            SetStatusMessage("Huella no encontrada");
                        }
                    }

                    SetMatchBar(0, Color.Gray);
                    SetStatusMessage("Huella no encontrada");
                }
            }
            catch (FingerprintException ge)
            {
                if (ge.ErrorCode == -8)
                {
                    System.IO.FileStream   dumpTemplate = System.IO.File.Create(@".\Dumptemplate.gt");
                    System.IO.StreamWriter stWriter     = new System.IO.StreamWriter(dumpTemplate);

                    stWriter.WriteLine(BitConverter.ToString(testTemplate.Buffer, 0));
                    stWriter.Close();
                }
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }