public SiteData(carrot_Site s) { if (s != null && String.IsNullOrEmpty(s.TimeZone)) { s.TimeZone = SiteTimeZoneInfo.Id; } this.TimeZoneIdentifier = s.TimeZone; this.SiteID = s.SiteID; this.MetaKeyword = s.MetaKeyword; this.MetaDescription = s.MetaDescription; this.SiteName = s.SiteName; this.SiteTagline = s.SiteTagline; this.SiteTitlebarPattern = s.SiteTitlebarPattern; this.MainURL = s.MainURL; this.BlockIndex = s.BlockIndex; this.SendTrackbacks = s.SendTrackbacks; this.AcceptTrackbacks = s.AcceptTrackbacks; this.Blog_Root_ContentID = s.Blog_Root_ContentID; this.Blog_FolderPath = String.IsNullOrEmpty(s.Blog_FolderPath) ? "" : s.Blog_FolderPath; this.Blog_CategoryPath = String.IsNullOrEmpty(s.Blog_CategoryPath) ? "" : s.Blog_CategoryPath; this.Blog_TagPath = String.IsNullOrEmpty(s.Blog_TagPath) ? "" : s.Blog_TagPath; this.Blog_EditorPath = String.IsNullOrEmpty(s.Blog_TagPath) ? "" : s.Blog_EditorPath; this.Blog_DatePath = String.IsNullOrEmpty(s.Blog_DatePath) ? "" : s.Blog_DatePath; this.Blog_DatePattern = String.IsNullOrEmpty(s.Blog_DatePattern) ? "yyyy/MM/dd" : s.Blog_DatePattern; if (String.IsNullOrEmpty(this.SiteTitlebarPattern)) { this.SiteTitlebarPattern = DefaultPageTitlePattern; } this.LoadTextWidgets(); }
public void Save() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { carrot_Site s = CompiledQueries.cqGetSiteByID(_db, this.SiteID); bool bNew = false; if (s == null) { s = new carrot_Site(); if (this.SiteID == Guid.Empty) { this.SiteID = Guid.NewGuid(); } bNew = true; } // if updating the current site then blank out its cache if (CurrentSiteID == this.SiteID) { CurrentSite = null; } s.SiteID = this.SiteID; s.TimeZone = this.TimeZoneIdentifier; FixMeta(); s.MetaKeyword = this.MetaKeyword.Replace("\r\n", " ").Replace("\n", " ").Replace("\r", " ").Replace(" ", " "); s.MetaDescription = this.MetaDescription.Replace("\r\n", " ").Replace("\n", " ").Replace("\r", " ").Replace(" ", " "); s.SiteName = this.SiteName; s.SiteTagline = this.SiteTagline; s.SiteTitlebarPattern = this.SiteTitlebarPattern; s.MainURL = this.MainURL; s.BlockIndex = this.BlockIndex; s.SendTrackbacks = this.SendTrackbacks; s.AcceptTrackbacks = this.AcceptTrackbacks; s.Blog_FolderPath = ContentPageHelper.ScrubSlug(this.Blog_FolderPath); s.Blog_CategoryPath = ContentPageHelper.ScrubSlug(this.Blog_CategoryPath); s.Blog_TagPath = ContentPageHelper.ScrubSlug(this.Blog_TagPath); s.Blog_EditorPath = ContentPageHelper.ScrubSlug(this.Blog_EditorPath); s.Blog_DatePath = ContentPageHelper.ScrubSlug(this.Blog_DatePath); s.Blog_Root_ContentID = this.Blog_Root_ContentID; s.Blog_DatePattern = String.IsNullOrEmpty(this.Blog_DatePattern) ? "yyyy/MM/dd" : this.Blog_DatePattern; if (bNew) { _db.carrot_Sites.InsertOnSubmit(s); } _db.SubmitChanges(); } }
public static SiteData GetSiteByID(Guid siteID) { using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) { carrot_Site s = CompiledQueries.cqGetSiteByID(_db, siteID); if (s != null) { #if DEBUG Debug.WriteLine(" ================ " + DateTime.UtcNow.ToString() + " ================"); Debug.WriteLine("Grabbed site : GetSiteByID(Guid siteID) " + siteID.ToString()); #endif return(new SiteData(s)); } else { return(null); } } }
public void Save() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) { carrot_Site s = CompiledQueries.cqGetSiteByID(_db, this.SiteID); bool bNew = false; if (s == null) { s = new carrot_Site(); if (this.SiteID == Guid.Empty) { this.SiteID = Guid.NewGuid(); } bNew = true; } // if updating the current site then blank out its cache if (CurrentSiteID == this.SiteID) { CurrentSite = null; } s.SiteID = this.SiteID; s.TimeZone = this.TimeZoneIdentifier; FixMeta(); s.MetaKeyword = this.MetaKeyword.Replace("\r\n", " ").Replace("\n", " ").Replace("\r", " ").Replace(" ", " "); s.MetaDescription = this.MetaDescription.Replace("\r\n", " ").Replace("\n", " ").Replace("\r", " ").Replace(" ", " "); s.SiteName = this.SiteName; s.SiteTagline = this.SiteTagline; s.SiteTitlebarPattern = this.SiteTitlebarPattern; s.MainURL = this.MainURL; s.BlockIndex = this.BlockIndex; s.SendTrackbacks = this.SendTrackbacks; s.AcceptTrackbacks = this.AcceptTrackbacks; s.Blog_FolderPath = ContentPageHelper.ScrubSlug(this.Blog_FolderPath); s.Blog_CategoryPath = ContentPageHelper.ScrubSlug(this.Blog_CategoryPath); s.Blog_TagPath = ContentPageHelper.ScrubSlug(this.Blog_TagPath); s.Blog_EditorPath = ContentPageHelper.ScrubSlug(this.Blog_EditorPath); s.Blog_DatePath = ContentPageHelper.ScrubSlug(this.Blog_DatePath); s.Blog_Root_ContentID = this.Blog_Root_ContentID; s.Blog_DatePattern = string.IsNullOrEmpty(this.Blog_DatePattern) ? "yyyy/MM/dd" : this.Blog_DatePattern; if (bNew) { _db.carrot_Sites.InsertOnSubmit(s); } _db.SubmitChanges(); } }