/// <summary>
        /// 删除一个流程模板
        /// </summary>
        /// <param name="workflowId">流程模板Id</param>
        /// <returns></returns>
        public int DeleteWorkFlow(string workflowId)
        {
            int returnInt = -1;

            if (workflowId.Trim().Length == 0 || workflowId == null)
            {
                throw new Exception("DeleteWorkFlow方法错误,workflowId 不能为空!");
            }

            try
            {
                //1、存储过程方式删除流程模板
                //returnInt = this.DBProvider.ExecuteProcedure("DeleteWorkFlow", new IDbDataParameter[] { DBProvider.MakeParameter(WorkFlowTemplateTable.FieldWorkFlowId, workflowId) });

                /*
                 *  删除的各语句
                 *  DELETE  WORKFLOW  WHERE   WORKFLOWID = @WORKFLOWID
                 *  DELETE  WORKTASK  WHERE   WORKFLOWID = @WORKFLOWID
                 *  DELETE  WORKLINK  WHERE   WORKFLOWID = @WORKFLOWID
                 *  DELETE  TASKVAR   WHERE   WORKFLOWID = @WORKFLOWID
                 *  DELETE  OPERATOR  WHERE   WORKFLOWID = @WORKFLOWID
                 *  DELETE  WORKTASKCOMMANDS  WHERE   WORKFLOWID = @WORKFLOWID
                 *  DELETE  SUBWORKFLOW  WHERE   WORKFLOWID = @WORKFLOWID
                 *  DELETE  WORKTASKCONTROLS WHERE   WORKFLOWID = @WORKFLOWID
                 *  DELETE  WORKFLOWEVENT  WHERE   WORKFLOWID = @WORKFLOWID
                 *  DELETE  WORKOUTTIME  WHERE   WORKFLOWID = @WORKFLOWID
                 */
                //2、直接语句方式删除流程模板
                //2.1、删除流程模板
                returnInt += new WorkFlowTemplateManager(DBProvider, this.UserInfo, WorkFlowTemplateTable.TableName).Delete(WorkFlowTemplateTable.FieldWorkFlowId, workflowId);
                //2.2、删除任务节点
                returnInt += new WorkTaskManager(DBProvider, this.UserInfo, WorkFlowTemplateTable.TableName).Delete(WorkTaskTable.FieldWorkFlowId, workflowId);
                //2.3、删除连线
                returnInt += new WorkLinkManager(DBProvider, this.UserInfo, WorkLinkTable.TableName).Delete(WorkLinkTable.FieldWorkFlowId, workflowId);
                //2.4、删除任务节点变量
                returnInt += new TaskVarManager(DBProvider, this.UserInfo, TaskVarTable.TableName).Delete(TaskVarTable.FieldWorkFlowId, workflowId);
                //2.5、删除操作者
                returnInt += new OperatorManager(DBProvider, this.UserInfo, OperatorTable.TableName).Delete(OperatorTable.FieldWorkFlowId, workflowId);
                //2.5、删除任务节点命令
                returnInt += new WorkTaskCommandsManager(DBProvider, this.UserInfo, WorkTaskCommandsTable.TableName).Delete(WorkTaskCommandsTable.FieldWorkFlowId, workflowId);
                //2.6、删除子流程
                returnInt += new SubWorkFlowManager(DBProvider, this.UserInfo, SubWorkFlowTable.TableName).Delete(SubWorkFlowTable.FieldWorkFlowId, workflowId);
                //2.7、删除任务节点表单
                returnInt += new WorkTaskControlsManager(DBProvider, this.UserInfo, WorkTaskControlsTable.TableName).Delete(WorkTaskControlsTable.FieldWorkflowId, workflowId);
                //2.8、删除任务节点事件通知
                returnInt += new WorkFlowEventManager(DBProvider, this.UserInfo, WorkFlowEventTable.TableName).Delete(WorkFlowEventTable.FieldWorkFlowId, workflowId);
                //2.9、删除任务节点工作任务超时设置
                returnInt += new WorkOutTimeManager(DBProvider, this.UserInfo, WorkOutTimeTable.TableName).Delete(WorkOutTimeTable.FieldWorkFlowId, workflowId);
            }
            catch (Exception ex)
            {
                throw new Exception("BizLogicError:删除流程失败,请与管理员联系!Error:" + ex.Message);
            }
            return(returnInt);
        }
        /// <summary>
        /// 根据任务模版主键删除事件通知记录
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="worktaskid">工作任务Id</param>
        /// <returns>大于0成功</returns>
        public int DeleteWorkFlowEvent(UserInfo userInfo, string worktaskid)
        {
            var returnValue = -1;
            var parameter   = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.WorkFlowTemplateService_DeleteWorkFlowEvent);

            ServiceUtil.ProcessWorkFlowDbWithTransaction(userInfo, parameter, dbProvider =>
            {
                var manager = new WorkFlowEventManager(dbProvider, userInfo);
                returnValue = manager.DeleteWorkFlowEvent(worktaskid);
            });
            return(returnValue);
        }
        /// <summary>
        /// 得到指定流程模版所有的事件通知列表
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="workFlowId">流程模版Id</param>
        /// <returns>事件通知列表</returns>
        public DataTable GetWorkFlowAllEventTable(UserInfo userInfo, string workFlowId)
        {
            var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.WorkFlowTemplateService_GetWorkFlowAllEventTable);
            var dataTable = new DataTable(WorkFlowEventTable.TableName);

            ServiceUtil.ProcessWorkFlowDb(userInfo, parameter, dbProvider =>
            {
                var manager = new WorkFlowEventManager(dbProvider, userInfo);
                dataTable   = manager.GetWorkFlowAllEventTable(workFlowId);
            });
            return(dataTable);
        }
        /// <summary>
        /// 增加事件通知
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="entity">事件通知实体</param>
        /// <returns>增加成功返回实体主键</returns>
        public string InsertWorkFlowEvent(UserInfo userInfo, WorkFlowEventEntity entity)
        {
            var returnValue = string.Empty;
            var parameter   = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.WorkFlowTemplateService_InsertWorkFlowEvent);

            ServiceUtil.ProcessWorkFlowDbWithTransaction(userInfo, parameter, dbProvider =>
            {
                var manager = new WorkFlowEventManager(dbProvider, userInfo);
                returnValue = manager.Insert(entity);
            });
            return(returnValue);
        }