Exemple #1
0
        public int Verify(FingerPrintMatchInputModel input)
        {
            InitializeDevice();

            int   matchedRecord = 0;
            Int32 err           = 0;

            Byte[] fingerprint = Convert.FromBase64String(input.FingerPrintTemplate);

            foreach (var data in input.FingerPrintTemplateListToMatch)
            {
                SGFPMISOTemplateInfo sample_info = new SGFPMISOTemplateInfo();

                byte[] byteTemplate = Convert.FromBase64String(data.Template);
                err = m_FPM.GetIsoTemplateInfo(byteTemplate, sample_info);

                for (int i = 0; i < sample_info.TotalSamples; i++)
                {
                    bool matched = false;
                    err = m_FPM.MatchIsoTemplate(byteTemplate, i, fingerprint, 0, m_SecurityLevel, ref matched);
                    if (matched)
                    {
                        matchedRecord = data.PatienId;
                        break;
                    }
                }
            }

            return(matchedRecord);
        }
Exemple #2
0
        protected void ComparaBiometria()
        {
            bool matched = false;

            LG = new EscreverLog();
            LG.Esrevelog("Processando comparações...", lbLogComparativo);
            similares    = "Biometria compatível com: ";
            lbnomes.Text = string.Empty;
            for (int i = 0; i <= ds.TBUsuarioLocal.Rows.Count - 1; i++)
            {
                lbnomes.Text = string.Format("Comparando com: {0}", ds.TBUsuarioLocal[i].DSUsuario).Trim();
                SGFPMISOTemplateInfo sample_info = new SGFPMISOTemplateInfo();
                error = m_FPM.GetIsoTemplateInfo(ds.TBUsuarioLocal[i].Template1, sample_info);

                for (int z = 0; z <= sample_info.TotalSamples; z++)
                {
                    error = m_FPM.MatchIsoTemplate(ds.TBUsuarioLocal[i].Template1, z, m_VrfMin, 0, SecuGen.FDxSDKPro.Windows.SGFPMSecurityLevel.NORMAL, ref matched);

                    if (matched)
                    {
                        //Se deu match. Listar o nome na listbox.
                        LG.Esrevelog(string.Format("Biometria compativa com: {0}", ds.TBUsuarioLocal[i].DSUsuario), lbLogComparativo);
                        similares += ds.TBUsuarioLocal[i].DSUsuario;

                        pontonarede.ServiceSoapClient WebS = new pontonarede.ServiceSoapClient("ServiceSoap", utilConexao.tcm.UrlWS);
                        WebS.Endpoint.Binding.OpenTimeout    = TimeSpan.FromSeconds(10); //OpenTimeout p/ 3 e SendTimeout p 15
                        WebS.Endpoint.Binding.SendTimeout    = TimeSpan.FromSeconds(15);
                        WebS.Endpoint.Binding.ReceiveTimeout = TimeSpan.FromSeconds(7);

                        //msg = WebS.BaterPonto(45, 410, Convert.ToInt32(ds.TBUsuarioLocal[i].IDUsuario), DateTime.Now, "TentoWebServiceNovamente7x24dm12");
                        WebS.Close();
                    }
                }
            }
            if (matched)
            {
                MessageBox.Show("Biometria compatível com os nomes listados na caixa de texto.");
                lbnomes.Text = string.Format("Total de usuários comparados: ", ds.TBUsuarioLocal.Rows.Count);
            }
            else
            {
                MessageBox.Show("Não foram encontradas compatibilidades com o usuário selecionado.");
                lbnomes.Text = string.Format("Total de usuários comparados: {0}", ds.TBUsuarioLocal.Rows.Count);
                lbLogComparativo.Items.Clear();
            }
        }
Exemple #3
0
        /////////////////////////////////////
        private void BtnRegister_Click(object sender, System.EventArgs e)
        {
            bool  matched = false;
            Int32 err     = 0;

            err = m_FPM.MatchTemplate(m_RegMin1, m_RegMin2, m_SecurityLevel, ref matched);

            if ((err == (Int32)SGFPMError.ERROR_NONE))
            {
                if (matched)
                {
                    // Save template after merging two template - m_FetBuf1, m_FetBuf2
                    Byte[] merged_template;
                    Int32  buf_size = 0;

                    if (m_useAnsiTemplate)
                    {
                        m_FPM.GetTemplateSizeAfterMerge(m_RegMin1, m_RegMin2, ref buf_size);
                        merged_template = new Byte[buf_size];
                        m_FPM.MergeAnsiTemplate(m_RegMin1, m_RegMin2, merged_template);
                    }
                    else
                    {
                        m_FPM.GetIsoTemplateSizeAfterMerge(m_RegMin1, m_RegMin2, ref buf_size);
                        merged_template = new Byte[buf_size];
                        m_FPM.MergeIsoTemplate(m_RegMin1, m_RegMin2, merged_template);
                    }

                    if (m_StoredTemplate == null)
                    {
                        m_StoredTemplate = new Byte[buf_size];
                        merged_template.CopyTo(m_StoredTemplate, 0);
                    }
                    else
                    {
                        Int32 new_size = 0;

                        if (m_useAnsiTemplate)
                        {
                            err = m_FPM.GetTemplateSizeAfterMerge(m_StoredTemplate, merged_template, ref new_size);
                        }
                        else
                        {
                            err = m_FPM.GetIsoTemplateSizeAfterMerge(m_StoredTemplate, merged_template, ref new_size);
                        }

                        Byte[] new_enroll_template = new Byte[new_size];

                        if (m_useAnsiTemplate)
                        {
                            err = m_FPM.MergeAnsiTemplate(merged_template, m_StoredTemplate, new_enroll_template);
                        }
                        else
                        {
                            err = m_FPM.MergeIsoTemplate(merged_template, m_StoredTemplate, new_enroll_template);
                        }

                        m_StoredTemplate = new Byte[new_size];

                        new_enroll_template.CopyTo(m_StoredTemplate, 0);
                    }

                    // Let's display ANSI/ISO template Info
                    for (int i = 0; i < m_RadioButton.Length; i++)
                    {
                        m_RadioButton[i].Checked = false;
                    }

                    if (m_useAnsiTemplate)
                    {
                        SGFPMANSITemplateInfo sample_info = new SGFPMANSITemplateInfo();
                        err = m_FPM.GetAnsiTemplateInfo(m_StoredTemplate, sample_info);
                        for (int i = 0; i < sample_info.TotalSamples; i++)
                        {
                            m_RadioButton[(Int32)sample_info.SampleInfo[i].FingerNumber].Checked = true;
                        }
                    }
                    else
                    {
                        SGFPMISOTemplateInfo sample_info = new SGFPMISOTemplateInfo();
                        err = m_FPM.GetIsoTemplateInfo(m_StoredTemplate, sample_info);
                        for (int i = 0; i < sample_info.TotalSamples; i++)
                        {
                            m_RadioButton[(Int32)sample_info.SampleInfo[i].FingerNumber].Checked = true;
                        }
                    }

                    StatusBar.Text = "Template registration success";
                }
                else
                {
                    StatusBar.Text = "Template registration failed";
                }
            }
            else
            {
                StatusBar.Text = "MatchTemplate() Error: " + err;
            }
        }