예제 #1
0
        private void btnTipoVehiculoGuardar_Click(object sender, EventArgs e)
        {
            if (txtTipoVehiculoDescripcion.Text == "")
            {
                MessageBox.Show("Llene los campos faltantes.",
                                "Datos necesarios vacios",
                                MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
            else
            {
                var tipoVehiculo = new Data.Entidades.TipoVehiculo
                {
                    Id          = lblTipoVehiculoId.Text == "Tip. Vehiculo ID" ? 0 : Convert.ToInt32(lblTipoVehiculoId.Text),
                    Descripcion = txtTipoVehiculoDescripcion.Text,
                };

                _tipoVehiculoService.Save(tipoVehiculo);

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

                TipoVehicloCrear_Load(sender, e);
                lblTipoVehiculoId.Text = "Tip. Vehiculo ID";

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

            if (lblTipoVehiculoId.Text == "Tip. Vehiculo ID")
            {
                txtTipoVehiculoDescripcion.Text = "";
            }
        }
예제 #2
0
 private void TipoVehicloCrear_Load(object sender, EventArgs e, Data.Entidades.TipoVehiculo tipoVehiculo)
 {
     lblTipoVehiculoId.Text          = tipoVehiculo.Id.ToString();
     txtTipoVehiculoDescripcion.Text = tipoVehiculo.Descripcion;
 }