Beispiel #1
0
 private void bunifuThinButton21_Click(object sender, EventArgs e)
 {
     try
     {
         DialogResult a;
         a = MessageBox.Show("suprimer", "suprimer", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (a == DialogResult.Yes)
         {
             Class1.cmd = new MySqlCommand("delete from produit WHERE N_P ='" + bunifuCustomDataGrid1.CurrentRow.Cells[0].Value + "'", Class1.cn);
             Class1.cn.Open();
             Class1.cmd.ExecuteNonQuery();
             DataTable dt1 = new DataTable();
             Class1.adapter = new MySqlDataAdapter("select * from produit ", Class1.cn);
             Class1.adapter.Fill(dt1);
             bunifuCustomDataGrid1.DataSource = dt1;
             notyf n = new notyf();
             n.Show();
             notificationicon not = new notificationicon("Supprimer", "le produit   :" + bunifuCustomDataGrid1.CurrentRow.Cells[0].Value);
             not.Location = new Point(Class1.index, n.Height * Class1.index);
             Class1.index++;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     Class1.cn.Close();
 }
Beispiel #2
0
        private void bunifuThinButton22_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult a;
                a = MessageBox.Show("suprimer", "suprimer", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (a == DialogResult.Yes)
                {
                    Class1.cmd = new MySqlCommand("delete from commande_fournisseur WHERE N_COMMANDE='" + bunifuCustomDataGrid3.CurrentRow.Cells[0].Value + "'", Class1.cn);
                    Class1.cn.Open();
                    Class1.cmd.ExecuteNonQuery();
                    Class1.cn.Close();

                    DataTable dt1 = new DataTable();
                    Class1.adapter = new MySqlDataAdapter("select * from commande_fournisseur ", Class1.cn);
                    Class1.adapter.Fill(dt1);
                    bunifuCustomDataGrid3.DataSource = dt1;

                    notyf na = new notyf();
                    na.Show();
                    notificationicon not = new notificationicon("Supprimer", "la commande fournisseur   :" + bunifuCustomDataGrid3.CurrentRow.Cells[0].Value);
                    not.Location = new Point(Class1.index, na.Height * Class1.index);
                    Class1.index++;
                    login.p.top_bare1.panel1.Controls.Add(not);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            Class1.cn.Close();
        }
Beispiel #3
0
        private void BunifuThinButton21_Click(object sender, EventArgs e)
        {
            if (BunifuMetroTextbox1.Text != "" && BunifuMetroTextbox2.Text != "" && BunifuMetroTextbox3.Text != "" && BunifuMetroTextbox4.Text != "" && BunifuMetroTextbox5.Text != "")
            {
                try
                {
                    Class1.cmd = new MySqlCommand("INSERT INTO fournisseur values (@N, @NOM, @ADRESSE, @TELEPHONE, @CATEGORIE,@E_mail, @LOGO )", Class1.cn);
                    Class1.cmd.Parameters.Add(new MySqlParameter("@N", MySqlDbType.VarChar, 30)).Value         = BunifuMetroTextbox1.Text;
                    Class1.cmd.Parameters.Add(new MySqlParameter("@NOM", MySqlDbType.VarChar, 30)).Value       = BunifuMetroTextbox2.Text;
                    Class1.cmd.Parameters.Add(new MySqlParameter("@ADRESSE", MySqlDbType.VarChar, 30)).Value   = BunifuMetroTextbox3.Text;
                    Class1.cmd.Parameters.Add(new MySqlParameter("@TELEPHONE", MySqlDbType.VarChar, 30)).Value = BunifuMetroTextbox4.Text;
                    Class1.cmd.Parameters.Add(new MySqlParameter("@E_mail", MySqlDbType.VarChar, 30)).Value    = bunifuMetroTextbox6.Text;
                    Class1.cmd.Parameters.Add(new MySqlParameter("@CATEGORIE", MySqlDbType.VarChar, 30)).Value = BunifuMetroTextbox5.Text;
                    if (PictureBox1.Image != null)
                    {
                        MemoryStream ms = new MemoryStream();
                        PictureBox1.Image.Save(ms, PictureBox1.Image.RawFormat);
                        var pictuure = ms.ToArray();
                        Class1.cmd.Parameters.Add(new MySqlParameter("@LOGO", MySqlDbType.LongBlob, 30)).Value = pictuure;
                    }
                    else
                    {
                        Class1.cmd.Parameters.Add(new MySqlParameter("@LOGO", MySqlDbType.LongBlob, 30)).Value = null;
                    }



                    Class1.cn.Open();
                    Class1.cmd.ExecuteNonQuery();
                    notyf na = new notyf();
                    na.Show();
                    notificationicon not = new notificationicon("Ajouter", "le fournisseur   :" + BunifuMetroTextbox1.Text);
                    not.Location = new Point(Class1.index, na.Height * Class1.index);
                    Class1.index++;
                    login.p.top_bare1.panel1.Controls.Add(not);
                    BunifuMetroTextbox1.Text = "";
                    BunifuMetroTextbox2.Text = "";
                    BunifuMetroTextbox5.Text = "";
                    BunifuMetroTextbox3.Text = "";
                    BunifuMetroTextbox4.Text = "";
                    bunifuMetroTextbox6.Text = "";
                    DataTable dt1 = new DataTable();
                    Class1.adapter = new MySqlDataAdapter("select * from fournisseur ", Class1.cn);
                    Class1.adapter.Fill(dt1);
                    bunifuCustomDataGrid1.DataSource = dt1;
                    bunifuCustomDataGrid1.Visible    = true;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                Class1.cn.Close();
            }
            else
            {
                MessageBox.Show("remplir tous les champs !!");
            }
        }
Beispiel #4
0
        private void bunifuThinButton26_Click(object sender, EventArgs e)
        {
            try
            {
                Class1.cmd = new MySqlCommand("update fournisseur set N=@N, NOM=@NOM, ADRESSE=@ADRESSE, TELEPHONE=@TELEPHONE, CATEGORIE=@CATEGORIE, E_mail=@E_mail, LOGO=@LOGO where N='" + bunifuCustomDataGrid1.CurrentRow.Cells [0].Value.ToString() + "'", Class1.cn);
                Class1.cmd.Parameters.Add(new MySqlParameter("@N", MySqlDbType.VarChar, 30)).Value         = BunifuMetroTextbox1.Text;
                Class1.cmd.Parameters.Add(new MySqlParameter("@NOM", MySqlDbType.VarChar, 30)).Value       = BunifuMetroTextbox2.Text;
                Class1.cmd.Parameters.Add(new MySqlParameter("@ADRESSE", MySqlDbType.VarChar, 30)).Value   = BunifuMetroTextbox3.Text;
                Class1.cmd.Parameters.Add(new MySqlParameter("@TELEPHONE", MySqlDbType.VarChar, 30)).Value = BunifuMetroTextbox4.Text;
                Class1.cmd.Parameters.Add(new MySqlParameter("@E_mail", MySqlDbType.VarChar, 30)).Value    = bunifuMetroTextbox6.Text;
                Class1.cmd.Parameters.Add(new MySqlParameter("@CATEGORIE", MySqlDbType.VarChar, 30)).Value = BunifuMetroTextbox5.Text;
                if (PictureBox1.Image != null)
                {
                    MemoryStream ms = new MemoryStream();
                    PictureBox1.Image.Save(ms, PictureBox1.Image.RawFormat);
                    var pictuure = ms.ToArray();
                    Class1.cmd.Parameters.Add(new MySqlParameter("@LOGO", MySqlDbType.LongBlob, 30)).Value = pictuure;
                }
                else
                {
                    Class1.cmd.Parameters.Add(new MySqlParameter("@LOGO", MySqlDbType.LongBlob, 30)).Value = null;
                }

                notyf na = new notyf();
                na.Show();
                notificationicon not = new notificationicon("Modifier", "le fournisseur   :" + BunifuMetroTextbox1.Text);
                not.Location = new Point(Class1.index, na.Height * Class1.index);
                Class1.index++;
                login.p.top_bare1.panel1.Controls.Add(not);
                Class1.cn.Open();
                Class1.cmd.ExecuteNonQuery();
                BunifuMetroTextbox1.Text = "";
                BunifuMetroTextbox2.Text = "";
                BunifuMetroTextbox5.Text = "";
                BunifuMetroTextbox3.Text = "";
                BunifuMetroTextbox4.Text = "";
                bunifuMetroTextbox6.Text = "";

                bunifuCustomDataGrid1.Visible = true;
                BunifuThinButton21.Visible    = true;
                bunifuThinButton26.Visible    = false;
                DataTable dt1 = new DataTable();
                Class1.adapter = new MySqlDataAdapter("select * from fournisseur ", Class1.cn);
                Class1.adapter.Fill(dt1);
                bunifuCustomDataGrid1.DataSource = dt1;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }



            Class1.cn.Close();
        }
Beispiel #5
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            bunifuMetroTextbox1.Text = r.DownloadString("http://127.0.0.1:8081/sfe/chate.php?a=read");
            if (bunifuMetroTextbox1.Text != "")
            {
                login.p.label1.Text = "1";
                notyf na = new notyf();

                notificationicon not = new notificationicon("Message", "le contenu   :" + bunifuMetroTextbox1.Text);
                not.Location = new Point(Class1.index, na.Height * Class1.index);
                Class1.index++;
                login.p.top_bare1.panel1.Controls.Add(not);
                timer1.Enabled = false;
            }
        }
Beispiel #6
0
        private void BunifuThinButton21_Click(object sender, EventArgs e)
        {
            if (bunifuMetroTextbox1.Text != "" && bunifuMetroTextbox2.Text != "" && bunifuMetroTextbox3.Text != "" && bunifuMetroTextbox4.Text != "" && bunifuMetroTextbox5.Text != "")
            {
                try
                {
                    Class1.cmd = new MySqlCommand("INSERT INTO client values (@CNI, @NOM, @PRENOM, @TELEPHONE, @ADRESSE, @NOTE )", Class1.cn);
                    Class1.cmd.Parameters.Add(new MySqlParameter("@CNI", MySqlDbType.VarChar, 30)).Value       = bunifuMetroTextbox1.Text;
                    Class1.cmd.Parameters.Add(new MySqlParameter("@NOM", MySqlDbType.VarChar, 30)).Value       = bunifuMetroTextbox2.Text;
                    Class1.cmd.Parameters.Add(new MySqlParameter("@PRENOM", MySqlDbType.VarChar, 30)).Value    = bunifuMetroTextbox3.Text;
                    Class1.cmd.Parameters.Add(new MySqlParameter("@TELEPHONE", MySqlDbType.VarChar, 30)).Value = bunifuMetroTextbox4.Text;
                    Class1.cmd.Parameters.Add(new MySqlParameter("@ADRESSE", MySqlDbType.VarChar, 30)).Value   = bunifuMetroTextbox5.Text;
                    Class1.cmd.Parameters.Add(new MySqlParameter("@NOTE", MySqlDbType.VarChar, 100)).Value     = bunifuMetroTextbox6.Text;
                    Class1.cn.Open();
                    Class1.cmd.ExecuteNonQuery();
                    DataTable dt1 = new DataTable();
                    Class1.adapter = new MySqlDataAdapter("select * from client ", Class1.cn);
                    Class1.adapter.Fill(dt1);
                    bunifuCustomDataGrid1.DataSource = dt1;
                    bunifuCustomDataGrid1.Visible    = true;
                    notyf n = new notyf();
                    n.Show();
                    notificationicon not = new notificationicon("Ajouter", "client   :" + bunifuMetroTextbox2.Text);
                    Class1.index++;
                    not.Location = new Point(Class1.index, n.Height * Class1.index);
                    login.p.top_bare1.panel1.Controls.Add(not);
                    bunifuMetroTextbox1.Text = "";
                    bunifuMetroTextbox2.Text = "";
                    bunifuMetroTextbox5.Text = "";
                    bunifuMetroTextbox3.Text = "";
                    bunifuMetroTextbox4.Text = "";
                    bunifuMetroTextbox6.Text = "";
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                Class1.cn.Close();
            }

            else
            {
                MessageBox.Show("Remplir tous les champs svp !!");
            }
        }
Beispiel #7
0
        private void bunifuThinButton22_Click(object sender, EventArgs e)
        {
            if (BunifuMetroTextbox1.Text != "" && BunifuMetroTextbox2.Text != "" && BunifuMetroTextbox3.Text != "" && bunifuMetroTextbox4.Text != "" && BunifuMetroTextbox5.Text != "" && BunifuMetroTextbox8.Text != "" && bunifuMetroTextbox11.Text != "" && bunifuMetroTextbox10.Text != "" && BunifuMetroTextbox7.Text != "" && bunifuMetroTextbox9.Text != "")
            {
                try
                {
                    Class1.cmd = new MySqlCommand("INSERT INTO produit values (@N_P, @N_fournisseur, @NOM_DEPOT, @NOM_FAMILLE, @NOM, @TAILLE,@POSITION, @PRIX_TOTALE, @seuil_bas, @image  )", Class1.cn);
                    Class1.cmd.Parameters.Add(new MySqlParameter("@N_P", MySqlDbType.VarChar, 30)).Value           = BunifuMetroTextbox1.Text;
                    Class1.cmd.Parameters.Add(new MySqlParameter("@N_fournisseur", MySqlDbType.VarChar, 30)).Value = BunifuMetroTextbox5.Text;
                    Class1.cmd.Parameters.Add(new MySqlParameter("@NOM_DEPOT", MySqlDbType.VarChar, 30)).Value     = bunifuMetroTextbox11.Text;
                    Class1.cmd.Parameters.Add(new MySqlParameter("@NOM_FAMILLE", MySqlDbType.VarChar, 30)).Value   = BunifuMetroTextbox3.Text;
                    Class1.cmd.Parameters.Add(new MySqlParameter("@NOM", MySqlDbType.VarChar, 30)).Value           = BunifuMetroTextbox2.Text;
                    Class1.cmd.Parameters.Add(new MySqlParameter("@TAILLE", MySqlDbType.VarChar, 30)).Value        = BunifuMetroTextbox8.Text + "*" + bunifuMetroTextbox9.Text + "*" + bunifuMetroTextbox10.Text;
                    Class1.cmd.Parameters.Add(new MySqlParameter("@POSITION", MySqlDbType.VarChar, 30)).Value      = bunifuMetroTextbox6.Text;
                    Class1.cmd.Parameters.Add(new MySqlParameter("@PRIX_TOTALE", MySqlDbType.VarChar, 30)).Value   = BunifuMetroTextbox7.Text;
                    Class1.cmd.Parameters.Add(new MySqlParameter("@seuil_bas", MySqlDbType.VarChar, 30)).Value     = BunifuMetroTextbox7.Text;


                    if (PictureBox1.Image != null)
                    {
                        MemoryStream ms = new MemoryStream();
                        PictureBox1.Image.Save(ms, PictureBox1.Image.RawFormat);
                        var pictuure = ms.ToArray();
                        Class1.cmd.Parameters.Add(new MySqlParameter("@image", MySqlDbType.LongBlob, 30)).Value = pictuure;
                    }
                    else
                    {
                        Class1.cmd.Parameters.Add(new MySqlParameter("@image", MySqlDbType.LongBlob, 30)).Value = null;
                    }
                    notyf n = new notyf();
                    n.Show();
                    notificationicon not = new notificationicon("Ajouter", "le produit   :" + bunifuMetroTextbox11.Text);
                    not.Location = new Point(Class1.index, n.Height * Class1.index);
                    Class1.index++;
                    Class1.cn.Open();
                    Class1.cmd.ExecuteNonQuery();
                    bunifuMetroTextbox11.Text = "";
                    BunifuMetroTextbox1.Text  = "";
                    BunifuMetroTextbox2.Text  = "";
                    BunifuMetroTextbox5.Text  = "";
                    BunifuMetroTextbox3.Text  = "";
                    bunifuMetroTextbox4.Text  = "";
                    BunifuMetroTextbox5.Text  = "";
                    bunifuMetroTextbox6.Text  = "";
                    BunifuMetroTextbox7.Text  = "";
                    BunifuMetroTextbox8.Text  = "";
                    bunifuMetroTextbox9.Text  = "";
                    bunifuMetroTextbox10.Text = "";

                    Class1.adapter = new MySqlDataAdapter("select * from produit ", Class1.cn);
                    Class1.adapter.Fill(dt1);
                    bunifuCustomDataGrid1.DataSource = dt1;
                    bunifuCustomDataGrid1.Visible    = true;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                Class1.cn.Close();
            }
            else
            {
                MessageBox.Show("remplir tous les champs !!");
            }
        }
        private void bunifuThinButton26_Click(object sender, EventArgs e)
        {
            DataTable verifier = new DataTable();

            Class1.adapter = new MySqlDataAdapter("select N_C_C from commande_effectue_client where N_C_C='" + bunifuCustomDataGrid3.CurrentRow.Cells[0].Value + "'", Class1.cn);
            Class1.adapter.Fill(verifier);
            ComboBox2.DataSource = verifier;
            if (verifier.Rows.Count == 0)
            {
                Class1.cmd = new MySqlCommand("INSERT INTO commande_effectue_client values (@N_C_C, @ID, @DATE1)", Class1.cn);
                Class1.cmd.Parameters.Add(new MySqlParameter("@N_C_C", MySqlDbType.VarChar, 30)).Value = bunifuCustomDataGrid3.CurrentRow.Cells[0].Value;
                Class1.cmd.Parameters.Add(new MySqlParameter("@ID", MySqlDbType.VarChar, 30)).Value    = login.p.Label3.Text.ToString();
                Class1.cmd.Parameters.Add(new MySqlParameter("@DATE1", MySqlDbType.VarChar, 30)).Value = DateTime.Now.ToString();
                Class1.cn.Open();
                Class1.cmd.ExecuteNonQuery();
                notyf n = new notyf();
                n.Show();
                Class1.cn.Close();
                DataTable dtcommande_ef = new DataTable();
                Class1.adapter = new MySqlDataAdapter("select * from commande_effectue_client ", Class1.cn);
                Class1.adapter.Fill(dtcommande_ef);
                bunifuCustomDataGrid1.DataSource = dtcommande_ef;
                //message
                if (login.p.parametre1.bunifuSwitch1.Value == true)
                {
                    DataTable tel = new DataTable();
                    Class1.adapter = new MySqlDataAdapter("select TELEPHONE from client where CNI='" + bunifuCustomDataGrid3.CurrentRow.Cells[2].Value + "'", Class1.cn);
                    Class1.adapter.Fill(tel);
                    MessageBox.Show(tel.Rows[0][0].ToString());
                    if (serialPort1.IsOpen)
                    {
                        serialPort1.Close();
                    }

                    serialPort1.PortName  = login.p.parametre1.ComboBox1.Text.ToString();
                    serialPort1.BaudRate  = 9600;
                    serialPort1.Parity    = System.IO.Ports.Parity.None;
                    serialPort1.DataBits  = 8;
                    serialPort1.Handshake = System.IO.Ports.Handshake.RequestToSend;
                    serialPort1.DtrEnable = true;
                    serialPort1.RtsEnable = true;
                    try
                    {
                        serialPort1.Open();
                        if (serialPort1.IsOpen)
                        {
                            serialPort1.Write("at\r");
                            serialPort1.Write("at+cmgf=1\r");
                            System.Threading.Thread.Sleep(1000);
                            serialPort1.Write("at+cmgs=\"" + tel.Rows[0][0].ToString() + "\"\r\n");
                            serialPort1.Write(login.p.parametre1.BunifuMetroTextbox1.Text + "\x1A");
                            System.Threading.Thread.Sleep(1000);
                            MessageBox.Show("efuctue");
                            notyf na = new notyf();
                            na.Show();
                            notificationicon not = new notificationicon("Passer a effectué", "la commande   :" + bunifuCustomDataGrid3.CurrentRow.Cells[0].Value);
                            not.Location = new Point(Class1.index, na.Height * Class1.index);
                            Class1.index++;
                            login.p.top_bare1.panel1.Controls.Add(not);
                            serialPort1.Close();
                            MessageBox.Show("message envoyer");
                        }
                        else
                        {
                            MessageBox.Show("Port '" + serialPort1.PortName + "' is not available!");
                        }
                    }


                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
            else
            {
                MessageBox.Show("deja effectué");
            }
        }
        private void bunifuThinButton23_Click(object sender, EventArgs e)
        {
            double prixtotal = 0;


            //prixtatoal
            for (int i = 0; i < bunifuCustomDataGrid2.Rows.Count - 1; i++)
            {
                prixtotal = prixtotal + Convert.ToInt32(bunifuCustomDataGrid2.Rows[i].Cells[1].Value);
            }

            //commande

            try
            {
                Class1.cmd = new MySqlCommand("INSERT INTO commande_c values (@N_C_C, @ID_user, @CNI, @N_FACTURE, @DATE, @PRIX_TOTALE,@N_bonne,@avance)", Class1.cn);
                Class1.cmd.Parameters.Add(new MySqlParameter("@N_C_C", MySqlDbType.VarChar, 30)).Value       = bunifuCustomLabel11.Text;
                Class1.cmd.Parameters.Add(new MySqlParameter("@ID_user", MySqlDbType.VarChar, 30)).Value     = login.p.Label3.Text;
                Class1.cmd.Parameters.Add(new MySqlParameter("@CNI", MySqlDbType.VarChar, 30)).Value         = ComboBox1.SelectedValue;
                Class1.cmd.Parameters.Add(new MySqlParameter("@N_FACTURE", MySqlDbType.VarChar, 30)).Value   = bunifuCustomLabel11.Text;
                Class1.cmd.Parameters.Add(new MySqlParameter("@DATE", MySqlDbType.Date)).Value               = bunifuDatepicker1.Value;
                Class1.cmd.Parameters.Add(new MySqlParameter("@PRIX_TOTALE", MySqlDbType.VarChar, 30)).Value = prixtotal.ToString();
                Class1.cmd.Parameters.Add(new MySqlParameter("@N_bonne", MySqlDbType.VarChar, 30)).Value     = bunifuMetroTextbox4.Text;
                Class1.cmd.Parameters.Add(new MySqlParameter("@avance", MySqlDbType.VarChar, 30)).Value      = bunifuMetroTextbox2.Text;

                Class1.cn.Open();
                Class1.cmd.ExecuteNonQuery();



                //contient


                for (int i = 0; i < bunifuCustomDataGrid2.Rows.Count; i++)
                {
                    MessageBox.Show(i.ToString());
                    Class1.cmd = new MySqlCommand("INSERT INTO contient_c_client values (@N_P,@N_C_C,@QTE)", Class1.cn);
                    Class1.cmd.Parameters.Add(new MySqlParameter("@N_P", MySqlDbType.VarChar, 30)).Value   = bunifuCustomDataGrid2.Rows[i].Cells[0].Value;
                    Class1.cmd.Parameters.Add(new MySqlParameter("@N_C_C", MySqlDbType.VarChar, 30)).Value = bunifuCustomLabel11.Text;
                    Class1.cmd.Parameters.Add(new MySqlParameter("@QTE", MySqlDbType.VarChar, 30)).Value   = bunifuCustomDataGrid2.Rows[i].Cells[3].Value;

                    Class1.cmd.ExecuteNonQuery();
                }
                Class1.cn.Close();

                ////facture
                Class1.cmd = new MySqlCommand("INSERT INTO facture values (@N_FACTURE, @CNI)", Class1.cn);
                Class1.cmd.Parameters.Add(new MySqlParameter("@N_FACTURE", MySqlDbType.VarChar, 30)).Value = bunifuCustomLabel11.Text;
                Class1.cmd.Parameters.Add(new MySqlParameter("@CNI", MySqlDbType.VarChar, 30)).Value       = ComboBox1.SelectedValue;
                Class1.cn.Open();
                Class1.cmd.ExecuteNonQuery();
                Class1.cn.Close();
                bunifuCustomDataGrid2.Rows.Clear();
                i = -1;
                Class1.cn.Close();
                DataTable dtn = new DataTable();
                Class1.adapter = new MySqlDataAdapter("select max(N_C_C) from commande_c  ", Class1.cn);
                Class1.adapter.Fill(dtn);
                int a = Convert.ToInt32(dtn.Rows[0][0]);
                a = a + 1;
                bunifuCustomLabel11.Text = a.ToString();
                ComboBox1.Enabled        = true;
                bunifuMetroTextbox3.Text = "";
                bunifuMetroTextbox1.Text = "";
                bunifuCustomLabel8.Text  = "Prix";
                ComboBox2.Text           = "";
                bunifuMetroTextbox4.Text = "";
                bunifuMetroTextbox2.Text = "";
                notyf na = new notyf();
                na.Show();
                notificationicon not = new notificationicon("Ajouter", "la commande   :" + bunifuCustomLabel8.Text);
                not.Location = new Point(Class1.index, na.Height * Class1.index);
                Class1.index++;
                login.p.top_bare1.panel1.Controls.Add(not);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #10
0
        private void bunifuThinButton23_Click(object sender, EventArgs e)
        {
            ComboBox1.Enabled = true;
            //total prix
            int prixtotal = 0;

            for (int i = 0; i < bunifuCustomDataGrid2.Rows.Count - 1; i++)
            {
                prixtotal = prixtotal + Convert.ToInt32(bunifuCustomDataGrid2.Rows[i].Cells[2].Value);
            }
            Class1.cmd = new MySqlCommand("INSERT INTO commande_fournisseur values (@N_COMMANDE, @USER_DEMANDER, @PRIX_TOTAL, @date)", Class1.cn);
            Class1.cmd.Parameters.Add(new MySqlParameter("@N_COMMANDE", MySqlDbType.VarChar, 30)).Value    = bunifuCustomLabel7.Text;
            Class1.cmd.Parameters.Add(new MySqlParameter("@USER_DEMANDER", MySqlDbType.VarChar, 30)).Value = login.p.Label3.Text;
            Class1.cmd.Parameters.Add(new MySqlParameter("@PRIX_TOTAL", MySqlDbType.VarChar, 30)).Value    = prixtotal;
            Class1.cmd.Parameters.Add(new MySqlParameter("@date", MySqlDbType.Date)).Value = bunifuDatepicker1.Value;
            Class1.cn.Open();
            Class1.cmd.ExecuteNonQuery();
            Class1.cn.Close();
            //contient
            Class1.cn.Open();
            for (int i = 0; i < bunifuCustomDataGrid2.Rows.Count; i++)
            {
                Class1.cmd = new MySqlCommand("INSERT INTO contient_c_fournisseur values (@N_COMMANDE, @N_P, @QTE)", Class1.cn);
                Class1.cmd.Parameters.Add(new MySqlParameter("@N_COMMANDE", MySqlDbType.VarChar, 30)).Value = bunifuCustomLabel7.Text.ToString();
                Class1.cmd.Parameters.Add(new MySqlParameter("@N_P", MySqlDbType.VarChar, 30)).Value        = bunifuCustomDataGrid2.Rows[i].Cells[0].Value.ToString();
                Class1.cmd.Parameters.Add(new MySqlParameter("@QTE", MySqlDbType.VarChar, 30)).Value        = bunifuCustomDataGrid2.Rows[i].Cells[2].Value.ToString();
                Class1.cmd.ExecuteNonQuery();
            }
            Class1.cn.Close();
            notyf     ntf = new notyf();
            DataTable dt2 = new DataTable();

            ntf.Show();
            Class1.adapter = new MySqlDataAdapter("select E_mail from fournisseur where N='" + ComboBox1.SelectedValue.ToString() + "'", Class1.cn);
            Class1.adapter.Fill(dt2);


            try
            {
                MailMessage mail = new MailMessage();
                mail.From = new System.Net.Mail.MailAddress(login.p.parametre1.bunifuMetroTextbox2.Text.ToString());
                SmtpClient smtp = new SmtpClient();
                smtp.Port                  = 587;
                smtp.EnableSsl             = true;
                smtp.DeliveryMethod        = SmtpDeliveryMethod.Network;
                smtp.UseDefaultCredentials = false;
                smtp.Credentials           = new NetworkCredential(mail.From.Address, login.p.parametre1.bunifuMetroTextbox3.Text.ToString());
                smtp.Host                  = "smtp.gmail.com";

                //recipient
                mail.To.Add(new MailAddress(dt2.Rows[0][0].ToString()));

                mail.IsBodyHtml = true;
                string st = login.p.parametre1.bunifuMetroTextbox4.Text.ToString();

                mail.Body = st;
                smtp.Send(mail);
                MessageBox.Show("envoyer");
                notyf na = new notyf();
                na.Show();
                notificationicon not = new notificationicon("Ajouter", "la commande   :" + bunifuCustomLabel7.Text);
                not.Location = new Point(Class1.index, na.Height * Class1.index);
                Class1.index++;
                login.p.top_bare1.panel1.Controls.Add(not);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }