Exemple #1
0
        /*****************CAMBIA ESTADO TRANSACCION A VALIDANDO(7), ERRONEO (5) O PENDIENTE(0) ***********************/
        public int actualizarEstadoTransaccion(E_PET_DATO PET, int estado)
        {
            ConexionBD    Conexion = new ConexionBD();
            SqlDataReader LeerFilas;
            SqlCommand    Comando = new SqlCommand();

            try
            {
                Comando.Connection  = Conexion.AbrirConexion();
                Comando.CommandText = "P_UPD_Transacciones_Estado";
                Comando.Parameters.AddWithValue("@idTrans", PET.idPET);
                Comando.Parameters.AddWithValue("@transaccion", PET.transaccion);
                Comando.Parameters.AddWithValue("@estado", estado);
                Comando.CommandType = CommandType.StoredProcedure;
                LeerFilas           = Comando.ExecuteReader();


                LeerFilas.Close();
                Conexion.CerrarConecion();
            }
            catch (Exception e)
            {
                Conexion.CerrarConecion();
                return(0);
            }

            return(1);
        }
Exemple #2
0
        /**DEVUELVE LA CANTIDAD DE VECES QUE EL REGISTOR ESTA PRESENTE EN LA TABLA FILE_ERR**/
        public string obtenerIdPadre(E_PET_DATO PET)
        {
            ConexionBD    Conexion = new ConexionBD();
            SqlDataReader LeerFilas;
            DataTable     tabla   = new DataTable();
            List <int>    Lista   = new List <int>();
            SqlCommand    Comando = new SqlCommand();
            string        idPadre = "";

            try
            {
                Comando.Connection  = Conexion.AbrirConexion();
                Comando.CommandText = "P_GET_idPadre_Transaccion";
                Comando.Parameters.AddWithValue("@idTrans", PET.idPET);
                Comando.Parameters.AddWithValue("@transaccion", PET.transaccion);
                Comando.CommandType = CommandType.StoredProcedure;
                LeerFilas           = Comando.ExecuteReader();
                tabla.Load(LeerFilas);
                foreach (DataRow row in tabla.Rows)
                {
                    idPadre = row["idTRAN_PADRE"].ToString();
                }

                LeerFilas.Close();
                Conexion.CerrarConecion();
            }
            catch (Exception e)
            {
                Conexion.CerrarConecion();
                return(idPadre);
            }
            return(idPadre);
        }
Exemple #3
0
        /**DEVUELVE LA CANTIDAD DE VECES QUE EL REGISTOR ESTA PRESENTE EN LA TABLA FILE_ERR**/
        public int obtenerErroresTransaccion(E_PET_DATO PET)
        {
            ConexionBD    Conexion = new ConexionBD();
            SqlDataReader LeerFilas;
            DataTable     tabla    = new DataTable();
            List <int>    Lista    = new List <int>();
            SqlCommand    Comando  = new SqlCommand();
            int           contador = 0;

            try
            {
                Comando.Connection  = Conexion.AbrirConexion();
                Comando.CommandText = "P_GET_Transaccion_ArchivosErroneos";
                Comando.Parameters.AddWithValue("@id", PET.idPET);
                Comando.Parameters.AddWithValue("@transaccion", PET.transaccion);
                Comando.CommandType = CommandType.StoredProcedure;
                LeerFilas           = Comando.ExecuteReader();
                tabla.Load(LeerFilas);
                foreach (DataRow row in tabla.Rows)
                {
                    contador = Int32.Parse(row["contador"].ToString());
                }

                LeerFilas.Close();
                Conexion.CerrarConecion();
            }
            catch (Exception e)
            {
                Conexion.CerrarConecion();
                return(contador);
            }
            return(contador);
        }
Exemple #4
0
        /**************OBTIENE LISTADO DE TRANSACCIONES CON ESTADO PENDIENTE VALIDAR (7)***********/
        public List <E_PET_DATO> ObtenerTransacciones()
        {
            ConexionBD        Conexion = new ConexionBD();
            SqlDataReader     LeerFilas;
            DataTable         tabla   = new DataTable();
            List <E_PET_DATO> Lista   = new List <E_PET_DATO>();
            SqlCommand        Comando = new SqlCommand();

            try
            {
                Comando.Connection  = Conexion.AbrirConexion();
                Comando.CommandText = "P_GET_Transacciones";
                Comando.CommandType = CommandType.StoredProcedure;
                LeerFilas           = Comando.ExecuteReader();
                tabla.Load(LeerFilas);
                foreach (DataRow row in tabla.Rows)
                {
                    E_PET_DATO dato = new E_PET_DATO();
                    dato.idPET       = Int32.Parse(row["idPET"].ToString());
                    dato.transaccion = row["transaccion"].ToString();

                    Lista.Add(dato);
                }

                LeerFilas.Close();
                Conexion.CerrarConecion();
            }
            catch (Exception e)
            {
                Conexion.CerrarConecion();
            }
            return(Lista);
        }
Exemple #5
0
        /*GUARDAR ERROR EN LA TABLA FILE_ERR*/
        public int GuardarError(int id, E_PET_DATO PET, string mensaje, string transaccion)
        {
            ConexionBD    Conexion = new ConexionBD();
            SqlDataReader LeerFilas;
            SqlCommand    Comando = new SqlCommand();

            try
            {
                Comando.Connection  = Conexion.AbrirConexion();
                Comando.CommandText = "P_INS_VALIDATE_ERR";
                Comando.CommandType = CommandType.StoredProcedure;
                Comando.Parameters.AddWithValue("@idFile", id);
                Comando.Parameters.AddWithValue("@idTrans", PET.idPET);
                Comando.Parameters.AddWithValue("@transaccion", PET.transaccion);
                Comando.Parameters.AddWithValue("@mensaje", mensaje);

                LeerFilas = Comando.ExecuteReader();

                while (LeerFilas.Read())
                {
                    string resp = Convert.ToString(LeerFilas["respuesta"]);
                    //EXISTE UN ERROR
                    if (resp.Equals("0"))
                    {
                        codigo = 0;
                    }
                }

                LeerFilas.Close();
                Conexion.CerrarConecion();
            }
            catch (Exception e)
            {
                Conexion.CerrarConecion();
                return(0);
            }


            return(1);
        }
Exemple #6
0
        /*OBTENER LOS REGISTROS ERRONEOS DE UNA TRANSACCION*/
        public List <E_PET_FILE> obtenerRegistrosErroneos(E_PET_DATO PET)
        {
            ConexionBD        Conexion = new ConexionBD();
            SqlDataReader     LeerFilas;
            List <E_PET_FILE> Lista   = new List <E_PET_FILE>();
            SqlCommand        Comando = new SqlCommand();

            try
            {
                Comando.Connection  = Conexion.AbrirConexion();
                Comando.CommandText = "P_GET_Transaccion_RegistrosErroneos";
                Comando.Parameters.AddWithValue("@idTrans", PET.idPET);
                Comando.Parameters.AddWithValue("@transaccion", PET.transaccion);
                Comando.CommandType = CommandType.StoredProcedure;
                LeerFilas           = Comando.ExecuteReader();

                while (LeerFilas.Read())
                {
                    E_PET_FILE adicional = new E_PET_FILE();
                    adicional.idPET_FILE    = Int32.Parse(LeerFilas["idPET_FILE"].ToString());
                    adicional.idPET         = Int32.Parse(LeerFilas["idPET"].ToString());
                    adicional.PET_NOM_ARCHV = LeerFilas["PET_NOM_ARCHV"].ToString();
                    adicional.PET_FILE_XML  = (byte[])LeerFilas["PET_FILE_XML"];
                    adicional.PET_ADD1      = LeerFilas["PET_ADD1"].ToString();
                    adicional.PET_ADD2      = LeerFilas["PET_ADD2"].ToString();

                    Lista.Add(adicional);
                }
                LeerFilas.Close();
                Conexion.CerrarConecion();
            }
            catch (Exception e)
            {
                Conexion.CerrarConecion();
            }

            return(Lista);
        }