Exemplo n.º 1
0
        public static void loadTutores()
        {
            MySqlCommand command = conn.CreateCommand();

            command.CommandText = "select * from profesor where estutor ='1'";
            conn.Open();
            MySqlDataReader reader = command.ExecuteReader();

            tutores = new List <ProfesorTutor>();
            while (reader.Read())
            {
                int           esTutor     = Int32.Parse(reader["esTutor"].ToString());
                int           codigo      = Int32.Parse(reader["codigo"].ToString());
                Profesor      newProfesor = ProfesorFactory.create(reader);
                ProfesorTutor newTutor    = new ProfesorTutor(newProfesor);
                if (esTutor == 1)
                {
                    newTutor.ListaAlumno  = AlumnoPersistance.getAlumnosByProfesor(codigo);
                    newTutor.ListaReunion = ReunionPersistance.getReunionesByProfesor(codigo);
                }

                tutores.Add(newTutor);
            }
            conn.Close();
        }
Exemplo n.º 2
0
        public static Profesor getProfesorByCodigo(int codigo)
        {
            MySqlConnection connection = new MySqlConnection(connecString);

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

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

            MySqlDataReader reader      = command.ExecuteReader();
            Profesor        newProfesor = null;

            while (reader.Read())
            {
                newProfesor = ProfesorFactory.create(reader);
            }

            connection.Close();
            return(newProfesor);
        }