示例#1
0
        public static Alumno getAlumnoByCodigo(int codigo)
        {
            MySqlConnection connection = new MySqlConnection(connecString);

            connection.Open();
            MySqlCommand command = connection.CreateCommand();

            command.CommandText = "select * from alumno where codigo =" + codigo + ";";

            MySqlDataReader reader    = command.ExecuteReader();
            Alumno          newAlumno = null;

            while (reader.Read())
            {
                newAlumno = AlumnoFactory.create(reader);
            }

            connection.Close();
            return(newAlumno);
        }
示例#2
0
        public static List <Alumno> getAlumnosByProfesor(int codigo)
        {
            List <Alumno>   lista      = new List <Alumno>();
            MySqlConnection connection = new MySqlConnection(connecString);
            MySqlCommand    command    = connection.CreateCommand();

            connection.Open();
            command.CommandText = "select a.* from alumno as a where a.tutor =" + codigo + ";";

            MySqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                Alumno newAlumno = AlumnoFactory.create(reader);
                lista.Add(newAlumno);
            }
            connection.Close();

            return(lista);
        }
示例#3
0
        public static void loadAlumnos()
        {
            MySqlCommand command = conn.CreateCommand();

            conn.Open();
            command.CommandText = "select * from alumno ";

            MySqlDataReader reader = command.ExecuteReader();

            alumnos = new List <Alumno>();

            while (reader.Read())
            {
                int    codigo    = Int32.Parse(reader["codigo"].ToString());
                Alumno newAlumno = AlumnoFactory.create(reader);
                newAlumno.ListaReuniones = ReunionPersistance.getReunionesByAlumno(codigo);

                alumnos.Add(newAlumno);
            }
            conn.Close();
        }