Example #1
0
        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);
            }
        }
Example #2
0
        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);
        }
Example #3
0
        public List <ContentDateLinks> GetSingleMonthBlogUpdateList(SiteData currentSite, DateTime monthDate, bool bActiveOnly)
        {
            List <ContentDateLinks> lstContent = new List <ContentDateLinks>();
            DateTime dateBegin = monthDate.AddDays(0 - monthDate.Day).AddDays(1);
            DateTime dateEnd   = dateBegin.AddMonths(1).AddMilliseconds(-1);

            if (currentSite != null)
            {
                dateBegin = currentSite.ConvertSiteTimeToUTC(dateBegin);
                dateEnd   = currentSite.ConvertSiteTimeToUTC(dateEnd);
            }

            IQueryable <vw_carrot_Content> query1 = CannedQueries.GetLatestBlogListDateRange(db, currentSite.SiteID, dateBegin, dateEnd, bActiveOnly);

            lstContent = (from p in query1
                          group p by p.GoLiveDateLocal.Date into g
                          select new ContentDateLinks {
                PostDate = g.Key, UseCount = g.Count()
            }).ToList();

            lstContent.ToList().ForEach(q => q.TheSite = currentSite);

            return(lstContent);
        }
Example #4
0
        public void Save()
        {
            if (!this.IsWidgetPendingDelete) {

                SiteData site = new SiteData(CompiledQueries.cqGetSiteFromRootContentID(db, this.Root_ContentID));

                carrot_Widget w = CompiledQueries.cqGetRootWidget(db, this.Root_WidgetID);

                bool bAdd = false;
                if (w == null) {
                    bAdd = true;
                    w = new carrot_Widget();
                }

                if (this.Root_WidgetID == Guid.Empty) {
                    this.Root_WidgetID = Guid.NewGuid();
                }

                if (this.GoLiveDate.Year < 1900) {
                    this.GoLiveDate = site.Now.AddMinutes(-5);
                }
                if (this.RetireDate.Year < 1900) {
                    this.RetireDate = site.Now.AddYears(200);
                }

                w.Root_WidgetID = this.Root_WidgetID;

                w.WidgetOrder = this.WidgetOrder;
                w.Root_ContentID = this.Root_ContentID;
                w.PlaceholderName = this.PlaceholderName;
                w.ControlPath = this.ControlPath.Replace("~~/", "~/");
                w.WidgetActive = this.IsWidgetActive;
                w.GoLiveDate = site.ConvertSiteTimeToUTC(this.GoLiveDate);
                w.RetireDate = site.ConvertSiteTimeToUTC(this.RetireDate);

                carrot_WidgetData wd = new carrot_WidgetData();
                wd.Root_WidgetID = w.Root_WidgetID;
                wd.WidgetDataID = Guid.NewGuid();
                wd.IsLatestVersion = true;
                wd.ControlProperties = this.ControlProperties;
                wd.EditDate = DateTime.UtcNow;

                carrot_WidgetData oldWD = CompiledQueries.cqGetWidgetDataByRootID(db, this.Root_WidgetID);

                //only add a new entry if the widget has some sort of change in the data stored.
                if (oldWD != null) {
                    if (oldWD.ControlProperties != wd.ControlProperties) {
                        oldWD.IsLatestVersion = false;
                        db.carrot_WidgetDatas.InsertOnSubmit(wd);
                    }
                } else {
                    db.carrot_WidgetDatas.InsertOnSubmit(wd);
                }

                if (bAdd) {
                    db.carrot_Widgets.InsertOnSubmit(w);
                }

                db.SubmitChanges();

            } else {

                DeleteAll();

            }
        }
Example #5
0
        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);
            }
        }
Example #6
0
        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 List<ContentDateLinks> GetSingleMonthBlogUpdateList(SiteData currentSite, DateTime monthDate, bool bActiveOnly)
        {
            List<ContentDateLinks> lstContent = new List<ContentDateLinks>();
            DateTime dateBegin = monthDate.AddDays(0 - monthDate.Day).AddDays(1);
            DateTime dateEnd = dateBegin.AddMonths(1).AddMilliseconds(-1);

            if (currentSite != null) {
                dateBegin = currentSite.ConvertSiteTimeToUTC(dateBegin);
                dateEnd = currentSite.ConvertSiteTimeToUTC(dateEnd);
            }

            IQueryable<vw_carrot_Content> query1 = CannedQueries.GetLatestBlogListDateRange(db, currentSite.SiteID, dateBegin, dateEnd, bActiveOnly);

            lstContent = (from p in query1
                          group p by p.GoLiveDateLocal.Date into g
                          select new ContentDateLinks { PostDate = g.Key, UseCount = g.Count() }).ToList();

            lstContent.ToList().ForEach(q => q.TheSite = currentSite);

            return lstContent;
        }
        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;
            }
        }
Example #9
0
        public void Save()
        {
            if (!this.IsWidgetPendingDelete)
            {
                SiteData site = new SiteData(CompiledQueries.cqGetSiteFromRootContentID(db, this.Root_ContentID));

                carrot_Widget w = CompiledQueries.cqGetRootWidget(db, this.Root_WidgetID);

                bool bAdd = false;
                if (w == null)
                {
                    bAdd = true;
                    w    = new carrot_Widget();
                }

                if (this.Root_WidgetID == Guid.Empty)
                {
                    this.Root_WidgetID = Guid.NewGuid();
                }

                if (this.GoLiveDate.Year < 1900)
                {
                    this.GoLiveDate = site.Now.AddMinutes(-5);
                }
                if (this.RetireDate.Year < 1900)
                {
                    this.RetireDate = site.Now.AddYears(200);
                }

                w.Root_WidgetID = this.Root_WidgetID;

                w.WidgetOrder     = this.WidgetOrder;
                w.Root_ContentID  = this.Root_ContentID;
                w.PlaceholderName = this.PlaceholderName;
                w.ControlPath     = this.ControlPath.Replace("~~/", "~/");
                w.WidgetActive    = this.IsWidgetActive;
                w.GoLiveDate      = site.ConvertSiteTimeToUTC(this.GoLiveDate);
                w.RetireDate      = site.ConvertSiteTimeToUTC(this.RetireDate);

                carrot_WidgetData wd = new carrot_WidgetData();
                wd.Root_WidgetID     = w.Root_WidgetID;
                wd.WidgetDataID      = Guid.NewGuid();
                wd.IsLatestVersion   = true;
                wd.ControlProperties = this.ControlProperties;
                wd.EditDate          = DateTime.UtcNow;

                carrot_WidgetData oldWD = CompiledQueries.cqGetWidgetDataByRootID(db, this.Root_WidgetID);

                //only add a new entry if the widget has some sort of change in the data stored.
                if (oldWD != null)
                {
                    if (oldWD.ControlProperties != wd.ControlProperties)
                    {
                        oldWD.IsLatestVersion = false;
                        db.carrot_WidgetDatas.InsertOnSubmit(wd);
                    }
                }
                else
                {
                    db.carrot_WidgetDatas.InsertOnSubmit(wd);
                }

                if (bAdd)
                {
                    db.carrot_Widgets.InsertOnSubmit(w);
                }

                db.SubmitChanges();
            }
            else
            {
                DeleteAll();
            }
        }