private void btnUpdateCategory_Click(object sender, EventArgs e) { try { cat.CategoryName = txtUpdateCategoryName.Text; cat.Description = rtxtUpdateCategoryDescription.Text; cat.Picture = ImageConvertToByte(imagePath); imagePath = ""; CategoryORM catORM = new CategoryORM(); bool result = catORM.Update(cat); if (result) { MessageBox.Show("Kategori Güncelleme İşleminiz Başarıyla Gerçekleştirildi", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); dGvCategories.DataSource = catORM.List(); tabControlCategories.SelectedIndex = 0; CategoryControlsClear(false); } else { MessageBox.Show("İşlem Sırasında Bir Hata Meydana Geldi !", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (SqlException ex) { MessageBox.Show(ex.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
protected void btnCategoryEkle_Click(object sender, EventArgs e) { CategoryORM catORM = new CategoryORM(); bool result = false; if (btnCategoryEkle.Text == "Güncelle") { result = catORM.Update(new Categories { CategoryID = int.Parse(ViewState["catID"].ToString()), CategoryName = txtCatName.Value }); } else { result = catORM.Insert(new Categories { CategoryName = txtCatName.Value }); } if (result) { eklemeBilgi.Visible = true; eklemeBilgi.InnerText = "İşleminiz Başarıyla Gerçekleştirildi."; rptCategory.DataSource = catORM.List(); rptCategory.DataBind(); } else { eklemeBilgi.Visible = true; eklemeBilgi.InnerText = "İşleminiz Gerçekleştirilemedi."; } }