流程跳转

This commit is contained in:
yubaolee
2016-09-05 20:07:10 +08:00
parent 8f2ae61905
commit d5d476bae4
21 changed files with 269 additions and 58 deletions

View File

@@ -34,7 +34,7 @@ namespace OpenAuth.Mvc.Models
_runtime = new WorkflowRuntime(new Guid("{8D38DB8F-F3D5-4F26-A989-4FDD40F32D9D}"))
.WithBuilder(builder)
// .WithRuleProvider(new WorkflowRuleProvider())
.WithRuleProvider(new WorkflowRuleProvider())
// .WithActionProvider(new WorkflowActionProvider())
.WithPersistenceProvider(new MSSQLProvider(connectionString))
.WithTimerManager(new TimerManager())
@@ -62,12 +62,7 @@ namespace OpenAuth.Mvc.Models
var nextState = WorkflowInit.Runtime.GetLocalizedStateName(e.ProcessId, e.ProcessInstance.CurrentState);
var _app = AutofacExt.GetFromFac<GoodsApplyApp>();
var goodsapply = _app.Get(e.ProcessId);
if (goodsapply != null)
{
goodsapply.StateName = nextState;
}
_app.ChangeState(goodsapply.Id, e.ProcessInstance.CurrentState, nextState);
_app.ChangeState(e.ProcessId, e.ProcessInstance.CurrentState, nextState);
}
}

View File

@@ -1,11 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using OpenAuth.App;
using OptimaJet.Workflow.Core.Model;
using OptimaJet.Workflow.Core.Runtime;
namespace OpenAuth.Mvc.Models
{
/// <summary>
/// 判断角色
/// </summary>
public class WorkflowRuleProvider : IWorkflowRuleProvider
{
private RoleManagerApp _app;
@@ -15,6 +19,9 @@ namespace OpenAuth.Mvc.Models
_app = AutofacExt.GetFromFac<RoleManagerApp>();
}
/// <summary>
/// 加载角色列表,供流程设计的时候进行选择
/// </summary>
public List<string> GetRules()
{
var roles = _app.Load(Guid.Empty, 1, 100).list;
@@ -26,10 +33,26 @@ namespace OpenAuth.Mvc.Models
return rolestrs;
}
/// <summary>
/// Checks the specified process instance.
/// <para>李玉宝于2016-09-05 16:43:07</para>
/// </summary>
/// <param name="processInstance">The process instance.</param>
/// <param name="runtime">The runtime.</param>
/// <param name="identityId">用户ID</param>
/// <param name="ruleName">Name of the rule.</param>
/// <param name="parameter">The parameter.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
public bool Check(ProcessInstance processInstance, WorkflowRuntime runtime, string identityId, string ruleName,
string parameter)
{
throw new NotImplementedException();
var userRole = _app.LoadForUser(Guid.Parse(identityId));
foreach (var role in userRole)
{
if (role.Name == ruleName)
return true;
}
return false;
}
public IEnumerable<string> GetIdentities(ProcessInstance processInstance, WorkflowRuntime runtime, string ruleName, string parameter)