예제 #1
0
        void Insertar(Object sender, EventArgs e)
        {
            String        txtMatricula        = FormInsertarVehiculo.EdMadricula.Text;
            String        txtTipo             = FormInsertarVehiculo.CbTipo.Text;
            String        txtMarca            = FormInsertarVehiculo.EdMarca.Text;
            String        txtModelo           = FormInsertarVehiculo.EdModelo.Text;
            String        txtConsumo          = FormInsertarVehiculo.EdConsumo.Text;
            String        txtFechaAdquisicion = FormInsertarVehiculo.EdFechaAdquisicion.Text;
            String        txtFechaFabricacion = FormInsertarVehiculo.EdFechaFabricacion.Text;
            bool          wifi        = FormInsertarVehiculo.EdWifi.Checked;
            bool          bluetooth   = FormInsertarVehiculo.EdBluetooth.Checked;
            bool          acc         = FormInsertarVehiculo.EdAcc.Checked;
            bool          litera      = FormInsertarVehiculo.EdLitera.Checked;
            bool          tv          = FormInsertarVehiculo.EdTV.Checked;
            List <string> comodidades = new List <string>();

            if (wifi)
            {
                comodidades.Add("wifi");
            }
            if (bluetooth)
            {
                comodidades.Add("bluetooth");
            }
            if (acc)
            {
                comodidades.Add("aire acondicionado");
            }
            if (litera)
            {
                comodidades.Add("litera");
            }
            if (tv)
            {
                comodidades.Add("tv");
            }

            Vehiculo v = new Vehiculo(txtMatricula, txtTipo, txtMarca, txtModelo, txtConsumo, txtFechaAdquisicion, txtFechaFabricacion, comodidades);

            Vehiculos.Inserta(v);
            VehiculosMainView.Lista.Items.Add(v.ToString());
            FormInsertarVehiculo.Close();
            this.Guardar(null, null);
        }
예제 #2
0
 void MostrarForm(Object sender, EventArgs e)
 {
     FormInsertarVehiculo.ShowDialog();
 }