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


C# IDbSession类代码示例

本文整理汇总了C#中IDbSession的典型用法代码示例。如果您正苦于以下问题:C# IDbSession类的具体用法?C# IDbSession怎么用?C# IDbSession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ExecuteInstanceImp

        internal override void ExecuteInstanceImp(IDbSession session)
        {
            //构造流程实例
            var processInstance = new ProcessInstanceManager()
                .CreateNewProcessInstanceObject(base.AppRunner, base.ProcessModel.ProcessEntity,
                base.ParentProcessInstance, base.InvokedSubProcessNode == null? null : base.InvokedSubProcessNode.ActivityInstance);

            //构造活动实例
            //1. 获取开始节点活动
            var startActivity = base.ProcessModel.GetStartActivity();

            var startExecutionContext = ActivityForwardContext.CreateStartupContext(base.ProcessModel,
                processInstance,
                startActivity,
                base.ActivityResource);

            //base.RunWorkItemIteraly(startExecutionContext, session);
            NodeMediator mediator = NodeMediatorFactory.CreateNodeMediator(startExecutionContext, session);
            mediator.Linker.FromActivityInstance = RunningActivityInstance;
            mediator.ExecuteWorkItem();

            //构造回调函数需要的数据
            WfExecutedResult result = base.WfExecutedResult;
            result.ProcessInstanceIDStarted = processInstance.ID;
            result.Status = WfExecutedStatus.Success;
        }
开发者ID:uname-yang,项目名称:WorkFlow-Engine-OData-WebApi-with-OdataClient,代码行数:26,代码来源:WfRuntimeManagerStartup.cs

示例2: ExecuteInstanceImp

        internal override void ExecuteInstanceImp(IDbSession session)
        {
            //创建新任务节点
            var backMostPreviouslyActivityInstanceID = GetBackwardMostPreviouslyActivityInstanceID();
            var nodeMediatorBackward = new NodeMediatorBackward(base.BackwardContext, session);

            nodeMediatorBackward.CreateBackwardActivityTaskTransitionInstance(base.BackwardContext.ProcessInstance,
                base.BackwardContext.BackwardFromActivityInstance,
                BackwardTypeEnum.Withdrawed,
                backMostPreviouslyActivityInstanceID,
                base.BackwardContext.BackwardToTargetTransitionGUID,
                TransitionTypeEnum.Withdrawed,
                TransitionFlyingTypeEnum.NotFlying,
                base.ActivityResource,
                session);

            //更新撤销节点的状态(从准备状态更新为撤销状态)
            var aim = new ActivityInstanceManager();
            aim.Withdraw(base.BackwardContext.BackwardFromActivityInstance.ID,
                base.ActivityResource.AppRunner, session);

            //构造回调函数需要的数据
            WfExecutedResult result = base.WfExecutedResult;
            result.BackwardTaskReciever = base.BackwardContext.BackwardTaskReciever;
            result.Status = WfExecutedStatus.Success;
        }
开发者ID:zengcheng,项目名称:Slickflow,代码行数:26,代码来源:WfRuntimeManagerWithdraw.cs

示例3: CreateBackwardActivityTaskOfInnerMultipleInstance

        /// <summary>
        /// 创建多实例节点之间回滚时的活动实例,任务数据
        /// </summary>
        /// <param name="processInstance"></param>
        /// <param name="originalBackwardToActivityInstance"></param>
        /// <param name="backwardType"></param>
        /// <param name="backSrcActivityInstanceID"></param>
        /// <param name="activityResource"></param>
        /// <param name="session"></param>
        internal void CreateBackwardActivityTaskOfInnerMultipleInstance(ProcessInstanceEntity processInstance,
            ActivityInstanceEntity originalBackwardToActivityInstance,
            BackwardTypeEnum backwardType,
            int backSrcActivityInstanceID,
            ActivityResource activityResource,
            IDbSession session)
        {
            //创建回滚到的节点信息
            var rollbackPreviousActivityInstance = base.CreateBackwardToActivityInstanceObject(processInstance,
                backwardType,
                backSrcActivityInstanceID,
                activityResource.AppRunner);

            rollbackPreviousActivityInstance.ActivityState = (short)ActivityStateEnum.Ready;
            rollbackPreviousActivityInstance.MIHostActivityInstanceID = originalBackwardToActivityInstance.MIHostActivityInstanceID;
            rollbackPreviousActivityInstance.CompleteOrder = originalBackwardToActivityInstance.CompleteOrder;
            rollbackPreviousActivityInstance.ComplexType = originalBackwardToActivityInstance.ComplexType;
            rollbackPreviousActivityInstance.SignForwardType = originalBackwardToActivityInstance.SignForwardType;
            rollbackPreviousActivityInstance.AssignedToUserIDs = originalBackwardToActivityInstance.AssignedToUserIDs;      //多实例节点为单一用户任务
            rollbackPreviousActivityInstance.AssignedToUserNames = originalBackwardToActivityInstance.AssignedToUserNames;

            //插入新活动实例数据
            base.ActivityInstanceManager.Insert(rollbackPreviousActivityInstance,
                session);

            //创建新任务数据
            base.CreateNewTask(rollbackPreviousActivityInstance, activityResource, session);
        }
开发者ID:uname-yang,项目名称:WorkFlow-Engine-OData-WebApi-with-OdataClient,代码行数:37,代码来源:NodeMediatorBackward.cs

示例4: CreateNodeMediator

 /// <summary>
 /// 创建节点执行器的抽象类
 /// </summary>
 /// <param name="processInstance"></param>
 /// <param name="activity"></param>
 /// <param name="activityResource"></param>
 /// <param name="dataContext"></param>
 /// <returns></returns>
 internal static NodeMediator CreateNodeMediator(ActivityForwardContext forwardContext,
     IDbSession session)
 {
     if (forwardContext.Activity.ActivityType == ActivityTypeEnum.StartNode)
     {
         return new NodeMediatorStart(forwardContext, session);
     }
     else if (forwardContext.Activity.ActivityType == ActivityTypeEnum.TaskNode)
     {
         //加签节点特殊处理
         if (forwardContext.Activity.ActivityTypeDetail.ComplexType == Xpdl.ComplexTypeEnum.SignForward)
         {
             //加签的动态变量传入
             if (forwardContext.ActivityResource.DynamicVariables != null
                 && !string.IsNullOrEmpty(forwardContext.ActivityResource.DynamicVariables["SignForwardType"]))
             {
                 return new NodeMediatorSignForward(forwardContext, session);
             }
             else
             {
                 return new NodeMediatorTask(forwardContext, session);
             }
         }
         else
             return new NodeMediatorTask(forwardContext, session);
     }
     else if (forwardContext.Activity.ActivityType == ActivityTypeEnum.SubProcessNode)
     {
         return new NodeMediatorSubProcess(forwardContext, session);
     }
     else
     {
         throw new ApplicationException(string.Format("不明确的节点类型: {0}", forwardContext.Activity.ActivityType.ToString()));
     }
 }
开发者ID:uname-yang,项目名称:WorkFlow-Engine-OData-WebApi-with-OdataClient,代码行数:43,代码来源:NodeMediatorFactory.cs

示例5: ExecuteInstanceImp

        internal override void ExecuteInstanceImp(IDbSession session)
        {
            try
            {
                var runningExecutionContext = ActivityForwardContext.CreateRunningContext(base.TaskView,
                    base.ProcessModel,
                    base.ActivityResource);

                //执行节点
                NodeMediator mediator = NodeMediatorFactory.CreateNodeMediator(runningExecutionContext, session);
                mediator.Linker.FromActivityInstance = RunningActivityInstance;
                mediator.ExecuteWorkItem();

                //构造回调函数需要的数据
                var result = base.WfExecutedResult;
                result.Status = WfExecutedStatus.Success;
                result.Message = mediator.GetNodeMediatedMessage();
            }
            catch (WfRuntimeException rx)
            {
                var result = base.WfExecutedResult;
                result.Status = WfExecutedStatus.Failed;
                result.ExceptionType = WfExceptionType.RunApp_RuntimeError;
                result.Message = rx.Message;
                throw rx;
            }
            catch (System.Exception ex)
            {
                var result = base.WfExecutedResult;
                result.Status = WfExecutedStatus.Failed;
                result.ExceptionType = WfExceptionType.RunApp_RuntimeError;
                result.Message = ex.Message;
                throw ex;
            }
        }
开发者ID:uname-yang,项目名称:WorkFlow-Engine-OData-WebApi-with-OdataClient,代码行数:35,代码来源:WfRuntimeManagerAppRunning.cs

示例6: ExecuteInstanceImp

        internal override void ExecuteInstanceImp(IDbSession session)
        {
            //根据加签类型选项,生成新的ActivityInstance记录
            //加签类型有前加签,后加签和并加签
            try
            {
                var signforwardExecutionContext = ActivityForwardContext.CreateRunningContext(base.TaskView,
                    base.ProcessModel,
                    base.ActivityResource);

                NodeMediator mediator = NodeMediatorFactory.CreateNodeMediator(signforwardExecutionContext, session);
                mediator.ExecuteWorkItem();

                var result = base.WfExecutedResult;
                result.Status = WfExecutedStatus.Success;
                result.Message = mediator.GetNodeMediatedMessage();
            }
            catch (WfRuntimeException rx)
            {
                var result = base.WfExecutedResult;
                result.Status = WfExecutedStatus.Failed;
                result.ExceptionType = WfExceptionType.SignForward_RuntimeError;
                result.Message = rx.Message;
                throw rx;
            }
            catch (System.Exception ex)
            {
                var result = base.WfExecutedResult;
                result.Status = WfExecutedStatus.Failed;
                result.ExceptionType = WfExceptionType.SignForward_RuntimeError;
                result.Message = ex.Message;
                throw ex;
            }
        }
开发者ID:uname-yang,项目名称:WorkFlow-Engine-OData-WebApi-with-OdataClient,代码行数:34,代码来源:WfRuntimeManagerSignForward.cs

示例7: CompleteAutomaticlly

        public GatewayExecutedResult CompleteAutomaticlly(ProcessInstanceEntity processInstance,
            string transitionGUID,
            ActivityInstanceEntity fromActivityInstance,
            ActivityResource activityResource,
            IDbSession session)
        {
            var gatewayActivityInstance = base.CreateActivityInstanceObject(base.GatewayActivity, processInstance, activityResource.AppRunner);
            gatewayActivityInstance.GatewayDirectionTypeID = (short)GatewayDirectionEnum.OrSplit;

            base.InsertActivityInstance(gatewayActivityInstance,
                session);

            base.CompleteActivityInstance(gatewayActivityInstance.ID,
                activityResource,
                session);

            gatewayActivityInstance.ActivityState = (short)ActivityStateEnum.Completed;
            base.GatewayActivityInstance = gatewayActivityInstance;

            //写节点转移实例数据
            base.InsertTransitionInstance(processInstance,
                transitionGUID,
                fromActivityInstance,
                gatewayActivityInstance,
                TransitionTypeEnum.Forward,
                TransitionFlyingTypeEnum.NotFlying,
                activityResource.AppRunner,
                session);

            GatewayExecutedResult result = GatewayExecutedResult.CreateGatewayExecutedResult(GatewayExecutedStatus.Successed);
            return result;
        }
开发者ID:zengcheng,项目名称:Slickflow,代码行数:32,代码来源:NodeMediatorOrSplit.cs

示例8: NodeMediator

 /// <summary>
 /// 向前流转时的NodeMediator的构造函数
 /// </summary>
 /// <param name="forwardContext"></param>
 /// <param name="session"></param>
 internal NodeMediator(ActivityForwardContext forwardContext, IDbSession session)
 {
     _activityForwardContext = forwardContext;
     _session = session;
     _processModel = forwardContext.ProcessModel;
     Linker.FromActivity = forwardContext.Activity;
 }
开发者ID:zengcheng,项目名称:Slickflow,代码行数:12,代码来源:NodeMediator.cs

示例9: CompleteAutomaticlly

        /// <summary>
        /// 自动完成结束节点
        /// </summary>
        /// <param name="processInstance"></param>
        /// <param name="fromActivityInstance"></param>
        /// <param name="activityResource"></param>
        /// <param name="wfLinqDataContext"></param>
        public GatewayExecutedResult CompleteAutomaticlly(ProcessInstanceEntity processInstance,
            string transitionGUID,
            ActivityInstanceEntity fromActivityInstance,
            ActivityResource activityResource,
            IDbSession session)
        {
            GatewayExecutedResult result = null;
            var toActivityInstance = base.CreateActivityInstanceObject(base.Linker.ToActivity,
                processInstance, activityResource.AppRunner);

            base.ActivityInstanceManager.Insert(toActivityInstance, session);

            base.ActivityInstanceManager.Complete(toActivityInstance.ID,
                activityResource.AppRunner,
                session);

            //写节点转移实例数据
            base.InsertTransitionInstance(processInstance,
                transitionGUID,
                fromActivityInstance,
                toActivityInstance,
                TransitionTypeEnum.Forward,
                TransitionFlyingTypeEnum.NotFlying,
                activityResource.AppRunner,
                session);

            //设置流程完成
            ProcessInstanceManager pim = new ProcessInstanceManager();
            pim.Complete(processInstance.ID, activityResource.AppRunner, session);

            //发送流程结束消息给流程启动人

            return result;
        }
开发者ID:uname-yang,项目名称:WorkFlow-Engine-OData-WebApi-with-OdataClient,代码行数:41,代码来源:NodeMediatorEnd.cs

示例10: CompleteAutomaticlly

        public GatewayExecutedResult CompleteAutomaticlly(ProcessInstanceEntity processInstance,
            string transitionGUID,
            ActivityInstanceEntity fromActivityInstance,
            ActivityResource activityResource,
            IDbSession session)
        {
            //检查是否有运行中的合并节点实例
            ActivityInstanceEntity joinNode = base.ActivityInstanceManager.GetActivityRunning(
                processInstance.ID,
                base.GatewayActivity.ActivityGUID,
                session);

            if (joinNode == null)
            {
                var joinActivityInstance = base.CreateActivityInstanceObject(base.GatewayActivity,
                    processInstance, activityResource.AppRunner);

                //计算总需要的Token数目
                joinActivityInstance.TokensRequired = GetTokensRequired();
                joinActivityInstance.TokensHad = 1;

                //进入运行状态
                joinActivityInstance.ActivityState = (short)ActivityStateEnum.Running;
                joinActivityInstance.GatewayDirectionTypeID = (short)GatewayDirectionEnum.AndJoin;

                base.InsertActivityInstance(joinActivityInstance,
                    session);
            }
            else
            {
                //更新节点的活动实例属性
                base.GatewayActivityInstance = joinNode;
                int tokensRequired = base.GatewayActivityInstance.TokensRequired;
                int tokensHad = base.GatewayActivityInstance.TokensHad;

                //更新Token数目
                base.ActivityInstanceManager.IncreaseTokensHad(base.GatewayActivityInstance.ID,
                    activityResource.AppRunner,
                    session);

                if ((tokensHad + 1) == tokensRequired)
                {
                    //如果达到完成节点的Token数,则设置该节点状态为完成
                    base.CompleteActivityInstance(base.GatewayActivityInstance.ID,
                        activityResource,
                        session);
                    base.GatewayActivityInstance.ActivityState = (short)ActivityStateEnum.Completed;
                }
            }

            GatewayExecutedResult result = GatewayExecutedResult.CreateGatewayExecutedResult(
                GatewayExecutedStatus.Successed);
            return result;
        }
开发者ID:uname-yang,项目名称:WorkFlow-Engine-OData-WebApi-with-OdataClient,代码行数:54,代码来源:NodeMediatorAndJoin.cs

示例11: Complete

        /// <summary>
        /// 设置任务完成
        /// </summary>
        /// <param name="taskID">任务ID</param>
        /// <param name="runner"></param>
        /// <param name="wfLinqDataContext"></param>
        internal void Complete(long taskID,
            WfAppRunner runner,
            IDbSession session)
        {
            TaskEntity task = Repository.GetById<TaskEntity>(taskID);
            task.TaskState = (byte)TaskStateEnum.Completed;
            task.EndedDateTime = DateTime.Now;
            task.EndedByUserID = runner.UserID;
            task.EndedByUserName = runner.UserName;

            Update(task, session);
        }
开发者ID:zengcheng,项目名称:Slickflow,代码行数:18,代码来源:TaskManager.cs

示例12: CreateNodeMediator

 /// <summary>
 /// 创建节点执行器的抽象类
 /// </summary>
 /// <param name="processInstance"></param>
 /// <param name="activity"></param>
 /// <param name="activityResource"></param>
 /// <param name="dataContext"></param>
 /// <returns></returns>
 internal static NodeMediator CreateNodeMediator(ActivityForwardContext forwardContext,
     IDbSession session)
 {
     if (forwardContext.Activity.ActivityType == ActivityTypeEnum.StartNode)
         return new NodeMediatorStart(forwardContext, session);
     else if (forwardContext.Activity.ActivityType == ActivityTypeEnum.TaskNode)
         return new NodeMediatorTask(forwardContext, session);
     else if (forwardContext.Activity.ActivityType == ActivityTypeEnum.SubProcessNode)
         return new NodeMediatorSubProcess(forwardContext, session);
     else
         throw new ApplicationException(string.Format("不明确的节点类型: {0}", forwardContext.Activity.ActivityType.ToString()));
 }
开发者ID:zengcheng,项目名称:Slickflow,代码行数:20,代码来源:NodeMediatorFactory.cs

示例13: Complete

        /// <summary>
        /// 活动实例完成
        /// </summary>
        /// <param name="activityInstanceID"></param>
        /// <param name="runner"></param>
        /// <param name="session"></param>
        internal void Complete(int activityInstanceID, 
            WfAppRunner runner,
            IDbSession session)
        {
            var activityInstance = GetById(session.Connection, activityInstanceID, session.Transaction);
            activityInstance.ActivityState = (short)ActivityStateEnum.Completed;
            activityInstance.LastUpdatedByUserID = runner.UserID;
            activityInstance.LastUpdatedByUserName = runner.UserName;
            activityInstance.LastUpdatedDateTime = System.DateTime.Now;
            activityInstance.EndedByUserID = runner.UserID;
            activityInstance.EndedByUserName = runner.UserName;
            activityInstance.EndedDateTime = System.DateTime.Now;

            Update(activityInstance, session);
        }
开发者ID:zengcheng,项目名称:Slickflow,代码行数:21,代码来源:ActivityInstanceManager.cs

示例14: ExecuteInstanceImp

        internal override void ExecuteInstanceImp(IDbSession session)
        {
            WfExecutedResult result = base.WfExecutedResult;

            //回跳类型的处理
            if (base.IsBackward == true)
            {
                //创建新任务节点
                var backMostPreviouslyActivityInstanceID = GetBackwardMostPreviouslyActivityInstanceID();
                var nodeMediatorBackward = new NodeMediatorBackward(base.BackwardContext, session);

                nodeMediatorBackward.CreateBackwardActivityTaskTransitionInstance(base.BackwardContext.ProcessInstance,
                    base.BackwardContext.BackwardFromActivityInstance,
                    BackwardTypeEnum.Sendback,
                    backMostPreviouslyActivityInstanceID,
                    base.BackwardContext.BackwardToTargetTransitionGUID,
                    TransitionTypeEnum.Sendback,
                    TransitionFlyingTypeEnum.NotFlying,
                    base.ActivityResource,
                    session);

                //更新当前办理节点的状态(从准备或运行状态更新为退回状态)
                var aim = new ActivityInstanceManager();
                aim.SendBack(base.BackwardContext.BackwardFromActivityInstance.ID,
                    base.ActivityResource.AppRunner,
                    session);

                //构造回调函数需要的数据
                result.BackwardTaskReciever = base.BackwardContext.BackwardTaskReciever;
                result.Status = WfExecutedStatus.Success;
            }
            else
            {
                var jumpActivityGUID = base.AppRunner.NextActivityPerformers.First().Key;
                var jumpforwardActivity = base.ProcessModel.GetActivity(jumpActivityGUID);
                var proecessInstance = (new ProcessInstanceManager()).GetById(base.RunningActivityInstance.ProcessInstanceID);
                var jumpforwardExecutionContext = ActivityForwardContext.CreateJumpforwardContext(jumpforwardActivity,
                    base.ProcessModel, proecessInstance, base.ActivityResource);

                NodeMediator mediator = NodeMediatorFactory.CreateNodeMediator(jumpforwardExecutionContext, session);
                mediator.Linker.FromActivityInstance = base.RunningActivityInstance;
                mediator.Linker.ToActivity = jumpforwardActivity;
                mediator.ExecuteWorkItem();

                result.Status = WfExecutedStatus.Success;
                result.Message = mediator.GetNodeMediatedMessage();
            }
        }
开发者ID:zengcheng,项目名称:Slickflow,代码行数:48,代码来源:WfRuntimeManagerJump.cs

示例15: CreateGatewayNodeMediator

 internal static NodeMediatorGateway CreateGatewayNodeMediator(ActivityEntity gActivity, 
     ProcessModel processModel,
     IDbSession session)
 {
     NodeMediatorGateway nodeMediator = null;
     if (gActivity.ActivityType == ActivityTypeEnum.GatewayNode)
     {
         if (gActivity.GatewayDirectionType == GatewayDirectionEnum.AndSplit)
         {
             nodeMediator = new NodeMediatorAndSplit(gActivity, processModel, session);
         }
         else if (gActivity.GatewayDirectionType == GatewayDirectionEnum.OrSplit)
         {
             nodeMediator = new NodeMediatorOrSplit(gActivity, processModel, session);
         }
         else if (gActivity.GatewayDirectionType == GatewayDirectionEnum.XOrSplit)
         {
             nodeMediator = new NodeMediatorXOrSplit(gActivity, processModel, session);
         }
         else if (gActivity.GatewayDirectionType == GatewayDirectionEnum.AndJoin)
         {
             nodeMediator = new NodeMediatorAndJoin(gActivity, processModel, session);
         }
         else if (gActivity.GatewayDirectionType == GatewayDirectionEnum.OrJoin)
         {
             nodeMediator = new NodeMediatorOrJoin(gActivity, processModel, session);
         }
         else if (gActivity.GatewayDirectionType == GatewayDirectionEnum.XOrJoin)
         {
             nodeMediator = new NodeMediatorXOrJoin(gActivity, processModel, session);
         }
         else
         {
             throw new XmlDefinitionException(string.Format("不明确的节点分支Gateway类型!{0}", gActivity.GatewayDirectionType.ToString()));
         }
     }
     else
     {
         throw new XmlDefinitionException(string.Format("不明确的节点类型!{0}", gActivity.ActivityType.ToString()));
     }
     return nodeMediator;
 }
开发者ID:uname-yang,项目名称:WorkFlow-Engine-OData-WebApi-with-OdataClient,代码行数:42,代码来源:NodeMediatorGatewayFactory.cs


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