private void dataGridRol1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     // Ignore clicks that are not in our
     if (e.ColumnIndex == dataGridRol1.Columns["buttonEliminar"].Index && e.RowIndex >= 0)
     {
         Aeronave aeronaveSel = new Aeronave(Convert.ToInt32(dataGridRol1.Rows[e.RowIndex].Cells["Id"].Value), Convert.ToString(dataGridRol1.Rows[e.RowIndex].Cells["Matricula"].Value), Convert.ToString(dataGridRol1.Rows[e.RowIndex].Cells["Modelo"].Value), Convert.ToDecimal(dataGridRol1.Rows[e.RowIndex].Cells["KG_Disponibles"].Value), Convert.ToString(dataGridRol1.Rows[e.RowIndex].Cells["Fabricante"].Value), Convert.ToInt32(dataGridRol1.Rows[e.RowIndex].Cells["Cant_Butacas_Ventanilla"].Value), Convert.ToInt32(dataGridRol1.Rows[e.RowIndex].Cells["Cant_Butacas_Pasillo"].Value), Convert.ToString(dataGridRol1.Rows[e.RowIndex].Cells["Tipo_Servicio"].Value));
         Form frm = new BajaAeronave(aeronaveSel);
         frm.Show(this);
     }
 }
Ejemplo n.º 2
0
        private void boton_Eliminar_Aeronave_Click(object sender, EventArgs e)
        {
            try
             {
                 SqlCommand sqlCmd = new SqlCommand("SELECT THE_CVENGERS.aeronaveEnElAire (" + dameIdAeronave(((Avion)listBox1.SelectedItem).getMatricula()) + ")", Conexion.getConexion());

                 if ((int)sqlCmd.ExecuteScalar() == 1)
                {
                     MessageBox.Show("No se puede dar de baja, la aeronave se encuentra en viaje", "Error",MessageBoxButtons.OK);
                }
                else {

                    BajaAeronave ventana = new BajaAeronave(((Avion)listBox1.SelectedItem).getMatricula());
                    ventana.Show();
                }

            }
            catch(Exception exc)
            {
                MessageBox.Show(exc.Message, "Error", MessageBoxButtons.OK);
            }
        }