增加系统异常日志记录功能
This commit is contained in:
parent
d7ab014898
commit
208cb9bede
|
@ -0,0 +1,33 @@
|
|||
using Bootstrap.DataAccess;
|
||||
using Longbow.Caching;
|
||||
using Longbow.ExceptionManagement;
|
||||
using Longbow.ExceptionManagement.Configuration;
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Web;
|
||||
|
||||
namespace Bootstrap.Admin
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class DBPublisher : IExceptionPublisher
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="ex"></param>
|
||||
/// <param name="additionalInfo"></param>
|
||||
/// <param name="publisherElement"></param>
|
||||
public void Publish(Exception ex, NameValueCollection additionalInfo, ExceptionPublisherElement publisherElement)
|
||||
{
|
||||
if (publisherElement.Mode == PublisherMode.Off) return;
|
||||
HttpContext context = HttpContext.Current;
|
||||
additionalInfo["ErrorPage"] = context.Request.AppRelativeCurrentExecutionFilePath;
|
||||
if (context.User != null) additionalInfo["UserId"] = context.User.Identity.Name;
|
||||
additionalInfo["UserIp"] = context.Request.UserHostAddress;
|
||||
ExceptionHelper.Log(ex, additionalInfo);
|
||||
CacheManager.Clear();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -43,6 +43,7 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Longbow.ExceptionManagement, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c20f2177a7066899, processorArchitecture=MSIL" />
|
||||
<Reference Include="Longbow.V4, Version=4.0.0.0, Culture=neutral, PublicKeyToken=c20f2177a7066899, processorArchitecture=MSIL" />
|
||||
<Reference Include="Longbow.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=c20f2177a7066899, processorArchitecture=MSIL" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
|
@ -205,6 +206,7 @@
|
|||
<Link>bldver.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="App_Start\BAAuthorizeAttribute.cs" />
|
||||
<Compile Include="App_Start\DBPublisher.cs" />
|
||||
<Compile Include="App_Start\FilterConfig.cs" />
|
||||
<Compile Include="App_Start\RouteConfig.cs" />
|
||||
<Compile Include="App_Start\WebApiConfig.cs" />
|
||||
|
|
|
@ -49,6 +49,7 @@ namespace Bootstrap.Admin.Controllers
|
|||
{
|
||||
//UNDONE: 本方法有严重安全漏洞,发布前需要修正
|
||||
var model = new LoginModel();
|
||||
if (string.IsNullOrEmpty(userName)) return View(model);
|
||||
model.UserName = userName;
|
||||
if (LgbPrincipal.IsAdmin(userName) || UserHelper.Authenticate(userName, password))
|
||||
{
|
||||
|
@ -72,15 +73,15 @@ namespace Bootstrap.Admin.Controllers
|
|||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
public ActionResult Register(string userName, string displayName, string password,string description)
|
||||
public ActionResult Register(string userName, string displayName, string password, string description)
|
||||
{
|
||||
var result = UserHelper.RegisterUser(userName, displayName, password,description);
|
||||
if (result)
|
||||
var result = UserHelper.RegisterUser(userName, displayName, password, description);
|
||||
if (result)
|
||||
{
|
||||
return Redirect("/Content/html/RegResult.html");
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
else
|
||||
return View();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,201 +21,204 @@
|
|||
</li>
|
||||
</ul>
|
||||
}
|
||||
@if (!Model.ShowMenu)
|
||||
{
|
||||
<!-- notification start -->
|
||||
<ul class="notify-row">
|
||||
<!-- settings start -->
|
||||
<li class="dropdown">
|
||||
<a data-toggle="dropdown" class="dropdown-toggle" href="#">
|
||||
<i class="fa fa-tasks"></i>
|
||||
<span class="badge bg-success">5</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu tasks-bar">
|
||||
<div class="notify-arrow notify-arrow-green"></div>
|
||||
<li>
|
||||
<p>您有 5 个待处理的任务</p>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<div>
|
||||
<div class="desc">任务1</div>
|
||||
<div class="percent">40%</div>
|
||||
</div>
|
||||
<div class="progress progress-striped">
|
||||
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width: 40%">
|
||||
<span class="sr-only">40% Complete (success)</span>
|
||||
<ul class="notify-row">
|
||||
<!-- settings start -->
|
||||
<li class="dropdown">
|
||||
<a data-toggle="dropdown" class="dropdown-toggle" href="#">
|
||||
<i class="fa fa-tasks"></i>
|
||||
<span class="badge bg-success">5</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu tasks-bar">
|
||||
<div class="notify-arrow notify-arrow-green"></div>
|
||||
<li>
|
||||
<p>您有 5 个待处理的任务</p>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<div>
|
||||
<div class="desc">任务1</div>
|
||||
<div class="percent">40%</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<div>
|
||||
<div class="desc">任务2</div>
|
||||
<div class="percent">60%</div>
|
||||
</div>
|
||||
<div class="progress progress-striped">
|
||||
<div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%">
|
||||
<span class="sr-only">60% Complete (warning)</span>
|
||||
<div class="progress progress-striped">
|
||||
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width: 40%">
|
||||
<span class="sr-only">40% Complete (success)</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<div>
|
||||
<div class="desc">任务3</div>
|
||||
<div class="percent">87%</div>
|
||||
</div>
|
||||
<div class="progress progress-striped">
|
||||
<div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" style="width: 87%">
|
||||
<span class="sr-only">87% Complete</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<div>
|
||||
<div class="desc">任务2</div>
|
||||
<div class="percent">60%</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<div>
|
||||
<div class="desc">任务4</div>
|
||||
<div class="percent">33%</div>
|
||||
</div>
|
||||
<div class="progress progress-striped">
|
||||
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style="width: 33%">
|
||||
<span class="sr-only">33% Complete (danger)</span>
|
||||
<div class="progress progress-striped">
|
||||
<div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%">
|
||||
<span class="sr-only">60% Complete (warning)</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<div>
|
||||
<div class="desc">任务5</div>
|
||||
<div class="percent">45%</div>
|
||||
</div>
|
||||
<div class="progress progress-striped active">
|
||||
<div class="progress-bar" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 45%">
|
||||
<span class="sr-only">45% Complete</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<div>
|
||||
<div class="desc">任务3</div>
|
||||
<div class="percent">87%</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">查看所有任务</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<!-- settings end -->
|
||||
<!-- inbox dropdown start-->
|
||||
<li id="header_inbox_bar" class="dropdown">
|
||||
<a data-toggle="dropdown" class="dropdown-toggle" href="#">
|
||||
<i class="fa fa-envelope-o"></i>
|
||||
<span class="badge bg-important">4</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu inbox">
|
||||
<div class="notify-arrow notify-arrow-red"></div>
|
||||
<li>
|
||||
<p>您有 4 个待处理的消息</p>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<span class="photo"><img alt="avatar" src="../content/images/logo6.jpg"></span>
|
||||
<span class="subject">
|
||||
<span class="from">Jianmin Yin</span>
|
||||
<span class="time">Just now</span>
|
||||
</span>
|
||||
<span class="message">你好, 测试消息</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<span class="photo"><img alt="avatar" src="../content/images/logo3.jpg"></span>
|
||||
<span class="subject">
|
||||
<span class="from">张广坡</span>
|
||||
<span class="time">10 mins</span>
|
||||
</span>
|
||||
<span class="message">还是测试消息</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<span class="photo"><img alt="avatar" src="../content/images/logo.jpg"></span>
|
||||
<span class="subject">
|
||||
<span class="from">李琦</span>
|
||||
<span class="time">3 hrs</span>
|
||||
</span>
|
||||
<span class="message">继续测试</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<span class="photo"><img alt="avatar" src="../content/images/logo1.jpg"></span>
|
||||
<span class="subject">
|
||||
<span class="from">刘老师</span>
|
||||
<span class="time">Just now</span>
|
||||
</span>
|
||||
<span class="message">统一管理</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">查看所有消息</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<!-- inbox dropdown end -->
|
||||
<!-- notification dropdown start-->
|
||||
<li id="header_notification_bar" class="dropdown">
|
||||
<a data-toggle="dropdown" class="dropdown-toggle" href="#">
|
||||
<i class="fa fa-bell-o"></i>
|
||||
<span class="badge bg-warning">5</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu notification">
|
||||
<div class="notify-arrow notify-arrow-yellow"></div>
|
||||
<li>
|
||||
<p>您有 5 条新通知</p>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<span class="label label-danger"><i class="fa fa-bolt"></i></span>
|
||||
服务器超载
|
||||
<span class="small italic">34 分钟</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<span class="label label-warning"><i class="fa fa-bell"></i></span>
|
||||
服务器未响应
|
||||
<span class="small italic">1 小时</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<span class="label label-danger"><i class="fa fa-bolt"></i></span>
|
||||
数据库内存过高
|
||||
<span class="small italic">4 小时</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<span class="label label-success"><i class="fa fa-plus"></i></span>
|
||||
新用户注册
|
||||
<span class="small italic">刚刚</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<span class="label label-info"><i class="fa fa-bullhorn"></i></span>
|
||||
程序出现错误
|
||||
<span class="small italic">10 分钟</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">查看所有通知</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<!-- notification dropdown end -->
|
||||
</ul>
|
||||
<div class="progress progress-striped">
|
||||
<div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" style="width: 87%">
|
||||
<span class="sr-only">87% Complete</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<div>
|
||||
<div class="desc">任务4</div>
|
||||
<div class="percent">33%</div>
|
||||
</div>
|
||||
<div class="progress progress-striped">
|
||||
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style="width: 33%">
|
||||
<span class="sr-only">33% Complete (danger)</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<div>
|
||||
<div class="desc">任务5</div>
|
||||
<div class="percent">45%</div>
|
||||
</div>
|
||||
<div class="progress progress-striped active">
|
||||
<div class="progress-bar" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 45%">
|
||||
<span class="sr-only">45% Complete</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">查看所有任务</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<!-- settings end -->
|
||||
<!-- inbox dropdown start-->
|
||||
<li id="header_inbox_bar" class="dropdown">
|
||||
<a data-toggle="dropdown" class="dropdown-toggle" href="#">
|
||||
<i class="fa fa-envelope-o"></i>
|
||||
<span class="badge bg-important">4</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu inbox">
|
||||
<div class="notify-arrow notify-arrow-red"></div>
|
||||
<li>
|
||||
<p>您有 4 个待处理的消息</p>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<span class="photo"><img alt="avatar" src="../content/images/logo6.jpg"></span>
|
||||
<span class="subject">
|
||||
<span class="from">Jianmin Yin</span>
|
||||
<span class="time">Just now</span>
|
||||
</span>
|
||||
<span class="message">你好, 测试消息</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<span class="photo"><img alt="avatar" src="../content/images/logo3.jpg"></span>
|
||||
<span class="subject">
|
||||
<span class="from">张广坡</span>
|
||||
<span class="time">10 mins</span>
|
||||
</span>
|
||||
<span class="message">还是测试消息</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<span class="photo"><img alt="avatar" src="../content/images/logo.jpg"></span>
|
||||
<span class="subject">
|
||||
<span class="from">李琦</span>
|
||||
<span class="time">3 hrs</span>
|
||||
</span>
|
||||
<span class="message">继续测试</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<span class="photo"><img alt="avatar" src="../content/images/logo1.jpg"></span>
|
||||
<span class="subject">
|
||||
<span class="from">刘老师</span>
|
||||
<span class="time">Just now</span>
|
||||
</span>
|
||||
<span class="message">统一管理</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">查看所有消息</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<!-- inbox dropdown end -->
|
||||
<!-- notification dropdown start-->
|
||||
<li id="header_notification_bar" class="dropdown">
|
||||
<a data-toggle="dropdown" class="dropdown-toggle" href="#">
|
||||
<i class="fa fa-bell-o"></i>
|
||||
<span class="badge bg-warning">5</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu notification">
|
||||
<div class="notify-arrow notify-arrow-yellow"></div>
|
||||
<li>
|
||||
<p>您有 5 条新通知</p>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<span class="label label-danger"><i class="fa fa-bolt"></i></span>
|
||||
服务器超载
|
||||
<span class="small italic">34 分钟</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<span class="label label-warning"><i class="fa fa-bell"></i></span>
|
||||
服务器未响应
|
||||
<span class="small italic">1 小时</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<span class="label label-danger"><i class="fa fa-bolt"></i></span>
|
||||
数据库内存过高
|
||||
<span class="small italic">4 小时</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<span class="label label-success"><i class="fa fa-plus"></i></span>
|
||||
新用户注册
|
||||
<span class="small italic">刚刚</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<span class="label label-info"><i class="fa fa-bullhorn"></i></span>
|
||||
程序出现错误
|
||||
<span class="small italic">10 分钟</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">查看所有通知</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<!-- notification dropdown end -->
|
||||
</ul>
|
||||
<!-- notification end -->
|
||||
}
|
||||
<!--search & user info start-->
|
||||
<ul class="nav pull-right top-menu">
|
||||
<li>
|
||||
|
@ -231,9 +234,9 @@
|
|||
</a>
|
||||
<ul class="dropdown-menu logout">
|
||||
<div class="arrow-up"></div>
|
||||
<li><a href="#"><i class=" fa fa-suitcase"></i>个人中心</a></li>
|
||||
<li><a href="~/Admin"><i class="fa fa-cog"></i>设置</a></li>
|
||||
<li><a href="#"><i class="fa fa-bell-o"></i>通知<span class="badge bg-success">5</span></a></li>
|
||||
<li><a href="~/Admin/Infos"><i class=" fa fa-suitcase"></i>个人中心</a></li>
|
||||
<li><a href="~/Admin/Index"><i class="fa fa-cog"></i>设置</a></li>
|
||||
<li><a href="~/Admin/News"><i class="fa fa-bell-o"></i>通知<span class="badge bg-success">5</span></a></li>
|
||||
<li><a href="~/Home/Logout"><i class="fa fa-key"></i>注销</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
-->
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="exceptionManagement" type="Longbow.ExceptionManagement.Configuration.ExceptionManagerSectionHandler, Longbow.ExceptionManagement" />
|
||||
<section name="cacheManager" type="Longbow.Caching.Configuration.CacheSection, Longbow.V4"/>
|
||||
<section name="cacheManagerList" type="Longbow.Caching.Configuration.CacheListSection, Longbow.V4"/>
|
||||
</configSections>
|
||||
|
@ -47,6 +48,11 @@
|
|||
<add key="bd" url="http://localhost:53233/CacheList.axd?cacheKey={0}" desc="系统缓存模块"/>
|
||||
</cacheManagerList>
|
||||
|
||||
<exceptionManagement>
|
||||
<publisher name="default" mode="On" exceptionFormat="File"/>
|
||||
<publisher name="db" mode="On" assembly="Bootstrap.Admin" type="Bootstrap.Admin.DBPublisher"/>
|
||||
</exceptionManagement>
|
||||
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.5"/>
|
||||
<httpRuntime targetFramework="4.5"/>
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
<Compile Include="DBAccessManager.cs" />
|
||||
<Compile Include="Dict.cs" />
|
||||
<Compile Include="DictHelper.cs" />
|
||||
<Compile Include="ExceptionHelper.cs" />
|
||||
<Compile Include="Group.cs" />
|
||||
<Compile Include="GroupHelper.cs" />
|
||||
<Compile Include="Log.cs" />
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
using Longbow.Data;
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
|
||||
namespace Bootstrap.DataAccess
|
||||
{
|
||||
public static class ExceptionHelper
|
||||
{
|
||||
public static void Log(Exception ex, NameValueCollection additionalInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
var sql = "insert into Exceptions (AppDomainName, ErrorPage, UserID, UserIp, Message, StackTrace, LogTime) values (@AppDomainName, @ErrorPage, @UserID, @UserIp, @Message, @StackTrace, GetDate())";
|
||||
using (DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql))
|
||||
{
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@AppDomainName", AppDomain.CurrentDomain.FriendlyName, ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@ErrorPage", additionalInfo["ErrorPage"], ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@UserID", DBAccess.ToDBValue(additionalInfo["UserId"]), ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@UserIp", additionalInfo["UserIp"], ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@Message", ex.Message, ParameterDirection.Input));
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@StackTrace", DBAccess.ToDBValue(ex.StackTrace), ParameterDirection.Input));
|
||||
DBAccessManager.SqlDBAccess.ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw new Exception("Excetion Log Error");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -55,6 +55,7 @@
|
|||
</Choose>
|
||||
<ItemGroup>
|
||||
<Compile Include="DictHelperTests.cs" />
|
||||
<Compile Include="ExceptionHelperTests.cs" />
|
||||
<Compile Include="RoleHelperTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="GroupHelperTests.cs" />
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
|
||||
namespace Bootstrap.DataAccess.Tests
|
||||
{
|
||||
[TestClass()]
|
||||
public class ExceptionHelperTests
|
||||
{
|
||||
[TestMethod()]
|
||||
public void LogTest()
|
||||
{
|
||||
var ex = new Exception("Just for Test");
|
||||
var nv = new NameValueCollection();
|
||||
nv.Add("ErrorPage", "UnitTest_Page");
|
||||
nv.Add("UserIp", "::1");
|
||||
ExceptionHelper.Log(ex, nv);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,7 +6,7 @@ SET IDENTITY_INSERT [dbo].[Users] ON
|
|||
insert into Users (ID, UserName, Password, PassSalt, DisplayName, RegisterTime, ApprovedTime, [Description]) values (1, 'Admin', 'Es7WVgNsJuELwWK8daCqufUBknCsSC0IYDphQZAiGOo=', 'W5vpBEOYRGHkQXatN0t+ECM/U8cHDuEgrq56+zZBk4J481xH', 'Administrator', GetDate(), GetDate(), N'系统默认创建')
|
||||
SET IDENTITY_INSERT [dbo].[Users] OFF
|
||||
|
||||
DELETE From Dicts where ID < 10
|
||||
DELETE From Dicts where ID < 12
|
||||
SET IDENTITY_INSERT [dbo].[Dicts] ON
|
||||
INSERT [dbo].[Dicts] ([ID], [Category], [Name], [Code], [Define]) VALUES (1, N'菜单', N'系统菜单', N'0', 0)
|
||||
INSERT [dbo].[Dicts] ([ID], [Category], [Name], [Code], [Define]) VALUES (2, N'菜单', N'外部菜单', N'1', 0)
|
||||
|
@ -77,4 +77,6 @@ INSERT [dbo].[NavigationRole] ([ID], [NavigationID], [RoleID]) VALUES (12, 11, 2
|
|||
INSERT [dbo].[NavigationRole] ([ID], [NavigationID], [RoleID]) VALUES (13, 12, 1)
|
||||
INSERT [dbo].[NavigationRole] ([ID], [NavigationID], [RoleID]) VALUES (14, 13, 2)
|
||||
INSERT [dbo].[NavigationRole] ([ID], [NavigationID], [RoleID]) VALUES (15, 14, 2)
|
||||
INSERT [dbo].[NavigationRole] ([ID], [NavigationID], [RoleID]) VALUES (16, 1, 2)
|
||||
INSERT [dbo].[NavigationRole] ([ID], [NavigationID], [RoleID]) VALUES (17, 10, 2)
|
||||
SET IDENTITY_INSERT [dbo].[NavigationRole] OFF
|
|
@ -136,7 +136,7 @@ GO
|
|||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
CREATE TABLE [dbo].[Notifications](
|
||||
[ID] [int] NOT NULL,
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[Category] [nvarchar](50) NOT NULL,
|
||||
[Title] [nvarchar](50) NOT NULL,
|
||||
[Content] [nvarchar](50) NOT NULL,
|
||||
|
@ -144,7 +144,11 @@ CREATE TABLE [dbo].[Notifications](
|
|||
[ProcessTime] [datetime] NULL,
|
||||
[ProcessBy] [nvarchar](50) NULL,
|
||||
[ProcessResult] [nvarchar](50) NULL,
|
||||
[Status] [nvarchar](50) NOT NULL
|
||||
[Status] [nvarchar](50) NOT NULL,
|
||||
CONSTRAINT [PK_Notifications] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[ID] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'0 标示未处理 1 标示已处理' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Notifications', @level2type=N'COLUMN',@level2name=N'Status'
|
||||
|
@ -235,7 +239,31 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'部门名称'
|
|||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'描述' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Groups', @level2type=N'COLUMN',@level2name=N'Description'
|
||||
GO
|
||||
/****** Object: Table [dbo].[Dicts] Script Date: 11/10/2016 11:32:54 ******/
|
||||
/****** Object: Table [dbo].[Exceptions] Script Date: 11/10/2016 16:30:56 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
SET ANSI_PADDING ON
|
||||
GO
|
||||
CREATE TABLE [dbo].[Exceptions](
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[AppDomainName] [varchar](50) NOT NULL,
|
||||
[ErrorPage] [varchar](50) NOT NULL,
|
||||
[UserID] [varchar](50) NULL,
|
||||
[UserIp] [varchar](15) NOT NULL,
|
||||
[Message] [nvarchar](max) NOT NULL,
|
||||
[StackTrace] [nvarchar](max) NULL,
|
||||
[LogTime] [datetime] NOT NULL,
|
||||
CONSTRAINT [PK_Exceptions] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[ID] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
SET ANSI_PADDING OFF
|
||||
GO
|
||||
/****** Object: Table [dbo].[Dicts] Script Date: 11/10/2016 16:30:56 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
|
|
Loading…
Reference in New Issue