public static List <Estudiantes> ListaDeEstudiantes(int Codigo_materia) { List <Estudiantes> Lista = new List <Estudiantes> { }; DataTable datos = new DataTable(); string consulta = "select person.id, person.name from course inner join enrollment on course.code_course = enrollment.code_course inner join person on person.id = enrollment.id_student where course.code_course=" + Codigo_materia + ";"; datos = ConexionColonos.EjecutarConsulta(consulta); DataTable Fotos = new DataTable(); byte[] imagenes = null; for (int i = 0; i < datos.Rows.Count; i++) { try { string consultados = "SELECT photo_profile FROM profile inner join user on user.code_user = profile.code_user where user.code_user = "******"id"].ToString() + ";"; Fotos = MensajeriaColonos.ConexionChat.EjecutarConsulta(consultados); imagenes = new byte[0]; imagenes = (Byte[])Fotos.Rows[i]["photo_profile"]; } catch (Exception) { imagenes = null; } Estudiantes estudiante = new Estudiantes(Convert.ToInt32(datos.Rows[i]["id"].ToString()), datos.Rows[i]["name"].ToString(), imagenes); Lista.Add(estudiante); } return(Lista); }
public static String consultarusuario(int id) { string comando = "select person.name from person where id = " + id + "; "; DataTable x = new DataTable(); x = ConexionColonos.EjecutarConsulta(comando); String nom = x.Rows[0]["name"].ToString(); return(nom); }
public static List <Cursos> CursosLista(int id) { List <Cursos> listadoCursos = new List <Cursos> { }; DataTable Datos = new DataTable(); String consulta = "select course.number_course, course.code_course, subject.name_subject from course inner join enrollment on course.code_course = enrollment.code_course inner join person on person.id = enrollment.id_student inner join detail_curriculum on detail_curriculum.code_curriculum= course.code_curriculum and course.code_subject = detail_curriculum.code_subject inner join subject on subject.code_subject= detail_curriculum.code_subject where person.id =" + id + ";"; Datos = ConexionColonos.EjecutarConsulta(consulta); for (int i = 0; i < Datos.Rows.Count; i++) { Cursos c = new Cursos(Convert.ToInt32(Datos.Rows[i]["code_course"].ToString()), Datos.Rows[i]["number_course"].ToString(), Datos.Rows[i]["name_subject"].ToString()); listadoCursos.Add(c); } return(listadoCursos); }