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


C# Document.XmlGenerate方法代码示例

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


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

示例1: PublishWithResult

        /// <summary>
        /// Publishing a document
        /// A xmlrepresentation of the document and its data are exposed to the runtime data
        /// (an xmlrepresentation is added -or updated if the document previously are published) ,
        /// this will lead to a new version of the document being created, for continuing editing of
        /// the data.
        /// </summary>
        /// <param name="u">The usercontext under which the action are performed</param>
        /// <returns>True if the publishing succeed. Possible causes for not publishing is if an event aborts the publishing</returns>
        public bool PublishWithResult(User u)
        {
            PublishEventArgs e = new PublishEventArgs();
            FireBeforePublish(e);

            if (!e.Cancel)
            {

                // make a lookup to see if template is 0 as the template is not initialized in the optimized
                // Document.Children method which is used in PublishWithChildrenWithResult methhod
                if (_template == 0)
                {
                    _template = new DocumentType(this.ContentType.Id).DefaultTemplate;
                }

                _published = true;
                string tempVersion = Version.ToString();
                Guid newVersion = createNewVersion();

                Log.Add(LogTypes.Publish, u, Id, "");

                //PPH make sure that there is only 1 newest node, this is important in regard to schedueled publishing...
                SqlHelper.ExecuteNonQuery("update cmsDocument set newest = 0 where nodeId = " + Id);

                SqlHelper.ExecuteNonQuery("insert into cmsDocument (newest, nodeId, published, documentUser, versionId, Text, TemplateId) values (1,@id, 0, @userId, @versionId, @text, @template)",
                    SqlHelper.CreateParameter("@id", Id),
                    SqlHelper.CreateParameter("@template", _template > 0 ? (object)_template : (object)DBNull.Value), //pass null in if the template doesn't have a valid id
                    SqlHelper.CreateParameter("@userId", u.Id),
                    SqlHelper.CreateParameter("@versionId", newVersion),
                    SqlHelper.CreateParameter("@text", Text));

                SqlHelper.ExecuteNonQuery("update cmsDocument set published = 0 where nodeId = " + Id);
                SqlHelper.ExecuteNonQuery("update cmsDocument set published = 1, newest = 0 where versionId = @versionId",
                                            SqlHelper.CreateParameter("@versionId", tempVersion));

                // update release and expire dates
                Document newDoc = new Document(Id, newVersion);
                if (ReleaseDate != new DateTime())
                    newDoc.ReleaseDate = ReleaseDate;
                if (ExpireDate != new DateTime())
                    newDoc.ExpireDate = ExpireDate;

                // Update xml in db using the new document (has correct version date)
                newDoc.XmlGenerate(new XmlDocument());

                FireAfterPublish(e);

                return true;
            }
            else
            {
                return false;
            }
        }
开发者ID:jracabado,项目名称:justEdit-,代码行数:63,代码来源:Document.cs


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