增加流程状态转换列表

This commit is contained in:
yubaolee
2016-09-07 11:11:34 +08:00
parent 96e8eec1e7
commit 0c82f7b8c3
20 changed files with 499 additions and 38 deletions

View File

@@ -0,0 +1,38 @@
using System;
using OpenAuth.Domain;
using OpenAuth.Domain.Interface;
namespace OpenAuth.App
{
public class ApplyTransitionHistoryApp
{
private IRepository<ApplyTransitionHistory> _repository;
public ApplyTransitionHistoryApp(IRepository<ApplyTransitionHistory> repository)
{
_repository = repository;
}
public ApplyTransitionHistory Get(Guid processId, string currentstate, string nextState)
{
return _repository.FindSingle(h => h.ApplyId == processId && !h.TransitionTime.HasValue &&
h.InitialState == currentstate && h.DestinationState == nextState);
}
public void Add(ApplyTransitionHistory historyItem)
{
_repository.Add(historyItem);
}
public void Update(ApplyTransitionHistory historyItem)
{
_repository.Update(historyItem);
}
public void DeleteByProcess(Guid processId)
{
_repository.Delete(dth =>
dth.ApplyId == processId && !dth.TransitionTime.HasValue);
}
}
}