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 sortByNameBtn_Click(object sender, EventArgs e) { CategoriesDAL c = new CategoriesDAL(); dataGridViewEdit.DataSource = c.GetCategoriesSortedByName(start, size); backEditBtn.Enabled = false; sortByName = 1; sortById = 0; }