diff --git a/OpenAuth.App/ApplyTransitionHistoryApp.cs b/OpenAuth.App/ApplyTransitionHistoryApp.cs new file mode 100644 index 00000000..80bf4976 --- /dev/null +++ b/OpenAuth.App/ApplyTransitionHistoryApp.cs @@ -0,0 +1,38 @@ +using System; +using OpenAuth.Domain; +using OpenAuth.Domain.Interface; + +namespace OpenAuth.App +{ + public class ApplyTransitionHistoryApp + { + private IRepository _repository; + + public ApplyTransitionHistoryApp(IRepository 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); + } + } +} \ No newline at end of file diff --git a/OpenAuth.App/OpenAuth.App.csproj b/OpenAuth.App/OpenAuth.App.csproj index 06d12ce7..c4551478 100644 --- a/OpenAuth.App/OpenAuth.App.csproj +++ b/OpenAuth.App/OpenAuth.App.csproj @@ -80,8 +80,10 @@ + + diff --git a/OpenAuth.App/RoleManagerApp.cs b/OpenAuth.App/RoleManagerApp.cs index c9cdda0f..f007e33b 100644 --- a/OpenAuth.App/RoleManagerApp.cs +++ b/OpenAuth.App/RoleManagerApp.cs @@ -147,5 +147,14 @@ namespace OpenAuth.App { _relevanceRepository.DeleteBy("UserRole", roleids.ToLookup(roleId => userId)); } + + public List GetUsersInRole(string ruleName) + { + var role = _repository.FindSingle(u => u.Name == ruleName); + if (role == null) return null; + + return _relevanceRepository.Find(u => u.Key == "UserRole" + && u.SecondId == role.Id).Select(u => u.FirstId).ToList(); + } } } \ No newline at end of file diff --git a/OpenAuth.App/UserManagerApp.cs b/OpenAuth.App/UserManagerApp.cs index 1eb1ebe0..0cc3244b 100644 --- a/OpenAuth.App/UserManagerApp.cs +++ b/OpenAuth.App/UserManagerApp.cs @@ -143,5 +143,9 @@ namespace OpenAuth.App _relevanceRepository.AddRelevance("UserOrg", orgIds.ToLookup(u => user.Id)); } + public IEnumerable GetUsers(IEnumerable userids) + { + return _repository.Find(u => userids.Contains(u.Id)); + } } } \ No newline at end of file diff --git a/OpenAuth.App/WorkflowInboxApp.cs b/OpenAuth.App/WorkflowInboxApp.cs new file mode 100644 index 00000000..62122576 --- /dev/null +++ b/OpenAuth.App/WorkflowInboxApp.cs @@ -0,0 +1,28 @@ +using System; +using OpenAuth.App.ViewModel; +using OpenAuth.Domain; +using OpenAuth.Domain.Interface; + +namespace OpenAuth.App +{ + public class WorkflowInboxApp + { + private IRepository _repository; + + public WorkflowInboxApp(IRepository repository) + { + _repository = repository; + } + + + public void DeleteAllByProcess(Guid processId) + { + _repository.Delete(u =>u.ProcessId == processId); + } + + public void Add(WorkflowInbox newInboxItem) + { + _repository.Add(newInboxItem); + } + } +} \ No newline at end of file diff --git a/OpenAuth.Domain/ApplyTransitionHistory.cs b/OpenAuth.Domain/ApplyTransitionHistory.cs new file mode 100644 index 00000000..fac480e7 --- /dev/null +++ b/OpenAuth.Domain/ApplyTransitionHistory.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a CodeSmith Template. +// +// DO NOT MODIFY contents of this file. Changes to this +// file will be lost if the code is regenerated. +// Author:Yubao Li +// +//------------------------------------------------------------------------------ + +using System; + +namespace OpenAuth.Domain +{ + /// + /// + /// + public partial class ApplyTransitionHistory :Entity + { + public ApplyTransitionHistory() + { + this.AllowedToUserNames= string.Empty; + this.TransitionTime= DateTime.Now; + this.InitialState= string.Empty; + this.DestinationState= string.Empty; + this.Command= string.Empty; + } + + /// + /// + /// + public System.Guid ApplyId { get; set; } + /// + /// + /// + public System.Guid? UserId { get; set; } + /// + /// + /// + public string AllowedToUserNames { get; set; } + /// + /// + /// + public System.DateTime? TransitionTime { get; set; } + /// + /// + /// + public long Order { get; set; } + /// + /// + /// + public string InitialState { get; set; } + /// + /// + /// + public string DestinationState { get; set; } + /// + /// + /// + public string Command { get; set; } + + } +} \ No newline at end of file diff --git a/OpenAuth.Domain/OpenAuth.Domain.csproj b/OpenAuth.Domain/OpenAuth.Domain.csproj index c56f7ca1..b336de46 100644 --- a/OpenAuth.Domain/OpenAuth.Domain.csproj +++ b/OpenAuth.Domain/OpenAuth.Domain.csproj @@ -42,6 +42,7 @@ + @@ -72,6 +73,7 @@ +