protected void Page_Load(object sender, EventArgs e) { if (Session["usuario"]==null || !Session["tipoUsuario"].Equals("p")) { Response.Redirect("login.aspx"); } ctx = new PW3Entities(); es = new ExamenService(ctx); cs = new CursoService(ctx); p = (profesor)Session["usuario"]; ps = new ProfesorService(ctx); if (PreviousPage == null && !Page.IsPostBack) { Response.Redirect("examenes-profesor.aspx"); } if (!Page.IsPostBack) { nombreCurso.Value = PreviousPage.getNombreCurso(); valorCantidadPreguntas.Value = PreviousPage.getCantidad(); cs.cargarCursosDropDownList(p, ref curso); } //Crea el formulario de preguntas de manera dinamica contenedorPreguntas.InnerHtml = es.getHTMLPreguntas(Convert.ToInt32(valorCantidadPreguntas.Value)); tituloCrearExamen.InnerText = "Creando examen de nombre: " + nombreCurso.Value; }
public String getTablaCursos(profesor _p, Int32 _opcion) { var lista = _p.curso.ToList(); String contenido = ""; foreach (var item in lista) { String cantidadAlumnos = Convert.ToString(item.alumno.Count()); string[] fecha_fin = Convert.ToString(item.fecha_fin).Split(' '); string[] fecha_inicio = Convert.ToString(item.fecha_inicio).Split(' '); String botonEditar; String botonBorrar; if (_opcion == 2) { botonEditar = "<a href='editar-curso.aspx?id=" + item.id_curso + "' class='btn btn-success'>Editar</a>"; botonBorrar = "<a href='borrarCurso.aspx?id=" + item.id_curso + "' class='btn btn-success'>Borrar</a>"; } else { botonEditar = ""; botonBorrar = ""; } contenido = contenido + "<tr><td>" + item.id_curso + "</td><td>" + item.nombre + "</td><td>" + "SI" + "</td><td>" + cantidadAlumnos + "</td><td>" + fecha_inicio[0] + "</td><td>" + fecha_fin[0] + "</td><td>" + botonEditar +botonBorrar+ "</td></tr>"; } return contenido; }
public String getTablaExamenes(profesor _p) { var lista = _p.curso.ToList(); String contenido = ""; Int32 contador = 1; foreach (var item in lista) { var examenes = item.examen.ToList(); foreach (var examen in examenes) { Int32 rindieron = examen.examen_realizado.Count(); Int32 aprobaron = examen.examen_realizado.Where(e => e.estado == "aprobado").Count(); Int32 desaprobaron = rindieron - aprobaron; Int32 faltan = examen.curso.alumno.Count() - rindieron; String botonGrafico = "<a href='ver-grafico.aspx?id="+examen.id_examen+"' class='btn btn-success'>Ver</a>"; contenido = contenido + "<tr><td>" + contador + "</td><td>" + item.nombre + "</td><td>" + examen.nombre + "</td><td>" + rindieron + "</td><td>" + aprobaron + "</td><td>"+ desaprobaron + "</td><td>"+faltan + "</td><td>"+botonGrafico+"</td></tr>"; contador++; } } return contenido; }
protected void Page_Load(object sender, EventArgs e) { if (Session["usuario"] == null || !Session["tipoUsuario"].Equals("p")) { Response.Redirect("login.aspx"); } ctx = new PW3Entities(); p = (profesor)Session["usuario"]; ps = new ProfesorService(ctx); cs = new CursoService(ctx); try { id = Convert.ToInt32(Request.QueryString["id"]); if (!ps.comprobarCurso(p,id)) { Response.Redirect("error-profesor.aspx"); } if (!cs.comprobarCursoBorrar(id)) { tituloBorrar.InnerText = "No se puede borrar el curso de nombre "+ctx.curso.Where(c=> c.id_curso==id).First().nombre; textoBorrar.InnerText = " No se puede borrar este curso, debido a que tiene un examen asociado, o un alumno inscripto en el mismo."; botonesBorrar.InnerHtml = ""; } else tituloBorrar.InnerText = cs.getTituloBorrarCurso(id); } catch (Exception) { Response.Redirect("error-profesor.aspx"); } }
public void cargarCursosDropDownList(profesor _p, ref DropDownList dp) { dp.DataSource = _p.curso.ToList(); dp.DataTextField = "nombre"; dp.DataValueField = "id_curso"; dp.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["usuario"] == null || !Session["tipoUsuario"].Equals("p")) { Response.Redirect("login.aspx"); } ctx = new PW3Entities(); ps = new ProfesorService(ctx); cs = new CursoService(ctx); p = (profesor) Session["usuario"]; try { id_curso = Convert.ToInt32(Request.QueryString["id"]); if (!ps.comprobarCurso(p,id_curso)) { Response.Redirect("error-profesor.aspx"); } } catch (Exception) { Response.Redirect("error-profesor.aspx"); } tituloEditar.InnerText = cs.getTituloEditar(id_curso); if (!Page.IsPostBack) { cargarCurso(id_curso); } }
public Boolean comprobarCurso(profesor _p, Int32 _idCurso) { if (ctx.curso.Where(c => c.id_curso == _idCurso).Count() > 0) { if (ctx.profesor.Where(p => p.id_profesor == _p.id_profesor).First().curso.Where(c => c.id_curso == _idCurso).Count() > 0) { return true; } else return false; } else return false; }
protected void Page_Load(object sender, EventArgs e) { if (Session["usuario"] == null || !Session["tipoUsuario"].Equals("p")) { Response.Redirect("login.aspx"); } p = (profesor)Session["usuario"]; ctx = new PW3Entities(); ps = new ProfesorService(ctx); misCursos.InnerHtml = ps.getTablaCursos(p,2);//Insearta la tabla con los cursos del profesor logueado }
protected void Page_Load(object sender, EventArgs e) { if (Session["usuario"] == null || !Session["tipoUsuario"].Equals("p")) { Response.Redirect("login.aspx"); } PW3Entities ctx = new PW3Entities(); p = (profesor)Session["usuario"]; cs = new CursoService(ctx); ps = new ProfesorService(ctx); tablaMisExamenes.InnerHtml = ps.getTablaExamenes(p); }
protected void Page_Load(object sender, EventArgs e) { if (Session["usuario"] == null || !Session["tipoUsuario"].Equals("p")) { Response.Redirect("login.aspx"); } ctx = new PW3Entities(); ps = new ProfesorService(ctx); p = (profesor)Session["usuario"]; tituloHomeProfesor.InnerText = ps.getTituloHome(p);//Inserta texto para el titulo misCursos.InnerHtml = ps.getTablaCursos(p,1);// Inserta el HTML de la tabla con los cursos del profesor logueado tablaMisExamenes.InnerHtml = ps.getTablaExamenes(p); }
public String getTituloHome(profesor _p) { return "Bienvenido " + _p.nombre + " " + _p.apellido; }
/// <summary> /// Deprecated Method for adding a new object to the profesor EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToprofesor(profesor profesor) { base.AddObject("profesor", profesor); }
/// <summary> /// Create a new profesor object. /// </summary> /// <param name="id_profesor">Initial value of the id_profesor property.</param> public static profesor Createprofesor(global::System.Int32 id_profesor) { profesor profesor = new profesor(); profesor.id_profesor = id_profesor; return profesor; }