private Task <bool> CompareImputado(byte[] Huella = null, enumTipoBiometrico?Finger = null) { var bytesHuella = FingerPrintData != null?FeatureExtraction.CreateFmdFromFid(FingerPrintData, Constants.Formats.Fmd.ANSI).Data.Bytes : null ?? Huella; var verifyFinger = Finger ?? (DD_Dedo.HasValue ? DD_Dedo.Value : enumTipoBiometrico.INDICE_DERECHO); if (bytesHuella == null) { Application.Current.Dispatcher.Invoke((System.Action)(delegate { if (Finger == null) { ScannerMessage = "Vuelve a capturar las huellas"; } else { ScannerMessage = "Siguiente Huella"; } AceptarBusquedaHuellaFocus = true; ColorMessage = new SolidColorBrush(Colors.DarkOrange); ShowLine = Visibility.Collapsed; })); } Application.Current.Dispatcher.Invoke((System.Action)(delegate { ScannerMessage = "Procesando..."; ColorMessage = new SolidColorBrush(System.Windows.Media.Color.FromRgb(51, 115, 242)); AceptarBusquedaHuellaFocus = false; })); var Service = new BiometricoServiceClient(); if (Service == null) { Application.Current.Dispatcher.Invoke((System.Action)(delegate { ScannerMessage = "Error en el servicio de comparacion"; AceptarBusquedaHuellaFocus = true; ColorMessage = new SolidColorBrush(Colors.Red); ShowLine = Visibility.Collapsed; })); } var CompareResult = Service.CompararHuellaImputado(new ComparationRequest { BIOMETRICO = bytesHuella, ID_TIPO_BIOMETRICO = verifyFinger, ID_TIPO_FORMATO = enumTipoFormato.FMTO_DP }); if (CompareResult.Identify) { ListResultado = ListResultado ?? new List <ResultadoBusquedaBiometrico>(); foreach (var item in CompareResult.Result) { var imputado = new cImputadoBiometrico().GetData().Where(w => w.ID_ANIO == item.ID_ANIO && w.ID_CENTRO == item.ID_CENTRO && w.ID_IMPUTADO == item.ID_IMPUTADO && w.ID_TIPO_BIOMETRICO == (DD_Dedo.HasValue ? (short)DD_Dedo.Value : (short)enumTipoBiometrico.INDICE_DERECHO) && w.ID_FORMATO == (short)enumTipoFormato.FMTO_DP).FirstOrDefault(); if (imputado == null) { ScannerMessage = "Registro no encontrado"; TextoBoton = "Crear Nuevo Expediente"; ColorMessage = new SolidColorBrush(Colors.Red); return(TaskEx.FromResult(false)); } Imputado = imputado.IMPUTADO; ShowContinuar = Visibility.Collapsed; if (imputado == null) { continue; } Application.Current.Dispatcher.Invoke((System.Action)(delegate { var ingresobiometrico = imputado.IMPUTADO.INGRESO.OrderByDescending(o => o.ID_INGRESO).FirstOrDefault(); var FotoBusquedaHuella = new Imagenes().ConvertByteToBitmap(new Imagenes().getImagenPerson()); if (ingresobiometrico != null) { if (ingresobiometrico.INGRESO_BIOMETRICO.Any()) { if (ingresobiometrico.INGRESO_BIOMETRICO.Where(w => w.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_SEGUIMIENTO && w.ID_FORMATO == (short)enumTipoFormato.FMTO_JPG).Any()) { FotoBusquedaHuella = new Imagenes().ConvertByteToBitmap(ingresobiometrico.INGRESO_BIOMETRICO.Where(w => w.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_SEGUIMIENTO && w.ID_FORMATO == (short)enumTipoFormato.FMTO_JPG).SingleOrDefault().BIOMETRICO); } else if (ingresobiometrico.INGRESO_BIOMETRICO.Where(w => w.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_REGISTRO && w.ID_FORMATO == (short)enumTipoFormato.FMTO_JPG).Any()) { FotoBusquedaHuella = new Imagenes().ConvertByteToBitmap(ingresobiometrico.INGRESO_BIOMETRICO.Where(w => w.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_REGISTRO && w.ID_FORMATO == (short)enumTipoFormato.FMTO_JPG).SingleOrDefault().BIOMETRICO); } } } ListResultado.Add(new ResultadoBusquedaBiometrico() { Nombre = imputado.IMPUTADO.NOMBRE, APaterno = imputado.IMPUTADO.PATERNO, AMaterno = imputado.IMPUTADO.MATERNO, Expediente = imputado.ID_ANIO + "/" + imputado.ID_IMPUTADO, NIP = imputado.IMPUTADO.NIP.ToString(), Foto = FotoBusquedaHuella, Imputado = imputado.IMPUTADO }); })); } ListResultado = new List <ResultadoBusquedaBiometrico>(ListResultado); ShowContinuar = Visibility.Collapsed; if (ListResultado.Any()) { Application.Current.Dispatcher.Invoke((System.Action)(delegate { if (!CancelKeepSearching) { ScannerMessage = "Registro encontrado"; AceptarBusquedaHuellaFocus = true; ColorMessage = new SolidColorBrush(Colors.Green); } })); if (Finger != null) { Service.Close(); } return(TaskEx.FromResult(false)); } else { Application.Current.Dispatcher.Invoke((System.Action)(delegate { if (!CancelKeepSearching) { ScannerMessage = "Registro no encontrado"; AceptarBusquedaHuellaFocus = true; ColorMessage = new SolidColorBrush(Colors.Red); } })); } } else { Application.Current.Dispatcher.Invoke((System.Action)(delegate { if (!CancelKeepSearching) { ScannerMessage = "Huella no encontrada"; ColorMessage = new SolidColorBrush(Colors.Red); AceptarBusquedaHuellaFocus = true; } })); _IsSucceed = false; if (!CancelKeepSearching) { _SelectRegistro = null; } PropertyImage = null; } Service.Close(); FingerPrintData = null; return(TaskEx.FromResult(true)); }
private void Compare(object Huella = null) { if (FingerPrintData == null) { Application.Current.Dispatcher.Invoke((System.Action)(delegate { ScannerMessage = "Vuelve a capturar la huella"; TextoBoton = "Crear Nuevo Expediente"; ColorMessage = new SolidColorBrush(Colors.DarkOrange); })); return; } Application.Current.Dispatcher.Invoke((System.Action)(delegate { ScannerMessage = "Procesando... "; ColorMessage = new SolidColorBrush(Color.FromRgb(51, 115, 242)); AceptarBusquedaHuellaFocus = false; })); var Service = new BiometricoServiceClient(); var CompareResult = Service.CompararHuellaImputado(new ComparationRequest { BIOMETRICO = FeatureExtraction.CreateFmdFromFid(FingerPrintData, Constants.Formats.Fmd.ANSI).Data.Bytes, ID_TIPO_BIOMETRICO = (DD_Dedo.HasValue ? DD_Dedo.Value : enumTipoBiometrico.INDICE_DERECHO), ID_TIPO_FORMATO = enumTipoFormato.FMTO_DP }); if (CompareResult.Identify) { Application.Current.Dispatcher.Invoke((System.Action)(delegate { var item = CompareResult.Result.FirstOrDefault(); var imputado = new cImputadoBiometrico().GetData().Where(w => w.ID_ANIO == item.ID_ANIO && w.ID_CENTRO == item.ID_CENTRO && w.ID_IMPUTADO == item.ID_IMPUTADO && w.ID_TIPO_BIOMETRICO == (DD_Dedo.HasValue ? (short)DD_Dedo.Value : (short)enumTipoBiometrico.INDICE_DERECHO) && w.ID_FORMATO == (short)enumTipoFormato.FMTO_DP).FirstOrDefault(); if (imputado == null) { ScannerMessage = "Registro no encontrado"; TextoBoton = "Crear Nuevo Expediente"; ColorMessage = new SolidColorBrush(Colors.Red); return; } Imputado = imputado.IMPUTADO; var ingresobiometrico = imputado.IMPUTADO.INGRESO.OrderByDescending(o => o.ID_INGRESO).FirstOrDefault(); if (ingresobiometrico != null) { if (ingresobiometrico.INGRESO_BIOMETRICO.Any()) { if (ingresobiometrico.INGRESO_BIOMETRICO.Where(w => w.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_SEGUIMIENTO && w.ID_FORMATO == (short)enumTipoFormato.FMTO_JPG).Any()) { ImputadoFoto = new Imagenes().ConvertByteToBitmap(ingresobiometrico.INGRESO_BIOMETRICO.Where(w => w.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_SEGUIMIENTO && w.ID_FORMATO == (short)enumTipoFormato.FMTO_JPG).SingleOrDefault().BIOMETRICO); } else if (ingresobiometrico.INGRESO_BIOMETRICO.Where(w => w.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_REGISTRO && w.ID_FORMATO == (short)enumTipoFormato.FMTO_JPG).Any()) { ImputadoFoto = new Imagenes().ConvertByteToBitmap(ingresobiometrico.INGRESO_BIOMETRICO.Where(w => w.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_REGISTRO && w.ID_FORMATO == (short)enumTipoFormato.FMTO_JPG).SingleOrDefault().BIOMETRICO); } else { ImputadoFoto = new Imagenes().ConvertByteToBitmap(new Imagenes().getImagenPerson()); } } } TextoBoton = "Nuevo Ingreso"; ScannerMessage = "Registro encontrado"; AceptarBusquedaHuellaFocus = true; ColorMessage = new SolidColorBrush(Colors.Green); })); } else { Application.Current.Dispatcher.Invoke((System.Action)(delegate { TextoBoton = "Crear Nuevo Expediente"; ScannerMessage = "Huella no encontrada"; ColorMessage = new SolidColorBrush(Colors.Red); AceptarBusquedaHuellaFocus = true; })); _IsSucceed = false; _Imputado = null; Nombre = string.Empty; APaterno = string.Empty; AMaterno = string.Empty; Expediente = string.Empty; NIP = string.Empty; PropertyImage = null; ImputadoFoto = null; } Service.Close(); FingerPrintData = null; }