public static bool Delete(Category entity)
        {
            SqlCommand command = new SqlCommand("DeleteCategory", Helper.Connection);
            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.AddWithValue("@id", entity.CategoryID);

            return Helper.MyExecuteNonQuery(command);
        }
        public static bool Add(Category entity)
        {
            SqlCommand command = new SqlCommand("AddCategory", Helper.Connection);
            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.AddWithValue("@n", entity.CategoryName);
            command.Parameters.AddWithValue("@d", entity.Description);

            return Helper.MyExecuteNonQuery(command);
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Category entity = new Category();
            entity.CategoryName = txtCategoryName.Text;
            entity.Description = txtDescription.Text;
            if (!Categories.Add(entity))
                MessageBox.Show("Kategori eklenemedi.");

            ListAgain();
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (dataGridView1.CurrentRow == null) return;
            Category deleted = new Category();
            deleted.CategoryID = (int)dataGridView1.CurrentRow.Cells["CategoryID"].Value;

            if (!Categories.Delete(deleted))
                MessageBox.Show("Kategori silinemedi.");

            ListAgain();
        }
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            Category updated = new Category();
            updated.CategoryName = txtCategoryName.Text;
            updated.Description = txtDescription.Text;
            updated.CategoryID = (int)txtCategoryName.Tag;

            if (!Categories.Update(updated))
                MessageBox.Show("Kategori güncellenemedi.");

            ListAgain();
        }