Skip to content

Commit

Permalink
Merge pull request #10 from Qeneke/master
Browse files Browse the repository at this point in the history
role ait kullanıcı id ile veritabanı güncelleme
  • Loading branch information
shenburak committed May 9, 2020
2 parents 4faa386 + 3375526 commit 39ddffc
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 12 deletions.
28 changes: 28 additions & 0 deletions Sukol/Gorevli.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,34 @@ public void KullaniciEkle(Kullanici k)

db.baslat();
db.calistir();

string identity = "select @@IDENTITY from kullanicilar";
db.sorgu(identity);
db.calistir();
int kullaniciId = db.scalar();


if (k.ogrenci != null)
{
string sorgu_ogrenci = "INSERT INTO ogrenciler(okul_no, kullanici_id) " +
"VALUES(@okul_no, @kullanici_id);";
db.sorgu(sorgu_ogrenci);
db.parametreEkle("okul_no", k.ogrenci.numara);
db.parametreEkle("kullanici_id", kullaniciId);
db.calistir();
}
if (k.ogretmen != null)
{
string sorgu_ogrenci = "INSERT INTO ogretmenler(sinif, kullanici_id) " +
"VALUES(@sinif, @kullanici_id);";
db.sorgu(sorgu_ogrenci);
db.parametreEkle("sinif", k.ogretmen.sinif);
db.parametreEkle("kullanici_id", kullaniciId);
db.calistir();
}
if (k.gorevli != null)
{
}
db.kapat();
}
}
Expand Down
21 changes: 11 additions & 10 deletions Sukol/KullaniciEkleme/KullaniciEkle.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Sukol/KullaniciEkleme/KullaniciEkle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private void button_ekle_click(object sender, EventArgs e)
kullanici.isim = textBox_ad.Text;
kullanici.soyisim = textBox_soyad.Text;
kullanici.kullaniciAdi = textBox_kullaniciAdi.Text;
kullanici.sifre = textBox_sifre.Text;
kullanici.sifre = maskedTextBox_sifre.Text;

gorevli.KullaniciEkle(kullanici);

Expand All @@ -71,7 +71,7 @@ private bool TextBoxlariKontrolEt()
if(textBox_ad.Text.Trim().Length < 2 &&
textBox_soyad.Text.Trim().Length < 2 &&
textBox_kullaniciAdi.Text.Trim().Length < 2 &&
textBox_sifre.Text.Trim().Length < 2)
maskedTextBox_sifre.Text.Trim().Length < 2)
{
MessageBox.Show("Alanları boş geçme", "Hata");
return false;
Expand Down
4 changes: 4 additions & 0 deletions Sukol/Veritabani.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ public OleDbDataReader oku()
{
return komut.ExecuteReader();
}
public int scalar()
{
return (int)komut.ExecuteScalar();
}
public void kapat()
{
baglantim.Close();
Expand Down

0 comments on commit 39ddffc

Please sign in to comment.