Exemplo n.º 1
0
 private void btn_Ajouter_Click(object sender, EventArgs e)
 {
     M              = new BL_Frm_Produits(mainCon);
     M.Id           = txt_Code.Text;
     M.Libelle      = txt_Libelle.Text;
     M.Stock_A      = Convert.ToInt32(txt_Stock_Alert.Text);
     M.Stock_P      = Convert.ToInt32(txt_Stock_Ph.Text);
     M.Quantite_A   = Convert.ToInt32(txt_Q_Annuelle.Text);
     M.Unite_Mesure = txt_Unite.Text;
     try
     {
         M.Add();
         MessageBox.Show("Le produit a été ajouter avec succès !");
         //txt_Code.Text = "";
         txt_Libelle.Text     = "";
         txt_Stock_Alert.Text = "";
         txt_Stock_Ph.Text    = "";
         txt_Q_Annuelle.Text  = "";
         txt_Unite.Text       = "";
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 2
0
        private void Frm_Produits_Load(object sender, EventArgs e)
        {
            M = new BL_Frm_Produits(mainCon);
            //dataGridView1.DataSource = M.Select().Tables[0];
            DataSet       d        = M.Select();
            List <string> produits = new List <string>();

            foreach (DataRow dr in d.Tables[0].Rows)
            {
                produits.Add(dr["libelle"].ToString());
            }
            listBox_Produits.DataSource = produits;
        }
Exemplo n.º 3
0
        private void listBox_Produits_SelectedIndexChanged(object sender, EventArgs e)
        {
            M         = new BL_Frm_Produits(mainCon);
            M.Libelle = listBox_Produits.SelectedItem.ToString();
            SqlDataReader dr = M.SelectRead();

            dr.Read();
            txt_Code.Text        = dr["id_Prod"].ToString();
            txt_Libelle.Text     = dr["libelle"].ToString();
            txt_Stock_Alert.Text = dr["stock_alert"].ToString();
            txt_Stock_Ph.Text    = dr["stock_phys"].ToString();
            txt_Q_Annuelle.Text  = dr["qt_annuelle"].ToString();
            txt_Unite.Text       = dr["unite_mesure"].ToString();
            M.UnLink();
        }
Exemplo n.º 4
0
 private void Btn_MAJ_Click(object sender, EventArgs e)
 {
     M              = new BL_Frm_Produits(mainCon);
     M.Id           = txt_Code.Text;
     M.Libelle      = txt_Libelle.Text;
     M.Stock_A      = Convert.ToInt32(txt_Stock_Alert.Text);
     M.Stock_P      = Convert.ToInt32(txt_Stock_Ph.Text);
     M.Quantite_A   = Convert.ToInt32(txt_Q_Annuelle.Text);
     M.Unite_Mesure = txt_Unite.Text;
     try
     {
         M.MiseAJour();
         MessageBox.Show("Le produit a été mise à jour avec succès !");
         Frm_Produits_Load(null, null);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 5
0
        private void btn_Supprimer_Click(object sender, EventArgs e)
        {
            M    = new BL_Frm_Produits(mainCon);
            M.Id = txt_Code.Text;
            DialogResult y = MessageBox.Show("Voulez-vous supprimer ce produit? \n\n", "Suppression du produit", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (y == DialogResult.Yes)
            {
                try
                {
                    M.Delete();
                    MessageBox.Show("Le produit a été supprimer avec succès !");
                    Frm_Produits_Load(null, null);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }