예제 #1
0
        private void PicAjouterproduit_Click(object sender, EventArgs e)
        {
            frmProduitStock formproduitsctok = new frmProduitStock();

            formproduitsctok.Show();
            this.Hide();
        }
예제 #2
0
 private void cmdValidder_Click(object sender, EventArgs e)
 {
     if (lstProduits.SelectedIndex != -1)
     {
         formproduit = new frmProduitStock();
         if (lstProduits.SelectedIndex != -1)
         {
             //Recuperer le Id du produit selectionnée
             Products produit = (Products)lstProduits.SelectedItem;
             idproduit = (int)produit.Id;
             this.Hide();
         }
     }
     else
     {
         MessageBox.Show("Selectionner un produit");
     }
 }
예제 #3
0
 private void DgvStock_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     foreach (DataGridViewCell oneCell in dgvStock.SelectedCells)
     {
         //Clic sur edit
         if (dgvStock.Rows[e.RowIndex].Cells[7].Selected)
         {
             frmProduitStock formproduitstock = new frmProduitStock();
             //Envoyer les informations du produit selectionnée dans le formulaire produitStock
             formproduitstock.modifierProduit        = true;
             formproduitstock.modiferIdCommandeLines = (int)dgvStock.Rows[oneCell.RowIndex].Cells[0].Value;
             formproduitstock.modifierNomProduit     = (string)dgvStock.Rows[oneCell.RowIndex].Cells[1].Value;
             formproduitstock.modiferCategorie       = (string)dgvStock.Rows[oneCell.RowIndex].Cells[2].Value;
             formproduitstock.modiferQuantite        = (int)dgvStock.Rows[oneCell.RowIndex].Cells[3].Value;
             formproduitstock.modiferUnite           = (string)dgvStock.Rows[oneCell.RowIndex].Cells[4].Value;
             formproduitstock.modiferDate            = (string)dgvStock.Rows[oneCell.RowIndex].Cells[5].Value;
             formproduitstock.ShowDialog();
             Actualizer();
         }
         //Clic sur supprimer
         if (dgvStock.Rows[e.RowIndex].Cells[6].Selected)
         {
             DialogResult dialogResult = MessageBox.Show("Voulez vous supprimer ce produit définitivement?", "Message de confirmation", MessageBoxButtons.YesNo);
             if (dialogResult == DialogResult.Yes)
             {
                 int id = (int)dgvStock.Rows[oneCell.RowIndex].Cells[0].Value;
                 MysqlConn.OpenDB();
                 MysqlConn.DeletInStock(id);
                 MysqlConn.CloseDB();
                 dgvStock.Rows.RemoveAt(oneCell.RowIndex);
             }
             else if (dialogResult == DialogResult.No)
             {
                 //do something else
             }
         }
     }
 }