Exemplo n.º 1
0
        private void modifierToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FRM_Produit_Commande frm = new FRM_Produit_Commande(this);
            Produit     PR           = new Produit();
            Affectation QteAff       = new Affectation();

            if (dvgDetailCommande.CurrentRow != null)
            {
                frm.lblTitre.Text          = "Modifier Produit";
                frm.txtIdClientAffect.Text = IDCLIENT.ToString();
                frm.txtIdExpediteur.Text   = IDEXPEDITEUR.ToString();
                frm.txtIdProduit.Text      = dvgDetailCommande.CurrentRow.Cells[0].Value.ToString();
                frm.lblnom.Text            = dvgDetailCommande.CurrentRow.Cells[1].Value.ToString();
                ////Importer le stock de produit depuis le datagrid produit//////
                int IDEX   = IDEXPEDITEUR;
                int IDPROD = int.Parse(dvgDetailCommande.CurrentRow.Cells[0].Value.ToString());
                QteAff            = db.Affectations.Single(s => s.ID_Client == IDEX && s.ID_Produit == IDPROD);
                frm.lblstock.Text = QteAff.Quantite_affectee.ToString();
                ////Importer inventaire de produit depuis le datagrid produit//////
                int IDP = int.Parse(dvgDetailCommande.CurrentRow.Cells[0].Value.ToString());
                PR = db.Produits.Single(s => s.ID_Produit == IDP);
                frm.lblInv.Text      = PR.NumInventaire.ToString();;
                frm.lblprix.Text     = dvgDetailCommande.CurrentRow.Cells[3].Value.ToString();
                frm.txtquantite.Text = dvgDetailCommande.CurrentRow.Cells[2].Value.ToString();
                frm.txtremise.Text   = dvgDetailCommande.CurrentRow.Cells[4].Value.ToString();
                frm.txttotal.Text    = dvgDetailCommande.CurrentRow.Cells[5].Value.ToString();
                frm.ShowDialog();
            }
        }
Exemplo n.º 2
0
 private void dvgProduit_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if ((txtNomExp.Text == "") || (txtNomDest.Text == ""))
     {
         MessageBox.Show("Saisir client", "Ajouter produit", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         FRM_Produit_Commande frmp = new FRM_Produit_Commande(this);
         //si stock vide
         if ((int)dvgProduit.CurrentRow.Cells[6].Value == 0)
         {
             MessageBox.Show("Stock vide", "Stock", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             //afficher les info de larticle
             frmp.txtIdClientAffect.Text = IDCLIENT.ToString();
             frmp.txtIdExpediteur.Text   = IDEXPEDITEUR.ToString();
             frmp.txtIdProduit.Text      = dvgProduit.CurrentRow.Cells[1].Value.ToString();
             frmp.lblInv.Text            = dvgProduit.CurrentRow.Cells[4].Value.ToString();
             frmp.lblnom.Text            = dvgProduit.CurrentRow.Cells[5].Value.ToString();
             frmp.lblstock.Text          = dvgProduit.CurrentRow.Cells[6].Value.ToString();
             frmp.lblprix.Text           = dvgProduit.CurrentRow.Cells[7].Value.ToString();
             frmp.txtremise.Text         = txtRemise.Text;
             if (dvgProduit.CurrentRow.Cells[3].Value.ToString() == "Unitaire")
             {
                 frmp.txtquantite.Text    = "1";
                 frmp.txtquantite.Enabled = false;
             }
             else
             {
                 frmp.txtquantite.Enabled = true;
             }
             frmp.ShowDialog();
         }
     }
 }