private void KullaniciTanitma_Load(object sender, EventArgs e) { if (kontrol == true) { txtKullaniciAdi.Enabled = false; txtKullanıcıKodu.Enabled = false; kullaniciVerisi = new Kullanici(); kullaniciVerisi = Veritabani.KullaniciBilgileri(userName); txtDoldur(); btnGuncelle.Enabled = true; btnSil.Enabled = true; btnEkle.Enabled = false; } else { txtKullanıcıKodu.Enabled = false; string dosyaNo = Veritabani.maxVeri("kodu", "tblKullanici"); int yeniDosyaNo = Convert.ToInt32(dosyaNo); yeniDosyaNo++; txtKullanıcıKodu.Text = yeniDosyaNo.ToString(); btnGuncelle.Enabled = false; btnSil.Enabled = false; btnEkle.Enabled = true; } }
void Login() { try { Kullanici yeniGirisKullanici = new Kullanici(); if (Veritabani.Login(txtUsername.Text, txtPass.Text)) { Kullanici yeniLogin = new Kullanici(); yeniLogin = Veritabani.KullaniciBilgileri(txtUsername.Text); yeniGirisKullanici = Veritabani.KullaniciBilgileri(txtUsername.Text); MessageBox.Show("Hoşgeldiniz " + yeniGirisKullanici.Ad + " " + yeniGirisKullanici.Soyad + "!", "GİRİŞ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); if (yeniGirisKullanici.Yetki == "true") { MainForm.menuStrip.referanslar.DropDownItems[1].Enabled = true; MainForm.menuStrip.referanslar.DropDownItems[2].Enabled = true; } this.Hide(); MainForm.menuStrip.referanslar.Visible = true; MainForm.menuStrip.hastakabul.Enabled = true; MainForm.menuStrip.raporlar.Enabled = true; } else { MessageBox.Show("Yanlış kullanıcı adı ve/veya şifre.", "UYARI", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception a) { MessageBox.Show("Bir hata oluştu:" + a.Message, "UYARI", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }