コード例 #1
0
ファイル: ADUbigeo.cs プロジェクト: Grob2401/protect-salud
        public ENUbigeoDist ObtenerDistUno(string CodigoDpto, string CodigoProv, string CodigoDist)
        {
            DbCommand    oCommand      = null;
            ENUbigeoDist oENUbigeoDist = new ENUbigeoDist();

            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", CodigoDist, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argErrorCode", 1, TipoParametro.INT, Direccion.OUTPUT);
                DbDataReader oDataReader = GenericDataAccess.ExecuteReader(oCommand);
                while (oDataReader.Read())
                {
                    oENUbigeoDist.CodigoDist      = oDataReader["CodigoDist"].ToString();
                    oENUbigeoDist.DescripcionDist = oDataReader["Nombre"].ToString();
                }
                return(oENUbigeoDist);
            }
            catch (Exception ex)
            {
                throw new Exception();
            }
            finally
            {
                GenericDataAccess.CerrarConexion(oCommand, null);
            }
        }
コード例 #2
0
ファイル: ADUbigeo.cs プロジェクト: Grob2401/protect-salud
        public List <ENUbigeoDist> ObtenerDist(string codDpto, string codProv)
        {
            DbCommand           oCommand   = null /* TODO Change to default(_) if this is not a reference type */;
            List <ENUbigeoDist> oListaDist = new List <ENUbigeoDist>();

            try
            {
                oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "usp_SCTR_Ubigeo_sel");
                GenericDataAccess.AgregarParametro(oCommand, "@argCodDpto", codDpto, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argCodProv", codProv, TipoParametro.STR, Direccion.INPUT);
                GenericDataAccess.AgregarParametro(oCommand, "@argErrorCode", 1, TipoParametro.INT, Direccion.OUTPUT);
                DbDataReader oDataReader = GenericDataAccess.ExecuteReader(oCommand);
                while (oDataReader.Read())
                {
                    ENUbigeoDist oENListaDist = new ENUbigeoDist();
                    oENListaDist.CodigoDist      = oDataReader["CodDist"].ToString();
                    oENListaDist.DescripcionDist = oDataReader["Nombre"].ToString();
                    oListaDist.Add(oENListaDist);
                }
                return(oListaDist);
            }
            catch (Exception ex)
            {
                throw new Exception();
            }
            finally
            {
                GenericDataAccess.CerrarConexion(oCommand, null /* TODO Change to default(_) if this is not a reference type */);
            }
        }