예제 #1
0
파일: frm_Login.cs 프로젝트: sule-mese/UBYS
        private void button1_Click(object sender, EventArgs e)
        {
            int i = 0;

            if (String.IsNullOrEmpty(textBox1.Text) || String.IsNullOrEmpty(textBox2.Text))
            {
                MessageBox.Show("Kullanıcı Adı ve/veya Şifre boş bırakılamaz!", "!.Uyarı.!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                i++;
            }

            try
            {
                str = @"SELECT * FROM Kullanici_Kaydi
                            WHERE Email='" + textBox1.Text.ToString() + @"' COLLATE Turkish_CS_AS AND
                            Sifre='" + HashLayer.SHA512(textBox2.Text.ToString()) + "'";
                if (DBLayer.TabloSorgula(str).Rows.Count > 0)
                {
                    this.Hide();
                    frm_Index frm = new frm_Index();
                    frm.ShowDialog();
                    frm.Close();
                }
                if (i == 0)
                {
                    MessageBox.Show("Yanlış Kullanıcı Adı ve/veya Şifre girdiniz!", "!.Uyarı.!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #2
0
 private void btn_Kaydet_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrEmpty(textBox2.Text) || String.IsNullOrEmpty(textBox3.Text))
     {
         //MessageBox.Show("Alanlar boş bırakılamaz!", "Uyarı");
     }
     else
     {
         string str = @"SELECT ID FROM Kullanici_Kaydi
                        WHERE Email='" + textBox2.Text.ToString() + "'";
         if (DBLayer.TabloSorgula(str).Rows.Count > 0)
         {
             string ID = DBLayer.FunctionÇağır(str).ToString();
             str = @"UPDATE Kullanici_Kaydi SET
                    Email = '" + textBox2.Text.ToString() + @"' ,
                    Sifre = '" + HashLayer.SHA512(textBox3.Text.ToString()) + @"'
                    WHERE ID = '" + ID.ToString() + "' ";
             DBLayer.IslemYap(str);
             str = "Select *from Kullanici_Kaydi";
             dataGridView1.DataSource = DBLayer.TabloSorgula(str);
             textBox1.Text            = "";
             textBox2.Text            = "";
             ID = "0";
         }
         else
         {
             str = @"INSERT INTO Kullanici_Kaydi (Email,Sifre)
             Values('" + textBox2.Text.ToString() + @"',
             '" + HashLayer.SHA512(textBox3.Text.ToString()) + "')";
             DBLayer.IslemYap(str);
             str = "Select *from Kullanici_Kaydi";
             dataGridView1.DataSource = DBLayer.TabloSorgula(str);
             textBox1.Text            = "";
             textBox2.Text            = "";
         }
     }
 }