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


C# CMSNode.IsMedia方法代码示例

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


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

示例1: Run

        public override void Run(IWorkflowInstance workflowInstance, IWorkflowRuntime runtime)
        {
            base.Run(workflowInstance, runtime);

            var body = Helper.Instance.RenderTemplate(RenderTemplate);
            
            IList<string> files = new List<string>();

            foreach(var nodeId in ((UmbracoWorkflowInstance) workflowInstance).CmsNodes)
            {
                var node = new CMSNode(nodeId);
                if(node.IsMedia())
                {
                    files.Add(IOHelper.MapPath((string) new Media(nodeId).getProperty("umbracoFile").Value));
                }
            }

            var f = new User(From).Email;
            foreach(var r in GetRecipients())
            {
                var mail = new MailMessage(f, r) {Subject = Subject, IsBodyHtml = true, Body = body};

                foreach(var file in files)
                {
                    var attach = new Attachment(file);
                    mail.Attachments.Add(attach);
                }

                var smtpClient = new SmtpClient();
                smtpClient.Send(mail);
            }

            runtime.Transition(workflowInstance, this, "done");
        }
开发者ID:OlivierAlbertini,项目名称:workflow-for-dot-net,代码行数:34,代码来源:TemplateEmailWithMediaWorkflowTask.cs

示例2: Run

        public void Run(IWorkflowInstance workflowInstance, IWorkflowRuntime runtime)
        {
            // Cast to Umbraco worklow instance.
            var umbracoWorkflowInstance = (UmbracoWorkflowInstance) workflowInstance;

            var count = 0;
            var newCmsNodes = new List<int>();

            foreach(var nodeId in umbracoWorkflowInstance.CmsNodes)
            {
                var n = new CMSNode(nodeId);
                if(!n.IsMedia()) continue;

                var d = new Media(nodeId);
                if (!MediaTypes.Contains(d.ContentType.Id)) continue;
                
                newCmsNodes.Add(nodeId);
                count++;
            }

            umbracoWorkflowInstance.CmsNodes = newCmsNodes;

            var transition = (count > 0) ? "contains_media" : "does_not_contain_media";
            runtime.Transition(workflowInstance, this, transition);
        }
开发者ID:OlivierAlbertini,项目名称:workflow-for-dot-net,代码行数:25,代码来源:FilterMediaWorkflowTask.cs

示例3: GetAttachmentLinks

        public virtual string GetAttachmentLinks(IEnumerable<int> attachedNodes)
        {
            var s = new StringBuilder();
            s.Append("<br/><br/>");

            var host = HttpContext.Current.Request.Url.Host;
            if (HttpContext.Current.Request.Url.Port != 80) host += ":" + HttpContext.Current.Request.Url.Port;

            foreach(var nodeId in attachedNodes)
            {
                var node = new CMSNode(nodeId);

                if(node.IsDocument())
                {
                    s.Append(string.Format("{2} ({1}): <a href='http://{0}/umbraco/dialogs/preview.aspx?id={1}'>[" + GlobalisationService.Instance.GetString("preview") + "]</a> ", host, nodeId, node.Text) + Environment.NewLine);
                    s.Append(string.Format("<a href='http://{0}/umbraco/actions/editContent.aspx?id={1}'>[" + GlobalisationService.Instance.GetString("edit") + "]</a><br/>", host, nodeId) + Environment.NewLine);

                } else if(node.IsMedia())
                {
                    s.Append(string.Format("{2} ({1}): <a href='http://{0}/umbraco/dialogs/preview.aspx?id={1}'>{2}</a> ", host, nodeId, node.Text) + Environment.NewLine);
                    
                } else
                {
                    s.Append(node.Text + "<br/>" + Environment.NewLine);
                }
            }
            
            return s.ToString();
        }
开发者ID:OlivierAlbertini,项目名称:workflow-for-dot-net,代码行数:29,代码来源:BaseEmailWorkflowTask.cs


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