private void LoadComboSubCategories()
        {
            if (cbCatItems.SelectedIndex == 0)
            {
                cbSubItems.Enabled = false;
            }
            else
            {
                cbSubItems.Enabled = true;
                if (cbSubItems.Items.Count > 0)
                {
                    cbSubItems.Items.Clear();
                    comboDictionarySub.Clear();
                }

                cbSubItems.Items.Add("ALL");
                comboDictionarySub.Add(0, null);
                Category sel_cat = null;
                comboDictionaryCat.TryGetValue(cbCatItems.SelectedIndex, out sel_cat);
                subcategories = manager.GetAllSubcategoriesByCat(sel_cat.category_id);

                for (int i = 0; i < subcategories.Count; i++)
                {
                    comboDictionarySub.Add(i + 1, subcategories[i]);
                    cbSubItems.Items.Add(subcategories[i].subcategory_name);
                }

                cbSubItems.SelectedIndex = 0;
            }
        }
        private void LoadViewSubcategories()
        {
            if (dgvSubcat.Rows.Count > 0)
            {
                dgvSubcat.Rows.Clear();
            }

            if (cbCatName.SelectedIndex == 0) // select all
            {
                subcategories = manager.GetAllSubcategories();
            }
            else
            {
                Category cats;
                if (comboDictionary.TryGetValue(cbCatName.SelectedIndex, out cats))
                {
                    subcategories = manager.GetAllSubcategoriesByCat(cats.category_id);
                }
            }

            for (int i = 0; i < subcategories.Count; i++)
            {
                DataGridViewRow row = new DataGridViewRow();
                row.CreateCells(dgvSubcat);

                row.Cells[0].Value = subcategories[i].subcategory_id;
                row.Cells[1].Value = subcategories[i].parent.category_name;
                row.Cells[2].Value = subcategories[i].subcategory_name;
                dgvSubcat.Rows.Add(row);
            }
        }