Example #1
0
        protected string GetFullURL(int sitemapID)
        {
            tbl_SiteMap sitemap = WebContentService.GetSitemapByID(sitemapID);

            if (sitemap == null)
            {
                return("");
            }

            string baseUrl = "";

            if (sitemap.SM_ParentID == 0 || this.Domain.DO_CustomRouteHandler)
            {
                return(sitemap.SM_URL);
            }

            var parent = WebContentService.GetSitemapByID(sitemap.SM_ParentID);

            while (parent.SM_ParentID > 0)
            {
                parent = WebContentService.GetSitemapByID(parent.SM_ParentID);
            }
            if (parent.SM_TypeID != null)
            {
                baseUrl = "/" + WebContentService.GetSitemapUrlByType((SiteMapType)parent.SM_TypeID, this.DomainID).Trim('/');
            }

            return(String.Format("{0}{1}", baseUrl, sitemap.SM_URL));
        }
Example #2
0
        public tbl_Content GetContentBySitemapUrl(string url, ContentType type, int domainID)
        {
            var         sType   = type.ToString();
            tbl_SiteMap siteMap = SitemapRepository.GetByUrl(url, domainID).Where(sm => sm.tbl_ContentType.CTP_Value.Equals(sType)).FirstOrDefault();

            return((siteMap == null || (siteMap.IsType(ContentType.Blog) && !siteMap.SM_Live)) ?
                   null :
                   siteMap.tbl_Content.Where(c => c.C_Approved && !c.C_Deleted).OrderByDescending(c => c.C_ModificationDate).FirstOrDefault());
        }
Example #3
0
 public tbl_Content ApproveContent(int sectionID, int contentID = 0)
 {
     if (contentID == 0)
     {
         tbl_SiteMap section = SitemapRepository.GetByID(sectionID);
         if (section != null)
         {
             contentID = section.tbl_Content.Where(c => !c.C_Deleted).OrderByDescending(c => c.C_ModificationDate).Select(c => c.ContentID).FirstOrDefault();
         }
     }
     return(ContentRepository.ApproveContent(contentID));
 }
Example #4
0
        public tbl_Content GetContentByRedirectUrl(string url, int domainID, int contentID = 0)
        {
            tbl_SiteMap section = SitemapRepository.GetByRedirectUrl(url, domainID);

            if (section == null || (section.IsType(ContentType.Blog) && !section.SM_Live))
            {
                return(null);
            }

            return((contentID == 0) ?
                   section.tbl_Content.Where(c => c.C_Approved && !c.C_Deleted).OrderByDescending(c => c.C_ModificationDate).FirstOrDefault():
                   section.tbl_Content.FirstOrDefault(c => c.ContentID == contentID));
        }
Example #5
0
        public int GetSitemapRootID(int domainID, int sitemapID)
        {
            tbl_SiteMap sitemap = SitemapRepository.GetByID(sitemapID);

            if (sitemap == null)
            {
                return(0);
            }

            if (sitemap.SM_ParentID == 0)
            {
                return(sitemap.SiteMapID);
            }
            else
            {
                return(this.GetSitemapRootID(domainID, sitemap.SM_ParentID));
            }
        }
Example #6
0
        public tbl_Content GetContentBySitemapUrl(string url, int domainID, int sectionID, int contentID = 0, bool isAdmin = false, int homepageID = 0)
        {
            tbl_SiteMap section   = null;
            bool        isPreview = false;

            if (String.IsNullOrEmpty(url) || url == "/" || (url.ToLowerInvariant() == "/preview" && isAdmin))
            {
                section   = SitemapRepository.GetByID(sectionID);
                isPreview = true;
            }
            else
            {
                section = SitemapRepository.GetByUrl(url, domainID).FirstOrDefault();
            }

            if (section == null || (section.IsType(ContentType.Blog) && !section.SM_Live && !isPreview) || (section.SiteMapID == homepageID && url != "/" && !isPreview))
            {
                return(null);
            }

            return((contentID == 0) ?
                   section.tbl_Content.Where(c => c.C_Approved && !c.C_Deleted).OrderByDescending(c => c.C_ModificationDate).FirstOrDefault():
                   section.tbl_Content.FirstOrDefault(c => c.ContentID == contentID));
        }