Exemplo n.º 1
0
        // Fills displayed productslist with current product, their amounts and prices.
        public void FillDisplayedProductList()
        {
            totalPrice = 0;

            // Puts productId's and their respective amounts  into sorted.
            var sorted =
                productList.GroupBy(x => x.productId)
                .Select(g => new { Value = g.Key, Count = g.Count() })
                .OrderByDescending(x => x.Count);

            Point newLocation = new Point(0, 0);

            foreach (var x in sorted)
            {
                Product p = productList.Find(item => item.productId == x.Value);
                totalPrice += (p.price * x.Count);
                InvoiceProductPanel ipp = new InvoiceProductPanel(p);
                ipp.SetRemainingValues(x.Count, newLocation);
                ilp.AddProduct(ipp);
                newLocation.Y += ipp.Height;
                productPanelList.Add(ipp);
            }
        }
Exemplo n.º 2
0
 public void RemoveProduct(InvoiceProductPanel ipp)
 {
     Controls.Remove(ipp);
 }
Exemplo n.º 3
0
 public void AddProduct(InvoiceProductPanel ipp)
 {
     Controls.Add(ipp);
 }