修改密码时,顺便修改用户名,另外Site调研增加查询条件
parent
e7416e03af
commit
369fbc6d2c
|
@ -167,6 +167,8 @@ namespace IRaCIS.Application.Contracts
|
||||||
|
|
||||||
public class EditPasswordCommand
|
public class EditPasswordCommand
|
||||||
{
|
{
|
||||||
|
public string NewUserName { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string NewPassWord { get; set; } = string.Empty;
|
public string NewPassWord { get; set; } = string.Empty;
|
||||||
public string OldPassWord { get; set; } = string.Empty;
|
public string OldPassWord { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,7 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 发送验证码 邮箱或者手机号
|
/// 发送验证码 邮箱或者手机号
|
||||||
|
@ -255,6 +255,7 @@ namespace IRaCIS.Application.Services
|
||||||
/// <param name="resetPwdModel"></param>
|
/// <param name="resetPwdModel"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
|
||||||
public async Task<IResponseOutput> SetNewPassword(ResetPasswordCommand resetPwdModel)
|
public async Task<IResponseOutput> SetNewPassword(ResetPasswordCommand resetPwdModel)
|
||||||
{
|
{
|
||||||
if (resetPwdModel.IsReviewer)
|
if (resetPwdModel.IsReviewer)
|
||||||
|
@ -520,6 +521,23 @@ namespace IRaCIS.Application.Services
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<IResponseOutput> ModifyPassword(EditPasswordCommand editPwModel)
|
public async Task<IResponseOutput> ModifyPassword(EditPasswordCommand editPwModel)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
if( !string.IsNullOrEmpty(editPwModel.NewUserName))
|
||||||
|
{
|
||||||
|
if (await _userRepository.AnyAsync(t => t.UserName == editPwModel.NewUserName && t.Id != _userInfo.Id))
|
||||||
|
{
|
||||||
|
return ResponseOutput.NotOk("UserId already exists");
|
||||||
|
}
|
||||||
|
|
||||||
|
var success = await _userRepository.UpdateFromQueryAsync(t => t.Id == _userInfo.Id, u => new User()
|
||||||
|
{
|
||||||
|
UserName = editPwModel.NewUserName,
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//验证旧密码OK
|
||||||
if (await _userRepository.FirstOrDefaultAsync(t => t.Id == _userInfo.Id && t.Password == editPwModel.OldPassWord) != null)
|
if (await _userRepository.FirstOrDefaultAsync(t => t.Id == _userInfo.Id && t.Password == editPwModel.OldPassWord) != null)
|
||||||
{
|
{
|
||||||
var success = await _userRepository.UpdateFromQueryAsync(t => t.Id == _userInfo.Id, u => new User()
|
var success = await _userRepository.UpdateFromQueryAsync(t => t.Id == _userInfo.Id, u => new User()
|
||||||
|
@ -531,10 +549,12 @@ namespace IRaCIS.Application.Services
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//医生密码
|
||||||
if (await _doctorRepository.AnyAsync(t => t.Id == _userInfo.Id && t.Password == editPwModel.OldPassWord))
|
if (await _doctorRepository.AnyAsync(t => t.Id == _userInfo.Id && t.Password == editPwModel.OldPassWord))
|
||||||
{
|
{
|
||||||
var success = await _doctorRepository.UpdateFromQueryAsync(t => t.Id == _userInfo.Id, u => new Doctor()
|
var success = await _doctorRepository.UpdateFromQueryAsync(t => t.Id == _userInfo.Id, u => new Doctor()
|
||||||
{
|
{
|
||||||
|
|
||||||
Password = editPwModel.NewPassWord
|
Password = editPwModel.NewPassWord
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -250,6 +250,10 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
public TrialSiteSurveyEnum? State { get; set; }
|
public TrialSiteSurveyEnum? State { get; set; }
|
||||||
|
|
||||||
public bool? IsAbandon { get; set; }
|
public bool? IsAbandon { get; set; }
|
||||||
|
|
||||||
|
public DateTime? UpdateTimeBegin { get; set; }
|
||||||
|
|
||||||
|
public DateTime? UpdateTimeEnd { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CopyTrialSiteSurveyDTO
|
public class CopyTrialSiteSurveyDTO
|
||||||
|
|
|
@ -369,6 +369,9 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
.WhereIf(surveyQueryDTO.IsAbandon != null, t => t.IsAbandon == surveyQueryDTO.IsAbandon)
|
.WhereIf(surveyQueryDTO.IsAbandon != null, t => t.IsAbandon == surveyQueryDTO.IsAbandon)
|
||||||
.WhereIf(!string.IsNullOrWhiteSpace(surveyQueryDTO.UserKeyInfo), t => t.UserName.Contains(surveyQueryDTO.UserKeyInfo) || t.Phone.Contains(surveyQueryDTO.UserKeyInfo) || t.Email.Contains(surveyQueryDTO.UserKeyInfo))
|
.WhereIf(!string.IsNullOrWhiteSpace(surveyQueryDTO.UserKeyInfo), t => t.UserName.Contains(surveyQueryDTO.UserKeyInfo) || t.Phone.Contains(surveyQueryDTO.UserKeyInfo) || t.Email.Contains(surveyQueryDTO.UserKeyInfo))
|
||||||
.WhereIf(surveyQueryDTO.State != null, t => t.State == surveyQueryDTO.State)
|
.WhereIf(surveyQueryDTO.State != null, t => t.State == surveyQueryDTO.State)
|
||||||
|
.WhereIf(surveyQueryDTO.UpdateTimeBegin != null, t => t.UpdateTime >= surveyQueryDTO.UpdateTimeBegin)
|
||||||
|
.WhereIf(surveyQueryDTO.UpdateTimeEnd != null, t => t.UpdateTime <= surveyQueryDTO.UpdateTimeEnd)
|
||||||
|
|
||||||
.ProjectTo<TrialSiteSurveyView>(_mapper.ConfigurationProvider);
|
.ProjectTo<TrialSiteSurveyView>(_mapper.ConfigurationProvider);
|
||||||
|
|
||||||
return await trialSiteSurveyQueryable.ToPagedListAsync(surveyQueryDTO.PageIndex, surveyQueryDTO.PageSize, surveyQueryDTO.SortField, surveyQueryDTO.Asc);
|
return await trialSiteSurveyQueryable.ToPagedListAsync(surveyQueryDTO.PageIndex, surveyQueryDTO.PageSize, surveyQueryDTO.SortField, surveyQueryDTO.Asc);
|
||||||
|
|
Loading…
Reference in New Issue