Exemplo n.º 1
0
        private void btnMostrar_Click(object sender, EventArgs e)
        {
            Coche tem;
            int   numFila;

            tem = ServicioCoche.GetCoches();

            if (tem == null)
            {
                MessageBox.Show("No hay Coches!");
                return;
            }

            grilla.Rows.Clear();

            while (tem != null)
            {
                numFila = grilla.Rows.Add();
                grilla.Rows[numFila].Cells[0].Value = tem.getID();
                grilla.Rows[numFila].Cells[1].Value = tem.getMarca();
                grilla.Rows[numFila].Cells[2].Value = tem.getModelo();
                grilla.Rows[numFila].Cells[3].Value = tem.getNumeroAirBag();
                grilla.Rows[numFila].Cells[4].Value = tem.getFechaCreacion().ToString("dd/MM/yyyy");

                tem = tem.getSgte();
            }
        }
Exemplo n.º 2
0
        private void btnAgragarFinal_Click(object sender, EventArgs e)
        {
            String   modelo;
            int      numeroAirBag;
            String   marca;
            Coche    nuevoCoche;
            DateTime fechaCreacion;

            modelo        = txtModelo.Text.Trim();
            numeroAirBag  = Convert.ToInt32(txtNumeroAir.Text);
            marca         = txtMarca.Text.Trim();
            fechaCreacion = dateTPFecha.Value.Date;

            nuevoCoche = new Coche(ServicioCoche.condeContar(), modelo, fechaCreacion, numeroAirBag, marca);
            try
            {
                ServicioCoche.adicionarFinal(nuevoCoche);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            MessageBox.Show("Nuevo carro");
            txtModelo.Text    = "";
            txtNumeroAir.Text = "";
            txtMarca.Text     = "";

            txtMarca.Focus();
        }
Exemplo n.º 3
0
 private void btnElimnarUlti_Click(object sender, EventArgs e)
 {
     try
     {
         ServicioCoche.eliminarUltimo();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 4
0
 private void btnElimPosicion_Click(object sender, EventArgs e)
 {
     try
     {
         int posicion;
         posicion = Convert.ToInt32(txtPosicion.Text);
         ServicioCoche.eliminarPosicion(posicion);
         txtPosicion.Text = "";
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 5
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            int ID;

            ID = Convert.ToInt32(txtID.Text.Trim());
            Coche buscado = null;

            try
            {
                buscado           = ServicioCoche.buscarId(ID);
                txtModelo.Text    = buscado.getModelo();
                txtNumeroAir.Text = Convert.ToString(buscado.getNumeroAirBag());
                txtMarca.Text     = buscado.getMarca();
                dateTPFecha.Value = buscado.getFechaCreacion();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 6
0
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            String modelo;
            int    numeroAirBag;
            String marca;
            Coche  nuevoCoche;
            int    ID;

            ID           = Convert.ToInt32(txtID.Text.Trim());
            modelo       = txtModelo.Text.Trim();
            numeroAirBag = Convert.ToInt32(txtNumeroAir.Text);
            marca        = txtMarca.Text.Trim();

            ServicioCoche.actualizarCoche(ID, modelo, numeroAirBag, marca);

            txtModelo.Text    = "";
            txtNumeroAir.Text = "";
            txtMarca.Text     = "";
            txtID.Text        = "";
        }
Exemplo n.º 7
0
        private void btnAgrePosi_Click(object sender, EventArgs e)
        {
            String   modelo;
            int      numeroAirBag;
            String   marca;
            Coche    nuevoCoche;
            int      posicion;
            DateTime fechaCreacion;

            if (txtPosicion.Text == "")
            {
                MessageBox.Show("No se especifico la posición, por favor digitar posición");
                return;
            }
            modelo        = txtModelo.Text.Trim();
            numeroAirBag  = Convert.ToInt32(txtNumeroAir.Text);
            marca         = txtMarca.Text.Trim();
            fechaCreacion = dateTPFecha.Value.Date;

            posicion = Convert.ToInt32(txtPosicion.Text);

            nuevoCoche = new Coche(ServicioCoche.condeContar(), modelo, fechaCreacion, numeroAirBag, marca);
            try
            {
                ServicioCoche.adicionarPosicion(nuevoCoche, posicion);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }


            MessageBox.Show("Nuevo carro");
            txtModelo.Text    = "";
            txtNumeroAir.Text = "";
            txtMarca.Text     = "";
            txtPosicion.Text  = "";

            txtMarca.Focus();
        }
Exemplo n.º 8
0
 private void btnListaAgre_Click(object sender, EventArgs e)
 {
     ServicioCoche.metodoPruebaInsertarNodos();
 }