コード例 #1
0
ファイル: crear-examen.aspx.cs プロジェクト: noyamn/TPWeb3
        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;
        }
コード例 #2
0
ファイル: ProfesorService.cs プロジェクト: noyamn/TPWeb3
        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;
        }
コード例 #3
0
ファイル: ProfesorService.cs プロジェクト: noyamn/TPWeb3
        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;
        }
コード例 #4
0
ファイル: borrarCurso.aspx.cs プロジェクト: noyamn/TPWeb3
        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");
            }
        }
コード例 #5
0
ファイル: CursoService.cs プロジェクト: noyamn/TPWeb3
 public void cargarCursosDropDownList(profesor _p, ref DropDownList dp)
 {
     dp.DataSource = _p.curso.ToList();
     dp.DataTextField = "nombre";
     dp.DataValueField = "id_curso";
     dp.DataBind();
 }
コード例 #6
0
ファイル: editar-curso.aspx.cs プロジェクト: noyamn/TPWeb3
        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);
            }
        }
コード例 #7
0
ファイル: ProfesorService.cs プロジェクト: noyamn/TPWeb3
 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;
 }
コード例 #8
0
ファイル: cursos-profesor.aspx.cs プロジェクト: noyamn/TPWeb3
        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
        }
コード例 #9
0
        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);
        }
コード例 #10
0
ファイル: home-profesor.aspx.cs プロジェクト: noyamn/TPWeb3
        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);
        }
コード例 #11
0
ファイル: ProfesorService.cs プロジェクト: noyamn/TPWeb3
 public String getTituloHome(profesor _p)
 {
     return "Bienvenido " + _p.nombre + " " + _p.apellido;
 }
コード例 #12
0
ファイル: Model1.Designer.cs プロジェクト: noyamn/TPWeb3
 /// <summary>
 /// Deprecated Method for adding a new object to the profesor EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToprofesor(profesor profesor)
 {
     base.AddObject("profesor", profesor);
 }
コード例 #13
0
ファイル: Model1.Designer.cs プロジェクト: noyamn/TPWeb3
 /// <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;
 }