private void ButtonKullaniciKayitGeri_Click(object sender, EventArgs e) { FormGirisPaneli GirisPanelNesnesi = new FormGirisPaneli(); GirisPanelNesnesi.Show(); this.Hide(); }
private void ButtonAnaSayfaSolMenuGirisSayfasinaGit_Click(object sender, EventArgs e) { ButtonSelectedColor(ButtonAnaSayfaSolMenuGirisSayfasinaGit); FormGirisPaneli GirisPanelNesnesi = new FormGirisPaneli(); GirisPanelNesnesi.Show(); this.Hide(); }
private void ButtonFormKullaniciKayitKaydet_Click(object sender, EventArgs e) { if (textBoxFormKullaniciKayitKullaniciAdi.TextLength == 0) { labelKullaniciKayitKullaniciAdiBos.Text = "Kullanıcı adı boş bırakılamaz."; labelKullaniciKayitSifreBos.Text = ""; labelKullaniciKayitSifreTekrarBos.Text = ""; labelKullaniciKayitAdBos.Text = ""; } else if (textBoxFormKullaniciKayitSifre.TextLength == 0) { labelKullaniciKayitKullaniciAdiBos.Text = ""; labelKullaniciKayitSifreBos.Text = "Şifre alanı boş bırakılamaz."; labelKullaniciKayitSifreTekrarBos.Text = ""; labelKullaniciKayitAdBos.Text = ""; } else if (textBoxFormKullaniciKayitSifreTekrar.TextLength == 0) { labelKullaniciKayitKullaniciAdiBos.Text = ""; labelKullaniciKayitSifreBos.Text = ""; labelKullaniciKayitSifreTekrarBos.Text = "Şifre tekrar alanı boş bırakılamaz."; labelKullaniciKayitAdBos.Text = ""; } else if (textBoxFormKullaniciKayitAd.TextLength == 0) { labelKullaniciKayitKullaniciAdiBos.Text = ""; labelKullaniciKayitSifreBos.Text = ""; labelKullaniciKayitSifreTekrarBos.Text = ""; labelKullaniciKayitAdBos.Text = "Ad alanı boş bırakılamaz."; } else if (textBoxFormKullaniciKayitSifre.Text != textBoxFormKullaniciKayitSifreTekrar.Text) { labelKullaniciKayitKullaniciAdiBos.Text = ""; labelKullaniciKayitSifreBos.Text = ""; labelKullaniciKayitSifreTekrarBos.Text = ""; labelKullaniciKayitAdBos.Text = ""; labelKullaniciKayitSifreTekrarBos.Text = "Girilen şifreler aynı değil."; } else if (textBoxFormKullaniciKayitSifre.Text == textBoxFormKullaniciKayitSifreTekrar.Text) { bool kontrol = true; labelKullaniciKayitKullaniciAdiBos.Text = ""; labelKullaniciKayitSifreBos.Text = ""; labelKullaniciKayitSifreTekrarBos.Text = ""; labelKullaniciKayitAdBos.Text = ""; baglanti.Open(); SqlCommand selectSorgu = new SqlCommand("select *from kullanici", baglanti); SqlDataReader kayitOkuma = selectSorgu.ExecuteReader(); while (kayitOkuma.Read()) { if (kayitOkuma["KullaniciAdi"].ToString() == textBoxFormKullaniciKayitKullaniciAdi.Text) { baglanti.Close(); MessageBox.Show("Bu kullanıcı adını kullanan bir kayıt mevcuttur.", "Kayıt Uyarısı"); kontrol = false; break; } else if (kayitOkuma["Email"].ToString() == textBoxFormKullaniciKayitEmail.Text) { baglanti.Close(); MessageBox.Show("Bu e-mail adresini kullanan bir kayıt mevcuttur.", "Kayıt Uyarısı"); kontrol = false; break; } } baglanti.Close(); if (kontrol) { try { baglanti.Open(); string sorgu = "INSERT INTO kullanici(YetkiID,KullaniciAdi,Sifre,Ad,Soyad,Email,KayitTarihi) VALUES(@Yetki, @KullaniciAdi, @Sifre, @Ad, @Soyad, @Email, @KayitTarihi)"; //string sorgu = "INSERT INTO kullanici(YetkiID,KullaniciAdi,Sifre,Ad,Soyad,Email) VALUES(@Yetki, @KullaniciAdi, @Sifre, @Ad, @Soyad, @Email)"; SqlCommand komut = new SqlCommand(sorgu, baglanti); komut.Parameters.AddWithValue("@Yetki", "3"); komut.Parameters.AddWithValue("@KullaniciAdi", textBoxFormKullaniciKayitKullaniciAdi.Text); komut.Parameters.AddWithValue("@Sifre", textBoxFormKullaniciKayitSifre.Text); komut.Parameters.AddWithValue("@Ad", textBoxFormKullaniciKayitAd.Text); komut.Parameters.AddWithValue("@Soyad", textBoxFormKullaniciKayitSoyad.Text); komut.Parameters.AddWithValue("@Email", textBoxFormKullaniciKayitEmail.Text); komut.Parameters.AddWithValue("@KayitTarihi", DateTime.Now); komut.ExecuteNonQuery(); baglanti.Close(); MessageBox.Show("Kullanıcı başarıyla kayıt edilmiştir.", "Kullanıcı Kayıt"); textBoxFormKullaniciKayitKullaniciAdi.Clear(); textBoxFormKullaniciKayitSifre.Clear(); textBoxFormKullaniciKayitSifreTekrar.Clear(); textBoxFormKullaniciKayitAd.Clear(); textBoxFormKullaniciKayitSoyad.Clear(); textBoxFormKullaniciKayitEmail.Clear(); FormGirisPaneli GirisPanelNesnesi = new FormGirisPaneli(); GirisPanelNesnesi.Show(); this.Hide(); } catch (Exception hataMesaji) { baglanti.Close(); MessageBox.Show(hataMesaji.Message, "Kullanıcı Kayıt Hatası"); } } } }