Esempio n. 1
0
        public static StoreBill operator -(StoreBill bill1, StoreBill bill2)
        {
            StoreBill NewBill = new StoreBill();

            if (bill1 == null & bill2 == null)
            {
                NewBill.Articles = null;
            }
            else if (bill1 == null)
            {
                NewBill.Articles = bill2.Articles;
            }
            else if (bill2 == null)
            {
                NewBill.Articles = bill1.Articles;
            }
            else
            {
                NewBill.Articles = bill1.Articles;
                foreach (Article artBill2 in bill2.Articles)
                {
                    foreach (Article artNewBill in NewBill.Articles)
                    {
                        if (artBill2.Item == artNewBill.Item)
                        {
                            artNewBill.Price    = Math.Abs(artNewBill.Price - artBill2.Price);
                            artNewBill.Quantity = Math.Abs(artNewBill.Quantity - artBill2.Quantity);
                        }
                        else
                        {
                            NewBill.Articles.Add(artBill2);
                        }
                    }
                }
            }
            return(NewBill);
        }
Esempio n. 2
0
 public void CopyFrom(StoreBill bill)
 {
     Articles = bill.Articles;
 }