Пример #1
0
        public ENCIIUPrincipal ObtenerPrincipalUno(string CodigoGrupoCIUU)
        {
            DbCommand       oCommand         = null;
            ENCIIUPrincipal oENCIIUPrincipal = new ENCIIUPrincipal();

            try
            {
                oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "usp_SCTR_Ubigeo_sel_uno");
                GenericDataAccess.AgregarParametro(oCommand, "@argTipo", "1", TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argCodGrupo", CodigoGrupoCIUU, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argCodCIIU", "", TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argErrorCode", 1, TipoParametro.INT, Direccion.OUTPUT);
                DbDataReader oDataReader = GenericDataAccess.ExecuteReader(oCommand);
                while (oDataReader.Read())
                {
                    oENCIIUPrincipal.CodigoCIIU      = oDataReader["CodigoCIIU"].ToString();
                    oENCIIUPrincipal.DescripcionCIIU = oDataReader["DescripcionCIIU"].ToString();
                }
                return(oENCIIUPrincipal);
            }
            catch (Exception ex)
            {
                throw new Exception();
            }
            finally
            {
                GenericDataAccess.CerrarConexion(oCommand, null);
            }
        }
Пример #2
0
        public List <ENCIIUPrincipal> ObtenerTodosPrincipal()
        {
            DbCommand oCommand            = null /* TODO Change to default(_) if this is not a reference type */;
            List <ENCIIUPrincipal> oLista = new List <ENCIIUPrincipal>();

            try
            {
                oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "usp_SCTR_CIIU_sel");
                GenericDataAccess.AgregarParametro(oCommand, "@argTipo", "1", TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argCodGrupo", "", TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argErrorCode", 1, TipoParametro.INT, Direccion.OUTPUT);
                DbDataReader oDataReader = GenericDataAccess.ExecuteReader(oCommand);
                while (oDataReader.Read())
                {
                    ENCIIUPrincipal oENLista = new ENCIIUPrincipal();
                    oENLista.CodigoCIIU      = oDataReader["CodigoCIIU"].ToString();
                    oENLista.DescripcionCIIU = oDataReader["DescripcionCIIU"].ToString();
                    oLista.Add(oENLista);
                }
                return(oLista);
            }
            catch (Exception ex)
            {
                throw new Exception();
            }
            finally
            {
                GenericDataAccess.CerrarConexion(oCommand, null /* TODO Change to default(_) if this is not a reference type */);
            }
        }