コード例 #1
0
		public static ContentCategory GetByURL(Guid SiteID, string requestedURL) {
			ContentCategory _item = null;
			using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) {
				vw_carrot_CategoryURL query = CompiledQueries.cqGetContentCategoryByURL(_db, SiteID, requestedURL);
				if (query != null) {
					_item = new ContentCategory(query);
				}
			}

			return _item;
		}
コード例 #2
0
        public string GetBlogHeadingFromURL(SiteData currentSite, string sFilterPath)
        {
            Guid siteID = currentSite.SiteID;

            string sTitle = String.Empty;

            if (currentSite.CheckIsBlogCategoryPath(sFilterPath))
            {
                vw_carrot_CategoryURL query = CompiledQueries.cqGetCategoryByURL(db, siteID, sFilterPath);
                sTitle = query.CategoryText;
            }
            if (currentSite.CheckIsBlogTagPath(sFilterPath))
            {
                vw_carrot_TagURL query = CompiledQueries.cqGetTagByURL(db, siteID, sFilterPath);
                sTitle = query.TagText;
            }
            if (currentSite.CheckIsBlogEditorFolderPath(sFilterPath))
            {
                vw_carrot_EditorURL query = CompiledQueries.cqGetEditorByURL(db, siteID, sFilterPath);
                ExtendedUserData    usr   = new ExtendedUserData(query.UserId);
                sTitle = usr.ToString();
            }
            if (currentSite.CheckIsBlogDateFolderPath(sFilterPath))
            {
                BlogDatePathParser p  = new BlogDatePathParser(currentSite, sFilterPath);
                TimeSpan           ts = p.DateEndUTC - p.DateBeginUTC;

                int daysDelta = ts.Days;
                if (daysDelta > 90)
                {
                    sTitle = "Year " + p.DateBegin.ToString("yyyy");
                }
                if (daysDelta < 36)
                {
                    sTitle = p.DateBegin.ToString("MMMM yyyy");
                }
                if (daysDelta < 5)
                {
                    sTitle = p.DateBegin.ToString("MMMM d, yyyy");
                }
            }
            if (currentSite.CheckIsSiteSearchPath(sFilterPath))
            {
                sTitle = "Search Results";
            }

            return(sTitle);
        }
コード例 #3
0
		internal ContentCategory(vw_carrot_CategoryURL c) {
			if (c != null) {
				SiteData site = SiteData.GetSiteFromCache(c.SiteID);

				this.ContentCategoryID = c.ContentCategoryID;
				this.SiteID = c.SiteID;
				this.CategoryURL = ContentPageHelper.ScrubFilename(c.ContentCategoryID, c.CategoryUrl);
				this.CategoryText = c.CategoryText;
				this.UseCount = c.UseCount;
				this.PublicUseCount = c.PublicUseCount;
				this.IsPublic = c.IsPublic;

				if (c.EditDate.HasValue) {
					this.EditDate = site.ConvertUTCToSiteTime(c.EditDate.Value);
				}
			}
		}
コード例 #4
0
		internal ContentCategory(vw_carrot_CategoryURL c) {
			if (c != null) {
				SiteData site = SiteData.GetSiteFromCache(c.SiteID);

				this.ContentCategoryID = c.ContentCategoryID;
				this.SiteID = c.SiteID;
				this.CategoryURL = c.CategoryUrl;
				this.CategoryText = c.CategoryText;
				this.UseCount = c.UseCount;
				this.PublicUseCount = c.PublicUseCount;
				this.IsPublic = c.IsPublic;

				if (c.EditDate.HasValue) {
					this.EditDate = site.ConvertUTCToSiteTime(c.EditDate.Value);
				}
			}
		}