private void bnvEditarAuto_Click(object sender, EventArgs e) { if (dgvAutos.Rows.Count != 0) { frmEditarVehiculo form = new frmEditarVehiculo(); form.Owner = this; int num = Convert.ToInt16(dgvAutos.CurrentRow.Cells[0].Value); form.Auto = Autos.Find(x => x.Numero == num); form.tipoElegido = 1; form.ShowDialog(); int pos = Autos.FindIndex(x => x.Numero == form.Auto.Numero); Autos[pos] = form.Auto; srcAutos.ResetBindings(true); dgvAutos.Refresh(); } }
private float CalcularCostoTotal(int opcion, int id, int cantPasKm) { float costo = 0; if (opcion == 0) { Avion a = Aviones.Find(x => x.Numero == id); costo = cantPasKm * a.CostoPorPersona + ((a.LowCost) ? 1200 : 2700); } else if (opcion == 1) { Auto a = Autos.Find(x => x.Numero == id); costo = cantPasKm * a.CostoPorKm; } else { Colectivo c = Colectivos.Find(x => x.Numero == id); costo = cantPasKm * c.CostoPorPersona + ((c.AlmuerzoCena) ? 100 : 0) + ((c.CocheCama) ? 30 : 0); } return(costo); }
private bool ComprobarVehiculo(List <Viaje> list, int id) { bool vehiculoDisponible = !list.Exists(x => x.IdVehiculo == id && x.FechaViaje.Date == fecha.Date); if (vehiculoDisponible) { if (tipoElegido == 0) { return((Aviones.Find(x => x.Numero == id).CantidadButacas >= cantPasajeros) ? true : false); } else if (tipoElegido == 1) { return((Autos.Find(x => x.Numero == id).CantidadButacas >= cantPasajeros) ? true : false); } else { return((Colectivos.Find(x => x.Numero == id).CantidadButacas >= cantPasajeros) ? true : false); } } else { return(false); } }