修改仓储批量更新和批量删除方法

This commit is contained in:
2022-04-19 09:01:59 +08:00
parent 7c1fdde2f3
commit eda7ac40bf
53 changed files with 316 additions and 254 deletions
@@ -72,7 +72,7 @@ namespace IRaCIS.Core.Application.Contracts
{
return ResponseOutput.NotOk("已锁定,不允许操作");
}
var success = await _trialSiteEquipmentSurveyRepository.DeleteFromQueryAsync(t => t.Id == trialSiteEquipmentSurveyId);
var success = await _trialSiteEquipmentSurveyRepository.BatchDeleteAsync(t => t.Id == trialSiteEquipmentSurveyId);
return ResponseOutput.Result(success);
}
@@ -273,7 +273,7 @@ namespace IRaCIS.Core.Application.Contracts
//删除验证码历史记录
await _repository.DeleteFromQueryAsync<VerificationCode>(t => t.EmailOrPhone == userInfo.EmailOrPhone && t.Code == userInfo.verificationCode && t.CodeType == userInfo.verificationType);
await _repository.BatchDeleteAsync<VerificationCode>(t => t.EmailOrPhone == userInfo.EmailOrPhone && t.Code == userInfo.verificationCode && t.CodeType == userInfo.verificationType);
await _repository.SaveChangesAsync();
@@ -349,7 +349,7 @@ namespace IRaCIS.Core.Application.Contracts
return ResponseOutput.NotOk("已锁定,不允许操作");
}
var success = await _trialSiteSurveyRepository.DeleteFromQueryAsync(t => t.Id == trialSiteSurveyId);
var success = await _trialSiteSurveyRepository.BatchDeleteAsync(t => t.Id == trialSiteSurveyId);
return ResponseOutput.Result(success);
}
@@ -600,7 +600,7 @@ namespace IRaCIS.Core.Application.Contracts
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM)
{
await _repository.UpdateFromQueryAsync<TrialSiteSurvey>(t => t.Id == trialSiteSurveyId, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.ToSubmit });
await _repository.BatchUpdateAsync<TrialSiteSurvey>(t => t.Id == trialSiteSurveyId, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.ToSubmit });
}
else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM)
{
@@ -608,12 +608,12 @@ namespace IRaCIS.Core.Application.Contracts
if (hasSPMOrCPM)
{
await _trialSiteSurveyRepository.UpdateFromQueryAsync(t => t.Id == trialSiteSurveyId, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.CRCSubmitted });
await _trialSiteSurveyRepository.BatchUpdateAsync(t => t.Id == trialSiteSurveyId, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.CRCSubmitted });
}
else
{
await _trialSiteSurveyRepository.UpdateFromQueryAsync(t => t.Id == trialSiteSurveyId, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.ToSubmit });
await _trialSiteSurveyRepository.BatchUpdateAsync(t => t.Id == trialSiteSurveyId, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.ToSubmit });
}
}
return ResponseOutput.Ok();
@@ -725,7 +725,7 @@ namespace IRaCIS.Core.Application.Contracts
smtp.MessageSent += (sender, args) =>
{
_ = _trialSiteUserSurveyRepository.UpdateFromQueryAsync(t => t.Id == item.Id, u => new TrialSiteUserSurvey() { IsGenerateSuccess = true, InviteState = TrialSiteUserStateEnum.HasSend, IsJoin = null, ConfirmTime = null, RejectReason = String.Empty, SystemUserId = sysUserInfo.Id, ExpireTime = DateTime.Now.AddDays(7) }).Result;
_ = _trialSiteUserSurveyRepository.BatchUpdateAsync(t => t.Id == item.Id, u => new TrialSiteUserSurvey() { IsGenerateSuccess = true, InviteState = TrialSiteUserStateEnum.HasSend, IsJoin = null, ConfirmTime = null, RejectReason = String.Empty, SystemUserId = sysUserInfo.Id, ExpireTime = DateTime.Now.AddDays(7) }).Result;
};
@@ -773,12 +773,12 @@ namespace IRaCIS.Core.Application.Contracts
if (hasSPMOrCPM)
{
await _trialSiteSurveyRepository.UpdateFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.ToSubmit, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.CRCSubmitted });
await _trialSiteSurveyRepository.BatchUpdateAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.ToSubmit, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.CRCSubmitted });
}
else
{
await _trialSiteSurveyRepository.UpdateFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.ToSubmit, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved });
await _trialSiteSurveyRepository.BatchUpdateAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.ToSubmit, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved });
}
@@ -786,7 +786,7 @@ namespace IRaCIS.Core.Application.Contracts
else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM)
{
await _trialSiteSurveyRepository.UpdateFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.CRCSubmitted, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved, PreliminaryUserId = _userInfo.Id, PreliminaryTime = DateTime.Now });
await _trialSiteSurveyRepository.BatchUpdateAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.CRCSubmitted, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved, PreliminaryUserId = _userInfo.Id, PreliminaryTime = DateTime.Now });
}
else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager)
@@ -803,7 +803,7 @@ namespace IRaCIS.Core.Application.Contracts
await SendInviteEmail(new InviteEmailCommand() { TrialId = trialId, RouteUrl = siteSurvyeSubmit.RouteUrl, UserList = needGenerateList });
await _trialSiteSurveyRepository.UpdateFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.SPMApproved, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.PMCreatedAndLock, ReviewerUserId = _userInfo.Id, ReviewerTime = DateTime.Now });
await _trialSiteSurveyRepository.BatchUpdateAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.SPMApproved, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.PMCreatedAndLock, ReviewerUserId = _userInfo.Id, ReviewerTime = DateTime.Now });
}
@@ -81,7 +81,7 @@ namespace IRaCIS.Core.Application.Contracts
return ResponseOutput.NotOk("已锁定,不允许操作");
}
var success = await _trialSiteUserSurveyRepository.DeleteFromQueryAsync(t => t.Id == trialSiteUserSurveyId);
var success = await _trialSiteUserSurveyRepository.BatchDeleteAsync(t => t.Id == trialSiteUserSurveyId);
return ResponseOutput.Result(success);
}