当前位置: 首页>>代码示例>>C#>>正文


C# SiteData.ConvertSiteTimeToUTC方法代码示例

本文整理汇总了C#中Carrotware.CMS.Core.SiteData.ConvertSiteTimeToUTC方法的典型用法代码示例。如果您正苦于以下问题:C# SiteData.ConvertSiteTimeToUTC方法的具体用法?C# SiteData.ConvertSiteTimeToUTC怎么用?C# SiteData.ConvertSiteTimeToUTC使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Carrotware.CMS.Core.SiteData的用法示例。


在下文中一共展示了SiteData.ConvertSiteTimeToUTC方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Save

        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();

            }
        }
开发者ID:mjohn,项目名称:CarrotCakeCMS,代码行数:66,代码来源:Widget.cs

示例2: PerformCommonSave

        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);
        }
开发者ID:ninianne98,项目名称:CarrotCakeCMS,代码行数:58,代码来源:ContentPage.cs

示例3: PerformCommonSaveRoot

        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);
            }
        }
开发者ID:ninianne98,项目名称:CarrotCakeCMS,代码行数:23,代码来源:ContentPage.cs

示例4: GetSingleMonthBlogUpdateList

        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;
        }
开发者ID:sunsiz,项目名称:CarrotCakeCMS-MVC,代码行数:21,代码来源:SiteNavHelperReal.cs


注:本文中的Carrotware.CMS.Core.SiteData.ConvertSiteTimeToUTC方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。