private void Button11_Click(object sender, EventArgs e) { try { var EmptyArea = EmptyTextBoxControl(groupBox11); if (EmptyArea) { MessageBox.Show("Eksik bilgi girdiniz.", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { Category newCategory = new Category { CategoryName = textBox19.Text, Description = richTextBox1.Text, }; var sorgu = DalCategory.CUD(newCategory, System.Data.Entity.EntityState.Added); if (sorgu) { textBox19.Clear(); richTextBox1.Clear(); GuncelleKategoriler(); MessageBox.Show("Yeni kategori eklendi.", "İşlem Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception) { MessageBox.Show("Eksik bilgi girdiniz.", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void Button10_Click(object sender, EventArgs e) { try { Category CategoryToDelete = new Category { CategoryID = Convert.ToInt32(listView3.SelectedItems[0].SubItems[1].Text), CategoryName = listView3.SelectedItems[0].SubItems[2].Text, Description = listView3.SelectedItems[0].SubItems[3].Text, }; var sorgu = DalCategory.CUD(CategoryToDelete, System.Data.Entity.EntityState.Deleted); if (sorgu) { GuncelleKategoriler(); MessageBox.Show("Kategori silindi.", "İşlem Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception) { MessageBox.Show("Kategori seçilmedi.", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void Button12_Click(object sender, EventArgs e) { try { var EmptyArea = EmptyTextBoxControl(groupBox12); if (EmptyArea) { MessageBox.Show("Eksik bilgi girdiniz.", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { Category categoryToUpdate = new Category { CategoryID = Convert.ToInt32(textBox28.Text.ToString()), CategoryName = textBox20.Text, Description = richTextBox2.Text, }; var sorgu = DalCategory.CUD(categoryToUpdate, System.Data.Entity.EntityState.Modified); if (sorgu) { textBox28.Clear(); textBox20.Clear(); richTextBox2.Clear(); GuncelleKategoriler(); MessageBox.Show("Yeni kategori eklendi.", "İşlem Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception) { MessageBox.Show("Eksik bilgi girdiniz.", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }