private void agregarbtn_Click(object sender, EventArgs e)
 {
     if (dataGridView1.SelectedRows.Count == 1)
     {
         int linea = Convert.ToInt16(dataGridView1.CurrentRow.Cells[0].Value);
         pilotoSeleccionado = pilBD.obtenerPiloto(linea);
         this.Close();
     }
 }
Exemplo n.º 2
0
        public static int Actualizar(_piloto pPiloto)
        {
            int             retorno  = 0;
            MySqlConnection conexion = BdConexion.ObtenerConexion();
            MySqlCommand    comando  = new MySqlCommand(String.Format("Update piloto set pil_lic ='{1}', pil_certm='{2}',pil_horas='{3}',pil_calif='{4}',emp_id='{5}' where pil_id = '{0}'", pPiloto.pil_id, pPiloto.pil_lic, pPiloto.pil_certm, pPiloto.pil_horas, pPiloto.pil_calif, pPiloto.emp_id), conexion);

            retorno = comando.ExecuteNonQuery();
            return(retorno);
        }
Exemplo n.º 3
0
        public static _piloto obtenerPiloto(int pil_id)
        {
            _piloto         pPiloto  = new _piloto();
            MySqlConnection conexion = BdConexion.ObtenerConexion();
            MySqlCommand    _comando = new MySqlCommand(String.Format("select * from piloto where pil_id ='{0}'", pil_id), conexion);
            MySqlDataReader _reader  = _comando.ExecuteReader();

            while (_reader.Read())
            {
                pPiloto.pil_id    = _reader.GetInt16(0);
                pPiloto.pil_lic   = _reader.GetString(1);
                pPiloto.pil_certm = _reader.GetString(2);
                pPiloto.pil_horas = _reader.GetInt16(3);
                pPiloto.pil_calif = _reader.GetInt16(4);
                pPiloto.emp_id    = _reader.GetInt16(5);
            }
            conexion.Close();
            return(pPiloto);
        }
Exemplo n.º 4
0
        public static List <_piloto> BuscarT()
        {
            List <_piloto>  _lista   = new List <_piloto>();
            MySqlCommand    _comando = new MySqlCommand(String.Format("Select pil_id as 'ID', pil_lic as 'Licencia', pil_certm as 'Certificado Médico', pil_horas as 'Horas de vuelo', pil_calif as 'Calificacíón', emp_id as 'Id empleado' from piloto"), BdConexion.ObtenerConexion());
            MySqlDataReader _reader  = _comando.ExecuteReader();

            while (_reader.Read())
            {
                _piloto pPiloto = new _piloto();
                pPiloto.pil_id    = _reader.GetInt16(0);
                pPiloto.pil_lic   = _reader.GetString(1);
                pPiloto.pil_certm = _reader.GetString(2);
                pPiloto.pil_horas = _reader.GetInt16(3);
                pPiloto.pil_calif = _reader.GetInt16(4);
                pPiloto.emp_id    = _reader.GetInt16(5);

                _lista.Add(pPiloto);
            }
            return(_lista);
        }
Exemplo n.º 5
0
        private void consultarbtn_Click(object sender, EventArgs e)
        {
            error.Clear();
            buscarPiloto buscar = new buscarPiloto();

            buscar.ShowDialog();
            if (buscar.pilotoSeleccionado != null)
            {
                pilotoActual        = buscar.pilotoSeleccionado;
                licenciatxt.Text    = pilotoActual.pil_lic;
                certificadotxt.Text = pilotoActual.pil_certm;
                horastxt.Text       = Convert.ToString(pilotoActual.pil_horas);
                trackBar1.Value     = pilotoActual.pil_calif;
                idEmpleadotxt.Text  = Convert.ToString(pilotoActual.pil_id);
                nombreEmpleado.Text = pilBD.nombreEmpleado(pilotoActual.pil_id);
                ingresarbtn.Hide();
                idEmpleadotxt.Enabled = false;
                prueba.Text           = Convert.ToString(trackBar1.Value);
            }
        }
Exemplo n.º 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (validar())
            {
                _piloto pPiloto = new _piloto();
                pPiloto.pil_lic   = licenciatxt.Text.Trim();
                pPiloto.pil_certm = certificadotxt.Text.Trim();
                pPiloto.pil_horas = Convert.ToInt16(horastxt.Text);
                pPiloto.emp_id    = Convert.ToInt16(idEmpleadotxt.Text);
                pPiloto.pil_calif = Convert.ToInt16(trackBar1.Value);

                int resultado = pilBD.Agregar(pPiloto);
                if (resultado > 0)
                {
                    MessageBox.Show("Piloto Guardado Con Exito!!", "Guardado", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    error.Clear();
                    limpiar();
                }
                else
                {
                    MessageBox.Show("No se pudo guardar el piloto", "Fallo!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }