Пример #1
0
        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;

        }
Пример #2
0
        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);
            }

        }
Пример #3
0
        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);
            }

        }
Пример #4
0
 private void loadData()
 {
     CategoriesDAL c = new CategoriesDAL();
     dataGridViewEdit.DataSource = c.GetCategoriesSortedById(start,size);
     backEditBtn.Enabled = false;
 }
Пример #5
0
        private void endPageBtn_Click(object sender, EventArgs e)
        {
            CategoriesDAL c = new CategoriesDAL();
            start = (c.CountCateg()/size)*size;
            loadData();
            backEditBtn.Enabled = true;

        }
Пример #6
0
 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");
     }
     
 }
Пример #7
0
 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!");
     } 
 }
Пример #8
0
        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!");

           
        }