コード例 #1
0
        private void Dg_Prod_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int           index = e.RowIndex;
            int           refe  = int.Parse(Dg_Prod.Rows[index].Cells[0].Value.ToString());
            String        desig = Dg_Prod.Rows[index].Cells[1].Value.ToString();
            int           prix  = int.Parse(Dg_Prod.Rows[index].Cells[2].Value.ToString());
            int           qte   = int.Parse(Dg_Prod.Rows[index].Cells[3].Value.ToString());
            int           total = int.Parse(Dg_Prod.Rows[index].Cells[4].Value.ToString());
            LigneCommande lc    = LigneCommandeADO.LigneCommande(refe);

            if (lc != null)
            {
                lcSelected   = lc;
                Txt_Qte.Text = lc.Qte.ToString();
                Commande cmd = CommandeADO.Recherche_Commande_Num_Cde(lc.NumCde);
                if (cmd != null)
                {
                    cmdSelected     = cmd;
                    Txt_NumCde.Text = cmd.Num_Cde.ToString();
                    Date_Cde.Text   = cmd.Date_Cde.ToString();
                    Client client = ClientADO.Recherche_cin(cmd.CIN_Cl);
                    if (client != null)
                    {
                        setClientFields(client);
                        clSelected = client;
                    }
                }
                Produit pr = ProduitADO.Recherche_Ref(lc.RefProd);
                if (pr != null)
                {
                    prSelected = pr;
                }
            }
        }
コード例 #2
0
ファイル: DevisService.cs プロジェクト: josysk8/MAJOJOGUI
    public decimal GetPriceOfModule(Module module)
    {
        decimal total = 0;

        if (module.Enfants.Count > 0)
        {
            foreach (var item in module.Enfants)
            {
                total += GetPriceOfModule(item);
            }
        }
        foreach (var composantCoupe in module.ComposantsCoupePrincipe)
        {
            LigneCommande lastCommande   = commandeFournisseurRepository.GetLastByComposant(composantCoupe.Composant);
            decimal       composantPrice = lastCommande.PrixAchat +
                                           ((decimal)composantCoupe.Composant.ValeurAjoutee * lastCommande.PrixAchat);
            decimal margeCom        = composantPrice * (decimal)module.MargeCommercial;
            decimal margeEntreprise = composantPrice * (decimal)module.MargeEntreprise;

            composantPrice += margeCom + margeEntreprise;
            total          += composantPrice;
        }

        return(total);
    }
コード例 #3
0
        private void Supp_Lig_Click(object sender, EventArgs e)
        {
            if (lcSelected != null)
            {
                DialogResult dialogResult = MessageBox.Show("Vous été sur de supprimer la ligne commande?", "Supprimer ligne commande", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    LigneCommandeADO.Supprimer(lcSelected.NumCde);

                    lcSelected  = null;
                    clSelected  = null;
                    cmdSelected = null;
                    prSelected  = null;
                    Affiche_Ligne_Commande();
                    MessageBox.Show("Ligne commande supprimer avec succès!");
                }
                else if (dialogResult == DialogResult.No)
                {
                    //do something else
                }
            }
            else
            {
                MessageBox.Show("Sélectionner une ligne commande!");
            }
        }
コード例 #4
0
        /// <summary>
        /// Cherche la ligne en fonction de la référence article ou du code barre
        /// </summary>
        /// <param name="dg"></param>
        private void CodeBarreKeyDown(DataGrid dg)
        {
            Debug.Print($"Code barre: {CodeBarre}");

            if (CodeBarre == null)
            {
                return;
            }

            IEnumerable <LigneCommande> r;

            // Ref Gamme ?
            r = Commande.Lignes.Where(s => s.AeRef == CodeBarre.ToUpper());

            // Ref Mag ?
            if (!r.Any())
            {
                r = Commande.Lignes.Where(s => s.ArRef == CodeBarre.ToUpper());
            }

            // Ref Fourn ?
            if (!r.Any())
            {
                r = Commande.Lignes.Where(s => s.RefFourn == CodeBarre.ToUpper());
            }

            // EAN?
            if (!r.Any())
            {
                _dataService.GetRefByGencod(CodeBarre,
                                            (dt, error) => {
                    if (error != null)
                    {
                        // TODO
                        return;
                    }
                    if (dt.Rows.Count == 1)
                    {
                        r = Commande.Lignes.Where(s => s.Ref == dt.Rows[0]["Ref"].ToString());
                    }
                });
            }

            if (r.Any())
            {
                LigneCommande ligne = r.First();
                ligne.RowHidden = false;
                dg.Focus();
                dg.SelectedItem = ligne;
                dg.UpdateLayout();
                dg.ScrollIntoView(dg.SelectedItem);
                dg.CurrentCell = new DataGridCellInfo(dg.SelectedItem, dg.Columns.Single(c => c.Header.ToString() == "Quantité"));
                dg.BeginEdit();
                CodeBarre = string.Empty;
                return;
            }

            CodeBarre = string.Empty;
            //MessageBox.Show("Article non trouvé.");
        }
コード例 #5
0
        public IHttpActionResult PutLigneCommande(int id, LigneCommande ligneCommande)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != ligneCommande.numLigne)
            {
                return(BadRequest());
            }

            db.Entry(ligneCommande).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LigneCommandeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #6
0
        internal bool Import(Commande cmd)
        {
            string path = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            string file = $"{path}\\{dbName}_{cmd.Piece}.xlsm";

            if (!File.Exists(file))
            {
                throw new Exception($"Fichier {file} non trouvé");
            }
            ExcelApp.Application app      = new ExcelApp.Application();
            ExcelApp.Workbook    workbook = app.Workbooks.Open(file);
            try
            {
                ExcelApp.Worksheet  worksheet  = workbook.Worksheets["Commande"];
                ExcelApp.ListObject listObject = worksheet.ListObjects["tableCommande"];
                foreach (ExcelApp.ListRow row in listObject.ListRows)
                {
                    try
                    {
                        string Ref   = (string)row.Range[2].Value();
                        double?qt    = (double?)row.Range[3].Value();
                        double stock = ((double?)row.Range[10].Value()) ?? 0;
                        Debug.Print($"{Ref} - {qt} - {stock}");

                        LigneCommande ligne = cmd.Lignes.Where(l => l.Ref == Ref).FirstOrDefault();
                        if (ligne == null)
                        {
                            continue;
                        }
                        if (qt != ligne.Qte)
                        {
                            ligne.Qte = qt;
                        }
                        if (stock != ligne.Stock)
                        {
                            ligne.Stock = stock;
                        }
                    }
                    catch (Exception)
                    {
                        // TODO Log
                    }
                }

                return(true);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                if (workbook != null)
                {
                    workbook.Close(false);
                }
                app.Quit();
            }
        }
コード例 #7
0
        public ActionResult DeleteConfirmed(int id)
        {
            LigneCommande ligneCommande = db.LignesCmd.Find(id);

            db.LignesCmd.Remove(ligneCommande);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #8
0
 private void Nouv_Lig_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(Txt_NumCde.Text))
     {
         Commande cmd = CommandeADO.Recherche_Commande_Num_Cde(int.Parse(Txt_NumCde.Text));
         if (cmd != null)
         {
             if (!string.IsNullOrEmpty(Txt_Qte.Text))
             {
                 FListe_Prod fc = new FListe_Prod();
                 fc.ShowDialog();
                 if (FListe_Prod.produit != null)
                 {
                     prSelected = FListe_Prod.produit;
                     if (prSelected != null)
                     {
                         LigneCommande lc = new LigneCommande
                         {
                             NumCde  = cmd.Num_Cde,
                             RefProd = prSelected.Ref_Prod,
                             Qte     = int.Parse(Txt_Qte.Text)
                         };
                         LigneCommandeADO.Inserer(lc);
                         Affiche_Ligne_Commande();
                         Vider_Clt_Click(sender, e);
                         Vider_Cde_Click(sender, e);
                         lcSelected  = null;
                         prSelected  = null;
                         cmdSelected = null;
                         clSelected  = null;
                         MessageBox.Show("Ligne Commande inserer");
                     }
                     else
                     {
                         MessageBox.Show("Sélectionner un produit");
                     }
                 }
                 else
                 {
                     MessageBox.Show("Sélectionner un produit");
                 }
             }
             else
             {
                 MessageBox.Show("Inserer une qunatité");
             }
         }
         else
         {
             MessageBox.Show("Inserer une commande");
         }
     }
     else
     {
         MessageBox.Show("Inserer une commande");
     }
 }
コード例 #9
0
        public async Task ModifierLigneCommande(LigneCommande ligneCommande, LigneCommandeDTO ligneCommandeDTO)
        {
            ligneCommande.Id       = ligneCommandeDTO.Id;
            ligneCommande.Commande = ligneCommandeDTO.Commande;
            ligneCommande.Box      = ligneCommandeDTO.Box;
            ligneCommande.Produit  = ligneCommandeDTO.Produit;
            context.Entry(ligneCommande).OriginalValues["RowVersion"] = ligneCommandeDTO.RowVersion;

            await context.SaveChangesAsync();
        }
コード例 #10
0
        public static void Inserer(LigneCommande lc)
        {
            SqlCommand cmdaj = new SqlCommand("insert into LigneCommande (Num_Cde,Ref_Prod,Qte)" +
                                              " values (@Num,@Ref,@Qte)", Connexion.cn);

            cmdaj.Parameters.AddWithValue("@Num", lc.NumCde);
            cmdaj.Parameters.AddWithValue("@Ref", lc.RefProd);
            cmdaj.Parameters.AddWithValue("@Qte", lc.Qte);
            cmdaj.ExecuteNonQuery();
        }
コード例 #11
0
 public ActionResult Edit([Bind(Include = "numLigne")] LigneCommande ligneCommande)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ligneCommande).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(ligneCommande));
 }
コード例 #12
0
        public static void Modifier(LigneCommande lc)
        {
            string     req    = "update LigneCommande set Num_Cde=@Num, Ref_Prod=@Ref, Qte=@Qte where Num_Cde=@Num";
            SqlCommand cmdmaj = new SqlCommand(req, Connexion.cn);

            cmdmaj.Parameters.AddWithValue("@Num", lc.NumCde);
            cmdmaj.Parameters.AddWithValue("@Ref", lc.RefProd);
            cmdmaj.Parameters.AddWithValue("@Qte", lc.Qte);
            cmdmaj.ExecuteNonQuery();
        }
コード例 #13
0
        public ActionResult Create([Bind(Include = "numLigne")] LigneCommande ligneCommande)
        {
            if (ModelState.IsValid)
            {
                db.LignesCmd.Add(ligneCommande);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(ligneCommande));
        }
コード例 #14
0
        public IHttpActionResult GetLigneCommande(int id)
        {
            LigneCommande ligneCommande = db.LigneCommandes.Find(id);

            if (ligneCommande == null)
            {
                return(NotFound());
            }

            return(Ok(ligneCommande));
        }
コード例 #15
0
        public async Task <ActionResult> AjouterLigneCommande([FromBody] LigneCommandeDTO ligneCommandeDTO)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            LigneCommande ligneCommande = mapper.Map <LigneCommande>(ligneCommandeDTO);

            ligneCommande = await ligneCommandeDAO.AjouterLigneCommande(ligneCommande);

            return(Created($"api/LigneCommande/{ligneCommande.Id}", mapper.Map <LigneCommandeDTO>(ligneCommande)));
        }
コード例 #16
0
        public IHttpActionResult PostLigneCommande(LigneCommande ligneCommande)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.LigneCommandes.Add(ligneCommande);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = ligneCommande.numLigne }, ligneCommande));
        }
コード例 #17
0
ファイル: Program.cs プロジェクト: PascalALM/BolyWood
        private static void initializeDb()
        {
            Piece piece1 = new Piece()
            {
                Nom          = "Planche",
                PrixUnitaire = 50.0
            };
            Piece piece2 = new Piece()
            {
                Nom          = "Ampoule",
                PrixUnitaire = 12.0
            };
            Commande commande  = new Commande("Première commande");
            Commande commande2 = new Commande("Deuxième commande");

            piece1    = CommandeDAO.insertObject(piece1);
            piece2    = CommandeDAO.insertObject(piece2);
            commande  = CommandeDAO.insertObject(commande);
            commande2 = CommandeDAO.insertObject(commande);

            List <Piece> pieces = CommandeDAO.getPieces();

            Console.WriteLine("get commande 1");
            Commande commande1 = CommandeDAO.getCommande(1);

            Console.WriteLine(commande1);



            //commande1.Nom = "Commande 2 modifiée";

            //commande1 = CommandeDAO.updateObject(commande1);
            //Console.WriteLine(commande1);

            Console.WriteLine("getAllPiece");
            LigneCommande ligneCommande;

            foreach (Piece p in pieces)
            {
                Console.WriteLine("Pièce : " + p.Nom + " " + p.PrixUnitaire);
                ligneCommande = new LigneCommande()
                {
                    Commande = commande1,
                    Piece    = p,
                    Quantite = 1000,
                    Unite    = "Lot"
                };
                //db.LignesCommande.Add(ligneCommande);
                //db.SaveChanges();
                ligneCommande = CommandeDAO.insertObject(ligneCommande);
                Console.WriteLine("Ligne de la commande ajouté");
            }
        }
コード例 #18
0
        public async Task <LigneCommande> AjouterLigneCommande(LigneCommande ligneCommande)
        {
            if (ligneCommande == null)
            {
                throw new LigneCommandeNotFoundException();
            }

            context.LigneCommande.Add(ligneCommande);
            await context.SaveChangesAsync();

            return(ligneCommande);
        }
コード例 #19
0
        //Rechercher une ligne de commande dans la commande en cours
        private static LigneCommande RechercherLigneCommande(int numArticle, ICollection <LigneCommande> ligneCommande)
        {
            LigneCommande ligne = null;
            IEnumerable <LigneCommande> result = from l in ligneCommande
                                                 where l.numArticle == numArticle
                                                 select l;

            if (result.Count() > 0)
            {
                ligne = result.Single();
            }
            return(ligne);
        }
コード例 #20
0
        public IHttpActionResult DeleteLigneCommande(int id)
        {
            LigneCommande ligneCommande = db.LigneCommandes.Find(id);

            if (ligneCommande == null)
            {
                return(NotFound());
            }

            db.LigneCommandes.Remove(ligneCommande);
            db.SaveChanges();

            return(Ok(ligneCommande));
        }
コード例 #21
0
        // GET: LigneCommandes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LigneCommande ligneCommande = db.LignesCmd.Find(id);

            if (ligneCommande == null)
            {
                return(HttpNotFound());
            }
            return(View(ligneCommande));
        }
コード例 #22
0
        private void bbiAddOrderLine_ItemClick(object sender, ItemClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            OrderLine ordernull = null;
            var       form      = new FrmEditOrderLine(Stocks, null, true);

            form.ShowDialog();
            LigneCommande = form.OrderLine;
            if (!LigneCommande.Equals(ordernull))
            {
                OrderLines.Add(LigneCommande);
            }
            GCOrderLine.RefreshDataSource();
            Cursor.Current = Cursors.Default;
        }
コード例 #23
0
ファイル: FCommande.cs プロジェクト: OussamaChkir/C-
 private void Nouv_lig_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(Qte.Text))
     {
         MessageBox.Show("qte empty");
     }
     else
     {
         FListe_Prod f = new FListe_Prod();
         f.ShowDialog();
         Dg_Prod.Rows.Add(f.p.Ref_Prod, f.p.Desig_Prod, f.p.PrixV_Prod, Qte.Text, f.p.PrixV_Prod * Convert.ToInt32(Qte.Text));
         LigneCommande lc = new LigneCommande(Convert.ToInt32(Txt_NumCde.Text), Convert.ToInt32(f.p.Ref_Prod), Convert.ToInt32(Qte.Text));
         list_commande.Add(lc);
         totalCde         += f.p.PrixV_Prod * Convert.ToInt32(Qte.Text);
         Txt_TotalCde.Text = totalCde.ToString();
     }
 }
コード例 #24
0
        public void TestAjoutCommandeOk()
        {
            Controleur c2     = new CommandeControleur();
            Client     client = c2.GetClients().Last();
            ICollection <LigneCommande> lignesCommande = new Collection <LigneCommande>();
            LigneCommande ligneCmd = new LigneCommande()
            {
                Produit = c2.GetProduits().First(), Quantite = 2
            };

            lignesCommande.Add(ligneCmd);
            c2.CreerCommande(client, lignesCommande);
            Assert.AreEqual(c2.GetCommandes().Last().Client, client);
            Assert.AreEqual(c2.GetProduits().First().Id, 1);
            Assert.AreEqual(c2.GetCommandes().Last().LignesCommande.Last().Quantite, 2);
            //J'ajoute une commande qui contient un le dernier client de la liste, le premier produit de la liste et une quantité à 2
            //Je vérifie qu'il me retourne bien que le dernier client de la liste commande bien 2 fois le premier produit de la liste
        }
コード例 #25
0
        public static LigneCommande insertLigneCommande(LigneCommande obj)
        {
            using (var db = new CommandeContext())
            {
                var table = db.Set(typeof(LigneCommande));
                try
                {
                    db.Entry(obj.Commande).State = EntityState.Unchanged;
                    db.Entry(obj.Piece).State    = EntityState.Unchanged;
                } catch (Exception e)
                {
                }

                table.Add(obj);
                db.SaveChanges();
                return(obj);
            }
        }
コード例 #26
0
        //Ajouter un article à la commande
        public static void Ajouter(NouvelleCommande frm)
        {
            try
            {
                int      numArticle = int.Parse(frm.TxtNum.Text);
                double   prix       = double.Parse(frm.TxtPrix.Text);
                int      quantite   = int.Parse(frm.TxtQuantite.Text);
                Commande cmd        = frm.Session["commande"] as Commande;

                LigneCommande ligne = RechercherLigneCommande(numArticle, cmd.LigneCommandes);
                if (ligne == null)
                {
                    ligne = new LigneCommande
                    {
                        numArticle = numArticle,
                        quantite   = quantite,
                        prix       = prix
                    };
                    cmd.LigneCommandes.Add(ligne);
                    cmd.montant        += prix * quantite;
                    frm.TxtMontant.Text = cmd.montant.ToString();
                }
                else
                {
                    ligne.quantite     += quantite;
                    cmd.montant        += prix * quantite;
                    frm.TxtMontant.Text = cmd.montant.ToString();
                }
                frm.GridViewCommande.DataSource = cmd.LigneCommandes;
                frm.GridViewCommande.DataBind();

                frm.TxtNum.Text                 = "";
                frm.TxtNom.Text                 = "";
                frm.TxtPrix.Text                = "";
                frm.TxtQuantite.Text            = "";
                frm.BtnAjouter.Enabled          = false;
                frm.BtnEnregistrer.Enabled      = true;
                frm.LblResultatTxtQuantite.Text = "";
            }
            catch (Exception e)
            {
                frm.LblResultatTxtQuantite.Text = "Champ obligatoire en nombre";
            }
        }
コード例 #27
0
    public LigneCommande GetLastByComposant(Composant composant)
    {
        LigneCommande dto = new LigneCommande();

        using (var db = new maderaEntities())
        {
            var query = (from a in db.LIGNE_COMMANDE
                         where a.COMPOSANT_ID.Equals(composant.Id)
                         orderby a.COMMANDE_ID descending
                         select a).Take(1);

            dto.Id        = query.First().COMMANDE_ID;
            dto.PrixAchat = query.First().PRIX_ACHAT;
            dto.Quantite  = query.First().QUANTITE_LIGNE_COMMANDE;
            // TODO: Fournisseur
        }

        return(dto);
    }
コード例 #28
0
        private ICollection<LigneCommande> AjouterLignes()
        {
            ICollection<LigneCommande> lignesCommande = new Collection<LigneCommande>();
            string input = "";
            do
            {

                Produit prod = this.AjouterProduit();
                Console.WriteLine("Veuillez entrer une quantité");
                int qte = int.Parse(Console.ReadLine());

                LigneCommande ligneCmd = new LigneCommande() { Produit = prod, Quantite = qte };
                lignesCommande.Add(ligneCmd);
                Console.WriteLine("Appuyer sur 'q' si vous souhaitez arrêter d'ajouter des produits, sinon, appuyez sur n'importe quelle touche");
                input = Console.ReadLine();
            } while (!"q".Equals(input));

            return lignesCommande;
        }
コード例 #29
0
        public async Task <ActionResult> ModifierLigneCommande([FromBody] LigneCommandeDTO ligneCommandeDTO)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            int           id            = Decimal.ToInt32(ligneCommandeDTO.Id);
            LigneCommande ligneCommande = await ligneCommandeDAO.GetLigneCommandeById(id);

            if (ligneCommande == null)
            {
                return(NotFound());
            }

            await ligneCommandeDAO.ModifierLigneCommande(ligneCommande, ligneCommandeDTO);

            return(Ok(ligneCommande));
        }
コード例 #30
0
 private void updateLigneFromIboLigne(LigneCommande ligne, IBODocumentAchatLigne3 IBOLigne)
 {
     IBOLigne.Refresh();
     if (IBOLigne.ArticleGammeEnum2 != null)
     {
         ligne.QteCom = IBOLigne.Article.StockCommandeDoubleGamme(IBOLigne.ArticleGammeEnum1, IBOLigne.ArticleGammeEnum2);
         ligne.QteRes = IBOLigne.Article.StockReserveContremarqueDoubleGamme(IBOLigne.ArticleGammeEnum1, IBOLigne.ArticleGammeEnum2);
     }
     else if (IBOLigne.ArticleGammeEnum1 != null)
     {
         ligne.QteCom = IBOLigne.Article.StockCommandeMonoGamme(IBOLigne.ArticleGammeEnum1);
         ligne.QteRes = IBOLigne.Article.StockReserveContremarqueMonoGamme(IBOLigne.ArticleGammeEnum1);
     }
     else
     {
         ligne.QteCom = IBOLigne.Article.StockCommande();
         ligne.QteRes = IBOLigne.Article.StockReserve();
     }
 }
コード例 #31
0
ファイル: TestCommandes.cs プロジェクト: jcambert/Webcorp.Erp
        public async Task TestCommandeFournisseurAvecArticleNonSST1()
        {
            var ch = kernel.Get<ICommandeBusinessHelper<Commande>>();
            var bh = kernel.Get<IArticleBusinessHelper<Article>>();
            ch.DeleteAll().Wait();
            bh.DeleteAll().Wait();



            var sst = await bh.Create("ArticleST",ArticleType.ProduitFini);
            sst.Libelle = "Peinture";
            var result = await sst.Save();
            Assert.IsTrue(result==1);

            var cde = await ch.Create(CommandeType.Fournisseur);
            var result0 = await ch.Save();
            Assert.IsTrue(result==1);

            var ligne = new LigneCommande(cde) { ArticleInner = sst, QuantiteCommandee = 5, Prixunitaire = new unite.Currency(5) };
            cde.Lignes.Add(ligne);

            ch.Save().Wait();
        }
コード例 #32
0
ファイル: TestCommandes.cs プロジェクト: jcambert/Webcorp.Erp
        public async Task TestCommandeFournisseurAvecArticleSST1()
        {
            var ch = kernel.Get<ICommandeBusinessHelper<Commande>>();
            var bh = kernel.Get<IArticleBusinessHelper<Article>>();
            ch.DeleteAll().Wait();
            bh.DeleteAll().Wait();



            var sst = await bh.Create("ArticleST",ArticleType.SousTraitance);
            sst.Libelle = "Peinture";
            var result = await sst.Save();
            Assert.IsTrue(result==1);

            var mp = await bh.Create("ArticleST",ArticleType.MatièrePremiere);
            mp.Libelle = "Peinture";
            var result0 = await sst.Save();
            Assert.IsTrue(result0==1);

            var cde = await ch.Create(CommandeType.Fournisseur);
            //var result1 = await ch.Save();
            //  Assert.IsTrue(!result1.HasError());
            ch.Save().Wait();

            Assert.IsTrue(cde.Id != "");

            var ligne0 = new LigneCommande(cde) { ArticleInner = sst, QuantiteCommandee = 5, Prixunitaire = new unite.Currency(5) };
            cde.Lignes.Add(ligne0);

            var ligne1 = new LigneCommande(cde) { ArticleInner = mp, QuantiteCommandee = 15, Prixunitaire = new unite.Currency(500) };
            cde.Lignes.Add(ligne1);

            ch.Save().Wait();
        }