Ejemplo n.º 1
0
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            int id;

            if (Int32.TryParse(codeBox.Text, out id))
            {
                Produit p = DataBase.Instance.GetProduitById(id);
                if (p != null)
                {
                    panier.AddProduit(p);
                    produitsPanier.Add(p);
                    DataBase.Instance.DescStock(p.Id);
                    totalBlock.Content = panier.Total + " euros";
                    codeBox.Text       = "";
                }
                else
                {
                    MessageBox.Show("Aucun produit avec cet id");
                }
            }
            else
            {
                MessageBox.Show("Erreur de code");
            }
        }