private void btnEkle_Click(object sender, EventArgs e)
        {
            Kategoriler k = new Kategoriler();

            k.Adi = Tools.ToTitleCase(txtKategoriAdi.Text);
            if (txtKategoriAdi.Text == null || txtKategoriAdi.Text == "")
            {
                MessageBox.Show("Kategori adını giriniz.", "Kategori Ekleme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtKategoriAdi.Focus();
                return;
            }
            bool sonuc = kOrm.Insert(k);

            if (sonuc)
            {
                MessageBox.Show("Kategori Eklendi", "Kategori Ekleme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                dataGridView1.DataSource = kOrm.Select();
                Tools.Temizle(this);
                txtKategoriAdi.Focus();
            }
            else
            {
                MessageBox.Show("Kategori Eklenmedi\n", "Kategori Ekleme", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        private void btnEkle_Click(object sender, EventArgs e)
        {
            Kategoriler k = new Kategoriler();

            k.Adi = txtKategoriler.Text;
            bool sonuc = korm.Insert(k);

            if (sonuc)
            {
                MessageBox.Show("Kategori Eklenmiştir.");
                dataGridView1.DataSource = korm.Select();
            }
            else
            {
                MessageBox.Show("Kategori Eklenirken Hata Oluştu");
            }
        }
예제 #3
0
        private void btn_KategoriEkle_Click(object sender, EventArgs e)
        {
            Kategoriler k = new Kategoriler();

            if (!string.IsNullOrEmpty(txt_KategoriAdi.Text))
            {
                k.Adi = txt_KategoriAdi.Text;
            }
            bool sonuc = kOrm.Insert(k);

            if (sonuc)
            {
                MessageBox.Show("Kayıt Eklenmiştir");
                dataGridView1.DataSource = kOrm.Select();
            }
            else
            {
                MessageBox.Show("Kategori eklenirken hata oluştu");
            }
        }