/// <summary> /// Sil (Delete) butonuna basıldığında ilgili kullanıcının veritabanından silinmesi işlemi gerçekleşmektedir ... /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSil_Click(object sender, EventArgs e) { if (MessageBox.Show("Silmek istediğinize emin misiniz ?", "Uyarı", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { KullaniciContract crud = new KullaniciContract(); crud.DeletedUser(txtKullaniciKod.Text); MessageBox.Show("Başarı ile silme işlemi gerçekleşmiştir. Silinen Kayıt : " + txtKullaniciKod.Text, "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information); UIUserIdentification user = new UIUserIdentification(); user.LoadUser(); this.Close(); } }
/// <summary> /// Duruma göre Insert / Update işlemi yapılmaktadır .. . /// </summary> public void AddOrUpdateByStataus() { #region Buton = "Kaydet" ise --> if (btnGüncelle.Text.Equals("Kaydet")) { #region Eklenecek veriler kullanici tablosundaki ilgili alanlara aktarılıyor .. kullanici user = new kullanici(); user.Code = txtKullaniciKod.Text; user.TCKN = txtTcNo.Text; user.PlateOfBirthh = txtDogumYeri.Text; user.FatherName = txtBabaAdi.Text; user.MotherName = txtAnneAdi.Text; user.Title = cmbUnvan.Text; user.Name = txtAd.Text; user.MobilePhone = txtTelNo.Text; user.SurName = txtSoyad.Text; user.Salary = txtMaas.Text; user.HomePhone = txtGsm.Text; user.StartWork = Convert.ToDateTime(dtIseBaslama.Value.ToShortDateString()); user.DateOfBirth = Convert.ToDateTime(dtDogumTarih.Value.ToShortDateString()); user.Gender = cmbCinsiyet.Text; user.BloodGroup = cmbKanGrubu.Text; user.MarialStatus = cmbMedeniHal.Text; user.Address = txtAdres.Text; user.UserName = txtKullaniciAdi.Text; user.Password = txtSifre.Text; if (chkYetkiliKullanici.Checked) { user.Authority = "var"; } else { user.Authority = "yok"; } KullaniciContract crud = new KullaniciContract(); if (!crud.InsertUserTable(user)) { MessageBox.Show("Lütfen Tüm alanları doldurunuz !"); } UIUserIdentification userIden = new UIUserIdentification(); userIden.LoadUser(); this.Close(); MessageBox.Show("Kayıt işlemi gerçekleşmiştir. Kaydedilen Kayıt : " + txtKullaniciKod.Text, "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information); #endregion } #endregion #region Buton = "Güncelle" ise --> else { #region Güncellenecek bilgiler değişiklik sonucunda kullanici tablosundakii ilgili alanlara aktarılmaktadır .. DialogResult result = MessageBox.Show("Güncellemek istediğinize emin misiniz ?", "Uyarı", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { kullanici user = new kullanici(); user.Code = txtKullaniciKod.Text; user.TCKN = txtTcNo.Text; user.PlateOfBirthh = txtDogumYeri.Text; user.FatherName = txtBabaAdi.Text; user.MotherName = txtAnneAdi.Text; user.Title = cmbUnvan.Text; user.Name = txtAd.Text; user.MobilePhone = txtTelNo.Text; user.SurName = txtSoyad.Text; user.Salary = txtMaas.Text; user.HomePhone = txtGsm.Text; user.StartWork = Convert.ToDateTime(dtIseBaslama.Value.ToShortDateString()); user.DateOfBirth = Convert.ToDateTime(dtDogumTarih.Value.ToShortDateString()); user.Gender = cmbCinsiyet.Text; user.BloodGroup = cmbKanGrubu.Text; user.MarialStatus = cmbMedeniHal.Text; user.Address = txtAdres.Text; user.UserName = txtKullaniciAdi.Text; user.Password = txtSifre.Text; if (chkYetkiliKullanici.Checked) { user.Authority = "var"; } else { user.Authority = "yok"; } KullaniciContract crud = new KullaniciContract(); if (!crud.UpdateUserTable(user)) { MessageBox.Show("Lütfen Tüm alanları doldurunuz !"); } MessageBox.Show("Güncelleme işlemi gerçekleşmiştir. Güncellenen Kayıt : " + txtKullaniciKod.Text, "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information); UIUserIdentification userIden = new UIUserIdentification(); userIden.LoadUser(); this.Close(); } #endregion } #endregion }