private void button2_Click(object sender, EventArgs e) { if (dataGridView1.CurrentRow == null) { return; } DialogResult sonuc = MessageBox.Show("Seçili Kaydı Silmek İstiyormusunuz?", "Satış Programı", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (sonuc == DialogResult.Yes) { int id = Convert.ToInt32(dataGridView1.CurrentRow.Cells["KategoriID"].Value.ToString()); DataLogic.KATEGORI kategori = new DataLogic.KATEGORI(); int a = kategori.silKategori(id); if (a == 1) { MessageBox.Show("İşleminiz Gerçekleştirildi", "Satış Programı", MessageBoxButtons.OK, MessageBoxIcon.Information); getirKategoriler(); } else { MessageBox.Show("İşleminiz Yapılamadı", "Satış Programı", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text.Trim() == "") { MessageBox.Show("Kategori Adı Alanını Doldurunuz"); return; } DataLogic.KATEGORI kategori = new DataLogic.KATEGORI(); Entities.KATEGORI degisken = new Entities.KATEGORI(); degisken.KategoriAdi = textBox1.Text.ToUpper(); int a = kategori.kaydetKategori(degisken); if (a == 1) { MessageBox.Show("İşleminiz Gerçekleştirildi", "Satış Programı", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Text = ""; getirKategoriler(); } else if (a == -1) { MessageBox.Show("İşleminiz Yapılamadı\n\nAynı Kategori Sistemde Kayıtlı", "Satış Programı", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
void getirKategoriler() { DataTable dt = new DataTable(); DataLogic.KATEGORI kategoriler = new DataLogic.KATEGORI(); dt = kategoriler.getirKategoriler(); dataGridView1.DataSource = dt; }
void kategorileriDoldur() { DataTable dt = new DataTable(); DataLogic.KATEGORI kategori = new DataLogic.KATEGORI(); dt = kategori.getirKategoriler(); comboBox2.DataSource = dt; comboBox2.DisplayMember = "KategoriAdi"; comboBox2.ValueMember = "KategoriID"; }