private void pictureBox2_Click(object sender, EventArgs e) { PersonelKayit personelKayit = new PersonelKayit(ad, soyad, tc_no); personelKayit.Show(); this.Hide(); }
private void button1_Click(object sender, EventArgs e) { try { SqlConnection sqlConnection = new SqlConnection("server=DESKTOP-4B6TH1C;database=kayit_elemanlari;" + "Integrated Security=true"); SqlCommand sqlCommand = new SqlCommand("SELECT * FROM kayit_elemanlari WHERE tc_no=@tc_no " + "and ad=@ad and soyad=@soyad and personel_no=@personel_no and sifre=@sifre", sqlConnection); sqlConnection.Open(); sqlCommand.Parameters.AddWithValue("@tc_no", textBox1.Text); sqlCommand.Parameters.AddWithValue("@ad", textBox2.Text); sqlCommand.Parameters.AddWithValue("@soyad", textBox3.Text); sqlCommand.Parameters.AddWithValue("@personel_no", maskedTextBox1.Text); sqlCommand.Parameters.AddWithValue("@sifre", textBox4.Text); SqlDataReader sqlDataReader = sqlCommand.ExecuteReader(); if (sqlDataReader.HasRows == true) { MessageBox.Show("Giriş başarılı"); PersonelKayit personelKayit = new PersonelKayit(textBox2.Text, textBox3.Text, textBox1.Text); personelKayit.Show(); this.Hide(); } else { MessageBox.Show("Tekrar deneyiniz"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button1_Click(object sender, EventArgs e) { bool gecerli = true; if (textBox1.Text.Length > 15 || textBox1.Text.Length < 5) { MessageBox.Show("Şİfre uzunluğu 5 ile 15 karakter arası olmalıdır."); textBox1.Focus(); gecerli = false; } if (textBox2.Text != textBox1.Text) { MessageBox.Show("Şifreler uyuşmuyor."); textBox2.Focus(); gecerli = false; } if (textBox1.Text == "") { MessageBox.Show("Geçerli bir şifre giriniz."); textBox1.Focus(); gecerli = false; } if (!checkBox1.Checked) { MessageBox.Show("Şifre değiştirmeyi onaylayınız."); gecerli = false; } if (textBox3.Text == "") { MessageBox.Show("Mevcut Şifrenizi giriniz."); textBox3.Focus(); gecerli = false; } else if (gecerli == true) { try { sqlConnection.Open(); SqlCommand sqlCommand = new SqlCommand("UPDATE kayit_elemanlari SET sifre=@sifre WHERE tc_no=@tc_no", sqlConnection); sqlCommand.Parameters.AddWithValue("@tc_no", tc_no); sqlCommand.Parameters.AddWithValue("@sifre", textBox1.Text); sqlCommand.ExecuteNonQuery(); sqlConnection.Close(); MessageBox.Show("Şifre değiştirme başarılı"); textBox1.Text = " "; textBox2.Text = " "; textBox3.Text = " "; PersonelKayit personelKayit = new PersonelKayit(ad, soyad, tc_no); personelKayit.Show(); this.Hide(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }