邮件更改

Test.EIImageViewer
hang 2022-03-30 17:25:02 +08:00
parent 8fdfe16dd2
commit 0ce6b765dc
3 changed files with 119 additions and 111 deletions

View File

@ -144,7 +144,9 @@ namespace IRaCIS.Application.Contracts
{ {
public Guid TrialId { get; set; } = Guid.Empty; public Guid TrialId { get; set; } = Guid.Empty;
public string UserRealName { get; set; } = string.Empty; public string UserRealName { get; set; } = string.Empty;
public string UserType { get; set; } = string.Empty; //public string UserType { get; set; } = string.Empty;
public Guid? UserTypeId { get; set; }
public string UserName { get; set; } = string.Empty; public string UserName { get; set; } = string.Empty;

View File

@ -316,13 +316,18 @@ namespace IRaCIS.Core.Application.Service
await _trialUserRepository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId }); await _trialUserRepository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId });
}
var success = await _trialExternalUseRepository.SaveChangesAsync();
var messageToSend = new MimeMessage(); var messageToSend = new MimeMessage();
//发件地址 //发件地址
messageToSend.From.Add(new MailboxAddress("GRR", "iracis_grr@163.com")); messageToSend.From.Add(new MailboxAddress("GRR", "iracis_grr@163.com"));
//收件地址 //收件地址
messageToSend.To.Add(new MailboxAddress(String.Empty, needUpdate.Email)); messageToSend.To.Add(new MailboxAddress(String.Empty, needUpdate.Email));
//主题 //主题
messageToSend.Subject = $"GRR External User survey (Trial {(editTrialUserPreparation.IsJoin == false ?"Reject Success":"Join Success")})"; messageToSend.Subject = $"GRR External User survey (Trial {(editTrialUserPreparation.IsJoin == false ? "Reject Success" : "Join Success")})";
var builder = new BodyBuilder(); var builder = new BodyBuilder();
@ -376,43 +381,6 @@ namespace IRaCIS.Core.Application.Service
</div> </div>
</div> </div>
</body>"; </body>";
}
else
{
builder.HtmlBody = @$"<body style='font-family: 微软雅黑;padding: 0;margin: 0;'>
<div style='padding-left: 40px;background: #f6f6f6'>
<div style='padding-top: 20px;padding-bottom:40px'>
<div style='line-height: 40px;font-size: 18px'>
{sysUserInfo.LastName + "/" + sysUserInfo.FirstName}:
</div>
<div style='line-height: 40px;padding-left: 40px;margin-bottom: 10px;'>
{trialInfo.ResearchProgramNo} IRC
</div>
<div style='border: 1px solid #eee;box-sizing:border-box;width: 80%;background: #fff;padding: 20px;line-height: 40px;font-size: 14px;border-radius: 5px;margin-left: 60px;margin-bottom: 30px;'>
<div>
: {trialInfo.TrialCode}
</div>
<div>
: {trialInfo.ResearchProgramNo}
</div>
<div>
: {trialInfo.ExperimentName}
</div>
<div>
: {sysUserInfo.UserName}
</div>
<div>
: {sysUserInfo.UserTypeRole.UserTypeShortName}
</div>
</div>
</div>
</div>
</body>";
}
messageToSend.Body = builder.ToMessageBody(); messageToSend.Body = builder.ToMessageBody();
@ -430,14 +398,50 @@ namespace IRaCIS.Core.Application.Service
await smtp.DisconnectAsync(true); await smtp.DisconnectAsync(true);
} }
}
await _userRepository.UpdateFromQueryAsync(t => t.Id == userId, u => new User() { Status = UserStateEnum.Enable }); await _userRepository.UpdateFromQueryAsync(t => t.Id == userId, u => new User() { Status = UserStateEnum.Enable });
var success = await _trialExternalUseRepository.SaveChangesAsync();
}
return ResponseOutput.Ok(); return ResponseOutput.Ok();
//else
//{
// builder.HtmlBody = @$"<body style='font-family: 微软雅黑;padding: 0;margin: 0;'>
// <div style='padding-left: 40px;background: #f6f6f6'>
// <div style='padding-top: 20px;padding-bottom:40px'>
// <div style='line-height: 40px;font-size: 18px'>
// {sysUserInfo.LastName + "/" + sysUserInfo.FirstName}:
// </div>
// <div style='line-height: 40px;padding-left: 40px;margin-bottom: 10px;'>
// 您好,您拒绝了参加 {trialInfo.ResearchProgramNo} 项目IRC相关工作的邀请。详细信息如下
// </div>
// <div style='border: 1px solid #eee;box-sizing:border-box;width: 80%;background: #fff;padding: 20px;line-height: 40px;font-size: 14px;border-radius: 5px;margin-left: 60px;margin-bottom: 30px;'>
// <div>
// 项目编号: {trialInfo.TrialCode}
// </div>
// <div>
// 试验方案号: {trialInfo.ResearchProgramNo}
// </div>
// <div>
// 试验名称: {trialInfo.ExperimentName}
// </div>
// <div>
// 用户名: {sysUserInfo.UserName}
// </div>
// <div>
// 角色: {sysUserInfo.UserTypeRole.UserTypeShortName}
// </div>
// </div>
// </div>
// </div>
// </body>";
//}
} }
/// <summary> /// <summary>
@ -449,7 +453,9 @@ namespace IRaCIS.Core.Application.Service
public async Task<IResponseOutput> TrialSiteSurveyUserJoinTrial(TrialExternalUserConfirm editInfo) public async Task<IResponseOutput> TrialSiteSurveyUserJoinTrial(TrialExternalUserConfirm editInfo)
{ {
var needUpdate = await _trialSiteSurveyUserRepository.Where(t => t.Id == editInfo.Id,true).Include(t => t.TrialSiteSurvey).FirstOrDefaultAsync(); var needUpdate = (await _trialSiteSurveyUserRepository.Where(t => t.Id == editInfo.Id, true).Include(t => t.TrialSiteSurvey).FirstOrDefaultAsync()).IfNullThrowException();
var revieweUser = await _userRepository.FirstOrDefaultAsync(t => t.Id == needUpdate.TrialSiteSurvey.ReviewerUserId);
if (DateTime.Now > needUpdate.ExpireTime) if (DateTime.Now > needUpdate.ExpireTime)
@ -478,14 +484,21 @@ namespace IRaCIS.Core.Application.Service
await _trialSiteUserRepository.AddAsync(new TrialSiteUser() { TrialId = trialId, SiteId = siteId, UserId = userId }); await _trialSiteUserRepository.AddAsync(new TrialSiteUser() { TrialId = trialId, SiteId = siteId, UserId = userId });
await _userRepository.UpdateFromQueryAsync(t => t.Id == needUpdate.SystemUserId, u => new User() { Status = UserStateEnum.Enable });
}
var success = await _trialExternalUseRepository.SaveChangesAsync();
var messageToSend = new MimeMessage(); var messageToSend = new MimeMessage();
//发件地址 //发件地址
messageToSend.From.Add(new MailboxAddress("GRR", "iracis_grr@163.com")); messageToSend.From.Add(new MailboxAddress("GRR", "iracis_grr@163.com"));
//收件地址 //收件地址
messageToSend.To.Add(new MailboxAddress(String.Empty, needUpdate.Email)); messageToSend.To.Add(new MailboxAddress(String.Empty, editInfo.IsJoin == true ? needUpdate.Email : revieweUser.EMail));
//主题 //主题
messageToSend.Subject = $"GRR Site survey (Trial {(editInfo.IsJoin == false ?"Reject Success":"Join Success")})"; messageToSend.Subject = $"GRR Site survey (Trial {(editInfo.IsJoin == false ? "Reject" : "Join Success")})";
var builder = new BodyBuilder(); var builder = new BodyBuilder();
@ -547,10 +560,10 @@ namespace IRaCIS.Core.Application.Service
<div style='padding-left: 40px;background: #f6f6f6'> <div style='padding-left: 40px;background: #f6f6f6'>
<div style='padding-top: 20px;padding-bottom:40px'> <div style='padding-top: 20px;padding-bottom:40px'>
<div style='line-height: 40px;font-size: 18px'> <div style='line-height: 40px;font-size: 18px'>
{sysUserInfo.LastName + "/" + sysUserInfo.FirstName}: {revieweUser.LastName + "/" + revieweUser.FirstName}:
</div> </div>
<div style='line-height: 40px;padding-left: 40px;margin-bottom: 10px;'> <div style='line-height: 40px;padding-left: 40px;margin-bottom: 10px;'>
{trialInfo.ResearchProgramNo} IRC {sysUserInfo.LastName + "/" + sysUserInfo.FirstName} {trialInfo.ResearchProgramNo} IRC
</div> </div>
<div style='border: 1px solid #eee;box-sizing:border-box;width: 80%;background: #fff;padding: 20px;line-height: 40px;font-size: 14px;border-radius: 5px;margin-left: 60px;margin-bottom: 30px;'> <div style='border: 1px solid #eee;box-sizing:border-box;width: 80%;background: #fff;padding: 20px;line-height: 40px;font-size: 14px;border-radius: 5px;margin-left: 60px;margin-bottom: 30px;'>
<div> <div>
@ -593,13 +606,6 @@ namespace IRaCIS.Core.Application.Service
} }
}
await _userRepository.UpdateFromQueryAsync(t => t.Id == needUpdate.SystemUserId, u => new User() { Status = UserStateEnum.Enable });
var success = await _trialExternalUseRepository.SaveChangesAsync();
return ResponseOutput.Ok(); return ResponseOutput.Ok();
} }

View File

@ -28,7 +28,7 @@ namespace IRaCIS.Application.Services
{ {
var query = _trialUseRepository.Where(t => t.TrialId == param.TrialId).IgnoreQueryFilters() var query = _trialUseRepository.Where(t => t.TrialId == param.TrialId).IgnoreQueryFilters()
.WhereIf(!string.IsNullOrWhiteSpace(param.UserType), t => t.User.UserTypeRole.UserTypeShortName.Contains(param.UserType)) .WhereIf(param.UserTypeId!=null, t => t.User.UserTypeId==param.UserTypeId)
.WhereIf(!string.IsNullOrWhiteSpace(param.UserName), t => t.User.UserName.Contains(param.UserName)) .WhereIf(!string.IsNullOrWhiteSpace(param.UserName), t => t.User.UserName.Contains(param.UserName))
//.WhereIf( param.JoinTime!=null, t => t.JoinTime.to ==param.JoinTime.ToString("yyyy-MM-dd")) //.WhereIf( param.JoinTime!=null, t => t.JoinTime.to ==param.JoinTime.ToString("yyyy-MM-dd"))
@ -54,7 +54,7 @@ namespace IRaCIS.Application.Services
var query = _trialUseRepository.Where(t => t.TrialId == param.TrialId) var query = _trialUseRepository.Where(t => t.TrialId == param.TrialId)
.Where(t => t.User.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator) .Where(t => t.User.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator)
.WhereIf(!string.IsNullOrWhiteSpace(param.UserType), t => t.User.UserTypeRole.UserTypeShortName.Contains(param.UserType)) .WhereIf(param.UserTypeId != null, t => t.User.UserTypeId == param.UserTypeId)
.WhereIf(!string.IsNullOrWhiteSpace(param.UserRealName), t => (t.User.LastName + " / " + t.User.FirstName).Contains(param.UserRealName)) .WhereIf(!string.IsNullOrWhiteSpace(param.UserRealName), t => (t.User.LastName + " / " + t.User.FirstName).Contains(param.UserRealName))
.ProjectTo<AssginSiteCRCListDTO>(_mapper.ConfigurationProvider, new { siteId = param.SiteId }); .ProjectTo<AssginSiteCRCListDTO>(_mapper.ConfigurationProvider, new { siteId = param.SiteId });