コード例 #1
0
 private void FormNewReservation_Load(object sender, EventArgs e)
 {
     if (CurrentClient != null)
     {
         try {
             using (ProjetSGBDEntities context = new ProjetSGBDEntities()) {
                 IQueryable <GetReservableReception_Result> Receptions = context.GetReservableReception(CurrentClient.Id);
                 foreach (GetReservableReception_Result rec in Receptions)
                 {
                     comboBoxReception.Items.Add(new ReceptionSelection(rec.ReceptionId, rec.DisplayName()));
                 }
                 comboBoxReception.DisplayMember = "DisplayName";
             }
         } catch (Exception ex) {
             ModelError modelError = new ModelError(ex);
             MessageBox.Show(modelError.Message, "Erreur fatale!", MessageBoxButtons.OK, MessageBoxIcon.Error);
             DialogResult = DialogResult.Abort;
             Close();
         }
     }
 }