Example #1
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (txbLibelle.Text != "")
     {
         Produit form_Produit = new Produit(txbLibelle.Text);
         form_Produit.Show();
         this.Hide();
     }
     else
     {
         //D'apres datagridView
         Produit form_Produit = new Produit(drvProduits.SelectedRows[0].Cells[0].Value.ToString());
         form_Produit.Show();
         this.Hide();
     }
 }
Example #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            Produit prod = new Produit();

            var lisprod = new List <Produit>();

            lisprod.Add(prod.RecupProduit(1));

            foreach (var article in lisprod)
            {
                MessageBox.Show(article.Quantite.ToString());
                //MessageBox.Show(prod.ProduitId.ToString());
                MessageBox.Show(article.Description);

                MessageBox.Show(article.Categorie);
            }
        }
Example #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(textBox1.Text) == true)
            {
                MessageBox.Show("Quantite vide");
            }
            else if (String.IsNullOrEmpty(textBox2.Text) == true)
            {
                MessageBox.Show("description vide");
            }
            else if (String.IsNullOrEmpty(textBox3.Text) == true)
            {
                MessageBox.Show("prix vide");
            }
            else if (String.IsNullOrEmpty(textBox4.Text) == true)
            {
                MessageBox.Show("categorie vide");
            }


            else
            {
                Produit pro = new Produit();
                pro.Quantite    = Int32.Parse(textBox1.Text);
                pro.Description = textBox2.Text.ToString();
                pro.Prix        = Int32.Parse(textBox3.Text);
                pro.Categorie   = textBox4.Text.ToString();
                pro.insertproduit(pro);
                MessageBox.Show("Produit ajoute quantite: " + textBox1.Text + " description " + textBox2.Text);



                //DataTable dt = new DataTable();
                //dt = cli.RecupAllClient();
                dataGridView1.DataSource = pro.RecupAllProduit();
                textBox1.Clear();
                textBox2.Clear();
                textBox3.Clear();
                textBox4.Clear();
            }
        }