Example #1
0
        private void btnNuevo_Click(object sender, EventArgs e)
        {
            FrmNuevoVehiculo oFrm = new FrmNuevoVehiculo(0);

            oFrm.label11.Text = "Nuevo Vehiculo";
            oFrm.ShowDialog();
            Cargar();
        }
Example #2
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            if (dgvVehiculos.CurrentRow != null)
            {
                FrmNuevoVehiculo oFrm = new FrmNuevoVehiculo(1);
                oFrm.label11.Text           = "Modificar Vehiculo";
                oFrm.txtID.Text             = dgvVehiculos.CurrentRow.Cells["ID"].Value.ToString();
                oFrm.txtMatricula.Text      = dgvVehiculos.CurrentRow.Cells["Matricula"].Value.ToString();
                oFrm.cmbMarca.SelectedValue = dgvVehiculos.CurrentRow.Cells["mar_ID"].Value.ToString();
                oFrm.cmbLinea.SelectedValue = dgvVehiculos.CurrentRow.Cells["lin_ID"].Value.ToString();
                oFrm.txtModelo.Text         = dgvVehiculos.CurrentRow.Cells["Modelo"].Value.ToString();
                oFrm.txtColor.Text          = dgvVehiculos.CurrentRow.Cells["Color"].Value.ToString();
                oFrm.txtPuertas.Text        = dgvVehiculos.CurrentRow.Cells["Puertas"].Value.ToString();

                if (dgvVehiculos.CurrentRow.Cells["GPS"].Value.ToString() == "True")
                {
                    oFrm.chbGPS.Checked = true;
                }
                else
                {
                    oFrm.chbGPS.Checked = false;
                }
                oFrm.cmb_tipo.SelectedValue  = dgvVehiculos.CurrentRow.Cells["tip_ID"].Value.ToString();
                oFrm.cmb_clase.SelectedValue = dgvVehiculos.CurrentRow.Cells["cls_ID"].Value.ToString();
                oFrm.txtPrecio.Text          = dgvVehiculos.CurrentRow.Cells["Precio"].Value.ToString();


                if (dgvVehiculos.CurrentRow.Cells["Estado"].Value.ToString() == "DISPONIBLE")
                {
                    oFrm.ShowDialog();
                }
                else
                {
                    MessageBox.Show("El Vehiculo esta Vendido no se puede editar!");
                }
                Cargar();
            }
            else
            {
                MessageBox.Show("Seleccione una fila por favor", "Importante", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }