Ejemplo n.º 1
0
        public List <ENUbigeoProv> ObtenerProv(string codDpto)
        {
            DbCommand           oCommand   = null /* TODO Change to default(_) if this is not a reference type */;
            List <ENUbigeoProv> oListaProv = new List <ENUbigeoProv>();

            try
            {
                oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "usp_SCTR_Ubigeo_sel");
                GenericDataAccess.AgregarParametro(oCommand, "@argCodDpto", codDpto, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argCodProv", "", TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argErrorCode", 1, TipoParametro.INT, Direccion.OUTPUT);
                DbDataReader oDataReader = GenericDataAccess.ExecuteReader(oCommand);
                while (oDataReader.Read())
                {
                    ENUbigeoProv oENListaProv = new ENUbigeoProv();
                    oENListaProv.CodigoProv      = oDataReader["CodProv"].ToString();
                    oENListaProv.DescripcionProv = oDataReader["Nombre"].ToString();
                    oListaProv.Add(oENListaProv);
                }
                return(oListaProv);
            }
            catch (Exception ex)
            {
                throw new Exception();
            }
            finally
            {
                GenericDataAccess.CerrarConexion(oCommand, null /* TODO Change to default(_) if this is not a reference type */);
            }
        }
Ejemplo n.º 2
0
        public ENUbigeoProv ObtenerProvUno(string CodigoDpto, string CodigoProv)
        {
            DbCommand    oCommand      = null;
            ENUbigeoProv oENUbigeoProv = new ENUbigeoProv();

            try
            {
                oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "usp_SCTR_Ubigeo_sel_uno");
                GenericDataAccess.AgregarParametro(oCommand, "@argCodDpto", CodigoDpto, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argCodProv", CodigoProv, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argCodDist", "", TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argErrorCode", 1, TipoParametro.INT, Direccion.OUTPUT);
                DbDataReader oDataReader = GenericDataAccess.ExecuteReader(oCommand);
                while (oDataReader.Read())
                {
                    oENUbigeoProv.CodigoProv      = oDataReader["CodigoProv"].ToString();
                    oENUbigeoProv.DescripcionProv = oDataReader["Nombre"].ToString();
                }
                return(oENUbigeoProv);
            }
            catch (Exception ex)
            {
                throw new Exception();
            }
            finally
            {
                GenericDataAccess.CerrarConexion(oCommand, null);
            }
        }