예제 #1
0
 private void btnGuncelle_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtAdi.Text) || string.IsNullOrEmpty(txtSoyadi.Text) || string.IsNullOrEmpty(mtxtTelefon.Text))
     {
         MessageBox.Show("Emlak Sahibi adı, soyadı ve telefonu boş geçemezsiniz!", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
         txtAdi.Focus();
     }
     else
     {
         cMusteriSatici ms = new cMusteriSatici();
         ms.MusteriSaticiID    = Convert.ToInt32(txtMusteriSaticiID.Text);
         ms.MusteriSaticiAd    = txtAdi.Text;
         ms.MusteriSaticiSoyad = txtSoyadi.Text;
         ms.Telefon            = mtxtTelefon.Text;
         ms.Mail = txtMail.Text;
         if (ms.MusteriKontrolByGuncelle(ms))
         {
             MessageBox.Show("Bu emlak sahibi önceden kayıtlı.", "Zaten Mevcut!!", MessageBoxButtons.OK, MessageBoxIcon.Information);
             txtAdi.Focus();
         }
         else
         {
             if (ms.MusteriGuncelle(ms))
             {
                 MessageBox.Show("Emlak sahibi güncellendi.", "Değişiklik Gerçekleştirildi.");
                 dgvMusteriSatici.DataSource = ms.MusteriSaticiGoster();
                 Temizle();
                 btnGuncelle.Enabled = false;
                 btnSil.Enabled      = false;
                 btnEkle.Enabled     = true;
                 txtAdi.Focus();
             }
             else
             {
                 MessageBox.Show("Güncelleme gerçekleşmedi!"); txtAdi.Focus();
             }
         }
     }
 }