Exemple #1
0
        //YO
        public static List <TipoCombustible> GetTipoCombustible()
        {
            List <TipoCombustible> resultado = new List <TipoCombustible>();

            // PREPARO EL PROCEDIMIENTO A EJECUTAR
            string procedimiento = "dbo.Get_TiposCombustible_pm";
            // PREPARO EL COMANDO PARA LA BD
            SqlCommand comando = new SqlCommand(procedimiento, conexion);

            // INDICO QUE LO QUE VOY A EJECUTAR ES UN PA
            comando.CommandType = CommandType.StoredProcedure;
            // EJECUTO EL COMANDO
            SqlDataReader reader = comando.ExecuteReader();

            // PROCESO EL RESULTADO Y LO MENTO EN LA VARIABLE
            while (reader.Read())
            {
                TipoCombustible tipo = new TipoCombustible();
                tipo.id           = (long)reader["id"];
                tipo.denominacion = reader["denominacion"].ToString();
                // añadiro a la lista que voy
                // a devolver
                resultado.Add(tipo);
            }

            return(resultado);
        }
Exemple #2
0
        public static List <TipoCombustible> GetCombu()
        {
            List <TipoCombustible> resultado = new List <TipoCombustible>();


            // PREPARO LA LLAMADA AL PROCEDIMIENTO ALMACENADO
            string procedimientoAEjecutar = "dbo.GET_COMBUSTIBLE_API";

            // PREPARAMOS EL COMANDO PRIMERO DECIR DONDE CONECTAR Y SEGUNDO PARA EJECUTAR EL PROCEDIMIENTO ALMACENADO
            SqlCommand comando = new SqlCommand(procedimientoAEjecutar, conexion);

            comando.CommandType = CommandType.StoredProcedure;
            //PROCESO EL RESULTADO Y LO METO EN LA VARIABLE

            SqlDataReader reader = comando.ExecuteReader();

            while (reader.Read())
            {
                TipoCombustible tipoCombustible = new ApiCarRental.TipoCombustible();
                tipoCombustible.id           = (long)reader["id"];
                tipoCombustible.denominacion = reader["denominacion"].ToString();

                resultado.Add(tipoCombustible);
            }

            return(resultado);
        }
Exemple #3
0
        public static List <TipoCombustible> GetTiposCombustibles()
        {
            List <TipoCombustible> resultados = new List <TipoCombustible>();
            string procedimiento = "dbo.GetTiposCombustibles";

            SqlCommand comando = new SqlCommand(procedimiento, conexion);

            SqlDataReader reader = comando.ExecuteReader();

            while (reader.Read())
            {
                TipoCombustible tipo = new TipoCombustible();
                tipo.id           = (long)reader["id"];
                tipo.denominacion = reader["denominacion"].ToString();
                resultados.Add(tipo);
            }


            return(resultados);
        }
Exemple #4
0
        public static List <TipoCombustible> DameTiposCombustible()
        {
            List <TipoCombustible> resultados = new List <TipoCombustible>();

            string nombreProcedimiento = "dbo.GET_TIPOS_COMBUSTIBLE";

            SqlCommand cmd = new SqlCommand(nombreProcedimiento, conexion);

            cmd.CommandType = CommandType.StoredProcedure;

            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                TipoCombustible tipoCombustible = new TipoCombustible();

                tipoCombustible.id           = (long)reader["id"];
                tipoCombustible.denominacion = reader["denominacion"].ToString();

                resultados.Add(tipoCombustible);
            }
            return(resultados);
        }