public Confirmacion(List<String> detalle, List<int> pasajerosIds, List<int> butacasNumeros, List<int> clientesIds, List<decimal> pesos, Viaje v, Aeronave a, LoginForm loginform) { this.InitializeComponent(); this.pasajerosIds = pasajerosIds; this.butacasNumeros = butacasNumeros; this.clientesIds = clientesIds; this.pesos = pesos; this.selectedAeronave = a; this.selectedViaje = v; this.detalleTextbox.Lines = detalle.ToArray(); this.fillCombos(); if (loginform == null || loginform.loggedUser == null) this.medioDePagoCombo.Enabled = false; }
private bool validarViaje(Aeronave aeronave, Ruta ruta, DateTime fechaSalida, ref String error) { if (fechaSalida < Config.SystemConfig.systemDate) { error = "La fecha de salida ingresada no puede ser menor a la fecha actual."; return false; } if (aeronave.Tipo_Servicio_Id != ruta.Tipo_Servicio_Id) { error = "La aeronave seleccionada no proporciona el tipo de servicio requerido por la ruta aerea seleccionada."; return false; } DAO.connect(); Viaje viaje = DAO.selectOne<Viaje>(new[] { "aeronave_id = " + aeronave.Id, "fecha_salida = '" + fechaSalida.ToString("yyyyMMdd HH:mm:ss") + "'" }); DAO.closeConnection(); if (viaje != null) { error = "La aeronave seleccionada ya ha sido previamente asignada a un viaje en la fecha seleccionada."; return false; } return true; }
private void viajesDataGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (this.selectedViaje == null || (int)this.viajesDataGrid.SelectedRows[0].Cells[1].Value != this.selectedViaje.Id) { this.paquetesDatatable.Clear(); this.pasajerosDatatable.Clear(); } DataGridViewRow row = this.viajesDataGrid.SelectedRows[0]; DAO.connect(); this.selectedViaje = DAO.selectOne<Viaje>( new[] { "id = " + row.Cells[1].Value }); this.selectedAeronave = this.selectedViaje.Aeronave; String connectionString = DAO.makeConnectionString(DBConfig.direccion, DBConfig.database, DBConfig.username, DBConfig.password); String selectCommand = "SELECT id, numero FROM BIEN_MIGRADO_RAFA.Butaca"; selectCommand += " WHERE aeronave_id = " + row.Cells[0].Value.ToString(); selectCommand += " AND id NOT IN (SELECT butaca_id FROM BIEN_MIGRADO_RAFA.Pasaje WHERE viaje_id = " + row.Cells[1].Value.ToString() + ")"; selectCommand += " ORDER BY numero"; dataAdapter = new SqlDataAdapter(selectCommand, connectionString); this.butacasSource = new DataSet(); dataAdapter.Fill(butacasSource); butacaCombo.DisplayMember = "numero"; butacaCombo.ValueMember = "id"; butacaCombo.DataSource = butacasSource.Tables[0]; DAO.closeConnection(); }