private void btnRegistrar_Click(object sender, EventArgs e) { try { String descripcion = textDescripcion.Text.Trim(); if (descripcion.Length > 0) { if (tipoSeleccionado == null) { fachada.crearTipoCombustible(descripcion); MessageBox.Show("El tipo de combustible ha sido creado"); } else { fachada.editarTipoCombustible((TipoCombustible)listaTiposCombustible.SelectedItem, textDescripcion.Text); MessageBox.Show("Se ha editado el elemento seleccionado de forma correcta!"); } listaTiposCombustible.Items.Clear(); foreach (TipoCombustible t in fachada.getListaTiposCombustible()) { listaTiposCombustible.Items.Add(t); } listaTiposCombustible.Show(); } else { MessageBox.Show("Valores incorrectos.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (MiExcepcion es) { MessageBox.Show(es.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error en los datos", MessageBoxButtons.OK, MessageBoxIcon.Error); } tipoSeleccionado = null; listaTiposCombustible.SelectedItem = null; }
public FormTipoCombustible() { InitializeComponent(); fachada = FachadaUISistema.getFachada(); tipoSeleccionado = null; listaTiposCombustible.Items.Clear(); foreach (TipoCombustible t2 in fachada.getListaTiposCombustible()) { listaTiposCombustible.Items.Add(t2); } listaTiposCombustible.Show(); }
public FormTanqueCombustible() { InitializeComponent(); fachada = FachadaUISistema.getFachada(); tanqueSeleccionado = null; comboTiposCombustible.Items.Clear(); foreach (TipoCombustible t in fachada.getListaTiposCombustible()) { comboTiposCombustible.Items.Add(t); } comboTiposCombustible.Show(); listaTanques.Items.Clear(); foreach (TanqueCombustible t2 in fachada.getListaTanquesCombustible()) { listaTanques.Items.Add(t2); } listaTanques.Show(); }