Exemple #1
0
        internal void decrementerStock(SetarticleBE setarticle, int nombre, int annee)
        {
            if (setarticle != null)
            {
                StockerBE stocker = new StockerBE();
                composers = composerDA.listerSuivantCritere("codesetarticle LIKE " + "'" + setarticle.codesetarticle + "'");
                foreach (ComposerBE c in composers)
                {
                    stocker             = new StockerBE();
                    stocker.annee       = annee;
                    stocker.codeArticle = c.codeArticle;
                    StockerBE dernier_stock = new StockerBE();
                    dernier_stock.codeArticle = c.codeArticle;
                    dernier_stock             = stockerDA.rechercherDernierEnregistrement(stocker);
                    if (dernier_stock != null)
                    {
                        if (dernier_stock.annee < stocker.annee)
                        {
                            stocker.stockDebut = dernier_stock.stockRestant;
                        }
                        else
                        {
                            stocker.stockDebut = dernier_stock.stockDebut;
                        }
                        stocker.stockRestant    = dernier_stock.stockRestant - (nombre * c.quantite);
                        stocker.quantiteVendue  = (nombre * c.quantite);
                        stocker.quantiteAchetee = 0;
                        stocker.puArticle       = dernier_stock.puArticle;
                        stocker.dateOperation   = DateTime.Today;
                        stocker.codeMagasin     = dernier_stock.codeMagasin;

                        stockerDA.ajouter(stocker);
                    }
                }
            }
        }
Exemple #2
0
 //lister tous les éléments de la table Composer respectant un critère
 public List <ComposerBE> listerComposerSuivantCrietere(string critere)
 {
     return(composerDA.listerSuivantCritere(critere));
 }