示例#1
0
        /**********************Minimizing the list*************************/
        public void minimize(ProductSale sale)
        {
            bool found = false;

            if (this.data == null || this.data.Count == 0)
            {
                data.Add(sale);
            }
            else
            {
                for (int i = 0; i < data.Count && !found; i++)
                {
                    if (data.ElementAt(i).ProductID == sale.ProductID)
                    {
                        data.ElementAt(i).Amount += sale.Amount;
                        found = true;
                    }
                }
                if (!found)
                {
                    data.Add(sale);
                }
            }
        }
示例#2
0
 public void removeProductSale(ProductSale sale)
 {
     data.Remove(sale);
 }
示例#3
0
 /*************************/
 public void addProductSale(ProductSale sale)
 {
     minimize(sale);
 }