Asp.net工作流workflow实战之给书签命名,四

之前我们的书签名字是通过手动录入的方式,在实际开发中要在流程设计的时候定义好:

namespace EazyBPMS.WorkFlow
{

    public sealed class SetStepActivity : CodeActivity
    {
        // 定义一个字符串类型的活动输入参数
        public InArgument<string> StepName { get; set; }
        public InArgument<bool> IsEnd { get; set; }

        // 如果活动返回值,则从 CodeActivity<TResult>
        // 并从 Execute 方法返回该值。
        protected override void Execute(CodeActivityContext context)
        {
            // 获取 Text 输入参数的运行时值
            string text = context.GetValue(this.StepName);
            bool end = context.GetValue(this.IsEnd);
            Guid insId = context.WorkflowInstanceId;
            //更新步骤名
            //根据流程id取得流程实例
            BLL.eazy_wf_instance instBll = new BLL.eazy_wf_instance();
            Model.eazy_wf_instance instModel = instBll.GetModel(insId);
            //根据流程实例id 和当前状态读取当前步骤
            BLL.eazy_wf_step stepBLL = new BLL.eazy_wf_step();   
            //报错的地方呢      
            EazyBPMS.Model.eazy_wf_step stepModel = stepBLL.GetCurrentModel(instModel.ID);
            stepModel.StepName = text;
            stepModel.IsEndStep = end;


            //是不是结束步骤更新一下
            if (end)
            {
                //步骤的结果 Result=“审核结果”
                stepModel.Result = "审批结束";
                //更新实例表中的状态
                instModel.Status= (short)EazyEnums.WFInstanceStatusEnum.End;
                instBll.Update(instModel);

            }
            // 更新步骤信息
            stepBLL.Update(stepModel);


        }
    }
}