private void PerformCommonSaveRoot(SiteData pageSite, carrot_RootContent rc) { rc.Root_ContentID = this.Root_ContentID; rc.PageActive = true; rc.BlockIndex = false; rc.ShowInSiteMap = true; rc.SiteID = this.SiteID; rc.ContentTypeID = ContentPageType.GetIDByType(this.ContentType); rc.CreateDate = DateTime.UtcNow; if (this.CreateUserId != Guid.Empty) { rc.CreateUserId = this.CreateUserId; } else { rc.CreateUserId = SecurityData.CurrentUserGuid; } rc.GoLiveDate = pageSite.ConvertSiteTimeToUTC(this.GoLiveDate); rc.RetireDate = pageSite.ConvertSiteTimeToUTC(this.RetireDate); if (this.CreateDate.Year > 1950) { rc.CreateDate = pageSite.ConvertSiteTimeToUTC(this.CreateDate); } }
private void PerformCommonSave(SiteData pageSite, carrot_RootContent rc, carrot_Content c) { c.NavOrder = this.NavOrder; if (this.ContentType == ContentPageType.PageType.BlogEntry) { this.PageSlug = ContentPageHelper.ScrubFilename(this.Root_ContentID, this.PageSlug); this.FileName = ContentPageHelper.CreateFileNameFromSlug(this.SiteID, this.GoLiveDate, this.PageSlug); c.NavOrder = SiteData.BlogSortOrderNumber; } rc.GoLiveDate = pageSite.ConvertSiteTimeToUTC(this.GoLiveDate); rc.RetireDate = pageSite.ConvertSiteTimeToUTC(this.RetireDate); rc.GoLiveDateLocal = pageSite.ConvertUTCToSiteTime(rc.GoLiveDate); rc.PageSlug = this.PageSlug; rc.PageThumbnail = this.Thumbnail; c.Root_ContentID = this.Root_ContentID; rc.Heartbeat_UserId = this.Heartbeat_UserId; rc.EditHeartbeat = this.EditHeartbeat; rc.FileName = this.FileName; rc.PageActive = this.PageActive; rc.ShowInSiteNav = this.ShowInSiteNav; rc.BlockIndex = this.BlockIndex; rc.ShowInSiteMap = this.ShowInSiteMap; rc.FileName = ContentPageHelper.ScrubFilename(this.Root_ContentID, rc.FileName); c.Parent_ContentID = this.Parent_ContentID; c.IsLatestVersion = true; c.TitleBar = this.TitleBar; c.NavMenuText = this.NavMenuText; c.PageHead = this.PageHead; c.PageText = this.PageText; c.LeftPageText = this.LeftPageText; c.RightPageText = this.RightPageText; c.EditUserId = this.EditUserId; c.CreditUserId = this.CreditUserId; c.EditDate = DateTime.UtcNow; c.TemplateFile = this.TemplateFile; FixMeta(); c.MetaKeyword = this.MetaKeyword.Replace("\r\n", " ").Replace("\n", " ").Replace("\r", " ").Replace(" ", " "); c.MetaDescription = this.MetaDescription.Replace("\r\n", " ").Replace("\n", " ").Replace("\r", " ").Replace(" ", " "); this.Root_ContentID = rc.Root_ContentID; this.ContentID = c.ContentID; this.FileName = rc.FileName; this.EditDate = pageSite.ConvertUTCToSiteTime(c.EditDate); this.CreateDate = pageSite.ConvertUTCToSiteTime(rc.CreateDate); this.GoLiveDate = pageSite.ConvertUTCToSiteTime(rc.GoLiveDate); this.RetireDate = pageSite.ConvertUTCToSiteTime(rc.RetireDate); }
public void ResetHeartbeatLock() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { carrot_RootContent rc = CompiledQueries.cqGetRootContentTbl(_db, this.SiteID, this.Root_ContentID); rc.EditHeartbeat = DateTime.UtcNow.AddHours(-2); rc.Heartbeat_UserId = null; _db.SubmitChanges(); } }
public void RecordHeartbeatLock(Guid currentUserID) { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { carrot_RootContent rc = CompiledQueries.cqGetRootContentTbl(_db, this.SiteID, this.Root_ContentID); rc.Heartbeat_UserId = currentUserID; rc.EditHeartbeat = DateTime.UtcNow; _db.SubmitChanges(); } }
public void SavePageEdit() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { SiteData site = SiteData.GetSiteFromCache(this.SiteID); if (this.Root_ContentID == Guid.Empty) { this.Root_ContentID = Guid.NewGuid(); } if (this.ContentID == Guid.Empty) { this.ContentID = Guid.NewGuid(); } if (this.Parent_ContentID == Guid.Empty) { this.Parent_ContentID = null; } carrot_RootContent rc = CompiledQueries.cqGetRootContentTbl(_db, this.SiteID, this.Root_ContentID); carrot_Content oldC = CompiledQueries.cqGetLatestContentTbl(_db, this.SiteID, this.Root_ContentID); bool bNew = false; if (rc == null) { rc = new carrot_RootContent(); PerformCommonSaveRoot(site, rc); _db.carrot_RootContents.InsertOnSubmit(rc); bNew = true; } carrot_Content c = new carrot_Content(); c.ContentID = Guid.NewGuid(); if (!bNew) { oldC.IsLatestVersion = false; } PerformCommonSave(site, rc, c); _db.carrot_Contents.InsertOnSubmit(c); SaveKeywordsAndTags(_db); _db.SubmitChanges(); SaveTrackbacks(); } }
public void SavePageAsDraft() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { SiteData site = SiteData.GetSiteFromCache(this.SiteID); if (this.Root_ContentID == Guid.Empty) { this.Root_ContentID = Guid.NewGuid(); } if (this.ContentID == Guid.Empty) { this.ContentID = Guid.NewGuid(); } carrot_RootContent rc = CompiledQueries.cqGetRootContentTbl(_db, this.SiteID, this.Root_ContentID); if (rc == null) { rc = new carrot_RootContent(); PerformCommonSaveRoot(site, rc); _db.carrot_RootContents.InsertOnSubmit(rc); } carrot_Content c = new carrot_Content(); c.ContentID = Guid.NewGuid(); PerformCommonSave(site, rc, c); c.IsLatestVersion = false; // draft, leave existing version latest _db.carrot_Contents.InsertOnSubmit(c); SaveKeywordsAndTags(_db); _db.SubmitChanges(); this.IsLatestVersion = c.IsLatestVersion; SaveTrackbacks(); } }
private void PerformCommonSaveRoot(SiteData pageSite, carrot_RootContent rc) { rc.Root_ContentID = this.Root_ContentID; rc.PageActive = true; rc.BlockIndex = false; rc.ShowInSiteMap = true; rc.SiteID = this.SiteID; rc.ContentTypeID = ContentPageType.GetIDByType(this.ContentType); rc.CreateDate = DateTime.UtcNow; if (this.CreateUserId != Guid.Empty) { rc.CreateUserId = this.CreateUserId; } else { rc.CreateUserId = SecurityData.CurrentUserGuid; } rc.GoLiveDate = pageSite.ConvertSiteTimeToUTC(this.GoLiveDate); rc.RetireDate = pageSite.ConvertSiteTimeToUTC(this.RetireDate); if (this.CreateDate.Year > 1950) { rc.CreateDate = pageSite.ConvertSiteTimeToUTC(this.CreateDate); } }
private void PerformCommonSave(SiteData pageSite, carrot_RootContent rc, carrot_Content c) { c.NavOrder = this.NavOrder; if (this.ContentType == ContentPageType.PageType.BlogEntry) { this.PageSlug = ContentPageHelper.ScrubFilename(this.Root_ContentID, this.PageSlug); this.FileName = ContentPageHelper.CreateFileNameFromSlug(this.SiteID, this.GoLiveDate, this.PageSlug); c.NavOrder = SiteData.BlogSortOrderNumber; } rc.GoLiveDate = pageSite.ConvertSiteTimeToUTC(this.GoLiveDate); rc.RetireDate = pageSite.ConvertSiteTimeToUTC(this.RetireDate); rc.GoLiveDateLocal = pageSite.ConvertUTCToSiteTime(rc.GoLiveDate); rc.PageSlug = this.PageSlug; rc.PageThumbnail = this.Thumbnail; c.Root_ContentID = this.Root_ContentID; rc.Heartbeat_UserId = this.Heartbeat_UserId; rc.EditHeartbeat = this.EditHeartbeat; rc.FileName = this.FileName; rc.PageActive = this.PageActive; rc.ShowInSiteNav = this.ShowInSiteNav; rc.BlockIndex = this.BlockIndex; rc.ShowInSiteMap = this.ShowInSiteMap; rc.FileName = ContentPageHelper.ScrubFilename(this.Root_ContentID, rc.FileName); c.Parent_ContentID = this.Parent_ContentID; c.IsLatestVersion = true; c.TitleBar = this.TitleBar; c.NavMenuText = this.NavMenuText; c.PageHead = this.PageHead; c.PageText = this.PageText; c.LeftPageText = this.LeftPageText; c.RightPageText = this.RightPageText; c.EditUserId = this.EditUserId; c.CreditUserId = this.CreditUserId; c.EditDate = DateTime.UtcNow; c.TemplateFile = this.TemplateFile; FixMeta(); c.MetaKeyword = this.MetaKeyword.Replace("\r\n", " ").Replace("\n", " ").Replace("\r", " ").Replace(" ", " "); c.MetaDescription = this.MetaDescription.Replace("\r\n", " ").Replace("\n", " ").Replace("\r", " ").Replace(" ", " "); this.Root_ContentID = rc.Root_ContentID; this.ContentID = c.ContentID; this.FileName = rc.FileName; this.EditDate = pageSite.ConvertUTCToSiteTime(c.EditDate); this.CreateDate = pageSite.ConvertUTCToSiteTime(rc.CreateDate); this.GoLiveDate = pageSite.ConvertUTCToSiteTime(rc.GoLiveDate); this.RetireDate = pageSite.ConvertUTCToSiteTime(rc.RetireDate); }
public void SavePageEdit() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) { SiteData site = SiteData.GetSiteFromCache(this.SiteID); if (this.Root_ContentID == Guid.Empty) { this.Root_ContentID = Guid.NewGuid(); } if (this.ContentID == Guid.Empty) { this.ContentID = Guid.NewGuid(); } if (this.Parent_ContentID == Guid.Empty) { this.Parent_ContentID = null; } carrot_RootContent rc = CompiledQueries.cqGetRootContentTbl(_db, this.SiteID, this.Root_ContentID); carrot_Content oldC = CompiledQueries.cqGetLatestContentTbl(_db, this.SiteID, this.Root_ContentID); bool bNew = false; if (rc == null) { rc = new carrot_RootContent(); PerformCommonSaveRoot(site, rc); _db.carrot_RootContents.InsertOnSubmit(rc); bNew = true; } carrot_Content c = new carrot_Content(); c.ContentID = Guid.NewGuid(); if (!bNew) { oldC.IsLatestVersion = false; } PerformCommonSave(site, rc, c); _db.carrot_Contents.InsertOnSubmit(c); SaveKeywordsAndTags(_db); _db.SubmitChanges(); SaveTrackbacks(); } }
public void SavePageAsDraft() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) { SiteData site = SiteData.GetSiteFromCache(this.SiteID); if (this.Root_ContentID == Guid.Empty) { this.Root_ContentID = Guid.NewGuid(); } if (this.ContentID == Guid.Empty) { this.ContentID = Guid.NewGuid(); } carrot_RootContent rc = CompiledQueries.cqGetRootContentTbl(_db, this.SiteID, this.Root_ContentID); if (rc == null) { rc = new carrot_RootContent(); PerformCommonSaveRoot(site, rc); _db.carrot_RootContents.InsertOnSubmit(rc); } carrot_Content c = new carrot_Content(); c.ContentID = Guid.NewGuid(); PerformCommonSave(site, rc, c); c.IsLatestVersion = false; // draft, leave existing version latest _db.carrot_Contents.InsertOnSubmit(c); SaveKeywordsAndTags(_db); _db.SubmitChanges(); this.IsLatestVersion = c.IsLatestVersion; SaveTrackbacks(); } }