/// <summary> /// Muestra el mensaje de resultado de la comparación del ID del custodio. /// </summary> /// <param name="TipoMensaje">Resultado que indica el tipo de mensaje a mostrar.</param> public async void CambiarMensajeNIP(enumMensajeNIP TipoMensaje) { switch (TipoMensaje) { case enumMensajeNIP.ENCONTRADO: MarkCheck = "\u2713 \u2713"; MensajeNipAprobacion = "Custodio encontrado"; //ImagenEvaluacion = new Imagenes().getImagenPermitido(); ColorNIPAprobacion = new SolidColorBrush(Colors.Green); break; case enumMensajeNIP.NO_ENCONTRADO: MarkCheck = "X"; ColorNIPAprobacion = new SolidColorBrush(Colors.Red); MensajeNipAprobacion = "Custodio no encontrado"; break; } await TaskEx.Delay(2000); MarkCheck = "🔍"; ColorNIPAprobacion = new SolidColorBrush(Colors.DarkBlue); BuscarNIP = string.Empty; MensajeNipAprobacion = "Capture NIP"; ImagenCustodio = ImagenPlaceHolder.getImagenPerson(); }
//HUELLA PARA LOS CUSTODIOS private Task <bool> CompararHuellaCustodio(byte[] Huella = null, enumTipoBiometrico?Finger = null) { try { var bytesHuella = FingerPrintData != null?FeatureExtraction.CreateFmdFromFid(FingerPrintData, Constants.Formats.Fmd.ANSI).Data.Bytes : null ?? Huella; var verifyFinger = Finger ?? (DD_DedoHuella.HasValue ? DD_DedoHuella.Value : enumTipoBiometrico.INDICE_DERECHO); ImagenCustodio = null; ListResultadoCustodio = null; TextoRegistroEdificioCustodio = null; if (bytesHuella == null) { Application.Current.Dispatcher.Invoke((System.Action)(delegate { if (Finger == null) { ScannerMessage = "Vuelve a capturar las huellas"; } else { ScannerMessage = "Siguiente Huella"; } FocusAceptarBusquedaHuella = true; ColorMensaje = new SolidColorBrush(Colors.DarkOrange); ShowLinea = Visibility.Collapsed; })); } Application.Current.Dispatcher.Invoke((System.Action)(delegate { ScannerMessage = "Procesando..."; ColorMensaje = new SolidColorBrush(System.Windows.Media.Color.FromRgb(51, 115, 242)); FocusAceptarBusquedaHuella = false; })); var Service = new BiometricoServiceClient(); if (Service == null) { Application.Current.Dispatcher.Invoke((System.Action)(delegate { ScannerMessage = "Error en el servicio de comparación"; FocusAceptarBusquedaHuella = true; ColorMensaje = new SolidColorBrush(Colors.Red); ShowLinea = Visibility.Collapsed; })); } var CompareResult = Service.CompararHuellaPersona(new ComparationRequest { BIOMETRICO = bytesHuella, ID_TIPO_BIOMETRICO = verifyFinger, ID_TIPO_FORMATO = enumTipoFormato.FMTO_DP, ID_TIPO_PERSONA = enumTipoPersona.PERSONA_EMPLEADO, ID_CENTRO = GlobalVar.gCentro }); //var CompareResult = Service.CompararHuellaPersona(new ComparationRequest { BIOMETRICO = bytesHuella, ID_TIPO_BIOMETRICO = verifyFinger, ID_TIPO_FORMATO = enumTipoFormato.FMTO_DP, ID_TIPO_PERSONA = enumTipoPersona.PERSONA_EMPLEADO }); if (CompareResult.Identify) { ListResultadoCustodio = ListResultadoCustodio ?? new List <ResultadoBusquedaBiometricoCustodio>(); if (CompareResult.Result.Count() > 1) { TextoRegistroEdificioCustodio = "NOTA: Se encontró más de una coincidencia, por favor intente de nuevo"; ScannerMessage = ""; return(TaskEx.FromResult(false)); } else { foreach (var item in CompareResult.Result) { var custodio = new cPersonaBiometrico().GetData().Where(w => w.ID_PERSONA == item.ID_PERSONA && (w.ID_TIPO_BIOMETRICO == (DD_DedoHuella.HasValue ? (short)DD_DedoHuella.Value : (short)enumTipoBiometrico.INDICE_DERECHO) && w.ID_FORMATO == (short)enumTipoFormato.FMTO_DP)).OrderBy(o => o.ID_PERSONA).FirstOrDefault(); ShowContinue = Visibility.Collapsed; if (custodio == null) { continue; } Application.Current.Dispatcher.Invoke((System.Action)(delegate { var custodio_biometrico = custodio.PERSONA; var FotoBusquedaHuella = new Imagenes().ConvertByteToBitmap(new Imagenes().getImagenPerson()); if (custodio_biometrico != null) { if (custodio_biometrico.PERSONA_BIOMETRICO.Where(w => w.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_SEGUIMIENTO && w.ID_FORMATO == (short)enumTipoFormato.FMTO_JPG).Any()) { FotoBusquedaHuella = new Imagenes().ConvertByteToBitmap(custodio_biometrico.PERSONA_BIOMETRICO.Where(w => w.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_SEGUIMIENTO && w.ID_FORMATO == (short)enumTipoFormato.FMTO_JPG).SingleOrDefault().BIOMETRICO); } else if (custodio_biometrico.PERSONA_BIOMETRICO.Where(w => w.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_REGISTRO && w.ID_FORMATO == (short)enumTipoFormato.FMTO_JPG).Any()) { FotoBusquedaHuella = new Imagenes().ConvertByteToBitmap(custodio_biometrico.PERSONA_BIOMETRICO.Where(w => w.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_REGISTRO && w.ID_FORMATO == (short)enumTipoFormato.FMTO_JPG).SingleOrDefault().BIOMETRICO); } } ListResultadoCustodio.Add(new ResultadoBusquedaBiometricoCustodio() { IdPersona = custodio.PERSONA.ID_PERSONA, Nombre = string.IsNullOrEmpty(custodio.PERSONA.NOMBRE) ? string.Empty : custodio.PERSONA.NOMBRE.TrimEnd(), CPaterno = string.IsNullOrEmpty(custodio.PERSONA.PATERNO) ? string.Empty : custodio.PERSONA.PATERNO.TrimEnd(), CMaterno = string.IsNullOrEmpty(custodio.PERSONA.MATERNO) ? string.Empty : custodio.PERSONA.MATERNO.TrimEnd(), ENCONTRADO = true, Persona = custodio.PERSONA }); })); ImagenCustodio = new cPersonaBiometrico().ObtenerTodos(custodio.ID_PERSONA, (short)enumTipoBiometrico.FOTO_FRENTE_REGISTRO).Any() ? new cPersonaBiometrico().ObtenerTodos(custodio.ID_PERSONA, (short)enumTipoBiometrico.FOTO_FRENTE_REGISTRO).FirstOrDefault().BIOMETRICO : new Imagenes().getImagenPerson(); } } foreach (var llenar in ListResultadoCustodio) { var igual = ListaCustodio.Where(w => w.IdPersona == llenar.IdPersona).Count(); if (igual == 0) { ListaCustodio.Add(llenar); } else { llenar.ENCONTRADO = false; } ListResultadoCustodio = new List <ResultadoBusquedaBiometricoCustodio>(ListResultadoCustodio); ShowContinue = Visibility.Collapsed; if (ListResultadoCustodio.Any()) { Application.Current.Dispatcher.Invoke((System.Action)(delegate { if (igual > 0) { ScannerMessage = "Registro repetido"; FocusAceptarBusquedaHuella = true; ColorMensaje = new SolidColorBrush(Colors.Orange); } else if (!CancelKeepSearching) { ScannerMessage = "Registro encontrado"; FocusAceptarBusquedaHuella = true; ColorMensaje = new SolidColorBrush(Colors.Green); } })); if (Finger != null) { Service.Close(); } return(TaskEx.FromResult(false)); } } } else { Application.Current.Dispatcher.Invoke((System.Action)(delegate { if (!CancelKeepSearching) { ScannerMessage = "Huella no encontrada"; ColorMensaje = new SolidColorBrush(Colors.Red); FocusAceptarBusquedaHuella = true; ImagenCustodio = ImagenPlaceHolder.getImagenPerson(); } })); IsSucceded = false; if (!CancelKeepSearching) { SelectedRegistroCustodio = null; } PropertyImage = null; } Service.Close(); FingerPrintData = null; return(TaskEx.FromResult(true)); } catch (System.ServiceModel.EndpointNotFoundException ex) { StaticSourcesViewModel.ShowMessageError("Algo pasó...", "No se pudo conectar al servidor de huellas", ex); return(TaskEx.FromResult(false)); } catch (Exception ex) { StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al cargar búsqueda", ex); return(TaskEx.FromResult(false)); } }