Exemple #1
0
        void GetSubCats(Category.ListUC parentUc, DbHelper.Subject helper, int schoolId, int categoryId, int paddingCount)
        {
            #region Function all

            var edit        = Manager;
            var subcats     = helper.ListSubCategories(schoolId, categoryId);
            var selectedCat = SelectedCategory;
            for (var s = 0; s < subcats.Count; s++)
            {
                var catUc = (Category.ListUC)Page.LoadControl("~/Views/Course/Category/ListUC.ascx");
                catUc.Deselect();

                catUc.SetNameAndIdOfCategory(subcats[s].Id, subcats[s].Name, paddingCount, edit);//list
                paddingCount      += 1;
                catUc.NameClicked += catUc_NameClicked;
                catUc.ID           = "category_" + subcats[s].Id;
                //parentUc.AddSubCategories(catUc);
                pnlCategories.Controls.Add(catUc);
                if ((selectedCat == subcats[s].Id && !IsPostBack) || selectedCat == 0)
                {
                    catUc_NameClicked(catUc, new DataEventArgs()
                    {
                        Id   = subcats[s].Id,
                        Name = subcats[s].Name
                    });
                    catUc.Select();
                    selectedCat = subcats[s].Id;
                }
                GetSubCats(catUc, helper, schoolId, subcats[s].Id, paddingCount);
            }

            #endregion
        }
Exemple #2
0
        //earlier code:::: works
        // Note :: ├ ==>1 ,    └ ==> 2 .   ┌ ==> 3 ,   │ ==> 4 ,  empty ==> 0
        void GetSubCats(Category.ListUC parentUc, DbHelper.Subject helper, int schoolId, int categoryId, List <int> parentPaddingList)
        {
            #region Function all

            var subcats = helper.ListSubCategories(schoolId, categoryId);
            var list    = new List <int>();
            if (subcats.Count > 0)
            {
                foreach (var i in parentPaddingList)
                {
                    list.Add(0);
                }
            }
            var selectedCat = SelectedCategory;
            for (var s = 0; s < subcats.Count; s++)
            {
                var catUc = (Category.ListUC)Page.LoadControl("~/Views/Course/Category/ListUC.ascx");
                catUc.Deselect();

                list.Add((parentPaddingList[parentPaddingList.Count - 1] == 1) ? 2 : 1);

                catUc.SetNameAndIdOfCategory(subcats[s].Id, subcats[s].Name, list, false);//list

                catUc.NameClicked += catUc_NameClicked;
                catUc.ID           = "category_" + subcats[s].Id;
                //parentUc.AddSubCategories(catUc);
                pnlCategories.Controls.Add(catUc);



                if ((selectedCat == subcats[s].Id && !IsPostBack) || selectedCat == 0)
                {
                    catUc_NameClicked(catUc, new DataEventArgs()
                    {
                        Id   = subcats[s].Id,
                        Name = subcats[s].Name
                    });
                    catUc.Select();
                    selectedCat = subcats[s].Id;
                }


                GetSubCats(catUc, helper, schoolId, subcats[s].Id, list);
                list.RemoveAt(list.Count - 1);
            }

            #endregion
        }
Exemple #3
0
 public void AddSubCategories(ListUC uc)
 {
     this.pnlSubCategories.Controls.Add(uc);
 }