public static Models.Planning MapReaderToPlannings(SqlDataReader reader) { Models.Planning planning = new Models.Planning { IdPlan = Convert.ToInt32(reader["PLAN_ID"]), DateVol = Convert.ToDateTime(reader["PLAN_VOL_DATE"].ToString()), IdVol = Convert.ToInt32(reader["PLAN_VOL_ID"].ToString()) }; return(planning); }
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); } }