private void buttonValider_Click(object sender, EventArgs e) { bool ok = int.TryParse(textBoxCode.Text, out int code); Dictionary <string, object> parameters = new Dictionary <string, object>(); if (ok) { parameters.Add("@pid_contact", code); if ((int)persistanceSQLServer.ExecuteDataReader(parameters, "SearchContact").Count == 0) { MessageBox.Show("Le code fournisseur est inexistant", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { AffichageFournisseur affichageFournisseur = new AffichageFournisseur(persistanceSQLServer, code); affichageFournisseur.Show(); } } else { MessageBox.Show("Le code est invalide", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public AffichageFournisseur(PersistanceSQLServer persistanceSQLServer, int codeFournisseur) { InitializeComponent(); this.persistanceSQLServer = persistanceSQLServer; Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters.Add("@pid_contact", codeFournisseur); ArrayList list = persistanceSQLServer.ExecuteDataReader(parameters, "SearchAllContact"); textBoxNom.Text = list[3].ToString(); textBoxNumRue.Text = list[2].ToString(); textBoxRue.Text = list[1].ToString(); textBoxCP.Text = list[5].ToString(); textBoxVille.Text = list[4].ToString(); textBoxContact.Text = list[3].ToString(); textBoxSatisfaction.Text = list[7].ToString(); createMode = false; }