Пример #1
0
        // Validation de la ligne de produit
        private void buttonValiderProduit_Click(object sender, EventArgs e)
        {
            // todo reference déjà dans le panier
            txtMessageP.Text = " ";
            // création de la ligne de commande
            LigneCommandeClient laLigne = new LigneCommandeClient(qte, laCommande, leProduit);

            // insertion dans la collection
            laCommande.getLesLignes().Add(laLigne);
            // ajout de la ligne dans le datagrid
            double totalLigne = Convert.ToDouble(textBoxPUHT.Text) * Int32.Parse(textBoxQuantite.Text);

            string[] ligne = { textBoxReference.Text, textBoxNomProduit.Text, textBoxCouleur.Text, textBoxTaille.Text, textBoxPUHT.Text, textBoxQuantite.Text, textBoxEtat.Text, totalLigne.ToString() };
            dataGridViewListeProduit.Rows.Add(ligne);
            dataGridViewListeProduit.AutoSize = true;
            //maj total commande
            double totCde = laCommande.getMontantCommandeTTC() + totalLigne;

            laCommande.setMontantCommandeTTC(totCde);
            textBoxTotCde.Text = totCde.ToString();
            textBoxTva.Text    = (Math.Round(totCde * leProduit.getTauxTVA() / 100, 2)).ToString();
            razPanel(panel1);
            txtMessageP.Text = "Entrez une référence et appuyez sur entrée ou validez le panier";
            //bool produitDejaChoisi = false;
            //    string referenceProd = leProduit.getReference();
            //    foreach (LigneCommandeClient laLigne in laCommande.getLesLignes())
            //    {
            //        if (laLigne.getLeProduit().getReference() == referenceProd)
            //            produitDejaChoisi = true;
            //    }

            //    if (produitDejaChoisi == false)
            //    {
            //

            //        string uncodeRetour = " ";
            //        string unMotif = " ";
            //        LigneCommandeClient laLigne = new LigneCommandeClient(quantiteProd, prixVente, uncodeRetour, leNumLigneCommande, laCommande.getNumCommande(), referenceProd);
            //        laCommande.ajouterUneLigneCommande(quantiteProd, prixVente, uncodeRetour, unMotif, laCommande);

            //        remplireResume();
            //    }
            //    else
            //    {
            //        MessageBox.Show(textBoxReference, "Produit déja ajouté à la commande !", "Duplicat produit");
        }
Пример #2
0
 public void ajouterUneLigneCommande(LigneCommandeClient uneLigne)
 {
     lesLignes.Add(uneLigne);
 }