Exemplo n.º 1
0
 private void btnEliminar_Click(object sender, EventArgs e)
 {
     if (tanqueSeleccionado != null)
     {
         if (fachada.contieneMangueras(tanqueSeleccionado))
         {
             MessageBox.Show("No se puede eliminar el tanque, el mismo tiene mangueras asociadas");
         }
         else
         {
             fachada.eliminarTanqueCombustible(tanqueSeleccionado.idTanque);
             MessageBox.Show("Se ha eliminado el elemento seleccionado de forma correcta!");
             listaTanques.Items.Clear();
             foreach (TanqueCombustible t2 in fachada.getListaTanquesCombustible())
             {
                 listaTanques.Items.Add(t2);
             }
             listaTanques.Show();
         }
         tanqueSeleccionado = null;
     }
     else
     {
         MessageBox.Show("Debe seleccionar un tanque");
     }
 }
Exemplo n.º 2
0
 private void listaTanques_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listaTanques.SelectedItem != null)
     {
         tanqueSeleccionado   = (TanqueCombustible)listaTanques.SelectedItem;
         textCapacidad.Text   = (tanqueSeleccionado).capacidad.ToString();
         textDescripcion.Text = (tanqueSeleccionado).descripcion.ToString();
         textNumero.Text      = (tanqueSeleccionado).idTanque.ToString();
         comboTiposCombustible.SelectedItem = tanqueSeleccionado.tipoCombustible;
     }
 }
Exemplo n.º 3
0
        public FormTareaTratamientoComb()
        {
            InitializeComponent();
            fachada            = FachadaUISistema.getFachada();
            tanqueSeleccionado = null;

            listBoxTanquesComb.Items.Clear();
            foreach (TanqueCombustible tanque in fachada.getListaTanquesCombustible())
            {
                listBoxTanquesComb.Items.Add(tanque);
            }
            listBoxTanquesComb.Show();
        }
Exemplo n.º 4
0
 private void btnIzq_Click(object sender, EventArgs e)
 {
     if (listBoxNuevaTanquesComb.SelectedItem != null)
     {
         tanqueSeleccionado = (TanqueCombustible)listBoxNuevaTanquesComb.SelectedItem;
         listBoxNuevaTanquesComb.Items.Remove(tanqueSeleccionado);
         listBoxTanquesComb.Items.Add(tanqueSeleccionado);
     }
     else
     {
         MessageBox.Show("Debe seleccionar un tanque");
     }
     tanqueSeleccionado = null;
 }
Exemplo n.º 5
0
        private void btnRegistrar_Click(object sender, EventArgs e)
        {
            try
            {
                String descripcion = textDescripcion.Text.Trim();
                if ((textCapacidad.Text.Trim().Length > 0) && (descripcion.Length > 0) && (textNumero.Text.Trim().Length > 0))
                {
                    int capacidad = Convert.ToInt32(textCapacidad.Text.Trim());
                    int numero    = Convert.ToInt32(textNumero.Text.Trim());

                    if (tanqueSeleccionado == null)
                    {
                        fachada.crearTanqueCombustible(numero, descripcion, capacidad, (TipoCombustible)comboTiposCombustible.SelectedItem);
                        MessageBox.Show("El tanque ha sido creado");
                    }
                    else
                    {
                        MessageBox.Show("Error");
                    }
                    borrarDatos();

                    listaTanques.Items.Clear();
                    foreach (TanqueCombustible t in fachada.getListaTanquesCombustible())
                    {
                        listaTanques.Items.Add(t);
                    }
                    listaTanques.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);
            }
            tanqueSeleccionado        = null;
            listaTanques.SelectedItem = null;
        }
Exemplo n.º 6
0
        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();
        }
Exemplo n.º 7
0
        private void buttonGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                TipoCombustible   tipoC  = (TipoCombustible)comboBoxTipoComb.SelectedItem;
                TanqueCombustible tanque = (TanqueCombustible)comboBoxTanque.SelectedItem;

                if ((textBoxCantidad.Text.Trim().Length > 0) && (tipoC != null) && (tanque != null))
                {
                    int cantidad = Convert.ToInt32(textBoxCantidad.Text.Trim());

                    if (tareaSeleccionada == null)
                    {
                        fachada.crearTareaReposicionCombustible((TanqueCombustible)comboBoxTanque.SelectedItem, cantidad);
                        MessageBox.Show("La tarea ha sido creada");
                    }

                    listBoxListaTareas.Items.Clear();
                    foreach (TareaReposicionCombustible t in fachada.getListaTareasReposicionCombustible())
                    {
                        listBoxListaTareas.Items.Add(t);
                    }
                    listBoxListaTareas.Show();
                    borrarDatos();
                }
                else
                {
                    MessageBox.Show("Faltan datos.", "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);
            }
        }