public void RecordHeartbeatLock(Guid currentUserID) { using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) { carrot_RootContentSnippet rc = CompiledQueries.cqGetSnippetDataTbl(_db, this.SiteID, this.Root_ContentSnippetID); rc.Heartbeat_UserId = currentUserID; rc.EditHeartbeat = DateTime.UtcNow; _db.SubmitChanges(); } }
public ExtendedUserData GetCurrentEditUserData() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) { carrot_RootContentSnippet rc = CompiledQueries.cqGetSnippetDataTbl(_db, this.SiteID, this.Root_ContentSnippetID); if (rc != null) { return(new ExtendedUserData((Guid)rc.Heartbeat_UserId)); } else { return(null); } } }
public Guid GetCurrentEditUser() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { carrot_RootContentSnippet rc = CompiledQueries.cqGetSnippetDataTbl(_db, this.SiteID, this.Root_ContentSnippetID); if (rc != null) { return((Guid)rc.Heartbeat_UserId); } else { return(Guid.Empty); } } }
public void Delete() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) { carrot_RootContentSnippet s = CompiledQueries.cqGetSnippetDataTbl(_db, this.SiteID, this.Root_ContentSnippetID); if (s != null) { IQueryable <carrot_ContentSnippet> lst = (from m in _db.carrot_ContentSnippets where m.Root_ContentSnippetID == s.Root_ContentSnippetID select m); _db.carrot_ContentSnippets.BatchDelete(lst); _db.carrot_RootContentSnippets.DeleteOnSubmit(s); _db.SubmitChanges(); } } }
public void DeleteThisVersion() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { carrot_RootContentSnippet s = CompiledQueries.cqGetSnippetDataTbl(_db, this.SiteID, this.Root_ContentSnippetID); if (s != null) { IQueryable <carrot_ContentSnippet> lst = (from m in _db.carrot_ContentSnippets where m.ContentSnippetID == this.ContentSnippetID && m.Root_ContentSnippetID == s.Root_ContentSnippetID && m.IsLatestVersion != true select m); _db.carrot_ContentSnippets.BatchDelete(lst); _db.SubmitChanges(); } } }
public void Save() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) { SiteData site = SiteData.GetSiteFromCache(this.SiteID); carrot_RootContentSnippet rc = CompiledQueries.cqGetSnippetDataTbl(_db, this.SiteID, this.Root_ContentSnippetID); carrot_ContentSnippet oldC = CompiledQueries.cqGetLatestSnippetContentTbl(_db, this.SiteID, this.Root_ContentSnippetID); bool bNew = false; if (rc == null) { rc = new carrot_RootContentSnippet(); rc.Root_ContentSnippetID = Guid.NewGuid(); rc.SiteID = site.SiteID; rc.CreateDate = DateTime.UtcNow; if (this.CreateUserId != Guid.Empty) { rc.CreateUserId = this.CreateUserId; } else { rc.CreateUserId = SecurityData.CurrentUserGuid; } _db.carrot_RootContentSnippets.InsertOnSubmit(rc); bNew = true; } this.ContentSnippetSlug = ContentPageHelper.ScrubSlug(this.ContentSnippetSlug); rc.ContentSnippetActive = this.ContentSnippetActive; rc.ContentSnippetName = this.ContentSnippetName; rc.ContentSnippetSlug = this.ContentSnippetSlug; rc.GoLiveDate = site.ConvertSiteTimeToUTC(this.GoLiveDate); rc.RetireDate = site.ConvertSiteTimeToUTC(this.RetireDate); carrot_ContentSnippet c = new carrot_ContentSnippet(); c.ContentSnippetID = Guid.NewGuid(); c.Root_ContentSnippetID = rc.Root_ContentSnippetID; c.IsLatestVersion = true; if (!bNew) { oldC.IsLatestVersion = false; } c.EditDate = DateTime.UtcNow; if (this.EditUserId != Guid.Empty) { c.EditUserId = this.EditUserId; } else { c.EditUserId = SecurityData.CurrentUserGuid; } c.ContentBody = this.ContentBody; rc.Heartbeat_UserId = c.EditUserId; rc.EditHeartbeat = DateTime.UtcNow; _db.carrot_ContentSnippets.InsertOnSubmit(c); _db.SubmitChanges(); this.ContentSnippetID = c.ContentSnippetID; this.Root_ContentSnippetID = rc.Root_ContentSnippetID; } }
public void Save() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) { SiteData site = SiteData.GetSiteFromCache(this.SiteID); carrot_RootContentSnippet rc = CompiledQueries.cqGetSnippetDataTbl(_db, this.SiteID, this.Root_ContentSnippetID); carrot_ContentSnippet oldC = CompiledQueries.cqGetLatestSnippetContentTbl(_db, this.SiteID, this.Root_ContentSnippetID); bool bNew = false; if (rc == null) { rc = new carrot_RootContentSnippet(); rc.Root_ContentSnippetID = Guid.NewGuid(); rc.SiteID = site.SiteID; rc.CreateDate = DateTime.UtcNow; if (this.CreateUserId != Guid.Empty) { rc.CreateUserId = this.CreateUserId; } else { rc.CreateUserId = SecurityData.CurrentUserGuid; } _db.carrot_RootContentSnippets.InsertOnSubmit(rc); bNew = true; } this.ContentSnippetSlug = ContentPageHelper.ScrubSlug(this.ContentSnippetSlug); rc.ContentSnippetActive = this.ContentSnippetActive; rc.ContentSnippetName = this.ContentSnippetName; rc.ContentSnippetSlug = this.ContentSnippetSlug; rc.GoLiveDate = site.ConvertSiteTimeToUTC(this.GoLiveDate); rc.RetireDate = site.ConvertSiteTimeToUTC(this.RetireDate); carrot_ContentSnippet c = new carrot_ContentSnippet(); c.ContentSnippetID = Guid.NewGuid(); c.Root_ContentSnippetID = rc.Root_ContentSnippetID; c.IsLatestVersion = true; if (!bNew) { oldC.IsLatestVersion = false; } c.EditDate = DateTime.UtcNow; if (this.EditUserId != Guid.Empty) { c.EditUserId = this.EditUserId; } else { c.EditUserId = SecurityData.CurrentUserGuid; } c.ContentBody = this.ContentBody; rc.Heartbeat_UserId = c.EditUserId; rc.EditHeartbeat = DateTime.UtcNow; _db.carrot_ContentSnippets.InsertOnSubmit(c); _db.SubmitChanges(); this.ContentSnippetID = c.ContentSnippetID; this.Root_ContentSnippetID = rc.Root_ContentSnippetID; } }