修改BUG:Proc_SaveUser存储过程移除ApprovedTime参数,使用默认的,防止美式时间格式插入时失败

This commit is contained in:
Argo-MacBookPro 2018-09-13 21:30:33 +08:00
parent 0ce25143fc
commit 1e2653e4e8
3 changed files with 4 additions and 6 deletions

View File

@ -83,7 +83,6 @@ namespace Bootstrap.Admin.Controllers.Api
{
value.Description = string.Format("管理员{0}创建用户", User.Identity.Name);
value.ApprovedBy = User.Identity.Name;
value.ApprovedTime = DateTime.Now;
ret = UserHelper.SaveUser(value);
}
else

View File

@ -116,9 +116,6 @@ namespace Bootstrap.DataAccess
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@passSalt", p.PassSalt));
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@displayName", p.DisplayName));
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@approvedBy", DBAccessFactory.ToDBValue(p.ApprovedBy)));
object approvedTime = p.ApprovedTime;
if (p.ApprovedTime == DateTime.MinValue) approvedTime = DBNull.Value;
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@approvedTime", approvedTime));
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@description", p.Description));
ret = DBAccessManager.SqlDBAccess.ExecuteNonQuery(cmd) == -1;
if (ret) CacheCleanUtility.ClearCache(userIds: p.Id == 0 ? new List<int>() : new List<int>() { p.Id });

View File

@ -178,8 +178,7 @@ CREATE PROCEDURE [dbo].[Proc_SaveUsers]
@password varchar(50),
@passSalt varchar(50),
@displayName nvarchar(50),
@approvedBy nvarchar(50),
@approvedTime datetime,
@approvedBy nvarchar(50) = null,
@description nvarchar(500)
WITH ENCRYPTION
AS
@ -189,6 +188,9 @@ BEGIN
SET NOCOUNT ON;
SET XACT_ABORT ON;
-- Insert statements for procedure here
declare @approvedTime datetime
if @approvedBy is not null set @approvedTime = GETDATE()
begin
if(not exists (select 1 from Users Where UserName = @userName))
begin