public void Save() { bool bNew = false; carrot_TrackbackQueue s = CompiledQueries.cqGetTrackbackTblByID(db, this.TrackbackQueueID); if (s == null) { s = new carrot_TrackbackQueue(); s.TrackbackQueueID = Guid.NewGuid(); s.Root_ContentID = this.Root_ContentID; s.CreateDate = DateTime.UtcNow; s.TrackBackURL = this.TrackBackURL.Trim(); bNew = true; } s.ModifiedDate = DateTime.UtcNow; s.TrackBackResponse = this.TrackBackResponse; s.TrackedBack = this.TrackedBack; if (bNew) { db.carrot_TrackbackQueues.InsertOnSubmit(s); } this.TrackbackQueueID = s.TrackbackQueueID; db.SubmitChanges(); }
public void Save() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) { bool bNew = false; carrot_UserData usr = CompiledQueries.cqFindUserTblByID(_db, this.UserId); if (usr == null) { usr = new carrot_UserData(); usr.UserId = this.UserId; bNew = true; } usr.UserNickName = this.UserNickName; usr.FirstName = this.FirstName; usr.LastName = this.LastName; usr.UserBio = this.UserBio; if (bNew) { _db.carrot_UserDatas.InsertOnSubmit(usr); } _db.SubmitChanges(); this.UserId = usr.UserId; } }
public static int GetSimilar(Guid SiteID, Guid CategoryID, string categorySlug) { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { IQueryable<carrot_ContentCategory> query = CompiledQueries.cqGetContentCategoryNoMatch(_db, SiteID, CategoryID, categorySlug); return query.Count(); } }
public static void SaveSerialized(Guid itemID, string sKey, string sData) { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { bool bAdd = false; carrot_SerialCache itm = CompiledQueries.SearchSeriaCache(_db, itemID, sKey); if (itm == null) { bAdd = true; itm = new carrot_SerialCache(); itm.SerialCacheID = Guid.NewGuid(); itm.SiteID = SiteData.CurrentSiteID; itm.ItemID = itemID; itm.EditUserId = SecurityData.CurrentUserGuid; itm.KeyType = sKey; } itm.SerializedData = sData; itm.EditDate = DateTime.UtcNow; if (bAdd) { _db.carrot_SerialCaches.InsertOnSubmit(itm); } _db.SubmitChanges(); } }
public List <SiteNav> GetSiblingNavigation(Guid siteID, string sPage, bool bActiveOnly) { List <SiteNav> lstContent = (from ct in CompiledQueries.GetLatestContentBySibling(db, siteID, sPage, bActiveOnly) select new SiteNav(ct)).ToList(); return(lstContent); }
public void DeleteAll(Guid rootWidgetID) { IQueryable <carrot_WidgetData> w1 = CannedQueries.GetWidgetDataByRootAll(db, rootWidgetID); carrot_Widget w2 = CompiledQueries.cqGetRootWidget(db, rootWidgetID); bool bPendingDel = false; if (w1 != null) { db.carrot_WidgetDatas.BatchDelete(w1); bPendingDel = true; } if (w2 != null) { db.carrot_Widgets.DeleteOnSubmit(w2); bPendingDel = true; } if (bPendingDel) { db.SubmitChanges(); } }
public void Save() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { bool bNew = false; carrot_ContentTag s = CompiledQueries.cqGetContentTagByID(_db, this.ContentTagID); if (s == null || (s != null && s.ContentTagID == Guid.Empty)) { s = new carrot_ContentTag(); s.ContentTagID = Guid.NewGuid(); s.SiteID = this.SiteID; bNew = true; } s.TagSlug = ContentPageHelper.ScrubSlug(this.TagSlug); s.TagText = this.TagText; s.IsPublic = this.IsPublic; if (bNew) { _db.carrot_ContentTags.InsertOnSubmit(s); } _db.SubmitChanges(); this.ContentTagID = s.ContentTagID; } }
public List <Widget> GetWidgets(Guid rootContentID, bool bActiveOnly) { List <Widget> w = (from r in CompiledQueries.cqGetLatestWidgets(db, rootContentID, bActiveOnly) select new Widget(r)).ToList(); return(w); }
public List <Widget> GetWidgetVersionHistory(Guid rootWidgetID) { List <Widget> w = (from r in CompiledQueries.cqGetWidgetVersionHistory_VW(db, rootWidgetID) select new Widget(r)).ToList(); return(w); }
public void Save() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { carrot_TextWidget s = CompiledQueries.cqTextWidgetByID(_db, this.TextWidgetID); if (s == null) { s = new carrot_TextWidget(); s.TextWidgetID = Guid.NewGuid(); s.SiteID = this.SiteID; s.TextWidgetAssembly = this.TextWidgetAssembly; _db.carrot_TextWidgets.InsertOnSubmit(s); } s.ProcessBody = this.ProcessBody; s.ProcessPlainText = this.ProcessPlainText; s.ProcessHTMLText = this.ProcessHTMLText; s.ProcessComment = this.ProcessComment; s.ProcessSnippet = this.ProcessSnippet; _db.SubmitChanges(); this.TextWidgetID = s.TextWidgetID; } }
public List <SiteNav> GetChildNavigation(Guid siteID, Guid?parentPageID, bool bActiveOnly) { List <SiteNav> lstContent = (from ct in CompiledQueries.GetLatestContentByParent(db, siteID, parentPageID, bActiveOnly).ToList() select new SiteNav(ct)).ToList(); return(lstContent); }
public List <SiteMapOrder> GetChildPages(Guid siteID, Guid?parentID, Guid contentID) { List <vw_carrot_Content> lstOtherPages = CompiledQueries.GetOtherNotPage(db, siteID, contentID, parentID).ToList(); if (!lstOtherPages.Any() && parentID == Guid.Empty) { lstOtherPages = CompiledQueries.TopLevelPages(db, siteID, false).ToList(); } lstOtherPages.RemoveAll(x => x.Root_ContentID == contentID); lstOtherPages.RemoveAll(x => x.Parent_ContentID == contentID); List <SiteMapOrder> lst = (from ct in lstOtherPages select new SiteMapOrder { NavLevel = -1, NavMenuText = (ct.PageActive ? "" : "{*U*} ") + ct.NavMenuText, NavOrder = ct.NavOrder, SiteID = ct.SiteID, FileName = ct.FileName, PageActive = ct.PageActive, ShowInSiteNav = ct.ShowInSiteNav, Parent_ContentID = ct.Parent_ContentID, Root_ContentID = ct.Root_ContentID }).ToList(); return(lst); }
public void Save() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { bool bNew = false; carrot_UserData usr = CompiledQueries.cqFindUserTblByID(_db, this.UserId); if (usr == null) { usr = new carrot_UserData(); usr.UserKey = this.UserKey; usr.UserId = Guid.NewGuid(); bNew = true; } usr.UserNickName = this.UserNickName; usr.FirstName = this.FirstName; usr.LastName = this.LastName; usr.UserBio = this.UserBio; if (bNew) { _db.carrot_UserDatas.InsertOnSubmit(usr); } _db.SubmitChanges(); this.UserId = usr.UserId; //grab fresh copy from DB vw_carrot_UserData rc = CompiledQueries.cqFindUserByID(_db, usr.UserId); LoadUserData(rc); } }
public ExtendedUserData(Guid UserID) { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { vw_carrot_UserData rc = CompiledQueries.cqFindUserByID(_db, UserID); LoadUserData(rc); } }
public ExtendedUserData(string UserName) { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { vw_carrot_UserData rc = CompiledQueries.cqFindUserByName(_db, UserName); LoadUserData(rc); } }
public static int GetSimilar(Guid SiteID, Guid TagID, string tagSlug) { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { IQueryable <carrot_ContentTag> query = CompiledQueries.cqGetContentTagNoMatch(_db, SiteID, TagID, tagSlug); return(query.Count()); } }
//================================================ public static List <ExtendedUserData> GetUserList() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) { List <ExtendedUserData> lstUsr = (from u in CompiledQueries.cqGetUserList(_db) select new ExtendedUserData(u)).ToList(); return(lstUsr); } }
public static int GetSimilar(Guid siteID, Guid rootSnippetID, string categorySlug) { using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) { IQueryable <vw_carrot_ContentSnippet> query = CompiledQueries.cqGetContentSnippetNoMatch(_db, siteID, rootSnippetID, categorySlug); return(query.Count()); } }
public static IQueryable <ExtendedUserData> GetUsers() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { IQueryable <ExtendedUserData> lstUsr = (from u in CompiledQueries.cqGetUserList(_db) select new ExtendedUserData(u)); return(lstUsr); } }
public static List <ContentSnippet> GetHistory(Guid rootSnippetID) { using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) { List <ContentSnippet> _types = (from d in CompiledQueries.cqGetSnippetVersionHistory(_db, rootSnippetID) select new ContentSnippet(d)).ToList(); return(_types); } }
public static int GetSiteCount(Guid siteID) { int iCt = -1; using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { iCt = CompiledQueries.cqGetContentCategoryCountBySiteID(_db, siteID); } return iCt; }
public List <ContentSnippet> GetHistory() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { List <ContentSnippet> _types = (from d in CompiledQueries.cqGetSnippetVersionHistory(_db, this.Root_ContentSnippetID) select new ContentSnippet(d)).ToList(); return(_types); } }
public List <ContentTag> GetTagList() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) { List <ContentTag> _types = (from d in CompiledQueries.cqGetContentTagBySiteID(_db, this.SiteID) select new ContentTag(d)).ToList(); return(_types); } }
public List <ContentSnippet> GetContentSnippetList() { using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { List <ContentSnippet> _types = (from d in CompiledQueries.cqGetSnippetsBySiteID(_db, this.SiteID) select new ContentSnippet(d)).ToList(); return(_types); } }
public static int GetSiteCount(Guid siteID) { int iCt = -1; using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) { iCt = CompiledQueries.cqGetContentTagCountBySiteID(_db, siteID); } return(iCt); }
public async Task <ActionResult <CustomerDto> > GetBy(int id) { var customer = await CompiledQueries.CustomerBy(dbContext, id); return(Ok(new CustomerDto { Id = customer.Id, Name = customer.Name })); }
public void Delete(Guid widgetDataID) { carrot_WidgetData w = CompiledQueries.cqGetWidgetDataByID_TBL(db, widgetDataID); if (w != null) { db.carrot_WidgetDatas.DeleteOnSubmit(w); db.SubmitChanges(); } }
public void Disable(Guid rootWidgetID) { carrot_Widget w = CompiledQueries.cqGetRootWidget(db, rootWidgetID); if (w != null) { w.WidgetActive = false; db.SubmitChanges(); } }
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 List <BasicContentData> GetFullSiteFileList() { List <BasicContentData> map = new List <BasicContentData>(); using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) { IQueryable <vw_carrot_Content> queryAllFiles = CompiledQueries.cqGetAllContent(_db, this.SiteID); map = queryAllFiles.Select(x => new BasicContentData(x)).ToList(); } return(map); }