Esempio n. 1
0
 public bool BestellingAfrekenen(Bestelling bestelling, decimal bedrag)
 {
     bestelling.Afrekenen(bedrag, DateTime.Now, bestelling.BetaaldBestuur);
     _afgerekendeBestellingen.Add(bestelling);
     BedragInKas += bestelling.BetaaldBedrag;
     _afgerekendeBestellingen.Sort((x, y) => - x.DatumBetaald.CompareTo(y.DatumBetaald));
     _bestellingen.Remove(bestelling);
     if (Database.GetIsConnected())
     {
         if (bestelling.GetProducten().Count > 0)
         {
             Database.BestellingRepo.BetaalBestelling(bestelling);
         }
         else
         {
             Database.BestellingRepo.DeleteBestelling(bestelling);
         }
         if (bedrag > 0)
         {
             Database.KassaLogRepo.AddLogString(
                 Id, bedrag + " euro toegevoegd aan kas", KassaSoortEnum.BETALING);
         }
         player.Play();
     }
     return(true);
 }
Esempio n. 2
0
        private void UpdateKlantBestelling(Bestelling bestelling)
        {
            lvProductenInBestelling.Items.Clear();
            if (bestelling != null)
            {
                foreach (Product p in bestelling.GetProducten())
                {
                    UpdateListViewKlantBestelling(p, "€" + p.Prijs, "€" + p.Ledenprijs.ToString(CultureInfo.InvariantCulture), lvProductenInBestelling);
                }
                lbTotaalPrijs.Text = @"€" + bestelling.TotaalPrijs.ToString(CultureInfo.InvariantCulture);
                lbLedenprijs.Text  = @"€" + bestelling.TotaalLedenPrijs.ToString(CultureInfo.InvariantCulture);
                lbDatumklant.Text  = bestelling.Datum.ToShortDateString() + @" - " + bestelling.Datum.ToShortTimeString();
            }
            else
            {
                if (App.CheckDbConnection())
                {
                    foreach (LosseVerkoop p in App.GetLosseVerkopen(DateTime.Today.AddDays(-8), DateTime.Today))
                    {
                        if (p.IsLid)
                        {
                            UpdateListViewKlantBestelling(p, "€ 0,-",
                                                          "€" + p.Ledenprijs.ToString(CultureInfo.InvariantCulture), lvProductenInBestelling);
                        }
                        else
                        {
                            UpdateListViewKlantBestelling(p, "€ " + p.Prijs, "€ 0,-", lvProductenInBestelling);
                        }
                    }

                    BerekenPrijsLosseVerkopen();
                }
            }
        }
Esempio n. 3
0
 public void UpdateProducten(Bestelling bestelling)
 {
     lvProducten.Items.Clear();
     if (bestelling != null)
     {
         foreach (Product p in bestelling.GetProducten())
         {
             ListViewItem lvi = new ListViewItem(p.Naam);
             lvi.SubItems.Add(p.Soort);
             lvi.SubItems.Add("€" + p.Prijs);
             lvi.SubItems.Add("€" + p.Ledenprijs.ToString(CultureInfo.InvariantCulture));
             lvProducten.Items.Add(lvi);
         }
     }
     else
     {
         foreach (LosseVerkoop p in App.GetLosseVerkopen(new DateTime(2000, 1, 1), DateTime.Today))
         {
             ListViewItem lvi = new ListViewItem(p.Naam);
             lvi.SubItems.Add(p.Soort);
             lvi.SubItems.Add("€ " + p.Prijs);
             lvi.SubItems.Add("€ " + p.Ledenprijs.ToString(CultureInfo.InvariantCulture));
             lvi.SubItems.Add(p.BestelDatum.ToShortTimeString() + " - " + p.BestelDatum.ToShortDateString());
             lvProducten.Items.Add(lvi);
         }
     }
 }
Esempio n. 4
0
        public void AddProductenToListTest()
        {
            testBestelling.AddProductenToList(producten); // Lijst van 2 producten toevoegen

            Assert.AreEqual(testBestelling.GetProducten().Count, 2);

            producten.Add(new Product(2, "Fanta", "Frisdrank", 48, 1.40m, 1.75m));
            testBestelling.AddProductenToList(null); // Eerst op null zetten zodat de lijst leeg is

            Assert.AreEqual(testBestelling.GetProducten(), null);

            testBestelling.AddProductenToList(producten); // Dan de lijst met 3 producten toevoegen

            Assert.AreEqual(testBestelling.GetProducten().Count, 3);

            testBestelling.AddProductenToList(null); // Terug op null voor de volgende test
        }