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 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"); } }