Exemple #1
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            VehiculoServiceClient servVehiculo = new VehiculoServiceClient();

            long       resp;
            VehiculoBE registrar_vehiculo = new VehiculoBE();

            try
            {
                registrar_vehiculo.Placa      = txtPlaca.Text;
                registrar_vehiculo.Marca      = txtMarca.Text;
                registrar_vehiculo.Cilindraje = txtCilindraje.Text;
                registrar_vehiculo.Modelo     = lstModelo.SelectedValue;
                registrar_vehiculo.Motor      = txtMotor.Text;
                registrar_vehiculo.Chasis     = txtChasis.Text;
                registrar_vehiculo.Estado     = lstEstado.SelectedValue;

                ConductorBE cond = new ConductorBE();
                cond.Cedula = txtCedConductor.Text;
                registrar_vehiculo.Conductor = cond;

                ContratistaBE contrat = new ContratistaBE();
                contrat.Cedula = txtCedula2.Text;
                registrar_vehiculo.Contratista = contrat;

                RutaBE rutaasig = new RutaBE();
                rutaasig.Id_Ruta        = lstRuta.SelectedValue;
                registrar_vehiculo.Ruta = rutaasig;

                resp = servVehiculo.Registrar_Vehiculo(registrar_vehiculo);

                MessageBox.Show("El vehículo fue registrado satisfactoriamente", "Registrar Vehículo");
            }
            catch (Exception ex)
            {
                Response.Redirect("~/About.aspx");
            }
            finally
            {
                servVehiculo.Close();
                Response.Redirect("~/Vehiculos/frmRegistrarVehiculo.aspx");
            }
        }