示例#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!");

           
        }