Example #1
0
 // PRE: una lista de vehiculos inicializada y != null y una posicion de la lista
 // POS: se rellenan todos los controles del formulario con los datos de vehiculo que ocupa dicha posicion de la lista
 public void rellenarDatos(int posicion, List <MD.Vehiculo> vehiculos)
 {
     tbNumeroBastidor.Text    = vehiculos[posicion].NumeroDeBastidor;
     tbAño.Text               = vehiculos[posicion].Año.ToString();
     tbMarca.Text             = vehiculos[posicion].Marca;
     tbModelo.Text            = vehiculos[posicion].Modelo;
     tbPotencia.Text          = vehiculos[posicion].Potencia.ToString();
     tbPrecioRecomendado.Text = vehiculos[posicion].PrecioRecomendado.ToString();
     if (vehiculos[posicion].GetType() == typeof(MD.SegundaMano))
     {
         rbSegundaMano.Checked = true;
         rbSegundaMano.Enabled = false;
         segundaMano           = new SegundaMano(((MD.SegundaMano)vehiculos[posicion]).Matricula, ((MD.SegundaMano)vehiculos[posicion]).FechaMatriculacion);
         segundaMano.Location  = new Point(352, 173);
         segundaMano.Show();
         Controls.Add(segundaMano);
     }
     if (vehiculos[posicion].GetType() == typeof(MD.Nuevo))
     {
         rbNuevo.Checked = true;
         rbNuevo.Enabled = false;
         nuevo           = new Nuevo(((MD.Nuevo)vehiculos[posicion]).Extras);
         nuevo.Location  = new Point(352, 173);
         nuevo.Show();
         Controls.Add(nuevo);
     }
     tbNumeroBastidor.Enabled    = false;
     tbModelo.Enabled            = false;
     tbMarca.Enabled             = false;
     tbAño.Enabled               = false;
     tbPotencia.Enabled          = false;
     tbPrecioRecomendado.Enabled = false;
 }
Example #2
0
 // PRE:
 // POS: muestra en el formulario un control de usuario de tipo "SegundaMano"
 private void rbSegundaMano_CheckedChanged(object sender, EventArgs e)
 {
     if (rbSegundaMano.Checked && !accion.Equals("Búsqueda"))
     {
         nuevo.Hide();
         segundaMano          = new SegundaMano();
         segundaMano.Location = new Point(390, 151);
         segundaMano.Show();
         Controls.Add(segundaMano);
     }
 }
Example #3
0
        // PRE:
        // POS: crea un formulario de tipo "VehiculoAltaBaja".
        public VehiculoAltaBaja(String numeroBastidor, String accion)
        {
            this.accion = accion;

            this.numeroBastidor = numeroBastidor;
            this.Text           = accion + "de un vehiculo";

            InitializeComponent();
            setControlsEnabled(true);
            if (accion.Equals("Búsqueda"))
            {
                vehiculo = LNVehiculo.Vehiculo.GetVehiculo(numeroBastidor);
                tbNumeroBastidor.Text    = numeroBastidor;
                tbAño.Text               = vehiculo.Año.ToString();
                tbMarca.Text             = vehiculo.Marca;
                tbModelo.Text            = vehiculo.Modelo;
                tbPotencia.Text          = vehiculo.Potencia.ToString();
                tbPrecioRecomendado.Text = vehiculo.PrecioRecomendado.ToString();
                if (vehiculo.GetType() == typeof(MD.SegundaMano))
                {
                    rbSegundaMano.Checked = true;
                    segundaMano           = new SegundaMano(((MD.SegundaMano)vehiculo).Matricula, ((MD.SegundaMano)vehiculo).FechaMatriculacion);
                    segundaMano.Location  = new Point(390, 151);
                    segundaMano.Show();
                    Controls.Add(segundaMano);
                }
                if (vehiculo.GetType() == typeof(MD.Nuevo))
                {
                    rbNuevo.Checked = true;
                    nuevo           = new Nuevo(((MD.Nuevo)vehiculo).Extras);
                    nuevo.Location  = new Point(390, 151);
                    nuevo.Show();
                    Controls.Add(nuevo);
                }
                setControlsEnabled(false);
            }
            tbNumeroBastidor.Text = numeroBastidor;
        }