修改调研表限制
parent
ea157cdb71
commit
bd8123af59
|
@ -17,10 +17,12 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public class TrialSiteEquipmentSurveyService : BaseService, ITrialSiteEquipmentSurveyService
|
||||
{
|
||||
private readonly IRepository<TrialSiteEquipmentSurvey> _trialSiteEquipmentSurveyRepository;
|
||||
private readonly IRepository<TrialSiteSurvey> _trialSiteSurveyRepository;
|
||||
|
||||
public TrialSiteEquipmentSurveyService(IRepository<TrialSiteEquipmentSurvey> trialSiteEquipmentSurveyRepository)
|
||||
public TrialSiteEquipmentSurveyService(IRepository<TrialSiteEquipmentSurvey> trialSiteEquipmentSurveyRepository, IRepository<TrialSiteSurvey> trialSiteSurveyRepository)
|
||||
{
|
||||
_trialSiteEquipmentSurveyRepository = trialSiteEquipmentSurveyRepository;
|
||||
_trialSiteSurveyRepository = trialSiteSurveyRepository;
|
||||
}
|
||||
|
||||
|
||||
|
@ -38,17 +40,14 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
[HttpPost("{trialId:guid}")]
|
||||
public async Task<IResponseOutput> AddOrUpdateTrialSiteEquipmentSurvey(TrialSiteEquipmentSurveyAddOrEdit addOrEditTrialSiteEquipmentSurvey)
|
||||
{
|
||||
|
||||
if (addOrEditTrialSiteEquipmentSurvey.Id != null)
|
||||
|
||||
if (await _trialSiteSurveyRepository.AnyAsync(t => t.Id == addOrEditTrialSiteEquipmentSurvey.TrialSiteSurveyId && (t.IsDeleted == true ||t.State==TrialSiteSurveyEnum.PMCreatedAndLock), true))
|
||||
{
|
||||
if (await _trialSiteEquipmentSurveyRepository.Where(t => t.Id == addOrEditTrialSiteEquipmentSurvey.Id).AnyAsync(t => t.TrialSiteSurvey.State==TrialSiteSurveyEnum.PMCreatedAndLock))
|
||||
{
|
||||
//---已锁定,不允许操作
|
||||
return ResponseOutput.NotOk(_localizer["TrialSiteEquipment_Locked"]);
|
||||
}
|
||||
return ResponseOutput.NotOk("当前调研表已废除,或者调研表状态已锁定,不允许操作");
|
||||
}
|
||||
|
||||
|
||||
|
||||
var entity = await _trialSiteEquipmentSurveyRepository.InsertOrUpdateAsync(addOrEditTrialSiteEquipmentSurvey, true);
|
||||
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
|
|
|
@ -703,7 +703,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
if (trialSiteSurvey.IsDeleted == true || trialSiteSurvey.State==TrialSiteSurveyEnum.PMCreatedAndLock)
|
||||
{
|
||||
throw new BusinessValidationFailedException("当前调研表已废除,或者调研表状态已锁定,不允许提交");
|
||||
throw new BusinessValidationFailedException("当前调研表已废除,或者调研表状态已锁定,不允许操作");
|
||||
}
|
||||
|
||||
var siteUserList = await _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurvey.TrialId == trialId && t.TrialSiteSurvey.SiteId == trialSiteSurvey.SiteId && t.TrialSiteSurvey.IsDeleted == false).Select(t =>
|
||||
|
|
|
@ -43,12 +43,14 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public async Task<IResponseOutput> AddOrUpdateTrialSiteUserSurvey(TrialSiteUserSurveyAddOrEdit addOrEditTrialSiteUserSurvey)
|
||||
{
|
||||
|
||||
if (await _trialSiteUserSurveyRepository.Where(t => t.Id == addOrEditTrialSiteUserSurvey.Id).AnyAsync(t => t.TrialSiteSurvey.State == TrialSiteSurveyEnum.PMCreatedAndLock))
|
||||
|
||||
|
||||
if (await _trialSiteSurveyRepository.AnyAsync(t => t.Id == addOrEditTrialSiteUserSurvey.TrialSiteSurveyId && (t.IsDeleted == true || t.State == TrialSiteSurveyEnum.PMCreatedAndLock), true))
|
||||
{
|
||||
//---已锁定,不允许操作
|
||||
return ResponseOutput.NotOk(_localizer["TrialSiteUser_Locked"]);
|
||||
//当前调研表已废除,或者调研表状态已锁定,不允许操作
|
||||
return ResponseOutput.NotOk("当前调研表已废除,或者调研表状态已锁定,不允许操作");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (addOrEditTrialSiteUserSurvey.IsGenerateAccount )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue