添加DI支持

This commit is contained in:
yubaolee 2015-09-23 00:10:11 +08:00
parent 2a5cdd453f
commit a284f975c3
10 changed files with 383 additions and 363 deletions

View File

@ -0,0 +1,50 @@
// ***********************************************************************
// Assembly : Infrastructure
// Author : Administrator
// Created : 09-22-2015
//
// Last Modified By : Administrator
// Last Modified On : 09-22-2015
// ***********************************************************************
// <copyright file="SessionHelper.cs" company="">
// Copyright (c) . All rights reserved.
// </copyright>
// <summary>SESSION辅助类</summary>
// ***********************************************************************
using System;
using System.Web;
namespace Infrastructure.Helper
{
/// <summary>
/// Session 帮助类
/// </summary>
public class SessionHelper
{
private static readonly string SessionUser = "SESSION_USER";
public static void AddSessionUser<T>(T user)
{
HttpContext rq = HttpContext.Current;
rq.Session[SessionUser] = user;
}
public static T GetSessionUser<T>()
{
try
{
HttpContext rq = HttpContext.Current;
return (T)rq.Session[SessionUser];
}
catch (Exception e)
{
throw new Exception(e.Message);
}
}
public static void Clear()
{
HttpContext rq = HttpContext.Current;
rq.Session[SessionUser] = null;
}
}
}

View File

@ -1,4 +1,6 @@
using System; using System;
using System.Collections.Generic;
using OpenAuth.Domain;
using OpenAuth.Domain.Interface; using OpenAuth.Domain.Interface;
namespace OpenAuth.App namespace OpenAuth.App
@ -24,5 +26,10 @@ namespace OpenAuth.App
} }
public IEnumerable<User> LoadUsers()
{
return _repository.LoadUsers();
}
} }
} }

View File

@ -1,16 +1,11 @@
using Microsoft.AspNet.Identity; using System;
using Microsoft.Owin.Security;
using OpenAuth.Mvc.Models;
using System.Collections.Generic;
using System.Security.Claims;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc; using System.Web.Mvc;
using Infrastructure.Helper; using Infrastructure.Helper;
using Newtonsoft.Json; using Newtonsoft.Json;
using OpenAuth.App; using OpenAuth.App;
using OpenAuth.Domain;
using OpenAuth.Domain.Interface; using OpenAuth.Domain.Interface;
using OpenAuth.Mvc.Models;
namespace OpenAuth.Mvc.Controllers namespace OpenAuth.Mvc.Controllers
{ {
@ -18,12 +13,10 @@ namespace OpenAuth.Mvc.Controllers
public class AccountController : Controller public class AccountController : Controller
{ {
private LoginApp _loginApp; private LoginApp _loginApp;
private IUserRepository _userRepository;
public AccountController(IUserRepository repository) public AccountController()
{ {
_userRepository = repository; _loginApp = (LoginApp) DependencyResolver.Current.GetService(typeof (LoginApp));
_loginApp = new LoginApp(_userRepository);
} }
// //
// GET: /Account/Login // GET: /Account/Login
@ -44,15 +37,15 @@ namespace OpenAuth.Mvc.Controllers
if (ModelState.IsValid) if (ModelState.IsValid)
{ {
//直接生成登陆用户,在实际的项目中采用数据库形式 //直接生成登陆用户,在实际的项目中采用数据库形式
var user = new User {Account = "admin"}; try
if (user != null)
{ {
_loginApp.Login(model.UserName, model.Password);
SessionHelper.AddSessionUser(model);
return RedirectToLocal(returnUrl); return RedirectToLocal(returnUrl);
} }
else catch (Exception exception)
{ {
ModelState.AddModelError("", "Invalid username or password."); ModelState.AddModelError("", exception.Message);
} }
} }
@ -72,10 +65,7 @@ namespace OpenAuth.Mvc.Controllers
{ {
return View(); return View();
} }
public string LoadUsers()
{
return JsonConvert.SerializeObject(_userRepository.LoadUsers());
}

View File

@ -15,6 +15,7 @@
using System.Web.Mvc; using System.Web.Mvc;
using Infrastructure.Helper; using Infrastructure.Helper;
using OpenAuth.Domain; using OpenAuth.Domain;
using OpenAuth.Mvc.Models;
namespace OpenAuth.Mvc.Controllers namespace OpenAuth.Mvc.Controllers
{ {
@ -25,7 +26,7 @@ namespace OpenAuth.Mvc.Controllers
base.OnActionExecuting(filterContext); base.OnActionExecuting(filterContext);
#region Session过期自动跳出登录画面 #region Session过期自动跳出登录画面
if (SessionHelper.GetSessionUser<User>() == null) if (SessionHelper.GetSessionUser<LoginViewModel>() == null)
{ {
Response.Redirect("~/Account/Login"); Response.Redirect("~/Account/Login");
} }

View File

@ -3,15 +3,28 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Web; using System.Web;
using System.Web.Mvc; using System.Web.Mvc;
using Newtonsoft.Json;
using OpenAuth.App;
namespace OpenAuth.Mvc.Controllers namespace OpenAuth.Mvc.Controllers
{ {
public class HomeController : BaseController public class HomeController : BaseController
{ {
private LoginApp _loginApp;
public HomeController()
{
_loginApp = (LoginApp)DependencyResolver.Current.GetService(typeof(LoginApp));
}
public ActionResult Index() public ActionResult Index()
{ {
return View(); return View();
} }
public string LoadUsers()
{
return JsonConvert.SerializeObject(_loginApp.LoadUsers());
}
} }
} }

View File

@ -1,56 +1,58 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Web; using System.Web;
using System.Web.Mvc; using System.Web.Mvc;
using System.Web.Optimization; using System.Web.Optimization;
using System.Web.Routing; using System.Web.Routing;
using Autofac; using Autofac;
using Autofac.Integration.Mvc; using Autofac.Integration.Mvc;
using OpenAuth.Domain.Interface; using OpenAuth.App;
using OpenAuth.Repository; using OpenAuth.Domain.Interface;
using OpenAuth.Repository;
namespace OpenAuth.Mvc
{ namespace OpenAuth.Mvc
public class MvcApplication : System.Web.HttpApplication {
{ public class MvcApplication : System.Web.HttpApplication
protected void Application_Start() {
{ protected void Application_Start()
InitAutofac(); {
InitAutofac();
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); AreaRegistration.RegisterAllAreas();
RouteConfig.RegisterRoutes(RouteTable.Routes); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
BundleConfig.RegisterBundles(BundleTable.Bundles); RouteConfig.RegisterRoutes(RouteTable.Routes);
} BundleConfig.RegisterBundles(BundleTable.Bundles);
}
private static void InitAutofac()
{ private static void InitAutofac()
var builder = new ContainerBuilder(); {
var builder = new ContainerBuilder();
builder.RegisterType<UserRepository>().As<IUserRepository>();
builder.RegisterType<UserRepository>().As<IUserRepository>();
// Register your MVC controllers. builder.RegisterType<LoginApp>();
builder.RegisterControllers(typeof (MvcApplication).Assembly);
// Register your MVC controllers.
// OPTIONAL: Register model binders that require DI. builder.RegisterControllers(typeof (MvcApplication).Assembly);
builder.RegisterModelBinders(Assembly.GetExecutingAssembly());
builder.RegisterModelBinderProvider(); // OPTIONAL: Register model binders that require DI.
builder.RegisterModelBinders(Assembly.GetExecutingAssembly());
// OPTIONAL: Register web abstractions like HttpContextBase. builder.RegisterModelBinderProvider();
builder.RegisterModule<AutofacWebTypesModule>();
// OPTIONAL: Register web abstractions like HttpContextBase.
// OPTIONAL: Enable property injection in view pages. builder.RegisterModule<AutofacWebTypesModule>();
builder.RegisterSource(new ViewRegistrationSource());
// OPTIONAL: Enable property injection in view pages.
// OPTIONAL: Enable property injection into action filters. builder.RegisterSource(new ViewRegistrationSource());
builder.RegisterFilterProvider();
// OPTIONAL: Enable property injection into action filters.
// Set the dependency resolver to be Autofac. builder.RegisterFilterProvider();
var container = builder.Build();
DependencyResolver.SetResolver(new AutofacDependencyResolver(container)); // Set the dependency resolver to be Autofac.
} var container = builder.Build();
} DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
} }
}
}

View File

@ -17,8 +17,8 @@
<MvcBuildViews>false</MvcBuildViews> <MvcBuildViews>false</MvcBuildViews>
<UseIISExpress>true</UseIISExpress> <UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort /> <IISExpressSSLPort />
<IISExpressAnonymousAuthentication /> <IISExpressAnonymousAuthentication>enabled</IISExpressAnonymousAuthentication>
<IISExpressWindowsAuthentication /> <IISExpressWindowsAuthentication>disabled</IISExpressWindowsAuthentication>
<IISExpressUseClassicPipelineMode /> <IISExpressUseClassicPipelineMode />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@ -107,10 +107,6 @@
<Private>True</Private> <Private>True</Private>
<HintPath>..\packages\WebGrease.1.5.2\lib\WebGrease.dll</HintPath> <HintPath>..\packages\WebGrease.1.5.2\lib\WebGrease.dll</HintPath>
</Reference> </Reference>
<Reference Include="Antlr3.Runtime">
<Private>True</Private>
<HintPath>..\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="EntityFramework"> <Reference Include="EntityFramework">
@ -119,45 +115,6 @@
<Reference Include="EntityFramework.SqlServer"> <Reference Include="EntityFramework.SqlServer">
<HintPath>..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> <HintPath>..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.AspNet.Identity.Core">
<HintPath>..\packages\Microsoft.AspNet.Identity.Core.1.0.0\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNet.Identity.Owin">
<HintPath>..\packages\Microsoft.AspNet.Identity.Owin.1.0.0\lib\net45\Microsoft.AspNet.Identity.Owin.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNet.Identity.EntityFramework">
<HintPath>..\packages\Microsoft.AspNet.Identity.EntityFramework.1.0.0\lib\net45\Microsoft.AspNet.Identity.EntityFramework.dll</HintPath>
</Reference>
<Reference Include="Owin">
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin">
<HintPath>..\packages\Microsoft.Owin.2.0.0\lib\net45\Microsoft.Owin.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Host.SystemWeb">
<HintPath>..\packages\Microsoft.Owin.Host.SystemWeb.2.0.0\lib\net45\Microsoft.Owin.Host.SystemWeb.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Security">
<HintPath>..\packages\Microsoft.Owin.Security.2.0.0\lib\net45\Microsoft.Owin.Security.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Security.Facebook">
<HintPath>..\packages\Microsoft.Owin.Security.Facebook.2.0.0\lib\net45\Microsoft.Owin.Security.Facebook.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Security.Cookies">
<HintPath>..\packages\Microsoft.Owin.Security.Cookies.2.0.0\lib\net45\Microsoft.Owin.Security.Cookies.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Security.OAuth">
<HintPath>..\packages\Microsoft.Owin.Security.OAuth.2.0.0\lib\net45\Microsoft.Owin.Security.OAuth.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Security.Google">
<HintPath>..\packages\Microsoft.Owin.Security.Google.2.0.0\lib\net45\Microsoft.Owin.Security.Google.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Security.Twitter">
<HintPath>..\packages\Microsoft.Owin.Security.Twitter.2.0.0\lib\net45\Microsoft.Owin.Security.Twitter.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Security.MicrosoftAccount">
<HintPath>..\packages\Microsoft.Owin.Security.MicrosoftAccount.2.0.0\lib\net45\Microsoft.Owin.Security.MicrosoftAccount.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="App_Start\BundleConfig.cs" /> <Compile Include="App_Start\BundleConfig.cs" />

View File

@ -1,35 +1,35 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// 有关程序集的常规信息是通过以下项进行控制的 // 有关程序集的常规信息是通过以下项进行控制的
// 控制。更改这些特性值可修改 // 控制。更改这些特性值可修改
// 与程序集关联的信息。 // 与程序集关联的信息。
[assembly: AssemblyTitle("OpenAuth.Mvc")] [assembly: AssemblyTitle("OpenAuth.Mvc")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OpenAuth.Mvc")] [assembly: AssemblyProduct("OpenAuth.Mvc")]
[assembly: AssemblyCopyright("版权所有(C) 2015")] [assembly: AssemblyCopyright("版权所有(C) 2015")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 将使此程序集中的类型 // 将 ComVisible 设置为 false 将使此程序集中的类型
// 对 COM 组件不可见。如果需要 // 对 COM 组件不可见。如果需要
// 从 COM 访问此程序集中的某个类型,请针对该类型将 ComVisible 特性设置为 true。 // 从 COM 访问此程序集中的某个类型,请针对该类型将 ComVisible 特性设置为 true。
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于 typelib 的 ID // 如果此项目向 COM 公开,则下列 GUID 用于 typelib 的 ID
[assembly: Guid("f8e0455e-d7e7-4ee0-b6df-ba8b36b3d4a5")] [assembly: Guid("f8e0455e-d7e7-4ee0-b6df-ba8b36b3d4a5")]
// 程序集的版本信息由下列四个值组成: // 程序集的版本信息由下列四个值组成:
// //
// 主版本 // 主版本
// 次版本 // 次版本
// 内部版本号 // 内部版本号
// 修订版本 // 修订版本
// //
// 你可以指定所有值,也可以让修订版本和内部版本号采用默认值, // 你可以指定所有值,也可以让修订版本和内部版本号采用默认值,
// 方法是按如下所示使用 "*": // 方法是按如下所示使用 "*":
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,140 +1,140 @@
@{ @{
Layout = "~/Views/Shared/_Layout.cshtml"; Layout = "~/Views/Shared/_Layout.cshtml";
} }
<div class="main-content"> <div class="main-content">
<div id="breadcrumbs"> <div id="breadcrumbs">
<ul class="breadcrumb"> <ul class="breadcrumb">
<li><i class="icon-home"></i> <a href="#">用户列表</a><span class="divider"><i class="icon-angle-right"></i></span></li> <li><i class="icon-home"></i> <a href="#">用户列表</a><span class="divider"><i class="icon-angle-right"></i></span></li>
</ul><!--.breadcrumb--> </ul><!--.breadcrumb-->
</div><!--#breadcrumbs--> </div><!--#breadcrumbs-->
<div class="page-content"> <div class="page-content">
<div class="row"> <div class="row">
<div class="col-sm-6" style="width:100%;"> <div class="col-sm-6" style="width:100%;">
<div class="dataTables_filter" id="sample-table-2_filter"> <div class="dataTables_filter" id="sample-table-2_filter">
<label> <label>
关键字: <input type="text" id="txtSearch" aria-controls="sample-table-2" placeholder="帐号/手机" /> 关键字: <input type="text" id="txtSearch" aria-controls="sample-table-2" placeholder="帐号/手机" />
<a href="javascript:void(0)" id="btnSearch" class="btn btn-xs btn-pink" style="margin-top:-4px;">搜索</a> <a href="javascript:void(0)" id="btnSearch" class="btn btn-xs btn-pink" style="margin-top:-4px;">搜索</a>
</label> </label>
</div> </div>
</div> </div>
<!-- PAGE CONTENT BEGINS HERE --> <!-- PAGE CONTENT BEGINS HERE -->
<div class="col-xs-12"> <div class="col-xs-12">
<table id="grid-table"></table> <table id="grid-table"></table>
<div id="grid-pager"></div> <div id="grid-pager"></div>
</div><!--/row--> </div><!--/row-->
<!-- PAGE CONTENT ENDS HERE --> <!-- PAGE CONTENT ENDS HERE -->
</div><!--/row--> </div><!--/row-->
</div><!--/#page-content--> </div><!--/#page-content-->
</div><!-- /.main-content --> </div><!-- /.main-content -->
<script src="~/assets/js/jqGrid/jquery.jqGrid.min.js"></script> <script src="~/assets/js/jqGrid/jquery.jqGrid.min.js"></script>
<script src="~/assets/js/jqGrid/i18n/grid.locale-en.js"></script> <script src="~/assets/js/jqGrid/i18n/grid.locale-en.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$(function () { $(function () {
$("#btnSearch").click(function () { $("#btnSearch").click(function () {
var searchString = $("#txtSearch").val(); var searchString = $("#txtSearch").val();
var grid = $('#grid-table'); var grid = $('#grid-table');
grid[0].p.search = true; grid[0].p.search = true;
$.extend(grid[0].p.postData, { kw: searchString }); $.extend(grid[0].p.postData, { kw: searchString });
grid.trigger("reloadGrid", [{ page: 1 }]); grid.trigger("reloadGrid", [{ page: 1 }]);
}); });
GetData(); GetData();
}); });
function GetData() { function GetData() {
var grid_selector = "#grid-table"; var grid_selector = "#grid-table";
var pager_selector = "#grid-pager"; var pager_selector = "#grid-pager";
jQuery(grid_selector).jqGrid({ jQuery(grid_selector).jqGrid({
url: "/Account/LoadUsers", url: "/Home/LoadUsers",
mtype: "post", mtype: "post",
datatype: "json", datatype: "json",
height: '100%', height: '100%',
width: '100%', width: '100%',
colNames: ['UserId', '用户帐号', '是否可用', '操作'], colNames: ['UserId', '用户帐号', '是否可用', '操作'],
colModel: [ colModel: [
{ name: 'UserId', key: true, index: 'UserId', width: 30, editable: true, hidden: true }, { name: 'UserId', key: true, index: 'UserId', width: 30, editable: true, hidden: true },
{ name: 'Account', index: 'Account', width: 30, editable: false }, { name: 'Account', index: 'Account', width: 30, editable: false },
{ {
name: 'Enabled', index: 'Enabled', width: 30, editable: true, edittype: "checkbox", name: 'Enabled', index: 'Enabled', width: 30, editable: true, edittype: "checkbox",
editoptions: { value: "true:false" }, unformat: aceSwitch editoptions: { value: "true:false" }, unformat: aceSwitch
}, },
{ {
name: 'myac', index: '', width: 80, fixed: true, sortable: false, resize: false, name: 'myac', index: '', width: 80, fixed: true, sortable: false, resize: false,
formatter: 'actions', formatter: 'actions',
formatoptions: { formatoptions: {
delOptions: { recreateForm: true, beforeShowForm: beforeDeleteCallback } delOptions: { recreateForm: true, beforeShowForm: beforeDeleteCallback }
} }
} }
], ],
viewrecords: true, viewrecords: true,
rowNum: 10, rowNum: 10,
rowList: [10, 20, 30], rowList: [10, 20, 30],
pager: pager_selector, pager: pager_selector,
altRows: true, altRows: true,
//toppager: true, //toppager: true,
multiselect: true, multiselect: true,
multiboxonly: true, multiboxonly: true,
loadComplete: function () { loadComplete: function () {
var table = this; var table = this;
setTimeout(function () { setTimeout(function () {
updatePagerIcons(table); updatePagerIcons(table);
enableTooltips(table); enableTooltips(table);
}, 0); }, 0);
}, },
editurl: '@Url.Action("Login","Account")',//编辑删除 editurl: '@Url.Action("Login","Account")',//编辑删除
caption: "当前用户列表", caption: "当前用户列表",
autowidth: true autowidth: true
}); });
//行内编辑时checkbox样式 //行内编辑时checkbox样式
function aceSwitch(cellvalue, options, cell) { function aceSwitch(cellvalue, options, cell) {
setTimeout(function () { setTimeout(function () {
$(cell).find('input[type=checkbox]') $(cell).find('input[type=checkbox]')
.wrap('<label class="inline" />') .wrap('<label class="inline" />')
.addClass('ace ace-switch ace-switch-5') .addClass('ace ace-switch ace-switch-5')
.after('<span class="lbl"></span>'); .after('<span class="lbl"></span>');
}, 0); }, 0);
} }
//分页栏中的功能按钮(只留了刷新功能) //分页栏中的功能按钮(只留了刷新功能)
jQuery(grid_selector).jqGrid('navGrid', pager_selector, jQuery(grid_selector).jqGrid('navGrid', pager_selector,
{ //navbar options { //navbar options
edit: false, edit: false,
add: false, add: false,
del: false, del: false,
search: false, search: false,
refresh: true, refresh: true,
refreshicon: 'icon-refresh green', refreshicon: 'icon-refresh green',
view: false, view: false,
}); });
//删除前的确认框 //删除前的确认框
function beforeDeleteCallback(e) { function beforeDeleteCallback(e) {
var form = $(e[0]); var form = $(e[0]);
if (form.data('styled')) return false; if (form.data('styled')) return false;
form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />'); form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />');
var buttons = form.next().find('.EditButton .fm-button'); var buttons = form.next().find('.EditButton .fm-button');
buttons.addClass('btn btn-sm').find('[class*="-icon"]').remove();//ui-icon, s-icon buttons.addClass('btn btn-sm').find('[class*="-icon"]').remove();//ui-icon, s-icon
buttons.eq(0).addClass('btn-danger').prepend('<i class="icon-trash"></i>'); buttons.eq(0).addClass('btn-danger').prepend('<i class="icon-trash"></i>');
buttons.eq(1).prepend('<i class="icon-remove"></i>'); buttons.eq(1).prepend('<i class="icon-remove"></i>');
form.data('styled', true); form.data('styled', true);
} }
//更新分页栏的按钮 //更新分页栏的按钮
function updatePagerIcons(table) { function updatePagerIcons(table) {
var replacement = var replacement =
{ {
'ui-icon-seek-first': 'icon-double-angle-left bigger-140', 'ui-icon-seek-first': 'icon-double-angle-left bigger-140',
'ui-icon-seek-prev': 'icon-angle-left bigger-140', 'ui-icon-seek-prev': 'icon-angle-left bigger-140',
'ui-icon-seek-next': 'icon-angle-right bigger-140', 'ui-icon-seek-next': 'icon-angle-right bigger-140',
'ui-icon-seek-end': 'icon-double-angle-right bigger-140' 'ui-icon-seek-end': 'icon-double-angle-right bigger-140'
}; };
$('.ui-pg-table:not(.navtable) > tbody > tr > .ui-pg-button > .ui-icon').each(function () { $('.ui-pg-table:not(.navtable) > tbody > tr > .ui-pg-button > .ui-icon').each(function () {
var icon = $(this); var icon = $(this);
var $class = $.trim(icon.attr('class').replace('ui-icon', '')); var $class = $.trim(icon.attr('class').replace('ui-icon', ''));
if ($class in replacement) icon.attr('class', 'ui-icon ' + replacement[$class]); if ($class in replacement) icon.attr('class', 'ui-icon ' + replacement[$class]);
}); });
} }
function enableTooltips(table) { function enableTooltips(table) {
$('.navtable .ui-pg-button').tooltip({ container: 'body' }); $('.navtable .ui-pg-button').tooltip({ container: 'body' });
$(table).find('.ui-pg-div').tooltip({ container: 'body' }); $(table).find('.ui-pg-div').tooltip({ container: 'body' });
} }
} }
</script> </script>

View File

@ -1,67 +1,67 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问 有关如何配置 ASP.NET 应用程序的详细信息,请访问
http://go.microsoft.com/fwlink/?LinkId=301880 http://go.microsoft.com/fwlink/?LinkId=301880
--> -->
<configuration> <configuration>
<configSections> <configSections>
<!-- 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"/>
</configSections> </configSections>
<connectionStrings> <connectionStrings>
<add name="OpenAuthDBContext" connectionString="Data Source=.;Initial Catalog=OpenAuthDB;Persist Security Info=True;User ID=sa;Password=516688;MultipleActiveResultSets=True" providerName="System.Data.SqlClient"/> <add name="OpenAuthDBContext" connectionString="Data Source=.;Initial Catalog=OpenAuthDB;Persist Security Info=True;User ID=sa;Password=516688;MultipleActiveResultSets=True" providerName="System.Data.SqlClient"/>
</connectionStrings> </connectionStrings>
<appSettings> <appSettings>
<add key="webpages:Version" value="3.0.0.0"/> <add key="webpages:Version" value="3.0.0.0"/>
<add key="webpages:Enabled" value="false"/> <add key="webpages:Enabled" value="false"/>
<add key="ClientValidationEnabled" value="true"/> <add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/> <add key="UnobtrusiveJavaScriptEnabled" value="true"/>
</appSettings> </appSettings>
<system.web> <system.web>
<authentication mode="None"/> <authentication mode="None"/>
<compilation debug="true" targetFramework="4.5"/> <compilation debug="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5"/> <httpRuntime targetFramework="4.5"/>
</system.web> </system.web>
<system.webServer> <system.webServer>
<modules> <modules>
<remove name="FormsAuthenticationModule"/> <remove name="FormsAuthenticationModule"/>
</modules> </modules>
</system.webServer> </system.webServer>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly> <dependentAssembly>
<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> <dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35"/> <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234"/> <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/> <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/> <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/> <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/> <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-5.1.0.0" newVersion="5.1.0.0"/> <bindingRedirect oldVersion="1.0.0.0-5.1.0.0" newVersion="5.1.0.0"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral"/> <assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0"/> <bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0"/>
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
<entityFramework> <entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
<providers> <providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/> <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
</providers> </providers>
</entityFramework> </entityFramework>
</configuration> </configuration>