예제 #1
0
        private void buttonValider_Click(object sender, EventArgs e)
        {
            if (this.SaisieValide())
            {
                string action = "";

                if (modeCourant == ModeInteractionBDD.modification)
                {
                    fournisseurCourant = new Fournisseur(Int32.Parse(this.textBoxCodeFournisseur.Text), this.textBoxNomFournisseur.Text, this.textBoxAdresseFournisseur.Text, this.textBoxCpFournisseur.Text, this.textBoxVilleFournisseur.Text, this.textBoxContactFournisseur.Text, byte.Parse(this.textBoxSatisfactionFournisseur.Text));
                    action             = "modifié";
                }
                else if (modeCourant == ModeInteractionBDD.ajout)
                {
                    fournisseurCourant = new Fournisseur(this.textBoxNomFournisseur.Text, this.textBoxAdresseFournisseur.Text, this.textBoxCpFournisseur.Text, this.textBoxVilleFournisseur.Text, this.textBoxContactFournisseur.Text, byte.Parse(this.textBoxSatisfactionFournisseur.Text));
                    action             = "ajouté";
                }

                fournisseurCourant.Save();
                MessageBox.Show("Fournisseur " + fournisseurCourant.Nom + " (code : " + fournisseurCourant.Id.ToString() + ") " + action + " avec succès !");

                this.GetListBoxFournisseurs();
                this.AfficherInformationsFournisseur(fournisseurCourant);
                modeCourant = ModeInteractionBDD.lecture;
                this.MiseAJourSelonMode();

                foreach (KeyValuePair <int, string> item in listeFournisseurs)
                {
                    if (item.Key == fournisseurCourant.Id)
                    {
                        comboBoxListeFournisseurs.SelectedItem = item;
                    }
                }
            }
        }
예제 #2
0
        private void buttonNouveau_Click(object sender, EventArgs e)
        {
            modeCourant = ModeInteractionBDD.ajout;
            this.ResetTextBoxes();
            textBoxCodeFournisseur.ResetText();
            this.MiseAJourSelonMode();

            //test
            this.SaisieJeuEssaiPourTest();
        }
예제 #3
0
 private void buttonAnnuler_Click(object sender, EventArgs e)
 {
     this.modeCourant = ModeInteractionBDD.lecture;
     this.ResetTextBoxes();
     this.MiseAJourSelonMode();
     this.textBoxCodeFournisseur.ResetText();
     this.comboBoxListeFournisseurs.SelectedIndex = -1;
     errorProviderNom.Clear();
     errorProviderAdresse.Clear();
     errorProviderCP.Clear();
     errorProviderVille.Clear();
     errorProviderContact.Clear();
     errorProviderSatisfaction.Clear();
 }
예제 #4
0
 private void buttonModifier_Click(object sender, EventArgs e)
 {
     modeCourant = ModeInteractionBDD.modification;
     this.MiseAJourSelonMode();
 }