private void sortByIdBtn_Click(object sender, EventArgs e) { CategoriesDAL c = new CategoriesDAL(); dataGridViewDelete.DataSource = c.GetCategoriesSortedById(start, size); backDeleteBtn.Enabled = false; sortByName = 0; sortById = 1; }
private void backBtn_Click(object sender, EventArgs e) { start = start - size; if (start < 0) { start = 0; backEditBtn.Enabled = false; } CategoriesDAL c = new CategoriesDAL(); if (sortById == 1) { dataGridViewEdit.DataSource = c.GetCategoriesSortedById(start, size); } if (sortByName == 1) { dataGridViewEdit.DataSource = c.GetCategoriesSortedByName(start, size); } }
private void forwardBtn_Click(object sender, EventArgs e) { CategoriesDAL c = new CategoriesDAL(); start = start + size; backEditBtn.Enabled = true; if (start >(c.CountCateg()/size)*size ) { start = 0; } if (sortById == 1) { dataGridViewEdit.DataSource = c.GetCategoriesSortedById(start, size); } if (sortByName == 1) { dataGridViewEdit.DataSource = c.GetCategoriesSortedByName(start, size); } }
private void loadData() { CategoriesDAL c = new CategoriesDAL(); dataGridViewEdit.DataSource = c.GetCategoriesSortedById(start,size); backEditBtn.Enabled = false; }
private void endPageBtn_Click(object sender, EventArgs e) { CategoriesDAL c = new CategoriesDAL(); start = (c.CountCateg()/size)*size; loadData(); backEditBtn.Enabled = true; }
private void addBtn_Click(object sender, EventArgs e) { if (nameEditTxt.Text != "") { CategoryDTO dto = new CategoryDTO(); CategoriesDAL c = new CategoriesDAL(); dto.categ_name = nameEditTxt.Text; dto.id_categ = Convert.ToInt32(idEditTxt.Text); c.updateCategory(dto); loadData(); MessageBox.Show("Edited"); } else { MessageBox.Show("select row for editing"); } }
private void addBtn_Click(object sender, EventArgs e) { CategoryDTO dto=new CategoryDTO(); CategoriesDAL c = new CategoriesDAL(); dto = c.GetCategoryByName(nameTxt.Text); if (dto == null) { MessageBox.Show("Category is not found!"); } else { c.deleteCategory(dto); loadData(); clearText(); MessageBox.Show("Deleted!"); } }
private void addBtn_Click(object sender, EventArgs e) { CategoryDTO dto=new CategoryDTO(); CategoriesDAL c = new CategoriesDAL(); dto.categ_name = nameTxt.Text; c.insertCategory(dto); start = (c.CountCateg() / size) * size; loadData(); clearText(); MessageBox.Show("Added!"); }