private void Ayarlar_Load(object sender, EventArgs e) { //Girş yapan müdürse ona göre işlemlere izin ver Personel personel = new Personel(); PersonelGörev görev = new PersonelGörev(); string gorev = görev.PersonelGörevTanım(Veritabanı._GörevId); if (gorev == "Müdür") { personel.BilgileriGöster(Cbpersonel); görev.PersonelGörevGetir(CbGorev); personel.PersonelBigileriGetir(listPersonel); BtnYeni.Enabled = true; BtnSil.Enabled = false; BtnDegıstır.Enabled = false; BtnKaydet.Enabled = false; groupBox2.Visible = false; groupBox1.Visible = true; groupBox3.Visible = true; groupBox4.Visible = true; TxtSıfre.ReadOnly = true; TxtSıfreTekrar.ReadOnly = true; LblGiriş.Text = "Müdür/Yetki Sınırsız / Kullanıcı:" + personel.PersonelİsimBilgi(Veritabanı._PersonelId); } else //Personel giriş yaptıysa { groupBox2.Visible = true; groupBox1.Visible = false; groupBox3.Visible = false; groupBox4.Visible = false; LblGiriş.Text = "Yetki Sınırlı / Kullanıcı:" + personel.PersonelİsimBilgi(Veritabanı._PersonelId); } }
private void BtnKaydet_Click(object sender, EventArgs e) { //Personel kaydetme işlemi if (TxtAd.Text.Trim() != "" & TxtSoyad.Text.Trim() != "" & TxtSıfre.Text.Trim() != "" & TxtSıfreTekrar.Text != "" & textBox2.Text != "") { if ((TxtSıfreTekrar.Text.Trim() == TxtSıfre.Text.Trim()) && (TxtSıfre.Text.Length > 5 || TxtSıfreTekrar.Text.Length > 5)) { Personel personel = new Personel(); personel.PersonelAd = TxtAd.Text.Trim(); personel.PersonelSoyad = TxtSoyad.Text.Trim(); personel.PersonelSıfre = TxtSıfreTekrar.Text; personel.PersonelGorevId = Convert.ToInt32(textBox2.Text); bool sonuc = personel.PersonelEkle(personel); //Personel sınıfına gönderme if (sonuc) { MessageBox.Show("Kayıt Eklendi."); personel.PersonelBigileriGetir(listPersonel); //Bilgileri listviewde gösterme } else { MessageBox.Show("Kayıt eklenirken hata oluştu."); } } else { MessageBox.Show("Şifreler aynı değil."); } } else { MessageBox.Show("Alanlar boş bırakılamaz."); } }
private void BtnSil_Click(object sender, EventArgs e) { //Personel silme işlemleri if (listPersonel.Items.Count > 0)//Listviewde personel varsa işlem yap { if (MessageBox.Show("Silmek istediğinize emin misiniz?", "Uyarı", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { Personel personel = new Personel(); bool sonuc = personel.PersonelSil(Convert.ToInt32(listPersonel.SelectedItems[0].Text)); if (sonuc) { MessageBox.Show("Kayıt silindi."); personel.PersonelBigileriGetir(listPersonel); } else { MessageBox.Show("Kayıt silinirken hata oluştu"); } } else { MessageBox.Show("Kayıt seçiniz."); } } }
private void BtnDegıstır_Click(object sender, EventArgs e) { //Personel bigisi değiştirme işlemi if (listPersonel.Items.Count > 0) //listviewde personel varsa işlem yap { if (TxtAd.Text != "" || TxtSoyad.Text != "" || TxtSıfre.Text != "" || TxtSıfreTekrar.Text != "" || textBox2.Text != "") { if ((TxtSıfreTekrar.Text.Trim() == TxtSıfre.Text.Trim()) && (TxtSıfre.Text.Length > 5 || TxtSıfreTekrar.Text.Length > 5)) { Personel personel = new Personel(); personel.PersonelAd = TxtAd.Text.Trim(); personel.PersonelSoyad = TxtSoyad.Text.Trim(); personel.PersonelSıfre = TxtSıfreTekrar.Text; personel.PersonelGorevId = Convert.ToInt32(textBox2.Text); bool sonuc = personel.PersonelGüncelle(personel, Convert.ToInt32(textBox1.Text)); if (sonuc) { MessageBox.Show("Kayıt Eklendi."); personel.PersonelBigileriGetir(listPersonel); } else { MessageBox.Show("Kayıt eklenirken hata oluştu."); } } else { MessageBox.Show("Şifreler aynı değil."); } } else { MessageBox.Show("Alanlar boş bırakılamaz."); } } else { MessageBox.Show("Kayıt seçiniz."); } }