private void cmbVolDetails_SelectedIndexChanged(object sender, EventArgs e) { Models.Vol oVol = (Models.Vol)cmbVolDetails.SelectedItem; List <Models.Planning> planningList = BLPlannings.GetDatesByVolId(oVol.IdVol); try { if (planningList.Count == 0) { cmbVolDetails.Text = ""; // Pas de plannings trouvés, on n'affiche rien dataGridViewPassagers.DataSource = null; // Pas de vols, pas de passagers } else { cmbVolDetails.DataSource = planningList; cmbVolDetails.ValueMember = "IdPlan"; cmbVolDetails.DisplayMember = "DateVol"; } } catch (CustomError cEx) { MessageBox.Show(cEx.Message); } catch (Exception ex) { CustomError cEx = new CustomError(666); MessageBox.Show(cEx.Message); } }
public static Models.Vol MapReaderToVols(SqlDataReader reader) { Models.Vol vol = new Models.Vol { IdVol = Convert.ToInt32(reader["VOL_ID"]), Code = reader["VOL_CODE"].ToString(), IdVilleDepart = Convert.ToInt32(reader["VOL_ID_VILLE_DEP"].ToString()), IdVilleArrivee = Convert.ToInt32(reader["VOL_ID_VILLE_ARR"].ToString()), NbPlacesDispo = Convert.ToInt32(reader["VOL_PLACES_DISP"].ToString()) }; return(vol); }
private void cmbTranchePrix_SelectedIndexChanged(object sender, EventArgs e) { Models.Vol oVolSelect = (Models.Vol)cmbTranchePrix.SelectedItem; try { DataTable oDatatable = BLTranches.GetTrancheParVol(oVolSelect.IdVol); dataGridViewPrix.DataSource = oDatatable.DefaultView; dataGridViewPrix.Columns[0].Visible = false; dataGridViewPrix.Columns[6].Visible = false; } catch (CustomError cEx) { MessageBox.Show(cEx.Message); } catch (Exception ex) { throw new CustomError(666); } }
private void cmbDateVol_SelectedIndexChanged(object sender, EventArgs e) { Models.Vol oVol = (Models.Vol)cmbVolDetails.SelectedItem; Models.Planning oPlanning = (Models.Planning)cmbDateVol.SelectedItem; DataSet dataSet = new DataSet(); DataSet oDataCa = new DataSet(); int nbPassagers; int nbPlacesRes; decimal tauxOcp; decimal ca; try { dataSet = BLPlannings.GetListePassagers(oVol.IdVol, oPlanning.IdPlan); dataGridViewPassagers.DataSource = dataSet.Tables[0].DefaultView; BLVols.GetStatsVol(oVol.IdVol, oPlanning.IdPlan, out nbPassagers, out nbPlacesRes, out tauxOcp, out ca); oDataCa = BLVols.GetCaTrancheVol(oPlanning.IdPlan); if (oDataCa == null) { dataGridViewCA.DataSource = null; } else { dataGridViewCA.DataSource = oDataCa.Tables[0].DefaultView; } txtNbPassagers.Text = nbPassagers.ToString(); txtNbPlacesRestantes.Text = nbPlacesRes.ToString(); txtOccupationVol.Text = tauxOcp.ToString(); txtCAVol.Text = ca.ToString(); } catch (CustomError cEx) { MessageBox.Show(cEx.Message); } catch (Exception ex) { CustomError cEx = new CustomError(666); MessageBox.Show(cEx.Message); } }