private static List <UserDTO> resolvePaticipantToUserDTOs( Paticipant paticipant, FlowInstance flowInstance) { if (paticipant.PaticipantType == "user") // 用户 { var result = new List <UserDTO>(); using (var db = new EnouFlowOrgMgmtContext()) { result.Add( new UserHelper(db).getUserDTO( (int)paticipant.PaticipantObj.userId)); } return(result); } if (paticipant.PaticipantType == "role") // 角色 { using (var db = new EnouFlowOrgMgmtContext()) { return(new UserHelper(db).getUserDTOsOfRole((int)paticipant.PaticipantObj.roleId)); } } if (paticipant.PaticipantType == "dynamic") // 流程动态用户 { FlowDynamicUser flowDynamicUser; using (var db = new EnouFlowTemplateDbContext()) { flowDynamicUser = db.flowDynamicUsers.Find( paticipant.PaticipantObj.flowDynamicUserId); } if (flowDynamicUser != null) { return(ResolveFlowDynamicUser( flowDynamicUser.script, flowDynamicUser.name, flowInstance)); } } return(new List <UserDTO>()); }
public void Setup() { db = new EnouFlowTemplateDbContext(); }