private void btnGuncelle_Click(object sender, EventArgs e) { if (txtAdi.Text == null || txtAdi.Text == "") { MessageBox.Show("Ürün adını giriniz ", "Ürün Adı", MessageBoxButtons.OK, MessageBoxIcon.Information); txtAdi.Focus(); return; } if (cmbKategori.Items.Count == 0 || cmbBirim.Items.Count == 0) { MessageBox.Show("Ürün eklemek için Kategori ve Birim Tipini belirlemelisiniz.\n -Tanımlar/Kategoriler \n -Tanımlar/Birim Tip", "Ürün Ekleme", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } int id = Convert.ToInt32(dataGridView1.CurrentRow.Cells["Id"].Value); if (id <= 0) { MessageBox.Show("Güncellenecek Ürün yoktur", "Ürün Yok", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { Urunler u = new Urunler(); u.Id = id; u.Adi = Tools.ToTitleCase(txtAdi.Text); u.Fiyat = nudFiyat.Value; u.Miktar = Convert.ToDouble(nudMiktar.Value); bool sonuc = uOrm.Updated(u); if (sonuc) { MessageBox.Show("Ürün Güncellendi", "Ürün Güncelleme", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Ürün Güncellenmedi\n", "Ürün Güncelleme", MessageBoxButtons.OK, MessageBoxIcon.Stop); } dataGridView1.DataSource = uOrm.Select(); Tools.ButtonVisibleControl(this.dataGridView1, this.btnEkle, this.btnGuncelle, this.btnIptal); Tools.Temizle(this); cmbKategori.Enabled = true; cmbBirim.Enabled = true; dataGridView1.Focus(); } }