private void dvgProduit_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (txtNomDest.Text == "") { MessageBox.Show("Saisir un déstinataire", "Ajouter produit", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { //MessageBox.Show(dvgProduit.CurrentRow.Cells[5].Value.ToString()); if (dvgProduit.CurrentRow.Cells[2].Value.ToString() == "Unitaire" && dvgProduit.CurrentRow.Cells[5].Value != null) { MessageBox.Show("Il n'est pas possible de saisir une quantitée supperieur a 1 pour un Unitaire.", "Ajouter produit", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { FRM_Produit_Livraison frmp = new FRM_Produit_Livraison(this); //afficher les info de larticle frmp.txtIdClientAffect.Text = IDDEST.ToString(); frmp.txtIdProduit.Text = dvgProduit.CurrentRow.Cells[0].Value.ToString(); frmp.lblInv.Text = dvgProduit.CurrentRow.Cells[3].Value.ToString(); frmp.lblnom.Text = dvgProduit.CurrentRow.Cells[4].Value.ToString(); //frmp.lblstock.Text = dvgProduit.CurrentRow.Cells[5].Value.ToString(); if (dvgProduit.CurrentRow.Cells[2].Value.ToString() == "Unitaire") { frmp.txtquantite.Text = "1"; frmp.txtquantite.Enabled = false; } frmp.ShowDialog(); } } }
private void modifierToolStripMenuItem_Click(object sender, EventArgs e) { FRM_Produit_Livraison frm = new FRM_Produit_Livraison(this); Produit PR = new Produit(); Affectation QteAff = new Affectation(); if (dvgDetailLivraison.CurrentRow != null) { frm.lblTitre.Text = "Modifier Livraison"; frm.txtIdClientAffect.Text = IDDEST.ToString(); frm.txtIdProduit.Text = dvgDetailLivraison.CurrentRow.Cells[0].Value.ToString(); frm.lblnom.Text = dvgDetailLivraison.CurrentRow.Cells[1].Value.ToString(); ////Importer inventaire de produit depuis le datagrid produit////// int IDP = int.Parse(dvgDetailLivraison.CurrentRow.Cells[0].Value.ToString()); PR = db.Produits.Single(s => s.ID_Produit == IDP); frm.lblInv.Text = PR.NumInventaire.ToString();; frm.txtquantite.Text = dvgDetailLivraison.CurrentRow.Cells[2].Value.ToString(); frm.ShowDialog(); } }