Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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;
            }
        }
Ejemplo n.º 3
0
		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();
			}
		}
Ejemplo n.º 4
0
        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();
            }
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        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();
            }
        }
Ejemplo n.º 7
0
        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;
            }
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
        public List <Widget> GetWidgetVersionHistory(Guid rootWidgetID)
        {
            List <Widget> w = (from r in CompiledQueries.cqGetWidgetVersionHistory_VW(db, rootWidgetID)
                               select new Widget(r)).ToList();

            return(w);
        }
Ejemplo n.º 10
0
        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;
            }
        }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
        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);
        }
Ejemplo n.º 13
0
        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);
            }
        }
Ejemplo n.º 14
0
 public ExtendedUserData(Guid UserID)
 {
     using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) {
         vw_carrot_UserData rc = CompiledQueries.cqFindUserByID(_db, UserID);
         LoadUserData(rc);
     }
 }
Ejemplo n.º 15
0
 public ExtendedUserData(string UserName)
 {
     using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) {
         vw_carrot_UserData rc = CompiledQueries.cqFindUserByName(_db, UserName);
         LoadUserData(rc);
     }
 }
Ejemplo n.º 16
0
        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());
            }
        }
Ejemplo n.º 17
0
        //================================================

        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);
            }
        }
Ejemplo n.º 18
0
        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());
            }
        }
Ejemplo n.º 19
0
 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);
     }
 }
Ejemplo n.º 20
0
        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);
            }
        }
Ejemplo n.º 21
0
		public static int GetSiteCount(Guid siteID) {
			int iCt = -1;

			using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) {
				iCt = CompiledQueries.cqGetContentCategoryCountBySiteID(_db, siteID);
			}

			return iCt;
		}
Ejemplo n.º 22
0
        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);
            }
        }
Ejemplo n.º 23
0
        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);
            }
        }
Ejemplo n.º 24
0
        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);
            }
        }
Ejemplo n.º 25
0
        public static int GetSiteCount(Guid siteID)
        {
            int iCt = -1;

            using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) {
                iCt = CompiledQueries.cqGetContentTagCountBySiteID(_db, siteID);
            }

            return(iCt);
        }
Ejemplo n.º 26
0
        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
            }));
        }
Ejemplo n.º 27
0
        public void Delete(Guid widgetDataID)
        {
            carrot_WidgetData w = CompiledQueries.cqGetWidgetDataByID_TBL(db, widgetDataID);

            if (w != null)
            {
                db.carrot_WidgetDatas.DeleteOnSubmit(w);
                db.SubmitChanges();
            }
        }
Ejemplo n.º 28
0
        public void Disable(Guid rootWidgetID)
        {
            carrot_Widget w = CompiledQueries.cqGetRootWidget(db, rootWidgetID);

            if (w != null)
            {
                w.WidgetActive = false;
                db.SubmitChanges();
            }
        }
Ejemplo n.º 29
0
        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();
            }
        }
Ejemplo n.º 30
0
        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);
        }