public DataSet consultarFuentesALL(string numDocumento, string opcionBusqueda)
        {
            AccesoDatos.AccesoDatos datos = new AccesoDatos.AccesoDatos();
            DataSet dsSalida = new DataSet();

            datos.MotorBasedatos = true;
            string connString = System.Configuration.ConfigurationManager.ConnectionStrings["ConexionRegistraduriaNUBE"].ConnectionString;

            datos.Conexion = connString;

            try
            {
                try
                {
                    if (opcionBusqueda == "DOCUMENTO")
                    {
                        dsSalida = datos.ConsultarTablasConComando("SELECT * FROM TABLE(registraduria.PKG_ACREDITACION.CM_FUN_ACREDIT_HECHOS_PERSONA(" + numDocumento + "))");
                    }

                    else if (opcionBusqueda == "NOMBRES Y APELLIDOS")
                    {
                        var primerNombre = numDocumento.Substring(0, numDocumento.IndexOf('|'));
                        numDocumento = numDocumento.Substring(numDocumento.IndexOf('|') + 1);
                        var segundoNombre = numDocumento.Substring(0, numDocumento.IndexOf('|'));
                        numDocumento = numDocumento.Substring(numDocumento.IndexOf('|') + 1);
                        var primerApellido = numDocumento.Substring(0, numDocumento.IndexOf('|'));
                        numDocumento = numDocumento.Substring(numDocumento.IndexOf('|') + 1);
                        var segundoApellido = numDocumento;
                        dsSalida = datos.ConsultarTablasConComando("select 'RUV' FUENTE, T.* from TABLE(PKG_VICTIMAS_RNI.cm_fun_persona_ruv_name('" + primerNombre + "','" + segundoNombre + "','" + primerApellido + "','" + segundoApellido + "')) T");
                    }
                    else if (opcionBusqueda == "DECLARACION RUV")
                    {
                        dsSalida = datos.ConsultarTablasConComando("select 'RUV' FUENTE, T.* from TABLE(PKG_VICTIMAS_RNI.cm_fun_persona_ruv_decla(1,'" + numDocumento + "')) T");
                    }
                    else if (opcionBusqueda == "NUMERO DE FORMULARIO FUD")
                    {
                        dsSalida = datos.ConsultarTablasConComando("select 'RUV' FUENTE, T.* from TABLE(PKG_VICTIMAS_RNI.cm_fun_persona_ruv_decla(2,'" + numDocumento + "')) T");
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }

                return(dsSalida);
            }
            finally
            {
                dsSalida.Dispose();
            }
        }
        public DataSet consultarFuenteSIV(string numDocumento, string opcionBusqueda)
        {
            AccesoDatos.AccesoDatos datos = new AccesoDatos.AccesoDatos();
            DataSet dsSalida = new DataSet();

            datos.MotorBasedatos = true;
            string connString = System.Configuration.ConfigurationManager.ConnectionStrings["ConexionFuenteSIPODSIV"].ConnectionString;

            datos.Conexion = connString;

            try
            {
                try
                {
                    if (opcionBusqueda == "DOCUMENTO")
                    {
                        dsSalida = datos.ConsultarTablasConComando("select 'SIV' FUENTE, T.* from TABLE(PKG_VICTIMAS_RNI.CM_FUN_HECHOS_PERSONA_SIV((select F.ID_PERSONA from TABLE(PKG_VICTIMAS_RNI.cm_fun_persona_siv(" + numDocumento + ")) F))) T");
                    }
                    else if (opcionBusqueda == "NOMBRES Y APELLIDOS")
                    {
                        var primerNombre = numDocumento.Substring(0, numDocumento.IndexOf('|'));
                        numDocumento = numDocumento.Substring(numDocumento.IndexOf('|') + 1);
                        var segundoNombre = numDocumento.Substring(0, numDocumento.IndexOf('|'));
                        numDocumento = numDocumento.Substring(numDocumento.IndexOf('|') + 1);
                        var primerApellido = numDocumento.Substring(0, numDocumento.IndexOf('|'));
                        numDocumento = numDocumento.Substring(numDocumento.IndexOf('|') + 1);
                        var segundoApellido = numDocumento;
                        dsSalida = datos.ConsultarTablasConComando("select 'SIV' FUENTE, T.* from TABLE(PKG_VICTIMAS_RNI.cm_fun_persona_siv_name('" + primerNombre + "','" + segundoNombre + "','" + primerApellido + "','" + segundoApellido + "')) T");
                    }
                    else if (opcionBusqueda == "SOLICITUD SIV")
                    {
                        dsSalida = datos.ConsultarTablasConComando("select 'SIV' FUENTE, T.* from TABLE(PKG_VICTIMAS_RNI.cm_fun_persona_siv_decla('1','" + numDocumento + "')) T");
                    }
                    else if (opcionBusqueda == "FICHA SIV")
                    {
                        dsSalida = datos.ConsultarTablasConComando("select 'SIV' FUENTE, T.* from TABLE(PKG_VICTIMAS_RNI.cm_fun_persona_siv_decla('2','" + numDocumento + "')) T");
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
                return(dsSalida);
            }
            finally
            {
                dsSalida.Dispose();
            }
        }
        public DataSet consultarRegistraduria(string documento)
        {
            List <Parametros> param = new List <Parametros>();

            DataSet dsSalida = null;

            AccesoDatos.AccesoDatos datos = new AccesoDatos.AccesoDatos();
            try
            {
                datos.MotorBasedatos = true;
                string connString = System.Configuration.ConfigurationManager.ConnectionStrings["ConexionRegistraduriaNUBE"].ConnectionString;
                datos.Conexion = connString;
                param          = new List <Parametros>();
                param.Add(asignarParametro("P_ID_PERSONA", 1, "System.Int32", documento));
                param.Add(asignarParametro("S_CURSOR", 2, "Cursor", ""));
                param.Add(asignarParametro("S_MENSAJE", 2, "System.String", ""));
                dsSalida = datos.ConsultarTablasConComando("SELECT T.NOM1_RENEC ||' '|| T.NOM2_RENEC ||' '|| T.APE1_RENEC ||' '|| T.APE2_RENEC NOMBRES, T.* FROM  TABLE(REGISTRADURIA.PKG_WS_RENEC.FUN_CONSULTA_RENEC(" + documento + ")) T");
                return(dsSalida);
            }
            finally
            {
                dsSalida.Dispose();
            }
        }
        public DataSet consultarFuenteSIRAV(string numDocumento, string opcionBusqueda)
        {
            AccesoDatos.AccesoDatos datos = new AccesoDatos.AccesoDatos();
            DataSet dsSalida = new DataSet();

            datos.MotorBasedatos = false;
            string connStringFuenteSIRAV = System.Configuration.ConfigurationManager.ConnectionStrings["ConexionSirav"].ConnectionString;

            datos.Conexion = connStringFuenteSIRAV;

            try
            {
                if (opcionBusqueda == "DOCUMENTO")
                {
                    dsSalida = datos.ConsultarTablasConComando("SELECT 'SIRAV' FUENTE, T.ID_PERSONA, T.PRIMERNOMBRE, T.SEGUNDONOMBRE, T.PRIMERAPELLIDO, T.SEGUNDOAPELLIDO, " +
                                                               " T.TIPO_DOC,  T.NUMERODOCUMENTO, T.F_NACIMIENTO, T.ESTADO, T.NUM_FUD_NUM_CASO, T.ID_DECLARACION,T.RELACION,T.GENERO, T.FECHASINIESTRO FECHA_SINIESTRO, T.HECHO FROM SIRAVNegocio.dbo.CM_FUN_HECHOS_PERSONA_SIRAV_DOC(" + numDocumento + ") T");
                }


                //if (dsSalida.Tables[0].Rows.Count > 0)
                //{
                //    String vacio = "VACIO";
                //    Console.WriteLine(vacio);


                //}
                //else if (dsSalida.Tables[0].Rows.Count > 0)
                //{
                //    String NOMBRE = dsSalida.Tables[0].TableName;
                //    Console.WriteLine(NOMBRE);
                //    String idPersona = dsSalida.Tables[NOMBRE].Rows[0]["ID_PERSONA"].ToString();
                //}


                else if (opcionBusqueda == "NOMBRES Y APELLIDOS")
                {
                    var primerNombre = numDocumento.Substring(0, numDocumento.IndexOf('|'));
                    numDocumento = numDocumento.Substring(numDocumento.IndexOf('|') + 1);
                    var segundoNombre = numDocumento.Substring(0, numDocumento.IndexOf('|'));
                    numDocumento = numDocumento.Substring(numDocumento.IndexOf('|') + 1);
                    var primerApellido = numDocumento.Substring(0, numDocumento.IndexOf('|'));
                    numDocumento = numDocumento.Substring(numDocumento.IndexOf('|') + 1);
                    var segundoApellido = numDocumento;
                    dsSalida = datos.ConsultarTablasConComando("select 'SIRAV' FUENTE, T.* from SIRAVNegocio.dbo.f_DatosPersona_RNI_name('" + primerNombre + "','" + segundoNombre + "','" + primerApellido + "','" + segundoApellido + "') T");
                }
                else if (opcionBusqueda == "RADICADO SIRAV")
                {
                    dsSalida = datos.ConsultarTablasConComando("select 'SIRAV' FUENTE,* from SIRAVNegocio.dbo.f_DatosPersona_RNI_decla('1','" + numDocumento + "')");
                }

                try
                {
                    return(dsSalida);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
                return(dsSalida);
            }
            finally
            {
                dsSalida.Dispose();
            }
        }