Esempio n. 1
0
        public LigneFacture ChercherLigneFacture(string p_identifiantArticle)
        {
            if (p_identifiantArticle == null)
            {
                throw new ArgumentNullException(nameof(p_identifiantArticle));
            }

            LigneFacture ligneFacture = null;

            LigneFacture ligneFactureCourante = null;

            for (int numeroLigneFacture = 0; ligneFacture == null && numeroLigneFacture < this.m_lignesFacture.Count; numeroLigneFacture++)
            {
                ligneFactureCourante = this.m_lignesFacture[numeroLigneFacture];
                if (ligneFactureCourante.Article.Identifiant.Equals(p_identifiantArticle))
                {
                    ligneFacture = ligneFactureCourante;
                }
            }

            return(ligneFacture);
        }
Esempio n. 2
0
        public void AjouterArticle(Article p_article, int p_quantite)
        {
            if (p_article == null)
            {
                throw new ArgumentNullException(nameof(p_article));
            }

            if (p_quantite < 0)
            {
                throw new ArgumentOutOfRangeException("La quantité ne doit pas être négative", nameof(p_quantite));
            }

            LigneFacture ligneFactureArticle = ChercherLigneFacture(p_article.Identifiant);

            if (ligneFactureArticle == null)
            {
                ligneFactureArticle = new LigneFacture(p_article, 0);
                this.m_lignesFacture.Add(ligneFactureArticle);
            }

            ligneFactureArticle.AjouterArticle(p_quantite);
        }