From 9ea25ec00ef55bb7e1da800db6f2ffce3af78c95 Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Fri, 11 Nov 2016 15:03:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DBUG=EF=BC=9ASaveUsers?= =?UTF-8?q?=E5=AD=98=E5=82=A8=E8=BF=87=E7=A8=8B=E6=B2=A1=E6=9C=89=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=EF=BC=8C=E8=A1=A5=E5=85=85=E4=B8=8A=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DatabaseScripts/Procedures.sql | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/DatabaseScripts/Procedures.sql b/DatabaseScripts/Procedures.sql index 6ad1bcc9..c721a761 100644 --- a/DatabaseScripts/Procedures.sql +++ b/DatabaseScripts/Procedures.sql @@ -189,13 +189,16 @@ BEGIN -- Insert statements for procedure here if @userStatus = 2 begin - update Users set ApprovedTime = GETDATE() where ID = @id + update Users set ApprovedTime = GETDATE(), ApprovedBy = @approvedBy where ID = @id end else begin declare @approveTime datetime = null if @userStatus = 0 set @approveTime = GETDATE() - Insert Into Users (UserName, [Password], PassSalt, DisplayName, RegisterTime, ApprovedTime, ApprovedBy, [Description]) values (@userName, @password, @passSalt, @displayName, GETDATE(), @approveTime, @approvedBy, @description) + if(@id = 0) + Insert Into Users (UserName, [Password], PassSalt, DisplayName, RegisterTime, ApprovedTime, [Description]) values (@userName, @password, @passSalt, @displayName, GETDATE(), @approveTime, @description) + else + Update Users set UserName = @userName, Password = @password, PassSalt = @passSalt, DisplayName = @displayName where ID = @id end END GO