示例#1
0
        private void cb_numero_SelectedIndexChanged(object sender, EventArgs e)
        {
            oa             = DeclarationsGlobales.avions[cb_numero.SelectedIndex];
            cb_marque.Text = oa.Marque.ToString();

            cb_type.Items.Clear();
            cb_type.Text = "";
            switch (cb_marque.SelectedIndex)
            {
            case 0:
                cb_type.Items.Add("A300");
                cb_type.Items.Add("A310");
                cb_type.Items.Add("A320");
                break;

            case 1:
                cb_type.Items.Add("737");
                cb_type.Items.Add("747");
                cb_type.Items.Add("757");
                break;

            case 2:
                cb_type.Items.Add("AN-14");
                cb_type.Items.Add("AN-24");
                cb_type.Items.Add("AN-34");
                break;
            }
            cb_type.Text      = oa.Type.ToString();
            txt_capacite.Text = oa.Capacite.ToString();
        }
 private void bt_valider_Click(object sender, EventArgs e)
 {
     if (ValidateChildren(ValidationConstraints.Enabled)) //Pour vérifier la validation de tous les controles
     {
         oa = new Avion(int.Parse(txt_numero.Text), cb_marque.Text, cb_type.Text, int.Parse(txt_capacite.Text));
         DeclarationsGlobales.avions.Add(oa);
         MessageBox.Show("Ajout Réussit ", "Nouveau Avion", MessageBoxButtons.OK, MessageBoxIcon.Information);
         DeclarationsGlobales.viderTextBox(this);
     }
 }
 private void bt_valider_Click(object sender, EventArgs e)
 {
     if (ValidateChildren(ValidationConstraints.Enabled)) //Pour vérifier la validation de tous les controles
     {
         Pilote op = DeclarationsGlobales.pilotes[cb_pilote.SelectedIndex];
         Avion  oa = DeclarationsGlobales.avions[cb_avion.SelectedIndex];
         ov = new Vol(op, oa, dateVol.Value, cb_villeDep.Text, cb_villeArr.Text, int.Parse(txt_nbrVoy.Text), int.Parse(txt_PrixBillet.Text));
         DeclarationsGlobales.vols.Add(ov);
         MessageBox.Show("Ajout Réussit ", "Nouveau Vol", MessageBoxButtons.OK, MessageBoxIcon.Information);
         DeclarationsGlobales.viderTextBox(this);
     }
 }