/// <summary>
        /// 获取流程第一步骤
        /// 用于启动该流程前打开表单
        /// </summary>
        /// <returns></returns>
        public ActionResult GetFirstStep()
        {
            Guid            flowId = QuestRequest.GetGuid("flowId");
            OperationResult or     = WFRunInstanceService.ProcessFirstStep(flowId);

            return(this.JsonFormat(or));
        }
        /// <summary>
        /// 运行流程
        /// </summary>
        /// <returns></returns>
        public ActionResult WFTask()
        {
            String mainId = QuestRequest.Get("mainId");
            Guid   stepId = QuestRequest.GetGuid("stepId");
            User   user   = new User()
            {
                Id = "00000000-0000-0000-0001-000000000001".GetGuid()
            };
            OperationResult or = WFRunInstanceService.Task(mainId, stepId, user);

            return(this.JsonFormat(or));
        }
        /// <summary>
        /// 运行流程
        /// </summary>
        /// <returns></returns>
        public ActionResult PlayWF()
        {
            String mainId = QuestRequest.Get("mainId");
            Guid   mId    = QuestRequest.GetGuid("mId");
            User   user   = new User()
            {
                Id = "00000000-0000-0000-0001-000000000001".GetGuid()
            };
            OperationResult or = WFRunInstanceService.Execute(mainId, mId, user);

            return(this.JsonFormat(or));
        }
        /// <summary>
        /// 创建流程
        /// 第一次启动流程
        /// </summary>
        /// <param name="designId">流程设计Id</param>
        /// <param name="mainId">实体唯一标识Id</param>
        /// <param name="userId">用户Id</param>
        /// <returns>放回流程实例</returns>
        private WFRunInstance CreateInstance(String dJson, String mainId, Guid userId)
        {
            OperationResult or = new OperationResult(OperationResultType.Error);

            // 获取当前流程运行实例
            WFRunInstance runInstance = new WFRunInstance
            {
                MainId     = mainId,
                UserId     = userId,
                DesignJSON = dJson
            };

            WFRunInstanceService.Insert(runInstance, false);

            return(runInstance);
        }