Beispiel #1
0
        private void DecrementPurchasedProduct(SelectedProductViewModel product)
        {
            product.Quantity--;
            if (product.Quantity == 0)
            {
                PurchasedProducts.Remove(product);
            }

            CurrentPurchase.ComputeTotal();
        }
Beispiel #2
0
        private void AddPurchasedProduct(SelectedProductViewModel product)
        {
            var item = new SelectedProductViewModel
            {
                Quantity = 1,
                ID       = product.ID,
                Name     = product.Name,
                Price    = product.Price,
                Discount = product.Discount
            };

            item.ComputeSubTotal();

            PurchasedProducts.Add(item);

            CurrentPurchase.ComputeTotal();
        }
Beispiel #3
0
        private void DiscountedProduct(SelectedProductViewModel product, ProductDiscountOptions option)
        {
            decimal discount = 0.0m;

            if (Decimal.TryParse(DiscountValue, out discount) == false)
            {
                discount = 0.0m;
            }

            if (option == ProductDiscountOptions.Dollar)
            {
                product.Discount = discount;
            }
            else if (option == ProductDiscountOptions.Percent)
            {
                product.Discount = product.Price * (discount / 100);
            }

            CurrentPurchase.ComputeTotal();
        }
Beispiel #4
0
 private void IncrementPurchasedProduct(SelectedProductViewModel product)
 {
     product.Quantity++;
     CurrentPurchase.ComputeTotal();
 }
Beispiel #5
0
 private void DiscountedProduct(SelectedProductViewModel product)
 {
     product.Discount = 5.50m;
     CurrentPurchase.ComputeTotal();
 }