Beispiel #1
0
 private void rbGoldenCustmor_CheckedChanged(object sender, EventArgs e)
 {
     if (rbGoldenCustmor.Checked)
     {
         customerType = new GoldenMembershipVisitor();
     }
 }
Beispiel #2
0
        public Form1()
        {
            InitializeComponent();

            supermarket  = new SupermarketStructure();
            customerType = new NormalMembershipVisitor();
        }
Beispiel #3
0
        //Methods
        public double Accept(IShoppingCartVisitor visitor)
        {
            double FinlaPrice = 0;

            foreach (var element in ProductElements)
            {
                FinlaPrice += element.Accept(visitor);
            }
            return(FinlaPrice);
        }
Beispiel #4
0
        public string PrintReceipt(IShoppingCartVisitor shoppingCart, DateTime purchaseDate)
        {
            totalDiscount        = shoppingCart.Products.Sum(x => x.GetDiscount());
            totalSum             = shoppingCart.Products.Sum(x => x.GetOriginalTotalPrice());
            totalSumWithDiscount = shoppingCart.Products.Sum(x => x.GetTotalFinalProductPriceWithDiscount());

            StringBuilder sb = new StringBuilder();

            sb.Append($"SUBTOTAL: ${totalSum}:F2 \n");
            sb.Append($"DISCOUNT: -${totalDiscount}:F2 \n");
            sb.Append($"TOTAL: ${totalSumWithDiscount}:F2");

            return(sb.ToString());
        }
 public int Accept(IShoppingCartVisitor shoppingCartVisitor)
 {
     return(shoppingCartVisitor.Visit(this));
 }
 public void Accept(IShoppingCartVisitor shoppingCartVisitor)
 {
     shoppingCartVisitor.Visit(this);
 }
Beispiel #7
0
 public int accept(IShoppingCartVisitor visitor)
 {
     return(visitor.visit(this));
 }
 //Constructor
 public Customer(IShoppingCartVisitor visitor)
 {
     this.visitor = visitor;
 }
Beispiel #9
0
 //Methods
 public double Accept(IShoppingCartVisitor visitor)
 {
     return(visitor.Visit(this));
 }