在WorkFlow Orchard中保存自定义表单项

时间:2015-08-20 18:10:20

标签: c# asp.net orchardcms

我目前遇到的问题是,在将自定义表单内容项目保存为提交之前,我正在尝试检查工作流程。点击CreateAndPublish工作流后,它实际上会创建项目,但字段值未正确保存。

这是我的工作流程:

    public class CreateAndPublishActivity : Task {
    private readonly IContentManager _contentManager;

    public CreateAndPublishActivity(IContentManager contentManager) {
        _contentManager = contentManager;
    }

    public Localizer T { get; set; }

    public override bool CanExecute(WorkflowContext workflowContext, ActivityContext activityContext) {
        return true;
    }

    public override IEnumerable<LocalizedString> GetPossibleOutcomes(WorkflowContext workflowContext, ActivityContext activityContext) {
        return new[] { T("Done") };
    }

    public override IEnumerable<LocalizedString> Execute(WorkflowContext workflowContext, ActivityContext activityContext) {
        _contentManager.Create(workflowContext.Content.ContentItem, VersionOptions.Published);
        yield return T("Done");
    }

    public override string Name {
        get { return "CreateAndPublish"; }
    }

    public override LocalizedString Category {
        get { return T("Content Items"); }
    }

    public override LocalizedString Description {
        get { return T("Create and Publish the content item."); }
    }
}

内容项目显示在提交下,但没有任何字段值。

0 个答案:

没有答案