Exemplo n.º 1
0
 protected void gridView_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         e.Row.RowState = DataControlRowState.Edit;
         Curso   curso          = (Curso)e.Row.DataItem;
         Usuario usuario        = Authenticate(true);
         int     cantInscriptos = cursos.CantInscriptos(curso);
         if (curso.Cupo - cantInscriptos > 0 && !cursos.AlumnoIsInCurso(usuario.Persona, curso))
         {
             ((Label)e.Row.FindControl("materiaLabel")).Text  = curso.Materia.Descripcion;
             ((Label)e.Row.FindControl("comisionLabel")).Text = curso.Comision.Descripcion;
             Materia materia = materias.GetOne(curso.Materia.ID);
             Plan    plan    = planes.GetOne(materia.Plan.ID);
             ((Label)e.Row.FindControl("especialidadLabel")).Text = plan.Especialidad.Descripcion;
             ((Label)e.Row.FindControl("cupoLabel")).Text         = (curso.Cupo - cantInscriptos) > 0? (curso.Cupo - cantInscriptos).ToString():"0";
         }
         else
         {
             e.Row.Visible = false;
         }
     }
 }
Exemplo n.º 2
0
        public void Listar()
        {
            this.dgvInscripciones.DataSource = cursos.ListByAño(System.DateTime.Now.Year);
            MateriaLogic materias = new MateriaLogic();
            PlanLogic    planes   = new PlanLogic();

            foreach (DataGridViewRow row in dgvInscripciones.Rows)
            {
                Curso   curso   = (Curso)row.DataBoundItem;
                Materia materia = materias.GetOne(curso.Materia.ID);
                Plan    plan    = planes.GetOne(materia.Plan.ID);
                row.Cells["Especialidad"].Value = plan.Especialidad.ToString();
                row.Cells["CupoDisp"].Value     = curso.Cupo - cursos.CantInscriptos(curso);
                row.Cells["Inscripto"].Value    = cursos.AlumnoIsInCurso(currentAlumno, curso);
            }
        }