public void Create() { CategoryORM categoryORM = new CategoryORM(); int id = categoryORM.Create(Build()); Console.WriteLine("id_ " + id); }
public void Edit() { CategoryORM categoryORM = new CategoryORM(); Category category = Build(); categoryORM.Edit(category); }
private void categoryDeleteToolStripMenuItem_Click(object sender, EventArgs e) { try { string categoryName = dGvCategories.SelectedRows[0].Cells[1].Value.ToString(); int categoryID = (int)dGvCategories.SelectedRows[0].Cells[0].Value; DialogResult dialogResult = MessageBox.Show("Seçili Kategoriyi Silmek İstediğinize Emin Misiniz ?", categoryName, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult == DialogResult.Yes) { CategoryORM catORM = new CategoryORM(); bool result = catORM.Delete(categoryID); if (result) { MessageBox.Show("Kategori Silme İşleminiz Başarıyla Gerçekleştirildi", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); dGvCategories.DataSource = catORM.List(); } else { MessageBox.Show("Kategoriye Ait Ürünler Bulunmaktadır. Lütfen İlk Önce Silmek İstediğiniz Kategoriye Ait Ürünleri Siliniz", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } catch (SqlException ex) { MessageBox.Show(ex.Message); } }
private void productsOfCategoryToolStripMenuItem_Click(object sender, EventArgs e) { try { string categoryName = dGvCategories.SelectedRows[0].Cells[1].Value.ToString(); int categoryID = (int)dGvCategories.SelectedRows[0].Cells[0].Value; DialogResult dialogResult = MessageBox.Show("Seçili Kategoriye Ait Tüm Ürünleri Silmek İstediğinize Emin Misiniz ?", categoryName, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult == DialogResult.Yes) { CategoryORM catORM = new CategoryORM(); bool result = catORM.ProductsOfCategoryDelete(categoryID); if (result) { MessageBox.Show("Kategoriye Ait Tüm Ürünler Başarıyla Silindi", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); dGvCategories.DataSource = catORM.List(); } else { MessageBox.Show("İşlem Sırasında Bir Hata İle Karşılaşıldı", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } catch (SqlException 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."; } }
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 rptCategory_ItemCommand(object source, RepeaterCommandEventArgs e) { bool result = false; if (e.CommandName == "btnDelete") { Button btnDelete = e.Item.FindControl("btnDelete") as Button; CategoryORM catORM = new CategoryORM(); result = catORM.Delete(Convert.ToInt32(btnDelete.CommandArgument)); 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."; } } else { Button btnUpdate = e.Item.FindControl("btnUpdate") as Button; ViewState["catID"] = btnUpdate.CommandArgument; txtCatName.Value = btnUpdate.CommandName; btnCategoryEkle.Text = "Güncelle"; } }
private void CategoryGetList() { CategoryORM catORM = new CategoryORM(); rptCategory.DataSource = catORM.List(); rptCategory.DataBind(); }
private void CategoryGet() { CategoryORM catORM = new CategoryORM(); rptMenuCategory.DataSource = catORM.List(); rptMenuCategory.DataBind(); rptFooterCategory.DataSource = catORM.List(); rptFooterCategory.DataBind(); }
private void CategoryList() { CategoryORM catORM = new CategoryORM(); drpCategory.DataSource = catORM.List(); drpCategory.DataTextField = "CategoryName"; drpCategory.DataValueField = "CategoryID"; drpCategory.DataBind(); }
private void tbxCatSearchName_TextChanged(object sender, EventArgs e) { if (tbxCatSearchName.Text.Equals("")) { RefreshData(); } else { DataTable data = new CategoryORM().Search(tbxCatSearchName.Text); dgvCat.DataSource = data; } }
void ComboBoxCategoryFill(ComboBox comboBox) { try { CategoryORM catORM = new CategoryORM(); comboBox.DataSource = catORM.List(); comboBox.DisplayMember = "CategoryName"; comboBox.ValueMember = "CategoryID"; } catch (SqlException ex) { MessageBox.Show(ex.Message); MessageBox.Show("Kategorileri Listeleme İşleminde Bir Hata İle Karşılaşıldı"); } }
private void tabPageCategories_Enter(object sender, EventArgs e) { try { CategoryORM catORM = new CategoryORM(); dGvCategories.DataSource = catORM.List(); } catch (SqlException ex) { MessageBox.Show(ex.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } }