public Stock EditStock(Stock s, User user)
        {
            Stock o = StockDao.EditStock(s);

            if (o != null)
            {
                logger.Info(user.Login + " a modifier le Stock de {" + s.NumStock + "," + s.QuantiteMedicament + "} a {" + o.NumStock + "," + o.QuantiteMedicament + "}");
                return(o);
            }
            return(null);
        }
Exemplo n.º 2
0
 public VenteMedi AddVenteMedi(VenteMedi vm, Stock s, User user)
 {
     if (vm != null)
     {
         if (VenteDao.GetOneVenteById(vm.NumVente) != null && MedicamentDao.GetOneMedicamentById(vm.CodeMedicament) != null)
         {
             VenteMedi o = VenteMediDao.AddVenteMedi(vm);
             if (o != null)
             {
                 s.QuantiteMedicament -= vm.QuantiteMedicament;
                 StockDao.EditStock(s);
                 StockMediDao.GetOneStockMediById(s.NumStock, vm.CodeMedicament).QuantiteMedicament -= vm.QuantiteMedicament;
                 StockMediDao.EditStockMedi(StockMediDao.GetOneStockMediById(s.NumStock, vm.CodeMedicament));
                 logger.Info(user.Login + " a ajouter le medicament " + MedicamentDao.GetOneMedicamentById(o.CodeMedicament).LibelleMedicament + " dans le stock " + o.NumVente);
                 return(o);
             }
         }
     }
     return(null);
 }
 public StockMedi AddStockMedi(StockMedi sm, User user)
 {
     if (sm != null)
     {
         if (StockDao.GetOneStockById(sm.NumStock) != null && MedicamentDao.GetOneMedicamentById(sm.CodeMedicament) != null)
         {
             Stock s = StockDao.GetOneStockById(sm.NumStock);
             s.QuantiteMedicament += sm.QuantiteMedicament;
             s = StockDao.EditStock(s);
             if (s != null)
             {
                 StockMedi o = StockMediDao.AddStockMedi(sm);
                 if (o != null)
                 {
                     logger.Info(user.Login + " a ajouter le medicament " + MedicamentDao.GetOneMedicamentById(o.CodeMedicament).LibelleMedicament + " dans le stock " + o.NumStock);
                     return(o);
                 }
             }
         }
     }
     return(null);
 }