Example #1
0
        public void RemoveProductFromListTest()
        {
            testBestelling.AddProductenToList(producten);
            testBestelling.RemoveProductFromList(product);

            Assert.AreEqual(testBestelling.GetProducten().Count, 1);
        }
Example #2
0
 public bool RemoveProductVanBestelling(Bestelling bestelling, Product product, LosseVerkoop verkoop)
 {
     if (Database.GetIsConnected())
     {
         VoorraadControle controle = null;
         if (bestelling != null)
         {
             Database.ProductbestellingRepo.RemoveProductFromBestelling(bestelling, product);
             bestelling.RemoveProductFromList(product);
             foreach (VoorraadControle c in product.GetVoorraadOpbouw())
             {
                 if (c.DatumControle >= new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day) &&
                     c.DatumControle < DateTime.Now.AddDays(1))
                 {
                     controle = c;
                 }
             }
         }
         else
         {
             Database.ProductbestellingRepo.RemoveProductFromLosseVerkoop(verkoop);
             _losseVerkopen.Remove(verkoop);
             foreach (VoorraadControle c in verkoop.GetVoorraadOpbouw())
             {
                 if (c.DatumControle >= new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day) &&
                     c.DatumControle < DateTime.Now.AddDays(1))
                 {
                     controle = c;
                 }
             }
         }
         if (controle != null)
         {
             Database.VoorraadControleRepo.ChangeVoorraadControle(controle, product.Voorraad, product.Voorraad - 1);
         }
     }
     return(true);
 }