private void btnGuncelle_Click(object sender, EventArgs e) { if (txtKasaHarAdi.Text == null || txtKasaHarAdi.Text == "") { MessageBox.Show("Kasa hareket tipi boş geçilemez", "Kasa Hareket Tip", MessageBoxButtons.OK, MessageBoxIcon.Information); txtKasaHarAdi.Focus(); return; } int id = Convert.ToInt32(dataGridView1.CurrentRow.Cells["Id"].Value); if (id <= 0) { MessageBox.Show("Güncellenecek Kasa Hareket Tipi yoktur", "Kasa Hareket Tipi Yok", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { KasaHareketTip kst = new KasaHareketTip(); kst.Id = id; kst.Adi = Tools.ToTitleCase(txtKasaHarAdi.Text); bool sonuc = kOrm.Updated(kst); if (sonuc) { MessageBox.Show("Kasa Hareket Tipi Güncellendi", "Kasa Hareket Tipi Güncelleme", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Kasa Hareket Tipi Güncellenmedi\n", "Kasa Hareket Tipi Güncelleme", MessageBoxButtons.OK, MessageBoxIcon.Stop); } dataGridView1.DataSource = kOrm.Select(); Tools.ButtonVisibleControl(this.dataGridView1, this.btnEkle, this.btnGuncelle, this.btnIptal); Tools.Temizle(this); dataGridView1.Focus(); } }
private void silToolStripMenuItem_Click(object sender, EventArgs e) { int id = Convert.ToInt32(dataGridView1.CurrentRow.Cells["Id"].Value); if (id <= 0) { MessageBox.Show("Silinecek eleman yoktur"); } else { KasaHareketTip k = new KasaHareketTip(); k.Id = id; bool sonuc = kOrm.Delete(k); if (sonuc) { MessageBox.Show("Kasa Hareket Tipi inaktif oldu", "Kasa Hareket Tipi Silme", MessageBoxButtons.OK, MessageBoxIcon.Information); dataGridView1.DataSource = kOrm.Select(); dataGridView1.Focus(); } else { MessageBox.Show("Kasa Hareket Tipi Silinmedi\n", "Kasa Hareket Tipi Silme", MessageBoxButtons.OK, MessageBoxIcon.Stop); } } }
private void btnEkle_Click(object sender, EventArgs e) { if (txtKasaHarAdi.Text == null || txtKasaHarAdi.Text == "") { MessageBox.Show("Kasa hareket tipi boş geçilemez", "Kasa Hareket Tip", MessageBoxButtons.OK, MessageBoxIcon.Information); txtKasaHarAdi.Focus(); return; } KasaHareketTip k = new KasaHareketTip(); k.Adi = Tools.ToTitleCase(txtKasaHarAdi.Text); bool sonuc = kOrm.Insert(k); if (sonuc) { MessageBox.Show("Kasa hareketi tanımlandı", "Kasa Hareket Tip", MessageBoxButtons.OK, MessageBoxIcon.Information); dataGridView1.DataSource = kOrm.Select(); Tools.Temizle(this); txtKasaHarAdi.Focus(); } else { MessageBox.Show("Kasa hareket tipi eklenmedi\n - Aynı isimde kasa hareketi tanımlanamaz", "Kasa hareket Tip Ekleme", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button1_Click(object sender, EventArgs e) { KasaHareketTip kasaHareketTipEntity = new KasaHareketTip(); kasaHareketTipEntity.Adi = txtAdi.Text; kasaHareketTipEntity.Id = int.Parse(dataGridView1.CurrentRow.Cells["Id"].Value.ToString()); bool sonuc = korm.Update(kasaHareketTipEntity); if (sonuc) { MessageBox.Show("Guncelleme başarılı"); dataGridView1.DataSource = korm.Select(); } else { MessageBox.Show("Guncelleme işlemi başarısız"); } }
private void btnEkle_Click(object sender, EventArgs e) { KasaHareketTip kEntity = new KasaHareketTip(); kEntity.Adi = txtAdi.Text.ToString(); bool sonuc = korm.Insert(kEntity); if (sonuc) { MessageBox.Show("Kayıt Eklenmiştir"); dataGridView1.DataSource = korm.Select(); } else { MessageBox.Show("Kayıt eklenirken hata oluştu"); } }
private void silToolStripMenuItem_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 0) { MessageBox.Show("Kayıt Seçiniz"); } else { KasaHareketTip kasaHareketTipEntity = new KasaHareketTip(); kasaHareketTipEntity.Id = int.Parse(dataGridView1.CurrentRow.Cells["Id"].Value.ToString()); bool sonuc = korm.Delete(kasaHareketTipEntity); if (sonuc) { MessageBox.Show("Kayıt silindi"); dataGridView1.DataSource = korm.Select(); txtAdi.Text = ""; } else { MessageBox.Show("Kayıt silinirken bir hata oluştu "); } } }