Example #1
0
        private void BindData()
        {
            FAQsController             FAQsController = new FAQsController();
            IEnumerable <CategoryInfo> cats           = FAQsController.ListCategoriesHierarchical(ModuleId, false);
            // treeCategories fails with int? FaqCategoryParentId
            // define a temp class that has no nullables
            // set null ints to Null.NullInt
            var lst = new List <CategoryInfoTreeNode>();

            foreach (CategoryInfo cat in cats)
            {
                lst.Add(cat.ToTreeNode());
            }

            treeCategories.Nodes.Clear();
            treeCategories.DataTextField     = "FaqCategoryName";
            treeCategories.DataFieldID       = "FaqCategoryId";
            treeCategories.DataFieldParentID = "FaqCategoryParentId";
            treeCategories.DataSource        = lst;
            treeCategories.DataBind();
            if (!IsPostBack && treeCategories.Nodes.Count > 0)
            {
                treeCategories.Nodes[0].Selected = true;
            }
        }
Example #2
0
        /// <summary>
        /// Populates the categories drop down.
        /// </summary>
        private void PopulateCategoriesDropDown()
        {
            FAQsController FAQsController = new FAQsController();

            foreach (CategoryInfo category in FAQsController.ListCategoriesHierarchical(ModuleId, false))
            {
                drpCategory.Items.Add(new ListItem(new string('.', category.Level * 3) + category.FaqCategoryName, category.FaqCategoryId.ToString()));
            }
        }
Example #3
0
        /// <summary>
        /// Populates the (Parent-)categories drop down.
        /// </summary>
        private void PopulateCategoriesDropDown(int faqCategoryId)
        {
            drpParentCategory.Items.Clear();
            drpParentCategory.Items.Add(new ListItem(Localization.GetString("SelectParentCategory.Text", this.LocalResourceFile), "-1"));
            FAQsController FAQsController = new FAQsController();

            foreach (CategoryInfo category in FAQsController.ListCategoriesHierarchical(ModuleId, false))
            {
                if (faqCategoryId != category.FaqCategoryId)
                {
                    drpParentCategory.Items.Add(new ListItem(new string('.', category.Level * 3) + category.FaqCategoryName, category.FaqCategoryId.ToString()));
                }
            }
        }
Example #4
0
        private void BindData()
        {
            FAQsController             FAQsController = new FAQsController();
            IEnumerable <CategoryInfo> cats           = FAQsController.ListCategoriesHierarchical(ModuleId, false);

            treeCategories.Nodes.Clear();
            treeCategories.DataTextField     = "FaqCategoryName";
            treeCategories.DataFieldID       = "FaqCategoryId";
            treeCategories.DataFieldParentID = "FaqCategoryParentId";
            treeCategories.DataSource        = cats;
            treeCategories.DataBind();
            if (!IsPostBack && treeCategories.Nodes.Count > 0)
            {
                treeCategories.Nodes[0].Selected = true;
            }
        }
		/// <summary>
		/// Populates the (Parent-)categories drop down.
		/// </summary>
		private void PopulateCategoriesDropDown(int faqCategoryId)
		{
			drpParentCategory.Items.Clear();
			drpParentCategory.Items.Add(new ListItem(Localization.GetString("SelectParentCategory.Text",this.LocalResourceFile), "-1"));
			FAQsController FAQsController = new FAQsController();
			foreach (CategoryInfo category in FAQsController.ListCategoriesHierarchical(ModuleId, false))
			{
				if (faqCategoryId != category.FaqCategoryId)
					drpParentCategory.Items.Add(new ListItem(new string('.',category.Level*3) + category.FaqCategoryName, category.FaqCategoryId.ToString()));
			}
		}
		private void BindData()
		{
			FAQsController FAQsController = new FAQsController();
            IEnumerable<CategoryInfo> cats = FAQsController.ListCategoriesHierarchical(ModuleId, false);

            treeCategories.Nodes.Clear();
			treeCategories.DataTextField = "FaqCategoryName";
			treeCategories.DataFieldID = "FaqCategoryId";
			treeCategories.DataFieldParentID = "FaqCategoryParentId";
			treeCategories.DataSource = cats;
			treeCategories.DataBind();
			if (!IsPostBack && treeCategories.Nodes.Count > 0)
				treeCategories.Nodes[0].Selected = true;
		}
Example #7
0
		/// <summary>
		/// Binds the categories.
		/// </summary>
		private void BindCategories()
		{
			//Show the categories ?
			if (ShowCategories)
			{
				// Do we have unassigned categories ?
				bool noCat = false;
				foreach (FAQsInfo faq in FaqData)
				{
					if (faq.CategoryId == null)
					{
						noCat = true;
						break;
					}
				}
				pnlShowCategories.Visible = true;

				//Build the Catagories List.
				FAQsController FAQsController = new FAQsController();
				ArrayList categories = new ArrayList();

				//Empty Category
				CategoryInfo emptyCategory = new CategoryInfo();
				emptyCategory.FaqCategoryId = -1;
				emptyCategory.FaqCategoryName = Localization.GetString("EmptyCategory", LocalResourceFile);

				//All Categories
				CategoryInfo allCategories = new CategoryInfo();
				allCategories.FaqCategoryId = -2;
				allCategories.FaqCategoryName = Localization.GetString("AllCategory", LocalResourceFile);

			    IEnumerable<CategoryInfo> cats = FAQsController.ListCategoriesHierarchical(ModuleId, !ShowEmptyCategories);

				switch (ShowCategoryType)
				{
					case 0:
						if (noCat)
							categories.Add(emptyCategory);
				        foreach (CategoryInfo cat in cats)
				        {
				            categories.Add(cat);
				        }
						listCategories.DataSource = categories;
						listCategories.DataBind();
						mvShowCategoryType.SetActiveView(vShowCategoryTypeList);
						pnlShowCategoryTypeDropdown.Visible = false;
						break;

					case 1:
						categories.Add(allCategories);
						if (noCat)
							categories.Add(emptyCategory);
                        foreach (CategoryInfo cat in cats)
                        {
                            categories.Add(cat);
                        }
						List<CategoryInfo> lst = new List<CategoryInfo>();
						foreach (CategoryInfo cat in categories)
						{
							lst.Add(cat);
						}
						treeCategories.DataTextField = "FaqCategoryName";
						treeCategories.DataFieldID = "FaqCategoryId";
						treeCategories.DataFieldParentID = "FaqCategoryParentId";
						treeCategories.DataSource = lst;
						treeCategories.DataBind();
						if (!IsPostBack)
							treeCategories.Nodes[0].Selected = true;
						mvShowCategoryType.SetActiveView(vShowCategoryTypeTree);
						pnlShowCategoryTypeDropdown.Visible = false;
						break;
					case 2:
						categories.Add(allCategories);
						if (noCat)
							categories.Add(emptyCategory);
                        foreach (CategoryInfo cat in cats)
                        {
                            categories.Add(cat);
                        }
						foreach (CategoryInfo cat in categories)
						{
							drpCategories.Items.Add(new ListItem(new string('.',cat.Level * 3) + cat.FaqCategoryName,cat.FaqCategoryId.ToString()));
						}
						if (!IsPostBack)
							drpCategories.SelectedIndex = 0;
						pnlShowCategoryTypeDropdown.Visible = true;
						pnlShowCategories.Visible = false;
						pnlSortbox.Style.Add("float", "right");
						pnlSortbox.Style.Add("text-align", "right");
						break;
				}
			}
			else
			{
				pnlShowCategories.Visible = false;
			}
		}
Example #8
0
        /// <summary>
        /// Binds the categories.
        /// </summary>
        private void BindCategories()
        {
            //Show the categories ?
            if (ShowCategories)
            {
                // Do we have unassigned categories ?
                bool noCat = false;
                foreach (FAQsInfo faq in FaqData)
                {
                    if (faq.CategoryId == null)
                    {
                        noCat = true;
                        break;
                    }
                }
                pnlShowCategories.Visible = true;

                //Build the Catagories List.
                FAQsController FAQsController = new FAQsController();
                ArrayList      categories     = new ArrayList();

                //Empty Category
                CategoryInfo emptyCategory = new CategoryInfo();
                emptyCategory.FaqCategoryId   = -1;
                emptyCategory.FaqCategoryName = Localization.GetString("EmptyCategory", LocalResourceFile);
                emptyCategory.ModuleId        = ModuleId;
                emptyCategory.Level           = 0;
                emptyCategory.ViewOrder       = 998;

                //All Categories
                CategoryInfo allCategories = new CategoryInfo();
                allCategories.FaqCategoryId   = -2;
                allCategories.FaqCategoryName = Localization.GetString("AllCategory", LocalResourceFile);
                allCategories.ModuleId        = ModuleId;
                allCategories.Level           = 0;
                allCategories.ViewOrder       = 999;

                IEnumerable <CategoryInfo> cats = FAQsController.ListCategoriesHierarchical(ModuleId, !ShowEmptyCategories);

                switch (ShowCategoryType)
                {
                case 0:
                    if (noCat)
                    {
                        categories.Add(emptyCategory);
                    }
                    foreach (CategoryInfo cat in cats)
                    {
                        categories.Add(cat);
                    }
                    listCategories.DataSource = categories;
                    listCategories.DataBind();
                    mvShowCategoryType.SetActiveView(vShowCategoryTypeList);
                    pnlShowCategoryTypeDropdown.Visible = false;
                    break;

                case 1:
                    categories.Add(allCategories);
                    if (noCat)
                    {
                        categories.Add(emptyCategory);
                    }
                    foreach (CategoryInfo cat in cats)
                    {
                        categories.Add(cat);
                    }
                    // treeCategories fails with int? FaqCategoryParentId
                    // define a temp class that has no nullables
                    // set null ints to Null.NullInt
                    ArrayList lst = new ArrayList();
                    foreach (CategoryInfo cat in categories)
                    {
                        lst.Add(cat.ToTreeNode());
                    }
                    treeCategories.DataTextField     = "FaqCategoryName";
                    treeCategories.DataFieldID       = "FaqCategoryId";
                    treeCategories.DataFieldParentID = "FaqCategoryParentId";
                    treeCategories.DataSource        = lst;
                    treeCategories.DataBind();
                    if (!IsPostBack)
                    {
                        treeCategories.Nodes[0].Selected = true;
                    }
                    mvShowCategoryType.SetActiveView(vShowCategoryTypeTree);
                    pnlShowCategoryTypeDropdown.Visible = false;
                    break;

                case 2:
                    categories.Add(allCategories);
                    if (noCat)
                    {
                        categories.Add(emptyCategory);
                    }
                    foreach (CategoryInfo cat in cats)
                    {
                        categories.Add(cat);
                    }
                    foreach (CategoryInfo cat in categories)
                    {
                        drpCategories.Items.Add(new ListItem(new string('.', cat.Level * 3) + cat.FaqCategoryName, cat.FaqCategoryId.ToString()));
                    }
                    if (!IsPostBack)
                    {
                        drpCategories.SelectedIndex = 0;
                    }
                    pnlShowCategoryTypeDropdown.Visible = true;
                    pnlShowCategories.Visible           = false;
                    pnlSortbox.Style.Add("float", "right");
                    pnlSortbox.Style.Add("text-align", "right");
                    break;
                }
            }
            else
            {
                pnlShowCategories.Visible = false;
            }
        }
Example #9
0
        /// <summary>
        /// Populates the categories drop down.
        /// </summary>
        private void PopulateCategoriesDropDown()
        {
            FAQsController FAQsController = new FAQsController();

            foreach (CategoryInfo category in FAQsController.ListCategoriesHierarchical(ModuleId, false))
            {
                drpCategory.Items.Add(new ListItem(new string('.', category.Level * 3) + category.FaqCategoryName, category.FaqCategoryId.ToString()));
            }
        }