Beispiel #1
0
        private void Btn_List_Product_Click(object sender, RoutedEventArgs e)
        {
            ListProduct listProduct = new ListProduct(this, gUser);

            this.Visibility = Visibility.Hidden;
            listProduct.ShowDialog();
        }
Beispiel #2
0
        public Shopping(List <Product> lProductBascet, ListProduct lWindow, Employee lUser)
        {
            gProductBascet = lProductBascet;
            gWindow        = lWindow;
            gUser          = lUser;
            InitializeComponent();

            for (int i = 0; i < gProductBascet.Count; i++)
            {
                bool bProductHave = false;
                for (int g = 0; g < gBasketList.Count; g++)
                {
                    if (gBasketList[g].product.IdProduct == gProductBascet[i].IdProduct)
                    {
                        gBasketList[g].TotalPrice += gBasketList[g].product.Price;
                        gBasketList[g].Count++;
                        bProductHave = true;
                    }
                }
                if (!bProductHave)
                {
                    gBasketList.Add(new Basket
                    {
                        product    = gProductBascet[i],
                        TotalPrice = gProductBascet[i].Price,
                        Count      = 1
                    });
                }
            }

            Lv_Bascet.ItemsSource = gBasketList.ToList();

            UpdateAll();

            Btn_Checkout.IsEnabled = false;
        }
Beispiel #3
0
        public DescriptionProduct(Product lProduct, ListProduct lWindow)
        {
            gWindow  = lWindow;
            gProduct = lProduct;
            InitializeComponent();

            Tb_Category.Text    = gProduct.View.Name;
            Tb_Name.Text        = gProduct.Name;
            Tb_Description.Text = gProduct.Information;
            Tb_Quantity.Text    = gProduct.Quantity.ToString();
            Tb_Articul.Text     = gProduct.IdProduct.ToString();
            Tb_Price.Text       = gProduct.Price.ToString();

            using (MemoryStream stream = new MemoryStream(gProduct.Images))
            {
                BitmapImage bitmapImage = new BitmapImage();
                bitmapImage.BeginInit();
                bitmapImage.CacheOption   = BitmapCacheOption.OnLoad;
                bitmapImage.CreateOptions = BitmapCreateOptions.PreservePixelFormat;
                bitmapImage.StreamSource  = stream;
                bitmapImage.EndInit();
                pathProduct.Source = bitmapImage;
            }
        }