mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-11-09 02:44:44 +08:00
Merge branch 'newui'
This commit is contained in:
@@ -31,7 +31,8 @@ namespace OpenAuth.App
|
|||||||
{
|
{
|
||||||
UserId = model.UserId,
|
UserId = model.UserId,
|
||||||
Name = model.Name,
|
Name = model.Name,
|
||||||
Comment = model.Comment
|
Comment = model.Comment,
|
||||||
|
WorkflowName = model.WorkflowName
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ namespace OpenAuth.App.ViewModel
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public System.Guid? ControllerUserId { get; set; }
|
public System.Guid? ControllerUserId { get; set; }
|
||||||
|
|
||||||
|
public string WorkflowName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 可用命令
|
/// 可用命令
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -60,5 +60,7 @@ namespace OpenAuth.Domain
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public System.Guid? ControllerUserId { get; set; }
|
public System.Guid? ControllerUserId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public string WorkflowName { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,8 +24,10 @@ using OpenAuth.Repository;
|
|||||||
|
|
||||||
namespace OpenAuth.Mvc
|
namespace OpenAuth.Mvc
|
||||||
{
|
{
|
||||||
internal static class AutofacExt
|
public static class AutofacExt
|
||||||
{
|
{
|
||||||
|
private static IContainer _container;
|
||||||
|
|
||||||
public static void InitAutofac()
|
public static void InitAutofac()
|
||||||
{
|
{
|
||||||
var builder = new ContainerBuilder();
|
var builder = new ContainerBuilder();
|
||||||
@@ -61,8 +63,8 @@ namespace OpenAuth.Mvc
|
|||||||
builder.RegisterFilterProvider();
|
builder.RegisterFilterProvider();
|
||||||
|
|
||||||
// Set the dependency resolver to be Autofac.
|
// Set the dependency resolver to be Autofac.
|
||||||
var container = builder.Build();
|
_container = builder.Build();
|
||||||
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
|
DependencyResolver.SetResolver(new AutofacDependencyResolver(_container));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -71,7 +73,8 @@ namespace OpenAuth.Mvc
|
|||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
public static T GetFromFac<T>()
|
public static T GetFromFac<T>()
|
||||||
{
|
{
|
||||||
return (T)DependencyResolver.Current.GetService(typeof(T));
|
return _container.Resolve<T>();
|
||||||
|
// return (T)DependencyResolver.Current.GetService(typeof(T));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -72,11 +72,26 @@ function MainGrid() {
|
|||||||
MainGrid.prototype = new Grid();
|
MainGrid.prototype = new Grid();
|
||||||
var list = new MainGrid();
|
var list = new MainGrid();
|
||||||
|
|
||||||
|
var selectScheme = function(val) {
|
||||||
|
$("#WorkflowName").empty();
|
||||||
|
$.getJSON('/workflowschemas/Load',
|
||||||
|
function (data) {
|
||||||
|
$.each(data.list, function (i, n) {
|
||||||
|
$("#WorkflowName").append("<option value='" + this.Code + "'>" + this.Code + "</option>");
|
||||||
|
});
|
||||||
|
|
||||||
|
if (val != undefined) {
|
||||||
|
$('#WorkflowName').val(val);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//添加(编辑)对话框
|
//添加(编辑)对话框
|
||||||
var editDlg = function () {
|
var editDlg = function () {
|
||||||
var show = function () {
|
var show = function () {
|
||||||
BJUI.dialog({ id: 'editDlg', title: '编辑对话框', target: '#editDlg' });
|
BJUI.dialog({ id: 'editDlg', title: '编辑对话框', target: '#editDlg' });
|
||||||
|
|
||||||
$("#btnSave").on("click", function () {
|
$("#btnSave").on("click", function () {
|
||||||
editDlg.save();
|
editDlg.save();
|
||||||
});
|
});
|
||||||
@@ -84,6 +99,7 @@ var editDlg = function () {
|
|||||||
return {
|
return {
|
||||||
add: function () { //弹出添加
|
add: function () { //弹出添加
|
||||||
show();
|
show();
|
||||||
|
selectScheme();
|
||||||
$.CurrentDialog.find("form")[0].reset(); //reset方法只能通过dom调用
|
$.CurrentDialog.find("form")[0].reset(); //reset方法只能通过dom调用
|
||||||
$("#Id").val('00000000-0000-0000-0000-000000000000');
|
$("#Id").val('00000000-0000-0000-0000-000000000000');
|
||||||
},
|
},
|
||||||
@@ -92,6 +108,7 @@ var editDlg = function () {
|
|||||||
$('#Id').val(ret.Id);
|
$('#Id').val(ret.Id);
|
||||||
$('#Name').val(ret.Name);
|
$('#Name').val(ret.Name);
|
||||||
$('#Comment').val(ret.Comment);
|
$('#Comment').val(ret.Comment);
|
||||||
|
selectScheme(ret.WorkflowName);
|
||||||
},
|
},
|
||||||
save: function () { //编辑-->保存
|
save: function () { //编辑-->保存
|
||||||
$('#editForm').isValid(function (v) {
|
$('#editForm').isValid(function (v) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
var schemecode = 'SimpleWF';
|
|
||||||
var wfdesigner = undefined;
|
var wfdesigner = undefined;
|
||||||
|
|
||||||
function wfdesignerRedraw() {
|
function wfdesignerRedraw() {
|
||||||
@@ -9,6 +9,7 @@ function wfdesignerRedraw() {
|
|||||||
wfdesigner.destroy();
|
wfdesigner.destroy();
|
||||||
}
|
}
|
||||||
var processid = $("#processId").val();
|
var processid = $("#processId").val();
|
||||||
|
var schemecode = $("#schemeCode").val();
|
||||||
|
|
||||||
wfdesigner = new WorkflowDesigner({
|
wfdesigner = new WorkflowDesigner({
|
||||||
name: 'simpledesigner',
|
name: 'simpledesigner',
|
||||||
|
|||||||
@@ -33,4 +33,12 @@ var QueryString = function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return query_string;
|
return query_string;
|
||||||
}();
|
}();
|
||||||
|
|
||||||
|
(function ($) {
|
||||||
|
$.getUrlParam = function (name) {
|
||||||
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
|
||||||
|
var r = window.location.search.substr(1).match(reg);
|
||||||
|
if (r != null) return unescape(r[2]); return null;
|
||||||
|
}
|
||||||
|
})(jQuery);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
{
|
{
|
||||||
apply.UserId = AuthUtil.GetCurrentUser().User.Id;
|
apply.UserId = AuthUtil.GetCurrentUser().User.Id;
|
||||||
_app.AddOrUpdate(apply);
|
_app.AddOrUpdate(apply);
|
||||||
CreateWorkflowIfNotExists(apply.Id);
|
CreateWorkflowIfNotExists(apply.Id,apply.WorkflowName);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -110,14 +110,14 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void CreateWorkflowIfNotExists(Guid id)
|
private void CreateWorkflowIfNotExists(Guid id, string schemecode)
|
||||||
{
|
{
|
||||||
if (WorkflowInit.Runtime.IsProcessExists(id))
|
if (WorkflowInit.Runtime.IsProcessExists(id))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
using (var sync = new WorkflowSync(WorkflowInit.Runtime, id))
|
using (var sync = new WorkflowSync(WorkflowInit.Runtime, id))
|
||||||
{
|
{
|
||||||
WorkflowInit.Runtime.CreateInstance("SimpleWF", id);
|
WorkflowInit.Runtime.CreateInstance(schemecode, id);
|
||||||
|
|
||||||
sync.StatrtWaitingFor(new List<ProcessStatus> { ProcessStatus.Initialized, ProcessStatus.Initialized });
|
sync.StatrtWaitingFor(new List<ProcessStatus> { ProcessStatus.Initialized, ProcessStatus.Initialized });
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,8 @@
|
|||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<input value="@Model.Id" id="processId" class="hidden" />
|
<input value="@Model.Id" id="processId" class="hidden"/>
|
||||||
|
<input value="@Model.WorkflowName" id="schemeCode" class="hidden" />
|
||||||
<h3 class="panel-title">
|
<h3 class="panel-title">
|
||||||
@Model.Name
|
@Model.Name
|
||||||
</h3>
|
</h3>
|
||||||
|
|||||||
@@ -29,11 +29,17 @@
|
|||||||
<input type="text" id="Name" name="Name" value="" />
|
<input type="text" id="Name" name="Name" value="" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="Comment" class="control-label x120">申请描述:</label>
|
||||||
|
<textarea type="text" id="Comment" name="Comment" value=""></textarea>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Comment" class="control-label x120">申请描述:</label>
|
<label for="Comment" class="control-label x120">流程模板:</label>
|
||||||
<textarea type="text" id="Comment" name="Comment" value=""></textarea>
|
<select id="WorkflowName" name="WorkflowName"></select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
<div id="wfdesigner"></div>
|
<div id="wfdesigner"></div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var schemecode = QueryString["schemeName"];
|
var schemecode = decodeURI(QueryString["schemeName"]);
|
||||||
var inputScheme = $("#schemeName");
|
var inputScheme = $("#schemeName");
|
||||||
var add = schemecode == "" ? true : false;
|
var add = schemecode == "" ? true : false;
|
||||||
if (!add) {
|
if (!add) {
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
loginInfo: { url: 'Login', title: '登录', width: 400, height: 200 }, // 会话超时后弹出登录对话框
|
loginInfo: { url: 'Login', title: '登录', width: 400, height: 200 }, // 会话超时后弹出登录对话框
|
||||||
statusCode: { ok: 200, error: 300, timeout: 301 }, //[可选]
|
statusCode: { ok: 200, error: 300, timeout: 301 }, //[可选]
|
||||||
ajaxTimeout: 50000, //[可选]全局Ajax请求超时时间(毫秒)
|
ajaxTimeout: 50000, //[可选]全局Ajax请求超时时间(毫秒)
|
||||||
pageInfo: { total: 'total', list:'rows', pageCurrent: 'page', pageSize: 'pageSize', orderField: 'orderField', orderDirection: 'orderDirection' }, //[可选]分页参数
|
pageInfo: { total: 'total', list:'rows', pageCurrent: 'pageCurrent', pageSize: 'pageSize', orderField: 'orderField', orderDirection: 'orderDirection' }, //[可选]分页参数
|
||||||
alertMsg: { displayPosition: 'topcenter', displayMode: 'slide', alertTimeout: 3000 }, //[可选]信息提示的显示位置,显隐方式,及[info/correct]方式时自动关闭延时(毫秒)
|
alertMsg: { displayPosition: 'topcenter', displayMode: 'slide', alertTimeout: 3000 }, //[可选]信息提示的显示位置,显隐方式,及[info/correct]方式时自动关闭延时(毫秒)
|
||||||
keys: { statusCode: 'statusCode', message: 'message' }, //[可选]
|
keys: { statusCode: 'statusCode', message: 'message' }, //[可选]
|
||||||
ui: {
|
ui: {
|
||||||
|
|||||||
@@ -45,6 +45,10 @@ namespace OpenAuth.Repository.Models.Mapping
|
|||||||
.HasColumnName("State")
|
.HasColumnName("State")
|
||||||
.HasMaxLength(1024)
|
.HasMaxLength(1024)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
Property(t => t.WorkflowName)
|
||||||
|
.HasColumnName("WorkflowName")
|
||||||
|
.HasMaxLength(1024)
|
||||||
|
.IsRequired();
|
||||||
Property(t => t.StateName)
|
Property(t => t.StateName)
|
||||||
.HasColumnName("StateName")
|
.HasColumnName("StateName")
|
||||||
.HasMaxLength(1024)
|
.HasMaxLength(1024)
|
||||||
|
|||||||
@@ -4,9 +4,11 @@
|
|||||||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
|
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
|
||||||
</configSections>
|
<section name="autofac" type="Autofac.Configuration.SectionHandler, Autofac.Configuration" />
|
||||||
|
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>
|
||||||
<connectionStrings>
|
<connectionStrings>
|
||||||
<add name="OpenAuthDBContext" connectionString="Data Source=.;Initial Catalog=OpenAuthDB;Persist Security Info=True;User ID=sa;Password=000000;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
|
<add name="OpenAuthDBContext" connectionString="Data Source=.;Initial Catalog=OpenAuthDB;Persist Security Info=True;User ID=sa;Password=000000;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
|
||||||
|
<add name="WorkFlow" connectionString="Data Source=.;Initial Catalog=Workflow.Net;Persist Security Info=True;User ID=sa;Password=000000;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
|
||||||
</connectionStrings>
|
</connectionStrings>
|
||||||
<log4net>
|
<log4net>
|
||||||
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
|
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
|
||||||
@@ -27,6 +29,20 @@
|
|||||||
<appender-ref ref="RollingLogFileAppender" />
|
<appender-ref ref="RollingLogFileAppender" />
|
||||||
</root>
|
</root>
|
||||||
</log4net>
|
</log4net>
|
||||||
|
|
||||||
|
<autofac defaultAssembly=" OpenAuth.Repository">
|
||||||
|
<components>
|
||||||
|
<component type=" OpenAuth.Repository.UserRepository" service=" OpenAuth.Domain.Interface.IUserRepository,OpenAuth.Domain" />
|
||||||
|
<component type=" OpenAuth.Repository.OrgRepository" service="OpenAuth.Domain.Interface.IOrgRepository,OpenAuth.Domain" />
|
||||||
|
<component type=" OpenAuth.Repository.RoleRepository" service="OpenAuth.Domain.Interface.IRoleRepository,OpenAuth.Domain" />
|
||||||
|
<component type=" OpenAuth.Repository.ModuleRepository" service="OpenAuth.Domain.Interface.IModuleRepository,OpenAuth.Domain" />
|
||||||
|
<component type=" OpenAuth.Repository.RelevanceRepository" service="OpenAuth.Domain.Interface.IRelevanceRepository,OpenAuth.Domain" />
|
||||||
|
<component type=" OpenAuth.Repository.CategoryRepository" service="OpenAuth.Domain.Interface.ICategoryRepository,OpenAuth.Domain" />
|
||||||
|
<component type=" OpenAuth.Repository.ResourceRepository" service="OpenAuth.Domain.Interface.IResourceRepository,OpenAuth.Domain" />
|
||||||
|
<component type=" OpenAuth.Repository.StockRepository" service="OpenAuth.Domain.Interface.IStockRepository,OpenAuth.Domain" />
|
||||||
|
<component type=" OpenAuth.Repository.Workflow.WorkflowSchemeRepository" service="OpenAuth.Domain.Interface.IWorkflowSchemeRepository,OpenAuth.Domain" />
|
||||||
|
</components>
|
||||||
|
</autofac>
|
||||||
<entityFramework>
|
<entityFramework>
|
||||||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
|
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
|
||||||
<parameters>
|
<parameters>
|
||||||
@@ -44,6 +60,18 @@
|
|||||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
|
||||||
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|||||||
44
OpenAuth.UnitTest/AutofacExt.cs
Normal file
44
OpenAuth.UnitTest/AutofacExt.cs
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Web.Mvc;
|
||||||
|
using Autofac;
|
||||||
|
using Autofac.Configuration;
|
||||||
|
using Autofac.Integration.Mvc;
|
||||||
|
using OpenAuth.App;
|
||||||
|
using OpenAuth.Domain.Interface;
|
||||||
|
using OpenAuth.Domain.Service;
|
||||||
|
using OpenAuth.Repository;
|
||||||
|
|
||||||
|
namespace OpenAuth.UnitTest
|
||||||
|
{
|
||||||
|
public class AutofacExt
|
||||||
|
{
|
||||||
|
private static IContainer _container;
|
||||||
|
|
||||||
|
public static void InitDI()
|
||||||
|
{
|
||||||
|
var builder = new ContainerBuilder();
|
||||||
|
|
||||||
|
//注册数据库基础操作和工作单元
|
||||||
|
builder.RegisterGeneric(typeof(BaseRepository<>)).As(typeof(IRepository<>));
|
||||||
|
builder.RegisterType(typeof(UnitWork)).As(typeof(IUnitWork));
|
||||||
|
|
||||||
|
//注册WebConfig中的配置
|
||||||
|
builder.RegisterModule(new ConfigurationSettingsReader("autofac"));
|
||||||
|
|
||||||
|
//注册app层
|
||||||
|
builder.RegisterAssemblyTypes(Assembly.GetAssembly(typeof(UserManagerApp)));
|
||||||
|
|
||||||
|
//注册领域服务
|
||||||
|
builder.RegisterAssemblyTypes(Assembly.GetAssembly(typeof(AuthoriseService)))
|
||||||
|
.Where(u => u.Namespace == "OpenAuth.Domain.Service");
|
||||||
|
|
||||||
|
_container = builder.Build();
|
||||||
|
DependencyResolver.SetResolver(new AutofacDependencyResolver(_container));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static T GetFromFac<T>()
|
||||||
|
{
|
||||||
|
return _container.Resolve<T>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -41,18 +41,67 @@
|
|||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
<Reference Include="Autofac, Version=3.5.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<HintPath>..\packages\Autofac.3.5.2\lib\net40\Autofac.dll</HintPath>
|
||||||
<HintPath>..\packages\EntityFramework.6.1.3\lib\net40\EntityFramework.dll</HintPath>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="EntityFramework.SqlServer">
|
<Reference Include="Autofac.Configuration, Version=3.3.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\EntityFramework.6.1.3\lib\net40\EntityFramework.SqlServer.dll</HintPath>
|
<HintPath>..\packages\Autofac.Configuration.3.3.0\lib\net40\Autofac.Configuration.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Autofac.Integration.Mvc, Version=3.3.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Autofac.Mvc5.3.3.4\lib\net45\Autofac.Integration.Mvc.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="OptimaJet.Workflow.Core, Version=1.5.5.0, Culture=neutral, PublicKeyToken=3d29392dccd464d7, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\WorkflowEngine.NET-Core.1.5.5.2\lib\net45\OptimaJet.Workflow.Core.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||||
<Reference Include="System.Core">
|
<Reference Include="System.Core">
|
||||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Choose>
|
<Choose>
|
||||||
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
|
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
|
||||||
@@ -69,10 +118,14 @@
|
|||||||
</Otherwise>
|
</Otherwise>
|
||||||
</Choose>
|
</Choose>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="AutofacExt.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="TestBase.cs" />
|
||||||
<Compile Include="TestFunction.cs" />
|
<Compile Include="TestFunction.cs" />
|
||||||
<Compile Include="TestLogin.cs" />
|
<Compile Include="TestLogin.cs" />
|
||||||
<Compile Include="TestAuthen.cs" />
|
<Compile Include="TestAuthen.cs" />
|
||||||
|
<Compile Include="TestCommonApply.cs" />
|
||||||
|
<Compile Include="TestUser.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="App.config">
|
<None Include="App.config">
|
||||||
@@ -93,6 +146,10 @@
|
|||||||
<Project>{6108DA8E-92A1-4ABE-B9F5-26D64D55CA2C}</Project>
|
<Project>{6108DA8E-92A1-4ABE-B9F5-26D64D55CA2C}</Project>
|
||||||
<Name>OpenAuth.Domain</Name>
|
<Name>OpenAuth.Domain</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\OpenAuth.Mvc\OpenAuth.Mvc.csproj">
|
||||||
|
<Project>{2A9D9687-1822-41CF-B7DF-819BFC0F8FE9}</Project>
|
||||||
|
<Name>OpenAuth.Mvc</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\OpenAuth.Repository\OpenAuth.Repository.csproj">
|
<ProjectReference Include="..\OpenAuth.Repository\OpenAuth.Repository.csproj">
|
||||||
<Project>{E8DF8DEA-E2CF-4BDB-8F4F-3F8205B0E03A}</Project>
|
<Project>{E8DF8DEA-E2CF-4BDB-8F4F-3F8205B0E03A}</Project>
|
||||||
<Name>OpenAuth.Repository</Name>
|
<Name>OpenAuth.Repository</Name>
|
||||||
|
|||||||
10
OpenAuth.UnitTest/TestBase.cs
Normal file
10
OpenAuth.UnitTest/TestBase.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
namespace OpenAuth.UnitTest
|
||||||
|
{
|
||||||
|
public class TestBase
|
||||||
|
{
|
||||||
|
public TestBase()
|
||||||
|
{
|
||||||
|
AutofacExt.InitDI();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
59
OpenAuth.UnitTest/TestCommonApply.cs
Normal file
59
OpenAuth.UnitTest/TestCommonApply.cs
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
using OpenAuth.App;
|
||||||
|
using OpenAuth.App.ViewModel;
|
||||||
|
using OpenAuth.Domain;
|
||||||
|
using OpenAuth.Mvc.Models;
|
||||||
|
using OptimaJet.Workflow.Core.Persistence;
|
||||||
|
using OptimaJet.Workflow.Core.Runtime;
|
||||||
|
|
||||||
|
namespace OpenAuth.UnitTest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 测试通用申请流程
|
||||||
|
/// </summary>
|
||||||
|
[TestClass]
|
||||||
|
public class TestCommonApply : TestBase
|
||||||
|
{
|
||||||
|
private CommonApplyApp _app;
|
||||||
|
|
||||||
|
public TestCommonApply()
|
||||||
|
{
|
||||||
|
_app = AutofacExt.GetFromFac<CommonApplyApp>();
|
||||||
|
Mvc.AutofacExt.InitAutofac();
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void Addd()
|
||||||
|
{
|
||||||
|
var commonApply = new CommonApply
|
||||||
|
{
|
||||||
|
Id = Guid.Empty,
|
||||||
|
WorkflowName = "新建模板",
|
||||||
|
State = "",
|
||||||
|
StateName = "",
|
||||||
|
Name = "测试"+DateTime.Now.ToLongTimeString()
|
||||||
|
};
|
||||||
|
_app.AddOrUpdate(commonApply);
|
||||||
|
|
||||||
|
CreateWorkflowIfNotExists(commonApply.Id, commonApply.WorkflowName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void CreateWorkflowIfNotExists(Guid id, string schemecode)
|
||||||
|
{
|
||||||
|
if (WorkflowInit.Runtime.IsProcessExists(id))
|
||||||
|
return;
|
||||||
|
|
||||||
|
using (var sync = new WorkflowSync(WorkflowInit.Runtime, id))
|
||||||
|
{
|
||||||
|
WorkflowInit.Runtime.CreateInstance(schemecode, id);
|
||||||
|
|
||||||
|
sync.StatrtWaitingFor(new List<ProcessStatus> { ProcessStatus.Initialized, ProcessStatus.Initialized });
|
||||||
|
|
||||||
|
sync.Wait(new TimeSpan(0, 0, 10));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
53
OpenAuth.UnitTest/TestUser.cs
Normal file
53
OpenAuth.UnitTest/TestUser.cs
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
using OpenAuth.App;
|
||||||
|
using OpenAuth.App.ViewModel;
|
||||||
|
|
||||||
|
namespace OpenAuth.UnitTest
|
||||||
|
{
|
||||||
|
[TestClass]
|
||||||
|
public class TestUser : TestBase
|
||||||
|
{
|
||||||
|
private UserManagerApp _app;
|
||||||
|
|
||||||
|
public TestUser()
|
||||||
|
{
|
||||||
|
_app = AutofacExt.GetFromFac<UserManagerApp>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void AddUser()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
var random = new Random();
|
||||||
|
int val = random.Next();
|
||||||
|
_app.AddOrUpdate(new UserView
|
||||||
|
{
|
||||||
|
|
||||||
|
Account = "test" + val,
|
||||||
|
Name = "test" + val,
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
OrganizationIds = "990cb229-cc18-41f3-8e2b-13f0f0110798,08f41bf6-4388-4b1e-bd3e-2ff538b44b1b",
|
||||||
|
Organizations = "研发部,研发1组",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void GetUser()
|
||||||
|
{
|
||||||
|
var users = _app.Load(new Guid("990cb229-cc18-41f3-8e2b-13f0f0110798"), 2, 30);
|
||||||
|
|
||||||
|
Console.WriteLine(users.total);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="EntityFramework" version="6.1.3" targetFramework="net40" requireReinstallation="True" />
|
<package id="Autofac" version="3.5.2" targetFramework="net45" />
|
||||||
|
<package id="Autofac.Configuration" version="3.3.0" targetFramework="net45" />
|
||||||
|
<package id="Autofac.Mvc5" version="3.3.4" targetFramework="net45" />
|
||||||
|
<package id="EntityFramework" version="6.1.3" targetFramework="net45" />
|
||||||
|
<package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net45" />
|
||||||
|
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net45" />
|
||||||
|
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net45" />
|
||||||
|
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
|
||||||
|
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
|
||||||
|
<package id="WorkflowEngine.NET-Core" version="1.5.5.2" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
||||||
BIN
建表&初始化数据.sql
BIN
建表&初始化数据.sql
Binary file not shown.
Reference in New Issue
Block a user