Пример #1
0
 public void EliminarAulas(EAulas e)
 {
     try
     {
         DAulas d = new DAulas();
         d.EliminarAula(e);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #2
0
 public void ModificarAulas(EAulas e)
 {
     try
     {
         if (e.Aula == "")
         {
             throw new ArgumentException("Ingrese una Aula");
         }
         DAulas d = new DAulas();
         d.ModificarAula(e);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #3
0
 public void IngresaAulas(EAulas e)
 {
     try
     {
         List <EAulas> Lista = ListaAulas().Where(x => x.Aula == e.Aula && x.GradoId == e.GradoId && e.Turno == x.Turno).ToList();
         if (Lista.Count > 0)
         {
             throw new ArgumentException("La Aula " + e.Aula + " ya existe");
         }
         DAulas d = new DAulas();
         d.IngresarAula(e);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #4
0
 public void EliminarAula(EAulas A)
 {
     try
     {
         comando             = new SqlCommand("EliminarAulas");
         comando.CommandType = CommandType.StoredProcedure;
         comando.Parameters.AddWithValue("@AulaId", A.AulaId);
         comando.Connection = conexion;
         conexion.Open();
         comando.ExecuteNonQuery();
         conexion.Close();
         conexion.Dispose();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #5
0
 public void IngresarAula(EAulas A)
 {
     try
     {
         comando             = new SqlCommand("IngresarAula", conexion);
         comando.CommandType = CommandType.StoredProcedure;
         comando.Parameters.AddWithValue("@Aula", A.Aula);
         comando.Parameters.AddWithValue("@capacidad", A.Capacidad);
         comando.Parameters.AddWithValue("@Vacantes", A.Vacantes);
         comando.Parameters.AddWithValue("@GradoId", A.GradoId);
         comando.Parameters.AddWithValue("@Turno", A.Turno);
         conexion.Open();
         comando.ExecuteNonQuery();
         conexion.Close();
         conexion.Dispose();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #6
0
        public List <EAulas> MostrarVacantesAulas(int turnoid, int id)
        {
            comando             = new SqlCommand("mostrarVacantesAula", conexion);
            comando.CommandType = CommandType.StoredProcedure;
            comando.Parameters.AddWithValue("@Gradoid", id);
            comando.Parameters.AddWithValue("@Turno", turnoid);
            conexion.Open();
            SqlDataReader leer  = comando.ExecuteReader();
            List <EAulas> lista = new List <EAulas>();

            while (leer.Read())
            {
                EAulas a = new EAulas();
                a.Aula      = leer[0].ToString();
                a.Capacidad = (int)leer[1];
                lista.Add(a);
            }
            leer.Close();
            conexion.Close();
            conexion.Dispose();
            return(lista);
        }
Пример #7
0
 public List <EAulas> ListaAulas()
 {
     try
     {
         string sql = "select AulaId,Aula,Capacidad,Vacantes,A.GradoId,Grado,A.activo,A.TurnoId, Turno \n" +
                      "from dba.Aulas A \n" +
                      "inner join dba.Grados G ON A.GradoId = G.GradoId \n" +
                      "inner join dba.Turnos T on A.TurnoId = T.TurnoId";
         comando             = new SqlCommand(sql, conexion);
         comando.CommandType = CommandType.Text;
         comando.Connection  = conexion;
         conexion.Open();
         List <EAulas> lista = new List <EAulas>();
         SqlDataReader leer  = comando.ExecuteReader();
         while (leer.Read())
         {
             EAulas a = new EAulas();
             a.AulaId    = (int)leer[0];
             a.Aula      = leer[1].ToString();
             a.Capacidad = (int)leer[2];
             a.Vacantes  = (int)leer[3];
             a.GradoId   = (int)leer[4];
             a.Grado     = leer[5].ToString();
             a.Activo    = (bool)leer[6];
             a.Turno     = Convert.ToInt32(leer[7].ToString());
             a.TurnoName = leer[8].ToString();
             lista.Add(a);
         }
         leer.Close();
         conexion.Close();
         conexion.Dispose();
         return(lista);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #8
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);
     }
 }