/// <summary> /// Captura una imagen de una huella /// </summary> private void getImage() { Huella.Dedo tipoDedo; Huella.Estatus estatus = Huella.Estatus.nueva; Enum.TryParse <Huella.Dedo>(this.cmbDedos.SelectedValue.ToString(), out tipoDedo); if (this.oEmpleado.Fingerprints.Count(item => ((Huella)item).dedo == tipoDedo) != 0) { if (MessageBox.Show("El usuario ya cuenta con un registro para el dedo seleccionado,¿Desea capturarlo nuevamente?", "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No) { return; } else { this.oEmpleado.Fingerprints.Where(item => ((Huella)item).dedo == tipoDedo).ToList().ForEach(item => ((Huella)item).estatus = Huella.Estatus.baja); //this.oEmpleado.Fingerprints.Remove(this.oEmpleado.Fingerprints.Where(huella => ((Huella)huella).dedo == tipoDedo).FirstOrDefault()); } } ClsRetorno oRetorno = this.oEscanner.getImage(Sesion.getRuta() + "\\" + txtCURP.Text.Trim(), tipoDedo); if (oRetorno == null) { return; } if (oRetorno.calidad < 50) { MessageBox.Show("La calidad de la captura es inferior a la aceptada, repita la captura"); return; } this.oEmpleado.Fingerprints.Add(new Huella(this.oEmpleado.Fingerprints.Count + 1, oRetorno.ruta, tipoDedo, estatus)); fillGridView(); }
private void capturarHuella() { this.lstMensajes = new List <string>(); String fecha = DateTime.Now.ToString("yyyy_MM_dd_HH_MM_ss"); ClsRetorno oRetorno = this.oEscanner.getImage(Sesion.getRuta() + "\\" + fecha, Huella.Dedo.Izq_Indice); if (oRetorno == null) { return; } Empleado empleadoX = new Empleado(); empleadoX.Fingerprints.Add(new Huella(1, oRetorno.ruta, Huella.Dedo.Izq_Indice)); Empleado empleadoIdentificado = this.oIdentificacion.identificarEmpleado(empleadoX); if (empleadoIdentificado != null) { this.oRegistro = new Registro() { empleado = new Empleado() { IdEmpleado = empleadoIdentificado.IdEmpleado, } }; this.oRegistro.insertar(); this.lstMensajes.Add(empleadoIdentificado.Nombres + " " + empleadoIdentificado.ApellidoPat + "\r\n" + this.oRegistro.fechaRegistro.ToLongTimeString()); this.lstMensajes.Add("Acceso Correcto"); } else { this.lstMensajes.Add("Empleado no encontrado"); this.lstMensajes.Add("Acceso Incorrecto"); this.lstMensajes.Add("Error"); } eliminarArchivo(oRetorno.ruta); }