private void Identify() { GriauleFingerprintLibrary.DataTypes.FingerprintTemplate testTemplate = null; try { if ((_template != null) && (_template.Size > 0)) { fingerPrint.IdentifyPrepare(_template); IGRDal dl = DalFactory.GetDal(GrConnector.AccessDal); IDataReader dataReader = dl.GetTemplates(); using (dataReader) { while (dataReader.Read()) { int tempId = Convert.ToInt32(dataReader["ID"]); byte[] buff = (byte[])dataReader["template"]; int quality = Convert.ToInt32(dataReader["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"); 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 { } }
public void Verificar() { VerifyDialog verify = new VerifyDialog(); if (verify.ShowDialog(this) == DialogResult.OK) { int verifyCode = Convert.ToInt32(verify.VerifyCode); if ((_template != null) && (_template.Size > 0)) { try { fingerPrint.IdentifyPrepare(_template); mEnroll dl = new mEnroll(); 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; GriauleFingerprintLibrary.DataTypes.FingerprintTemplate testTemplate = new GriauleFingerprintLibrary.DataTypes.FingerprintTemplate(); testTemplate.Size = buff.Length; testTemplate.Buffer = buff; int score; if (Identify(testTemplate, out score)) { //WriteLog(string.Format("Fingerprint matched, ID:{0} - Score: {1}", tempId, score)); DisplayImage(_template, true); return; } // WriteLog("Fingerprint not found."); } } catch { } } else { // WriteLog("Must acquire a finger print image and extract a template, before verify within the database"); } } }
private void ExtractTemplate() { if (rawImage != null) { try { _template = null; fingerPrint.Extract(rawImage, ref _template); SetQualityBar(_template.Quality); DisplayImage(_template, false); } catch { SetQualityBar(-1); } } }
private void DisplayImage(GriauleFingerprintLibrary.DataTypes.FingerprintTemplate template, bool identify) { IntPtr hdc = FingerprintCore.GetDC(); IntPtr image = new IntPtr(); if (identify) { fingerPrint.GetBiometricDisplay(template, rawImage, hdc, ref image, FingerprintConstants.GR_DEFAULT_CONTEXT); } else { fingerPrint.GetBiometricDisplay(template, rawImage, hdc, ref image, FingerprintConstants.GR_NO_CONTEXT); } SetImage(Bitmap.FromHbitmap(image)); FingerprintCore.ReleaseDC(hdc); }
protected override void InternalSaveTemplate(byte fingerCode, GriauleFingerprintLibrary.DataTypes.FingerprintTemplate fingerPrintTemplate) { base.InternalSaveTemplate(fingerCode, fingerPrintTemplate); using (SqlCommand cmd = new SqlCommand()) { try { cmd.Connection = (SqlConnection)Connection; string cmdStr = String.Format("SELECT COUNT(*) n FROM [{0}] WHERE [{1}]=@individual AND [{2}]=@finger", TemplateTable, IndividualFieldName, FingerFieldName); cmd.CommandText = cmdStr; cmd.Parameters.AddWithValue("@individual", ActiveIndividual); cmd.Parameters.AddWithValue("@finger", fingerCode); int cnt = (int)cmd.ExecuteScalar(); if (cnt > 0) //Finger template already exists, update { cmdStr = String.Format("UPDATE [{0}] SET [{1}]=@template, SET [{2}]=@quality WHERE [{3}]=@individual AND [{4}]=@finger", TemplateTable, TemplateFieldName, QualityFieldName, IndividualFieldName, FingerFieldName); } else //Finger template doesn't exist, insert { cmdStr = String.Format("INSERT INTO [{0}] ([{1}],[{2}],[{3}],[{4}]) VALUES (@individual,@finger,@template,@quality)", TemplateTable, IndividualFieldName, FingerFieldName, TemplateFieldName, QualityFieldName); } cmd.CommandText = cmdStr; //cmd.Parameters.AddWithValue("@individual", ActiveIndividual); //Already set //cmd.Parameters.AddWithValue("@finger", fingerCode); //Already set cmd.Parameters.AddWithValue("@template", fingerPrintTemplate.Buffer); cmd.Parameters.AddWithValue("@quality", fingerPrintTemplate.Quality); int rowsAffected = cmd.ExecuteNonQuery(); if (rowsAffected == 0) { throw new FPLibraryException(FPLibraryException.LibraryDalError, String.Format("Template not saved for individual {0} finger {1}", ActiveIndividual, fingerCode)); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private bool Identify(GriauleFingerprintLibrary.DataTypes.FingerprintTemplate testTemplate, out int score) { return(fingerPrint.Identify(testTemplate, out score) == 1? true : false); }
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); } }
void core_onImage(object source, GriauleFingerprintLibrary.Events.ImageEventArgs ie) { try { huella = ie.RawImage; core.Extract(huella, ref template); label4.Text = "";//"Espere, identificando..."; bool haveHorarios = false; string consulta; byte[] dataTemp; GriauleFingerprintLibrary.DataTypes.FingerprintTemplate templateTemp; int precision, calidad; // selecciono consulta = "select id, rol, concat_ws(' ', nombre, apellidoPaterno, apellidoMaterno) as nombreCompleto, template, calidad_template, foto from usuarios where template is not null and 1 = 1"; MySqlDataReader reader = this.EjecutarQuery(consulta); core.IdentifyPrepare(template); bool match = false; while (reader.Read()) { Log.WriteLog("Recorriendo usuarios."); dataTemp = (byte[])reader["template"]; calidad = (int)reader["calidad_template"]; templateTemp = new GriauleFingerprintLibrary.DataTypes.FingerprintTemplate(); templateTemp.Buffer = dataTemp; templateTemp.Size = dataTemp.Length; templateTemp.Quality = calidad; int result = core.Identify(templateTemp, out precision); if (result == 1) { Usuario = reader["id"].ToString(); string nombreCompleto = reader["nombreCompleto"].ToString(); string rol = reader["rol"].ToString(); string foto = reader["foto"].ToString(); Rol = rol; Log.WriteLog("Encontre al Usuario - " + reader["nombreCompleto"].ToString()); string inout = new Rules().isInOut(Usuario); if (inout == "In") { Log.WriteLog(inout); if (Rol == "Cliente") { List<Horario> horarios = this.getHorarios(Usuario); if (horarios.Count > 0) { haveHorarios = true; } else { Log.WriteLog("No hay horarios disponibles."); MessageBox.Show("Lo sentimos no contamos con horarios disponibles"); //clean(); } if (haveHorarios) { label4.Text = ""; dataGridView1.DataSource = horarios; label2.Text = "Bienvenido " + nombreCompleto; mensualidad.Text = new Rules().ProximoPago(Usuario); Log.WriteLog("Encontre horarios para - " + nombreCompleto); if (!String.IsNullOrEmpty(foto)) { fotoGrafia.ImageLocation = @"c:\wamp\www\gym\fotos\" + foto; } this.WindowState = FormWindowState.Normal; } } else if (Rol == "Instructor") { label4.Text = ""; dataGridView1.DataSource = null; label2.Text = "Bienvenido " + nombreCompleto; if (!String.IsNullOrEmpty(foto)) { fotoGrafia.ImageLocation = @"c:\wamp\www\gym\fotos\" + foto; } this.WindowState = FormWindowState.Normal; Log.WriteLog("Bienvenido Instructor - " + nombreCompleto); } } else { if (new Rules().registrarSalida(Usuario)) { Log.WriteLog("Se registro la salida - " + nombreCompleto); label2.Text = "Hasta pronto " + nombreCompleto; if (!String.IsNullOrEmpty(foto)) { fotoGrafia.ImageLocation = @"c:\wamp\www\gym\fotos\" + foto; } this.WindowState = FormWindowState.Normal; this.button2.Visible = true; } } match = true; break; } } if(!match) { label4.Text = "Usuario no registrado, te invitamos a darte de alta"; Log.WriteLog("No se encontro ni un usuario"); //clean(); this.WindowState = FormWindowState.Normal; } } catch (Exception ex) { MessageBox.Show(ex.Message); Log.WriteLog(ex.Message); } }
internal void setTemplate(GriauleFingerprintLibrary.DataTypes.FingerprintTemplate _template) { this._template = _template; }
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); } }
void core_onImage(object source, GriauleFingerprintLibrary.Events.ImageEventArgs ie) { try { huella = ie.RawImage; core.Extract(huella, ref template); label4.Text = "";//"Espere, identificando..."; bool haveHorarios = false; string consulta; byte[] dataTemp; GriauleFingerprintLibrary.DataTypes.FingerprintTemplate templateTemp; int precision, calidad; // selecciono consulta = "select id, rol, concat_ws(' ', nombre, apellidoPaterno, apellidoMaterno) as nombreCompleto, template, calidad_template, foto from usuarios where template is not null and 1 = 1"; MySqlDataReader reader = this.EjecutarQuery(consulta); core.IdentifyPrepare(template); bool match = false; while (reader.Read()) { Log.WriteLog("Recorriendo usuarios."); dataTemp = (byte[])reader["template"]; calidad = (int)reader["calidad_template"]; templateTemp = new GriauleFingerprintLibrary.DataTypes.FingerprintTemplate(); templateTemp.Buffer = dataTemp; templateTemp.Size = dataTemp.Length; templateTemp.Quality = calidad; int result = core.Identify(templateTemp, out precision); if (result == 1) { Usuario = reader["id"].ToString(); string nombreCompleto = reader["nombreCompleto"].ToString(); string rol = reader["rol"].ToString(); string foto = reader["foto"].ToString(); Rol = rol; Log.WriteLog("Encontre al Usuario - " + reader["nombreCompleto"].ToString()); string inout = new Rules().isInOut(Usuario); if (inout == "In") { Log.WriteLog(inout); if (Rol == "Cliente") { List <Horario> horarios = this.getHorarios(Usuario); if (horarios.Count > 0) { haveHorarios = true; } else { Log.WriteLog("No hay horarios disponibles."); MessageBox.Show("Lo sentimos no contamos con horarios disponibles"); //clean(); } if (haveHorarios) { label4.Text = ""; dataGridView1.DataSource = horarios; label2.Text = "Bienvenido " + nombreCompleto; mensualidad.Text = new Rules().ProximoPago(Usuario); Log.WriteLog("Encontre horarios para - " + nombreCompleto); if (!String.IsNullOrEmpty(foto)) { fotoGrafia.ImageLocation = @"c:\wamp\www\gym\fotos\" + foto; } this.WindowState = FormWindowState.Normal; } } else if (Rol == "Instructor") { label4.Text = ""; dataGridView1.DataSource = null; label2.Text = "Bienvenido " + nombreCompleto; if (!String.IsNullOrEmpty(foto)) { fotoGrafia.ImageLocation = @"c:\wamp\www\gym\fotos\" + foto; } this.WindowState = FormWindowState.Normal; Log.WriteLog("Bienvenido Instructor - " + nombreCompleto); } } else { if (new Rules().registrarSalida(Usuario)) { Log.WriteLog("Se registro la salida - " + nombreCompleto); label2.Text = "Hasta pronto " + nombreCompleto; if (!String.IsNullOrEmpty(foto)) { fotoGrafia.ImageLocation = @"c:\wamp\www\gym\fotos\" + foto; } this.WindowState = FormWindowState.Normal; this.button2.Visible = true; } } match = true; break; } } if (!match) { label4.Text = "Usuario no registrado, te invitamos a darte de alta"; Log.WriteLog("No se encontro ni un usuario"); //clean(); this.WindowState = FormWindowState.Normal; } } catch (Exception ex) { MessageBox.Show(ex.Message); Log.WriteLog(ex.Message); } }
private void button2_Click(object sender, EventArgs e) { VerifyDialog verify = new VerifyDialog(); if (verify.ShowDialog(this) == DialogResult.OK) { int verifyCode = Convert.ToInt32(verify.VerifyCode); if ((_template != null) && (_template.Size > 0) ) { try { fingerPrint.IdentifyPrepare(_template); IGRDal dl = DalFactory.GetDal(GrConnector.AccessDal); IDataReader dataReader = dl.GetTemplate(verifyCode); using (dataReader) { while (dataReader.Read()) { int tempId = Convert.ToInt32(dataReader["ID"]); byte[] buff = (byte[])dataReader["template"]; GriauleFingerprintLibrary.DataTypes.FingerprintTemplate testTemplate = new GriauleFingerprintLibrary.DataTypes.FingerprintTemplate(); testTemplate.Size = buff.Length; testTemplate.Buffer = buff; int score; if (Identify(testTemplate, out score)) { // WriteLog(string.Format("Fingerprint matched, ID:{0} - Score: {1}", tempId, score)); DisplayImage(_template, true); return; } } // WriteLog("Fingerprint not found."); } } catch { } } else { // WriteLog("Must acquire a finger print image and extract a template, before verify within the database"); } } }
private void Identify() { GriauleFingerprintLibrary.DataTypes.FingerprintTemplate testTemplate = null; try { if ((_template != null) && (_template.Size > 0)) { fingerPrint.IdentifyPrepare(_template); IGRDal dl = DalFactory.GetDal(GrConnector.AccessDal); IDataReader dataReader = dl.GetTemplates(); using (dataReader) { while (dataReader.Read()) { int tempId = Convert.ToInt32(dataReader["Enroll_ID"]); byte[] buff = (byte[])dataReader["template"]; int quality = Convert.ToInt32(dataReader["quality"]); testTemplate = new GriauleFingerprintLibrary.DataTypes.FingerprintTemplate(); testTemplate.Size = buff.Length; testTemplate.Buffer = buff; testTemplate.Quality = quality; int score; string name = Convert.ToString(dataReader["Name"]); string info = Convert.ToString(dataReader["Info"]); if (dataReader["Name"] == null) name = "Invalid"; if (dataReader["Info"] == null) info = "Invalid"; if (Identify(testTemplate, out score)) { SetMatchBar(score , Color.SeaGreen); SetStatusMessage("Template Matched"); DisplayImage(_template, true); DisplayUser(name,info); return; } else { SetMatchBar(score, Color.LightCoral); SetStatusMessage("Template Unmatched"); } SynchronousSocketListener.StartClient(name + "[{sep}]" + info); } SetMatchBar(0,Color.Gray); SetStatusMessage("Template Unmatched"); DisplayNewUser(_template); } } } 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 { } }
private void ExtractTemplate() { if (rawImage != null) { try { _template = null; fingerPrint.Extract(rawImage, ref _template); SetQualityBar(_template.Quality); DisplayImage(_template, false); } catch { SetQualityBar(-1); } } }
private void button2_Click(object sender, EventArgs e) { VerifyDialog verify = new VerifyDialog(); if (verify.ShowDialog(this) == DialogResult.OK) { int verifyCode = Convert.ToInt32(verify.VerifyCode); if ((_template != null) && (_template.Size > 0)) { try { fingerPrint.IdentifyPrepare(_template); IGRDal dl = DalFactory.GetDal(GrConnector.AccessDal); IDataReader dataReader = dl.GetTemplate(verifyCode); using (dataReader) { while (dataReader.Read()) { int tempId = Convert.ToInt32(dataReader["ID"]); byte[] buff = (byte[])dataReader["template"]; GriauleFingerprintLibrary.DataTypes.FingerprintTemplate testTemplate = new GriauleFingerprintLibrary.DataTypes.FingerprintTemplate(); testTemplate.Size = buff.Length; testTemplate.Buffer = buff; int score; if (Identify(testTemplate, out score)) { // WriteLog(string.Format("Fingerprint matched, ID:{0} - Score: {1}", tempId, score)); DisplayImage(_template, true); return; } } // WriteLog("Fingerprint not found."); } } catch { } } else { // WriteLog("Must acquire a finger print image and extract a template, before verify within the database"); } } }
void core_onImage(object source, GriauleFingerprintLibrary.Events.ImageEventArgs ie) { try { WriteLog("Obteniendo Huella."); huella = ie.RawImage; core.Extract(huella, ref template); string consulta; byte[] dataTemp; GriauleFingerprintLibrary.DataTypes.FingerprintTemplate templateTemp; int precision, calidad; // selecciono consulta = "select id, id as no_empleado, telefono, rfc, rol, concat_ws(' ', nombre, apellidoPaterno, apellidoMaterno) as nombreCompleto, template, calidad_template, foto from usuarios where template is not null and 1 = 1"; MySqlDataReader reader = this.EjecutarQuery(consulta); core.IdentifyPrepare(template); while (reader.Read()) { dataTemp = (byte[])reader["template"]; calidad = (int)reader["calidad_template"]; templateTemp = new GriauleFingerprintLibrary.DataTypes.FingerprintTemplate(); templateTemp.Buffer = dataTemp; templateTemp.Size = dataTemp.Length; templateTemp.Quality = calidad; int result = core.Identify(templateTemp, out precision); WriteLog("Resultado: " + result.ToString() + " Precision: " + precision.ToString()); if (result == 1) { // Usuario = reader["id"].ToString(); string no_Empleado = reader["no_empleado"].ToString(); string nombreCompleto = reader["nombreCompleto"].ToString(); string rfc = reader["rfc"].ToString(); string telefono = reader["telefono"].ToString(); string rol = reader["rol"].ToString(); string foto = reader["foto"].ToString(); Rol = rol; WriteLog("Huella encontrada."); WriteLog("Empleado: " + no_Empleado); string inout = new Rules().isInOut(Usuario); if (inout == "In") { if (new Rules().registrarEntrada(Usuario)) { this.no_personal.Text = no_Empleado; this.nombre_completo.Text = nombreCompleto; this.rfc.Text = rfc; this.telefono.Text = telefono; label1.Text = "Entrada"; if (!String.IsNullOrEmpty(foto)) { fotoGrafia.ImageLocation = @RutaFotos + foto; } this.WindowState = FormWindowState.Normal; WriteLog("Entrada Registrada. " + no_Empleado); } else { MessageBox.Show("No hemos podido registrar su entrada"); WriteLog("No hemos podido registrar su entrada" + no_Empleado); } } else { if (new Rules().registrarSalida(Usuario)) { this.no_personal.Text = no_Empleado; this.nombre_completo.Text = nombreCompleto; this.rfc.Text = rfc; this.telefono.Text = telefono; if (!String.IsNullOrEmpty(foto)) { fotoGrafia.ImageLocation = @RutaFotos + foto; } this.no_personal.Text = no_Empleado; this.nombre_completo.Text = nombreCompleto; this.rfc.Text = rfc; this.telefono.Text = telefono; label1.Text = "Salida"; if (!String.IsNullOrEmpty(foto)) { fotoGrafia.ImageLocation = @RutaFotos + foto; } this.WindowState = FormWindowState.Normal; WriteLog("Salida Registrada. " + no_Empleado); } } break; } else { WriteLog("No concuerda"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
void core_onImage(object source, GriauleFingerprintLibrary.Events.ImageEventArgs ie) { try { WriteLog("Obteniendo Huella."); huella = ie.RawImage; core.Extract(huella, ref template); string consulta; byte[] dataTemp; GriauleFingerprintLibrary.DataTypes.FingerprintTemplate templateTemp; int precision, calidad; // selecciono consulta = "select id, id as no_empleado, telefono, rfc, rol, concat_ws(' ', nombre, apellidoPaterno, apellidoMaterno) as nombreCompleto, template, calidad_template, foto from usuarios where template is not null and 1 = 1"; MySqlDataReader reader = this.EjecutarQuery(consulta); core.IdentifyPrepare(template); while (reader.Read()) { dataTemp = (byte[])reader["template"]; calidad = (int)reader["calidad_template"]; templateTemp = new GriauleFingerprintLibrary.DataTypes.FingerprintTemplate(); templateTemp.Buffer = dataTemp; templateTemp.Size = dataTemp.Length; templateTemp.Quality = calidad; int result = core.Identify(templateTemp, out precision); WriteLog("Resultado: "+result.ToString() + " Precision: " + precision.ToString()); if (result == 1) { // Usuario = reader["id"].ToString(); string no_Empleado = reader["no_empleado"].ToString(); string nombreCompleto = reader["nombreCompleto"].ToString(); string rfc = reader["rfc"].ToString(); string telefono = reader["telefono"].ToString(); string rol = reader["rol"].ToString(); string foto = reader["foto"].ToString(); Rol = rol; WriteLog("Huella encontrada."); WriteLog("Empleado: " + no_Empleado); string inout = new Rules().isInOut(Usuario); if (inout == "In") { if (new Rules().registrarEntrada(Usuario)) { this.no_personal.Text = no_Empleado; this.nombre_completo.Text = nombreCompleto; this.rfc.Text = rfc; this.telefono.Text = telefono; label1.Text = "Entrada"; if (!String.IsNullOrEmpty(foto)) { fotoGrafia.ImageLocation = @RutaFotos + foto; } this.WindowState = FormWindowState.Normal; WriteLog("Entrada Registrada. " + no_Empleado); } else { MessageBox.Show("No hemos podido registrar su entrada"); WriteLog("No hemos podido registrar su entrada" + no_Empleado); } } else { if (new Rules().registrarSalida(Usuario)) { this.no_personal.Text = no_Empleado; this.nombre_completo.Text = nombreCompleto; this.rfc.Text = rfc; this.telefono.Text = telefono; if (!String.IsNullOrEmpty(foto)) { fotoGrafia.ImageLocation = @RutaFotos + foto; } this.no_personal.Text = no_Empleado; this.nombre_completo.Text = nombreCompleto; this.rfc.Text = rfc; this.telefono.Text = telefono; label1.Text = "Salida"; if (!String.IsNullOrEmpty(foto)) { fotoGrafia.ImageLocation = @RutaFotos + foto; } this.WindowState = FormWindowState.Normal; WriteLog("Salida Registrada. " + no_Empleado); } } break; } else { WriteLog("No concuerda"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }