private void lIntegrantes_SelectedIndexChanged(object sender, EventArgs e) { if (lIntegrantes.SelectedIndex == -1) { return; } PersonaBD persona = (PersonaBD)lIntegrantes.Items[lIntegrantes.SelectedIndex]; lUser.Text = persona.usuario; lNombre.Text = persona.nombre; lApellidos.Text = persona.apellido; lCorreo.Text = persona.correo; if (curso != null) { lCalificacion.Text = BD.Select(String.Format("SELECT AVG(p.nota) FROM Puntuacion p JOIN Test t ON p.idTest = t.idTest WHERE p.nombreUsuario = '{0}' AND t.idCurso = {1};", persona.usuario, curso.id))[0][0].ToString(); } }
void cargarMensajes(PersonaBD p) { tMensajes.Text = ""; var id1 = Usuario.getInstance().usuario; var id2 = p.usuario; var con = BD.Select(String.Format("select * from Conversacion where (usuario1 = '{0}' and usuario2 = '{1}') or (usuario1 = '{1}' and usuario2 = '{0}')", id1, id2)); if (con.Count != 0) { tMensajes.Text = (string)con[0][2]; } else { BD.Insert(String.Format("insert into Conversacion Values ('{0}','{1}','')", id1, id2)); } //pCara = ; // TODO var esta_bloqueado = BD.Select(String.Format("select * from Bloqueado where bloqueador = '{0}' and bloqueado = '{1}'", id1, id2)); var estoy_bloqueado = BD.Select(String.Format("select * from Bloqueado where bloqueador = '{0}' and bloqueado = '{1}'", id2, id1)); bEnviar.Enabled = !(estoy_bloqueado.Count != 0 || esta_bloqueado.Count != 0); if (esta_bloqueado.Count != 0) { bBloquear.Text = "Desbloquear"; } else { bBloquear.Text = "Bloquear"; } }