示例#1
0
 private void comboBoxListeFournisseurs_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBoxListeFournisseurs.SelectedIndex >= 0 && modeCourant == ModeInteractionBDD.lecture)
     {
         fournisseurCourant = Fournisseur.Load((int)comboBoxListeFournisseurs.SelectedValue);
         this.AfficherInformationsFournisseur(fournisseurCourant);
         buttonModifier.Enabled  = true;
         buttonSupprimer.Enabled = true;
     }
     else
     {
         this.ResetTextBoxes();
         buttonModifier.Enabled  = false;
         buttonSupprimer.Enabled = false;
     }
 }
示例#2
0
        private void buttonRechercher_Click(object sender, EventArgs e)
        {
            if (Int32.TryParse(textBoxCodeFournisseur.Text, out int result) && Fournisseur.Load(result).Id != -1)
            {
                fournisseurCourant = Fournisseur.Load(result);
                this.AfficherInformationsFournisseur(fournisseurCourant);
                buttonModifier.Enabled  = true;
                buttonSupprimer.Enabled = true;
            }
            else
            {
                errorProviderFournisseur.SetError(buttonRechercher, "Fournisseur inexistant");
                this.ResetTextBoxes();
                buttonModifier.Enabled  = false;
                buttonSupprimer.Enabled = false;

                comboBoxListeFournisseurs.SelectedIndex = -1;
            }
        }