コード例 #1
0
        // GET: /DocumentCategory/345
        public ActionResult ByCategoryID(string enccategoryid)
        {
            // get the category page and loat that page for the content page
            int categoryid            = Crypto.DecryptID(enccategoryid);
            DocumentCategory category = DocumentCategory.LoadByDocumentCategoryID(categoryid);

            if (category == null)
            {
                throw new Beweb.BadUrlException("Category not found with ID of [" + enccategoryid + " (" + categoryid + ")]");
            }
            var data = new ViewModel(category);

            return(View("DocumentCategory", data));
        }
コード例 #2
0
            private void SetCategoryPage(int categoryID)
            {
                DocumentCategory thisCategory = DocumentCategory.LoadByDocumentCategoryID(categoryID);

                if (thisCategory.PageID.HasValue)
                {
                    _categoryPage = Page.LoadByPageID(thisCategory.PageID.ToInt());
                }
                else if (thisCategory.ParentDocumentCategoryID.HasValue)
                {
                    SetCategoryPage(thisCategory.ParentDocumentCategoryID.ToInt());
                }
                else
                {
                    throw new Exception("Category has no page or parent page");
                }
            }
コード例 #3
0
            private string CreateCategoryBreadCrumb(int categoryID, string categoryCrumb)
            {
                string           separator    = " > ";
                string           thisCrumb    = "";
                DocumentCategory thisCategory = DocumentCategory.LoadByDocumentCategoryID(categoryID);

                if (thisCategory.PageID.HasValue)
                {
                    thisCrumb     = "<a href='" + _categoryPage.GetUrl() + "'>" + _categoryPage.Title + "</a>" + separator;
                    thisCrumb    += (categoryCrumb == "")?thisCategory.Title: "<a href='" + Web.Root + "DocumentCategory/" + Crypto.EncryptID(thisCategory.ID) + "'>" + thisCategory.Title + "</a>" + separator;
                    categoryCrumb = thisCrumb + categoryCrumb;
                }
                else if (thisCategory.ParentDocumentCategoryID.HasValue)
                {
                    thisCrumb     = "<a href='" + Web.Root + "DocumentCategory/" + Crypto.EncryptID(thisCategory.ID) + "'>" + thisCategory.Title + "</a>";
                    categoryCrumb = (categoryCrumb == "")?thisCategory.Title: thisCrumb + separator + categoryCrumb;
                    categoryCrumb = CreateCategoryBreadCrumb(thisCategory.ParentDocumentCategoryID.ToInt(), categoryCrumb);
                }
                else
                {
                    throw new Exception("Category has no page or parent page");
                }
                return(categoryCrumb);
            }