Пример #1
0
 protected void btnCancelar_Click(object sender, EventArgs e)
 {
     using (ModeloOcupacional1 contexto = new ModeloOcupacional1())
     {
         NOTAS nota = (from p in contexto.NOTAS
                       where p.COD_ALU == txbCodAlu.Text && p.COD_CUR == txbCodCur.Text
                       select p).First();
         txbNota1.Text = nota.NOTA1.ToString();
         txbNota2.Text = nota.NOTA2.ToString();
         txbNota3.Text = nota.NOTA3.ToString();
         txbMedia.Text = nota.MEDIA.ToString();
     }
 }
Пример #2
0
 protected void btnModificar_Click(object sender, EventArgs e)
 {
     using (ModeloOcupacional1 contexto = new ModeloOcupacional1())
     {
         NOTAS nota = (from p in contexto.NOTAS
                       where p.COD_CUR == txbCodCur.Text && p.COD_ALU == txbCodAlu.Text
                       select p).First();
         nota.COD_CUR           = txbCodCur.Text;
         nota.COD_ALU           = txbCodAlu.Text;
         nota.ALUMNOS.APELLIDOS = txbApellidos.Text;
         nota.ALUMNOS.NOMBRE    = txbNombre.Text;
         nota.NOTA1             = Int32.Parse(txbNota1.Text);
         nota.NOTA2             = Int32.Parse(txbNota2.Text);
         nota.NOTA3             = Int32.Parse(txbNota3.Text);
         nota.MEDIA             = Int32.Parse(txbMedia.Text);
         contexto.SaveChanges();
         dropNotasCurso.ClearSelection();
         GridviewNota.DataBind();
     }
 }
Пример #3
0
 protected void btnAceptar_Click(object sender, EventArgs e)
 {
     try
     {
         using (ModeloOcupacional1 contexto = new ModeloOcupacional1())
         {
             NOTAS nota = new NOTAS();
             nota.COD_ALU = ddAlumnos.Text;
             nota.COD_CUR = ddCursos.Text;
             nota.NOTA1   = 0;
             nota.NOTA2   = 0;
             nota.NOTA3   = 0;
             nota.MEDIA   = 0;
             contexto.NOTAS.Add(nota);
             contexto.SaveChanges();
         }
     }
     catch (Exception)
     {
         literal1.Text = "El alumno ya se encuentra en el curso";
         return;
     }
     Response.Redirect("WebFormAlumno.aspx");
 }