Beispiel #1
0
        private void BunifuThinButton21_Click_1(object sender, EventArgs e)
        {
            try
            {
                DataTable dt1 = new DataTable();
                Class1.adapter = new MySqlDataAdapter("select * from utilisateur where ID = @ID and PWD = @PWD", Class1.cn);
                Class1.adapter.SelectCommand.Parameters.Add(new MySqlParameter("@ID", MySqlDbType.VarChar, 50)).Value  = bunifuMetroTextbox1.Text;
                Class1.adapter.SelectCommand.Parameters.Add(new MySqlParameter("@PWD", MySqlDbType.VarChar, 50)).Value = Class1.sha256(bunifuMetroTextbox2.Text);
                Class1.adapter.Fill(dt1);
                if (dt1.Rows.Count > 0)
                {
                    Class1.cmd = new MySqlCommand("INSERT INTO historique_acces values (@date, @ID)", Class1.cn);
                    Class1.cmd.Parameters.Add(new MySqlParameter("@ID", MySqlDbType.VarChar, 30)).Value   = bunifuMetroTextbox1.Text;
                    Class1.cmd.Parameters.Add(new MySqlParameter("@date", MySqlDbType.VarChar, 30)).Value = DateTime.Now.ToString();


                    Class1.cn.Open();
                    Class1.cmd.ExecuteNonQuery();
                    Class1.cn.Close();
                    p.Show();
                    notifyIcon1.ShowBalloonTip(20, "Beinvenu", bunifuMetroTextbox1.Text, ToolTipIcon.Info);
                    p.Label3.Text = bunifuMetroTextbox1.Text;


                    this.Visible = false;
                }
                else
                {
                    MessageBox.Show("le utilisateur ou le mote de passe incorecte !", "Ereur !!");
                }
            }


            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #2
0
        private void BunifuThinButton21_Click(object sender, EventArgs e)
        {
            try
            {
                Class1.cmd = new MySqlCommand("INSERT INTO utilisateur values (@ID, @PWD)", Class1.cn);
                Class1.cmd.Parameters.Add(new MySqlParameter("@ID", MySqlDbType.VarChar, 30)).Value  = BunifuMetroTextbox4.Text;
                Class1.cmd.Parameters.Add(new MySqlParameter("@PWD", MySqlDbType.VarChar, 30)).Value = Class1.sha256(BunifuMetroTextbox5.Text);

                Class1.cn.Open();
                Class1.cmd.ExecuteNonQuery();
                BunifuMetroTextbox4.Text = "";
                BunifuMetroTextbox5.Text = "";
                DataTable dt1 = new DataTable();

                Class1.adapter = new MySqlDataAdapter("select * from utilisateur ", Class1.cn);
                Class1.adapter.Fill(dt1);
                BunifuCustomDataGrid1.DataSource = dt1;
                notyf n = new notyf();
                n.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            Class1.cn.Close();
        }