Beispiel #1
0
        private void cartInfoButton_Click(object sender, RoutedEventArgs e)
        {
            price = 0;
            mw.homePage.Children.Clear();
            mw.hideOrUnhideAll(1);

            cartUsr = new usrCtrl_CartInfo(name, itemList, productList, conn, this);
            usrCtrl_ItemInCart item;
            itemListInCart = new List<usrCtrl_ItemInCart>();
            for (int i = 0; i < itemList.Count; i++)
            {
                int index = GetIndex(itemList[i].getIndex());

                item = new usrCtrl_ItemInCart(this, cartUsr);
                item.image.Source = productList[index].getImage();
                item.text.Text = productList[index].getName();
                item.priceBox.Text = Convert.ToString(productList[index].getPrice());
                item.quantityLabel.Content = productList[index].getQuantity();
                item.countBox.Text = itemList[i].getCount().ToString();


                cartUsr.stackPanel.Children.Add(item);
                itemListInCart.Add(item);

                price += productList[index].getPrice() * Convert.ToInt32(item.countBox.Text);
                item.Tag = i;
                item.priceBox.Text = (productList[index].getPrice() * Convert.ToInt32(item.countBox.Text)).ToString();
            }

            cartUsr.username.Content = name;

            cartUsr.currentPriceBox.Text = Convert.ToString(price);

            mw.homePage.Children.Add(cartUsr);

            OrderToCache(name);

            mw.ReadData();
        }
Beispiel #2
0
        //Help function to use in itemFrame class
        public void PrepareCart()
        {
            cartUsr = new usrCtrl_CartInfo(name, itemList, productList, conn, this);
            usrCtrl_ItemInCart item;
            itemListInCart = new List<usrCtrl_ItemInCart>();

            for (int i = 0; i < itemList.Count; i++)
            {
                item = new usrCtrl_ItemInCart(this, cartUsr);

                cartUsr.stackPanel.Children.Add(item);
                itemListInCart.Add(item);
            }
        }