修改BUG:Proc_SaveUser存储过程移除ApprovedTime参数,使用默认的,防止美式时间格式插入时失败
This commit is contained in:
parent
0ce25143fc
commit
1e2653e4e8
|
@ -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
|
||||
|
|
|
@ -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 });
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue