예제 #1
0
 public void AddDiscount(IDiscount discount)
 {
     if (discounts.Any(d => d.GetType() == discount.GetType()))
     {
         throw new Exception("Discount already exists!");
     }
     else
     {
         discounts.Add(discount);
     }
 }
예제 #2
0
        public void AddDiscount(IDiscount discount)
        {
            if (discount.GetType() == typeof(OfferVoucher))
            {
                AddOfferVoucher((OfferVoucher)discount);
            }

            if (!ErrorInBasket)
            {
                Discounts.Add(discount);
                OnDiscountAdded(EventArgs.Empty);
            }
        }
        public decimal Calculate(IDiscount discounts, int categoryQuantity, decimal unitPrice)
        {
            decimal result = 0;

            if (discounts.GetType() == typeof(Coupon))
            {
                if (categoryQuantity >= discounts.Quantity)
                {
                    result = (unitPrice / 100) * discounts.DiscountValue;
                }
            }
            return(result);
        }
        private void InitDiscountSubTree(TreeNode root, IDiscount Idiscount)
        {
            TreeNode localRoot = new TreeNode(Idiscount.ToString());

            localRoot.Tag = Idiscount;
            root.Nodes.Add(localRoot);
            if (Idiscount.GetType() == typeof(DiscountManager))
            {
                localRoot.ForeColor = Color.Red;
                foreach (var discount in ((DiscountManager)Idiscount).Discounts)
                {
                    InitDiscountSubTree(localRoot, discount);
                }
            }
        }
예제 #5
0
 public void SetDiscount(IDiscount Idiscount)
 {
     if (Idiscount.GetType() == typeof(DiscountNrBilete))
     {
         cbTipDiscount.SelectedItem = "Discount Numar Bilete";
         cbTipDiscount.Enabled      = false;
         var discount = Idiscount as DiscountNrBilete;
         numericProcSpec.Value = (decimal)discount.ProcentDiscount * 100;
     }
     else if (Idiscount is DiscountSpecific)
     {
         cbTipDiscount.SelectedItem = "Discount Specific";
         cbTipDiscount.Enabled      = false;
         var discount = Idiscount as DiscountSpecific;
         numericProcSpec.Value = (decimal)discount.ProcentDiscount * 100;
         numericSumaAd.Value   = (decimal)discount.SumaAditionala;
         cbMotiv.SelectedItem  = discount.MotivulDiscountului;
         dateTimeInceput.Value = discount.DataInceput;
         dateTimeSfirsit.Value = discount.DataSfirsit;
     }
 }