private void cargaAutomovil(int auto_id = Entidad.NUEVO) { try { ComboBoxManager cbm = new ComboBoxManager(); if (auto_id == Entidad.NUEVO) { automovil = new Automovil(); comboBoxMarca = cbm.Marca(comboBoxMarca); comboBoxTurno = cbm.Turno(comboBoxTurno); comboBoxChofer = cbm.Chofer(comboBoxChofer); } else { Automovil automovil_mapper = new Automovil(); this.automovil = automovil_mapper.Mapear(auto_id); checkBoxHabilitado.Checked = automovil.habilitado; textBoxModelo.Text = automovil.modelo; textBoxPatente.Text = automovil.patente; comboBoxMarca = cbm.Marca(comboBoxMarca, automovil.marca.nombre); comboBoxTurno = cbm.Turno(comboBoxTurno, automovil.turno.descripcion); comboBoxChofer = cbm.Chofer(comboBoxChofer, automovil.chofer.nombre + ' ' + automovil.chofer.apellido); } } catch (Exception exception) { MessageBox.Show(exception.Message, "Automovil error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void cargaCombos() { try { ComboBoxManager cmb = new ComboBoxManager(); comboBoxMarca = cmb.Marca(comboBoxMarca); } catch (Exception exception) { MessageBox.Show(exception.Message, "Carga de automoviles error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }