Exemplo n.º 1
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            var id = NavigationContext.QueryString["id"];
            _item = App.Locator.Main.GetItem(new Guid(id));
            DataContext = _item;
        }
Exemplo n.º 2
0
        public void GetCarts(Action<IEnumerable<Cart>, Exception> callback)
        {
            var carts = new List<Cart>();
            var randomizer = new Random();
            var storeEnumCount = Enum.GetNames(typeof(Store)).Length;
            var discountTypeEnumCount = Enum.GetNames(typeof(DiscountType)).Length;

            for (int i = 0; i < 10; i++)
            {
                var cart = new Cart();
                cart.Name = "Cart " + (i + 1);
                cart.Store = (Store)randomizer.Next(storeEnumCount);

                for (int j = 0; j < 10; j++)
                {
                    var item = new CartItem(cart);
                    item.Name = "Cart Item " + (j + 1);
                    item.Price = j * 10;
                    item.Quantity = j;
                    item.Taxable = i % 2 == 0;
                    item.ExpirationDate = DateTime.Now;

                    for (int k = 0; k < 3; k++)
                    {
                        var discount = new CartItemDiscount(item);
                        discount.Name = "Discount " + (i + 1);
                        discount.Discount = k * .75;
                        discount.Type = (DiscountType)randomizer.Next(discountTypeEnumCount);
                        discount.ExpirationDate = DateTime.Now;
                        item.Discounts.Add(discount);
                    }

                    cart.Items.Add(item);
                }

                carts.Add(cart);
            }

            callback(carts, null);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CartItemDiscount" /> class.
 /// </summary>
 /// <param name="owningItem">The owning item.</param>
 public CartItemDiscount(CartItem owningItem)
 {
     OwningItem = owningItem;
 }
Exemplo n.º 4
0
 public static Uri GetNavigationUri(CartItem item)
 {
     return new Uri(ItemDetailView.NavigateToMeUri + item.Id, UriKind.Relative);
 }