コード例 #1
0
 void CargarLista()
 {
     try
     {
         NAulas        n          = new NAulas();
         List <EAulas> L          = n.ListaAulas();
         var           NuevaLista = (from i in L
                                     select new
         {
             i.AulaId,
             i.Aula,
             i.Capacidad,
             i.Vacantes,
             i.Turno,
             i.TurnoName,
             i.GradoId,
             i.Grado,
             i.Activo
         }).OrderBy(x => x.TurnoName).ToList();
         gridControl1.DataSource = NuevaLista;
         gridView1.BestFitColumns();
         gridView1.Columns[0].Visible = false;
         gridView1.Columns[4].Visible = false;
         gridView1.Columns[6].Visible = false;
         gridView1.Columns[7].Group();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
 private void eliminarToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         EAulas A = new EAulas();
         NAulas n = new NAulas();
         A.AulaId = Convert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "AulaId").ToString());
         var          Aula = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "Aula").ToString();
         DialogResult o    = MessageBox.Show("¿Realmente deseas eliminar la Aula " + Aula + " ?", "SGA", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
         if (o == DialogResult.OK)
         {
             n.EliminarAulas(A);
             MessageBox.Show("Aula Eliminada con exito", "SGA", MessageBoxButtons.OK, MessageBoxIcon.Information);
             Limpiar();
             CargarGrados();
             CargarLista();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "SGA", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }