Пример #1
0
        private void guardarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (PermisoGuardar == true)
                {
                    if (_template == null)
                    {
                        MessageBox.Show("Error...");
                        return;
                    }
                    mEnroll dl = new mEnroll();
                    FingerprintTemplateDTO _templateDTO = new FingerprintTemplateDTO();

                    _templateDTO.Buffer  = _template.Buffer;
                    _templateDTO.Quality = _template.Quality;
                    dl.SaveTemplate(_templateDTO);

                    EliminarHuellaAntigua();

                    int    IIdUltimoTemplate = GetIdHuellaActual();
                    ByARpt ResAsigHuella     = AsignarHuellaPersona(IIdUltimoTemplate);
                    MessageBox.Show("Se asigno huella a la persona...");
                    this.Close();
                    //IGRDal dl = DalFactory.GetDal(GrConnector.AccessDal);
                    //dl.SaveTemplate(_template);
                }
                else
                {
                    MessageBox.Show("No se puede guardar, esta huella ya esta registrada...");
                }
            }
            catch { }
        }
Пример #2
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                //IGRDal dl = DalFactory.GetDal(GrConnector.AccessDal);
                //dl.SaveTemplate(_template);

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

                _templateDTO.Buffer  = _template.Buffer;
                _templateDTO.Quality = _template.Quality;

                dl.SaveTemplate(_templateDTO);

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                this.DialogResult = DialogResult.Abort;
                this.Close();
            }
        }
Пример #3
0
        private void enrollToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            try
            {
                if (_template == null)
                {
                    MessageBox.Show("Error, Null template");
                    return;
                }
                mEnroll dl = new mEnroll();
                FingerprintTemplateDTO _templateDTO = new FingerprintTemplateDTO();

                _templateDTO.Buffer  = _template.Buffer;
                _templateDTO.Quality = _template.Quality;
                dl.SaveTemplate(_templateDTO);

                //IGRDal dl = DalFactory.GetDal(GrConnector.AccessDal);
                //dl.SaveTemplate(_template);
            }
            catch { }
        }
Пример #4
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);
            }
        }
Пример #5
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);
            }
        }
Пример #6
0
        void refFingercore_onImage(object source, GriauleFingerprintLibrary.Events.ImageEventArgs ie)
        {
            rawImage = ie.RawImage;
            SetImage(ie.RawImage.Image);
            stepCount++;
            //ExtractTemplate();

            try
            {
                _template = new GriauleFingerprintLibrary.DataTypes.FingerprintTemplate();
                int ret = (int)refFingercore.Enroll(ie.RawImage, ref _template, GrTemplateFormat.GR_FORMAT_DEFAULT, FingerprintConstants.GR_DEFAULT_CONTEXT);
                if (ret >= FingerprintConstants.GR_ENROLL_SUFFICIENT)
                {
                    //IGRDal dl = DalFactory.GetDal(GrConnector.AccessDal);
                    //dl.SaveTemplate(template);

                    if (ret == FingerprintConstants.GR_ENROLL_SUFFICIENT)
                    {
                        SetStatusMessage("Sufficient quality value.");
                        PerformStep(QualityTemplate.SUF, Color.YellowGreen);
                    }
                    else if (ret == FingerprintConstants.GR_ENROLL_GOOD)
                    {
                        SetStatusMessage("Good quality value.");
                        PerformStep(QualityTemplate.GOOD, Color.MediumSeaGreen);
                    }
                    else if (ret == FingerprintConstants.GR_ENROLL_VERY_GOOD)
                    {
                        //IGRDal dl = DalFactory.GetDal(GrConnector.AccessDal);
                        //dl.SaveTemplate(_template);
                        BLL.mEnroll dl = new BLL.mEnroll();
                        //DB.AEF.EnrollDAO dl = new DB.AEF.EnrollDAO();
                        _templateDTO = new FingerprintTemplateDTO();

                        _templateDTO.Buffer  = _template.Buffer;
                        _templateDTO.Quality = _template.Quality;

                        dl.SaveTemplate(_templateDTO);

                        PerformStep(QualityTemplate.VERYGOOD, Color.SeaGreen);

                        this.DialogResult = DialogResult.OK;
                        this.Close();
                    }
                    else if (ret == FingerprintConstants.GR_ENROLL_MAX_LIMIT_REACHED)
                    {
                        //IGRDal dl = DalFactory.GetDal(GrConnector.AccessDal);
                        //dl.SaveTemplate(_template);

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

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

                        _templateDTO.Buffer  = _template.Buffer;
                        _templateDTO.Quality = _template.Quality;

                        dl.SaveTemplate(_templateDTO);

                        this.DialogResult = DialogResult.OK;
                        this.Close();
                    }

                    EnableOk();
                }
                else
                {
                    // WriteLog("The Template does not reach a good quality value");
                    SetStatusMessage("Please put your finger again");
                    PerformStep(QualityTemplate.INSF, Color.LightCoral);
                }
            }
            catch { }


            System.Threading.Thread.Sleep(100);
        }