Пример #1
0
        public static List<partidaGlobal> obtenerPartidasGlobales(string nombreFaena)
        {
            List<partidaGlobal> retorno = new List<partidaGlobal>();

            SqlConnection cnx = conexion.crearConexion();

            SqlCommand cmd = new SqlCommand();
            cmd.Connection = cnx;
            cmd.CommandText = "SELECT * from partidas_global WHERE( faena = '" + nombreFaena + "')";
            cmd.CommandType = CommandType.Text;
            SqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                partidaGlobal partidaGlobal = new partidaGlobal();
                partidaGlobal.nombre = (string)dr["nombre"];
                partidaGlobal.ID = (string)dr["id"];
                partidaGlobal.faena = nombreFaena;

                //Agregar el detalle

                retorno.Add(partidaGlobal);
            }
            cnx.Close();

            return retorno;
        }
Пример #2
0
        public static partidaGlobal obtenerPartidaGlobal(string nombreFaena, string id)
        {
            partidaGlobal retorno = new partidaGlobal();

            SqlConnection cnx = conexion.crearConexion();

            SqlCommand cmd = new SqlCommand();
            cmd.Connection = cnx;
            cmd.CommandText = "SELECT * from partidas_global WHERE( faena = '" + nombreFaena + "' AND id='" + id + "')";
            cmd.CommandType = CommandType.Text;
            SqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                retorno.nombre = (string)dr["nombre"];
                retorno.ID = id;
                retorno.faena = nombreFaena;
            }
            cnx.Close();

            return retorno;
        }