Пример #1
0
        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));
        }
        public ListResultado Post(Parametros Datos)
        {
            try
            {
                SqlCommand comando = new SqlCommand("ValidaValoresCategoria")
                {
                    CommandType = CommandType.StoredProcedure
                };                //browseGastosInforme

                //Declaracion de parametros
                comando.Parameters.Add("@idinforme", SqlDbType.Int);

                //Asignacion de valores a parametros
                comando.Parameters["@idinforme"].Value = Datos.IdInforme;

                comando.Connection     = new SqlConnection(VariablesGlobales.CadenaConexion);
                comando.CommandTimeout = 0;
                comando.Connection.Open();

                DataTable      DT = new DataTable();
                SqlDataAdapter DA = new SqlDataAdapter(comando);
                comando.Connection.Close();
                DA.Fill(DT);

                if (DT.Rows.Count > 0)
                {
                    List <ListResult> Lista_Justificacion = new List <ListResult>();

                    foreach (DataRow row in DT.Rows)
                    {
                        ListResult justificacion_faltante = new ListResult {
                            Justificacion = Convert.ToString(row["justificacion"]),
                            Categoria     = Convert.ToString(row["categoria"]),
                            Comensales    = Convert.ToString(row["comensales"]),
                            Valor         = Convert.ToString(row["valor"])
                        };
                        Lista_Justificacion.Add(justificacion_faltante);
                    }

                    ListResultado lista = new ListResultado
                    {
                        Error   = 2,
                        Mensaje = "Justificar " + DT.Rows.Count + " Gasto(s)",
                        Lista   = Lista_Justificacion
                    };
                    return(lista);
                }
                else
                {
                    ListResultado lista = new ListResultado
                    {
                        Error   = 0,
                        Mensaje = "OK",
                        Lista   = null
                    };
                    return(lista);
                }
            }
            catch (Exception ex)
            {
                ListResultado lista = new ListResultado
                {
                    Error   = 1,
                    Mensaje = "Error al validar justificación del informe. " + ex.ToString(),
                    Lista   = null
                };
                return(lista);
            }
        }
Пример #3
0
        private Task <bool> ComparePersona(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.CompararHuellaPersona(new ComparationRequest
            {
                BIOMETRICO         = bytesHuella,
                ID_TIPO_BIOMETRICO = verifyFinger,
                ID_TIPO_FORMATO    = enumTipoFormato.FMTO_DP,
                ID_TIPO_PERSONA    = BuscarPor == enumTipoPersona.PERSONA_TODOS ? new Nullable <enumTipoPersona>() : BuscarPor
            });

            if (CompareResult.Identify)
            {
                ListResultado = ListResultado ?? new List <ResultadoBusquedaBiometrico>();

                foreach (var item in CompareResult.Result)
                {
                    var persona = new cPersonaBiometrico().GetData().Where(w => w.ID_PERSONA == item.ID_PERSONA && (w.ID_TIPO_BIOMETRICO == (DD_Dedo.HasValue ? (short)DD_Dedo.Value : (short)enumTipoBiometrico.INDICE_DERECHO)) && w.ID_FORMATO == (short)enumTipoFormato.FMTO_DP).FirstOrDefault();

                    ShowContinuar = Visibility.Collapsed;
                    if (persona == null)
                    {
                        continue;
                    }

                    Application.Current.Dispatcher.Invoke((System.Action)(delegate
                    {
                        var perosonabiometrico = new cPersonaBiometrico().GetData().Where(w => w.ID_PERSONA == persona.ID_PERSONA).ToList();
                        var FotoBusquedaHuella = new Imagenes().ConvertByteToBitmap(new Imagenes().getImagenPerson());

                        if (perosonabiometrico != null)
                        {
                            if (perosonabiometrico.Any())
                            {
                                if (perosonabiometrico.Where(w => w.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_SEGUIMIENTO && w.ID_FORMATO == (short)enumTipoFormato.FMTO_JPG).Any())
                                {
                                    FotoBusquedaHuella = new Imagenes().ConvertByteToBitmap(perosonabiometrico.Where(w => w.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_SEGUIMIENTO && w.ID_FORMATO == (short)enumTipoFormato.FMTO_JPG).SingleOrDefault().BIOMETRICO);
                                }
                                else
                                if (perosonabiometrico.Where(w => w.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_REGISTRO && w.ID_FORMATO == (short)enumTipoFormato.FMTO_JPG).Any())
                                {
                                    FotoBusquedaHuella = new Imagenes().ConvertByteToBitmap(perosonabiometrico.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     = persona.PERSONA.NOMBRE,
                            APaterno   = persona.PERSONA.PATERNO,
                            AMaterno   = persona.PERSONA.MATERNO,
                            Expediente = persona.PERSONA.ID_PERSONA.ToString(),
                            NIP        = persona.PERSONA.PERSONA_NIP.Where(w => w.ID_CENTRO == GlobalVar.gCentro).Any() ?
                                         persona.PERSONA.PERSONA_NIP.Where(w => w.ID_CENTRO == GlobalVar.gCentro).FirstOrDefault().NIP.HasValue
                                    ? persona.PERSONA.PERSONA_NIP.Where(w => w.ID_CENTRO == GlobalVar.gCentro).FirstOrDefault().NIP.Value.ToString()
                                        : string.Empty : string.Empty,
                            Foto    = FotoBusquedaHuella,
                            Persona = persona.PERSONA
                        });
                    }));
                }

                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));
        }