private void btnValider_Click(object sender, EventArgs e) { int res; bl = new BALProduit(); dl = new Produit(); cl = new BALTProduit(); dl.CodeProduit = txtCodeProduit.Text; dl.Designation = txtDesignation.Text; dl.CodeTProduit = cl.getCodeTProduit(TPBox.Text); res = bl.AjouterProduit(dl); if (res == 1) { MessageBox.Show("Succès Ajout de noucsdsdveau Produit." + reef + "dfdfdf" + idClient); AjoutProduit win; win = new AjoutProduit(reef, idClient); win.Show(); this.Dispose(); } else { MessageBox.Show("Echec Ajout de nouveau Produit."); } }
private void btnSupprimer_Click(object sender, EventArgs e) { if (gridProduit.SelectedRows.Count == 0) { MessageBox.Show("Selectionner la ligne entiere." + "\n" + "Cliquer sur le curseur à gauche du datagid", "Erreur de selection", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (MessageBox.Show("Voulez vous supprimer ce commande?", "Confirmation de la suppression", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { bl = new BALProduit(); bl.deleteProduit(gridProduit.SelectedRows[0].Cells[0].Value.ToString()); remplirDatagrdview(); } }