Ejemplo n.º 1
0
        public ENUbigeoDpto ObtenerDptoUno(string CodigoDpto)
        {
            DbCommand    oCommand      = null;
            ENUbigeoDpto oENUbigeoDpto = new ENUbigeoDpto();

            try
            {
                oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "usp_SCTR_Ubigeo_sel_uno");
                GenericDataAccess.AgregarParametro(oCommand, "@argCodDpto", CodigoDpto, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argCodProv", "", 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())
                {
                    oENUbigeoDpto.CodigoDpto      = oDataReader["CodigoDpto"].ToString();
                    oENUbigeoDpto.DescripcionDpto = oDataReader["Nombre"].ToString();
                }
                return(oENUbigeoDpto);
            }
            catch (Exception ex)
            {
                throw new Exception();
            }
            finally
            {
                GenericDataAccess.CerrarConexion(oCommand, null);
            }
        }
Ejemplo n.º 2
0
        public List <ENUbigeoDpto> ObtenerDpto()
        {
            DbCommand           oCommand   = null /* TODO Change to default(_) if this is not a reference type */;
            List <ENUbigeoDpto> oListaDpto = new List <ENUbigeoDpto>();

            try
            {
                oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "usp_SCTR_Ubigeo_sel");
                GenericDataAccess.AgregarParametro(oCommand, "@argCodDpto", "", 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())
                {
                    ENUbigeoDpto oENListaDpto = new ENUbigeoDpto();
                    oENListaDpto.CodigoDpto      = oDataReader["Coddpto"].ToString();
                    oENListaDpto.DescripcionDpto = oDataReader["Nombre"].ToString();
                    oListaDpto.Add(oENListaDpto);
                }
                return(oListaDpto);
            }
            catch (Exception ex)
            {
                throw new Exception();
            }
            finally
            {
                GenericDataAccess.CerrarConexion(oCommand, null /* TODO Change to default(_) if this is not a reference type */);
            }
        }