From 3e465ca0d82ff34707400c8af54740457e9ff798 Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Fri, 11 Nov 2016 14:47:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=89=B9=E5=A4=8D=E4=BA=BA?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bootstrap.Admin/Controllers/UsersController.cs | 1 + Bootstrap.DataAccess/User.cs | 4 ++++ Bootstrap.DataAccess/UserHelper.cs | 1 + DatabaseScripts/Install.sql | 1 + DatabaseScripts/Procedures.sql | 3 ++- 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Bootstrap.Admin/Controllers/UsersController.cs b/Bootstrap.Admin/Controllers/UsersController.cs index f95b09e5..d695b85a 100644 --- a/Bootstrap.Admin/Controllers/UsersController.cs +++ b/Bootstrap.Admin/Controllers/UsersController.cs @@ -67,6 +67,7 @@ namespace Bootstrap.Admin.Controllers { value.ApprovedTime = DateTime.Now; value.Description = string.Format("管理员{0}创建用户", User.Identity.Name); + value.ApprovedBy = User.Identity.Name; return UserHelper.SaveUser(value); } diff --git a/Bootstrap.DataAccess/User.cs b/Bootstrap.DataAccess/User.cs index c20c4811..819331f9 100644 --- a/Bootstrap.DataAccess/User.cs +++ b/Bootstrap.DataAccess/User.cs @@ -32,6 +32,10 @@ namespace Bootstrap.DataAccess /// public DateTime ApprovedTime { get; set; } /// + /// 获得/设置 用户批复人 + /// + public string ApprovedBy { get; set; } + /// /// 获得/设置 用户的申请理由 /// public string Description { get; set; } diff --git a/Bootstrap.DataAccess/UserHelper.cs b/Bootstrap.DataAccess/UserHelper.cs index a26a48ff..43fe3821 100644 --- a/Bootstrap.DataAccess/UserHelper.cs +++ b/Bootstrap.DataAccess/UserHelper.cs @@ -141,6 +141,7 @@ namespace Bootstrap.DataAccess cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@passSalt", p.PassSalt, ParameterDirection.Input)); cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@displayName", p.DisplayName, ParameterDirection.Input)); cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@description", DBAccess.ToDBValue(p.Description), ParameterDirection.Input)); + cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@approvedBy", DBAccess.ToDBValue(p.ApprovedBy), ParameterDirection.Input)); cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@userStatus", p.UserStatus, ParameterDirection.Input)); DBAccessManager.SqlDBAccess.ExecuteNonQuery(cmd); } diff --git a/DatabaseScripts/Install.sql b/DatabaseScripts/Install.sql index 997050a6..83af08a2 100644 --- a/DatabaseScripts/Install.sql +++ b/DatabaseScripts/Install.sql @@ -23,6 +23,7 @@ CREATE TABLE [dbo].[Users]( [DisplayName] [nvarchar](50) NOT NULL, [RegisterTime] [datetime] NOT NULL, [ApprovedTime] [datetime] NULL, + [ApprovedBy] [nvarchar](50) NULL, [Description] [nvarchar](500) NOT NULL, CONSTRAINT [PK_Users] PRIMARY KEY CLUSTERED ( diff --git a/DatabaseScripts/Procedures.sql b/DatabaseScripts/Procedures.sql index 03c9266a..6ad1bcc9 100644 --- a/DatabaseScripts/Procedures.sql +++ b/DatabaseScripts/Procedures.sql @@ -176,6 +176,7 @@ CREATE PROCEDURE [dbo].[Proc_SaveUsers] @password varchar(50), @passSalt varchar(50), @displayName nvarchar(50), + @approvedBy varchar(50), @description nvarchar(500), @userStatus int = 0 --0表示管理员创建 1标示用户注册 2标示管理员批复 WITH ENCRYPTION @@ -194,7 +195,7 @@ BEGIN begin declare @approveTime datetime = null if @userStatus = 0 set @approveTime = GETDATE() - Insert Into Users (UserName, [Password], PassSalt, DisplayName, RegisterTime, ApprovedTime, [Description]) values (@userName, @password, @passSalt, @displayName, GETDATE(), @approveTime, @description) + Insert Into Users (UserName, [Password], PassSalt, DisplayName, RegisterTime, ApprovedTime, ApprovedBy, [Description]) values (@userName, @password, @passSalt, @displayName, GETDATE(), @approveTime, @approvedBy, @description) end END GO