/// <summary> /// carga los datos del data grid vehiculo al formulario frmMostrarVehiculo /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dataVehiculo_CurrentCellChanged(object sender, EventArgs e) { if (this.dataVehiculo.CurrentRow != null) { FrmMostrarVehiculo frmMosVehiculo = new FrmMostrarVehiculo(); Form frmMostrarVehiculo = Application.OpenForms.Cast <Form>().FirstOrDefault(x => x is FrmMostrarVehiculo); if (frmMostrarVehiculo != null) { ((FrmMostrarVehiculo)frmMostrarVehiculo).txtAMatricula.Text = dataVehiculo.CurrentRow.Cells[0].Value.ToString(); ((FrmMostrarVehiculo)frmMostrarVehiculo).cmbMarca.Text = dataVehiculo.CurrentRow.Cells[1].Value.ToString(); ((FrmMostrarVehiculo)frmMostrarVehiculo).txtALinea.Text = dataVehiculo.CurrentRow.Cells[2].Value.ToString(); ((FrmMostrarVehiculo)frmMostrarVehiculo).cmbModelo.Text = dataVehiculo.CurrentRow.Cells[3].Value.ToString(); ((FrmMostrarVehiculo)frmMostrarVehiculo).cmbColor.Text = dataVehiculo.CurrentRow.Cells[4].Value.ToString(); ((FrmMostrarVehiculo)frmMostrarVehiculo).cmbCantPuert.Text = dataVehiculo.CurrentRow.Cells[5].Value.ToString(); ((FrmMostrarVehiculo)frmMostrarVehiculo).cmbTipo.Text = dataVehiculo.CurrentRow.Cells[6].Value.ToString(); ((FrmMostrarVehiculo)frmMostrarVehiculo).cmbClase.Text = dataVehiculo.CurrentRow.Cells[7].Value.ToString(); ((FrmMostrarVehiculo)frmMostrarVehiculo).txtAPrecio.Text = dataVehiculo.CurrentRow.Cells[9].Value.ToString(); ((FrmMostrarVehiculo)frmMostrarVehiculo).determinarVistaGps(Convert.ToBoolean(dataVehiculo.CurrentRow.Cells[8].Value)); ((FrmMostrarVehiculo)frmMostrarVehiculo).habilitarDesabilitarCampos(Convert.ToBoolean(dataVehiculo.CurrentRow.Cells[10].Value)); ((FrmMostrarVehiculo)frmMostrarVehiculo).btnMVehiculo.Enabled = false; ((FrmMostrarVehiculo)frmMostrarVehiculo).marca = dataVehiculo.CurrentRow.Cells[1].Value.ToString(); ((FrmMostrarVehiculo)frmMostrarVehiculo).modelo = dataVehiculo.CurrentRow.Cells[3].Value.ToString(); ((FrmMostrarVehiculo)frmMostrarVehiculo).color = dataVehiculo.CurrentRow.Cells[4].Value.ToString(); ((FrmMostrarVehiculo)frmMostrarVehiculo).cantPuertas = dataVehiculo.CurrentRow.Cells[5].Value.ToString(); ((FrmMostrarVehiculo)frmMostrarVehiculo).tipoVehiculo = dataVehiculo.CurrentRow.Cells[6].Value.ToString(); ((FrmMostrarVehiculo)frmMostrarVehiculo).claseVehiculo = dataVehiculo.CurrentRow.Cells[7].Value.ToString(); ((FrmMostrarVehiculo)frmMostrarVehiculo).gps = Convert.ToBoolean(dataVehiculo.CurrentRow.Cells[8].Value); } } }
/// <summary> /// carga en el panel el formulario frmMostrarVehiculo /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnMostrar_Click(object sender, EventArgs e) { var form = Application.OpenForms.OfType <FrmMostrarVehiculo>().FirstOrDefault(); FrmMostrarVehiculo frmMostrar = form ?? new FrmMostrarVehiculo(); AddFormInPanel(frmMostrar); }
/// <summary> /// acciones que se realizan al cargar el formulario vehiculo /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FrmVehiculo_Load(object sender, EventArgs e) { var form = Application.OpenForms.OfType <FrmMostrarVehiculo>().FirstOrDefault(); FrmMostrarVehiculo frmLista = form ?? new FrmMostrarVehiculo(); AddFormInPanel(frmLista); cargarVehiculos(); }
/// <summary> /// actualiza el combo clase del formulario mostrar vehiculo /// </summary> private void actualizarComboClase() { FrmMostrarVehiculo frmMosVehiculo = new FrmMostrarVehiculo(); Form frmMostrarVehiculo = Application.OpenForms.Cast <Form>().FirstOrDefault(x => x is FrmMostrarVehiculo); if (frmMostrarVehiculo != null) { ((FrmMostrarVehiculo)frmMostrarVehiculo).cargarClase(); } }