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


C# Document.SaveAndPublish方法代码示例

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


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

示例1: PublishDocument

 public JsonResult PublishDocument(int documentId, bool publishDescendants, bool includeUnpublished)
 {
     var content = Services.ContentService.GetById(documentId);
     var doc = new Document(content);
     //var contentService = (ContentService) Services.ContentService;
     if (publishDescendants == false)
     {
         //var result = contentService.SaveAndPublishInternal(content);
         var result = doc.SaveAndPublish(UmbracoUser.Id);
         return Json(new
             {
                 success = result.Success,
                 message = GetMessageForStatus(result.Result)
             });
     }
     else
     {
         /*var result = ((ContentService) Services.ContentService)
             .PublishWithChildrenInternal(content, UmbracoUser.Id, includeUnpublished)
             .ToArray();*/
         var result = doc.PublishWithSubs(UmbracoUser.Id, includeUnpublished);
         return Json(new
             {
                 success = result.All(x => x.Success),
                 message = GetMessageForStatuses(result.Select(x => x.Result), content)
             });
     }
 }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:28,代码来源:BulkPublishController.cs

示例2: Execute

        public override TaskExecutionDetails Execute(string Value)
        {
            TaskExecutionDetails d = new TaskExecutionDetails();

            if (HttpContext.Current != null && HttpContext.Current.Items["pageID"] != null)
            {
                string id = HttpContext.Current.Items["pageID"].ToString();

                Document doc = new Document(Convert.ToInt32(id));

                if (doc.getProperty(PropertyAlias) != null)
                {
                    d.OriginalValue = doc.getProperty(PropertyAlias).Value.ToString();

                    doc.getProperty(PropertyAlias).Value = Value;
                    doc.SaveAndPublish(new BusinessLogic.User(0));

                    d.NewValue = Value;
                    d.TaskExecutionStatus = TaskExecutionStatus.Completed;
                }
                else
                    d.TaskExecutionStatus = TaskExecutionStatus.Cancelled;

            }
            else
                d.TaskExecutionStatus = TaskExecutionStatus.Cancelled;

            return d;
        }
开发者ID:ChrisNikkel,项目名称:Umbraco-CMS,代码行数:29,代码来源:ModifyPageProperty.cs

示例3: editPost

        public object editPost(
            string postid,
            string username,
            string password,
            Post post,
            bool publish)
        {
            if (validateUser(username, password))
            {
                Channel userChannel = new Channel(username);
                Document doc = new Document(Convert.ToInt32(postid));


                doc.Text = HttpContext.Current.Server.HtmlDecode(post.title);

                // Excerpt
                if (userChannel.FieldExcerptAlias != null && userChannel.FieldExcerptAlias != "")
                    doc.getProperty(userChannel.FieldExcerptAlias).Value = removeLeftUrl(post.mt_excerpt);

                if (UmbracoSettings.TidyEditorContent)
                    doc.getProperty(userChannel.FieldDescriptionAlias).Value = library.Tidy(removeLeftUrl(post.description), false);
                else
                    doc.getProperty(userChannel.FieldDescriptionAlias).Value = removeLeftUrl(post.description);

                updateCategories(doc, post, userChannel);


                if (publish)
                {
                    doc.SaveAndPublish(new User(username));
                }
                return true;
            }
            else
            {
                return false;
            }
        }
开发者ID:CarlSargunar,项目名称:Umbraco-CMS,代码行数:38,代码来源:UmbracoMetaWeblogAPI.cs

示例4: Publish

        /// <summary>
        /// Publishes the update.
        /// </summary>
        public void Publish()
        {
            // keep track of documents published in this request
            List<int> publishedDocuments = (List<int>)HttpContext.Current.Items["ItemUpdate_PublishedDocuments"];
            if (publishedDocuments == null)
            {
                HttpContext.Current.Items["ItemUpdate_PublishedDocuments"] = publishedDocuments = new List<int>();
            }

            // publish each modified document just once (e.g. several fields are updated)
            if(!publishedDocuments.Contains(NodeId.Value))
            {
                Document document = new Document(NodeId.Value);
                document.SaveAndPublish(Umbraco.Web.UmbracoContext.Current.UmbracoUser);
                
                publishedDocuments.Add(NodeId.Value);
            }
        }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:21,代码来源:ItemUpdate.cs

示例5: SaveProject

        private void SaveProject(Document project, Member user)
        {
            if (!string.IsNullOrWhiteSpace(Request["title"]))
            {
                project.getProperty("title").Value = Request["title"];
            }
            if (!string.IsNullOrWhiteSpace(Request["description"]))
                project.getProperty("description").Value = Request["description"];
            if (!string.IsNullOrWhiteSpace(Request["projectType"]))
                project.getProperty("projectType").Value = Convert.ToInt32(Request["projectType"]);
            if (!string.IsNullOrWhiteSpace(Request["area"]))
                project.getProperty("area").Value = Convert.ToInt32(Request["area"]);
            project.getProperty("allowComments").Value = !string.IsNullOrWhiteSpace(Request["allowComments"]) && Request["allowComments"].ToLower().Equals("on");

            project.getProperty("author").Value = user.Id;

            if (Request.Files.Count > 0 && Request.Files[0].ContentLength > 0)
            {
                var uploadedFile = Request.Files[0];
                var fileName = Path.GetFileName(uploadedFile.FileName);
                var fileSavePath = Server.MapPath("~/media/projects/" + fileName);
                uploadedFile.SaveAs(fileSavePath);

                project.getProperty("image").Value = "/media/projects/" + fileName;
            }

            project.SaveAndPublish(user.User);
            umbraco.library.UpdateDocumentCache(project.Id);
        }
开发者ID:v-five,项目名称:upgradeit,代码行数:29,代码来源:ProjectController.cs


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