public ShoppingCard(IValueCalculator valueCalc, IDiscount discount)
        {
            if (valueCalc == null || discount == null)
            {
                throw new ArgumentNullException("Not all of arguments were set.");
            }

            this.valueCalc = valueCalc;
            this.discount = discount;
        }
 public decimal ValueProducts(IEnumerable<IProduct> products, IDiscount discount)
 {
     if (products == null || discount == null)
     {
         throw new ArgumentNullException();
     }
     
     decimal sumOfProduct = 0;
     foreach (var product in products)
     {
         sumOfProduct += product.Price / 2;
     }
     Decimal.Multiply(sumOfProduct, (decimal)discount.Discount);
     return sumOfProduct - Decimal.Multiply(sumOfProduct, (decimal)discount.Discount);
 }
        public DiscountDisplayBox(IDiscount discount, Item possesingItem,Transaction transaction, RemoveDiscountFromDisplay removeFunction, UpdateItemDisplay updateFunction, Employee currentUser)
        {
            InitializeComponent();

            SourceDiscount = discount;
            PossessingItem = possesingItem;
            m_transaction = transaction;
            m_removeFunction = removeFunction;
            m_updateFunction = updateFunction;
            m_currentUser = currentUser;

            NameField.Text = discount.ToString().Substring(0, Math.Min(discount.ToString().Length, 40));

            UpdateDiscountString();

            AmountField.Text = Discount;

            PreviewMouseLeftButtonDown += DisplayItemClickedEvent;
        }
        public void AddDiscount(IDiscount discount)
        {
            if (m_noDiscounts)
                m_stackOfDiscounts.Children.Clear();

                m_noDiscounts = false;
                DiscountDisplayBox newDiscount = new DiscountDisplayBox(discount, m_item, m_transaction, RemoveDiscount, UpdateItemDetails, m_currentUser);
                newDiscount.Height = boxHeight;
                m_stackOfDiscounts.Children.Add(newDiscount);
                UpdateHeight();
        }
 public void SetDiscount(IDiscount discount)
 {
     if (discount != null)
         Price = discount.setDiscount(Price);
 }
Exemple #6
0
 public void RemoveDiscount(IDiscount discount)
 {
     _discounts.Remove(discount);
     discount.RemoveFrom(this);
 }
Exemple #7
0
 public void AddDiscount(IDiscount discount)
 {
     if(discount.AppliesTo(this))
     { 
         _discounts.Add(discount);
         discount.ApplyTo(this);
     }
 }
Exemple #8
0
 public double CalculatePrice(IDiscount discount)
 {
     return Quantity * Product.Price * discount.GetSetDiscount(Quantity);
 }
 public BaseCustomer(ITax tax, IDiscount discount, IDelivery delivery)
 {
     _tax      = tax;
     _discount = discount;
     _delivery = delivery;
 }
Exemple #10
0
 public Cart(IDiscount discount)
 {
     m_Orders = new List<IOrder>();
     m_Discount = discount;
 }