Exemple #1
0
        private void btnVehiculoComb_Click(object sender, EventArgs e)
        {
            this.Dispose();
            TipoCombustibleCrear form = new TipoCombustibleCrear();

            form.ShowDialog();
        }
        private void btnTipoCombustibleGuardar_Click(object sender, EventArgs e)
        {
            if (txtTipoCombustibleDescripcion.Text == "")
            {
                MessageBox.Show("Llene los campos faltantes.",
                                "Datos necesarios vacios",
                                MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
            else
            {
                var tipoCombustible = new Data.Entidades.TipoCombustible
                {
                    Id          = lblTipoCombustibleId.Text == "Comb. ID" ? 0 : Convert.ToInt32(lblTipoCombustibleId.Text),
                    Descripcion = txtTipoCombustibleDescripcion.Text,
                };

                _tipoCombustibleService.Save(tipoCombustible);

                MessageBox.Show("El tipo de Combustible ha sido agregado exitosamente.",
                                "Tipo de combustible agregado",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);

                TipoCombustible_Load(sender, e);
                lblTipoCombustibleId.Text = "Comb. ID";

                this.Dispose();
                VehiculoCrear form = new VehiculoCrear();
                form.ShowDialog();
            }

            if (lblTipoCombustibleId.Text == "Comb. ID")
            {
                txtTipoCombustibleDescripcion.Text = "";
            }
            else
            {
                Dispose();
                var tipoCombustibleCrear = new TipoCombustibleCrear();
                tipoCombustibleCrear.Show();
            }
        }