diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index c88b743c4..8d13ba8d7 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -1327,7 +1327,11 @@ public class VisitTaskService(IRepository _visitTaskRepository, var isSPMJoinReReadingApproval = _trialRepository.Any(t => t.Id == trialId && t.IsSPMJoinReReadingApproval); - var hasSPMOrCPM = await _trialRepository.Where(t => t.Id == trialId).SelectMany(t => t.TrialIdentityUserList).AnyAsync(t => t.TrialUserRoleList.Any(t => t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM)); + var hasSPMOrCPM = await _trialRepository.Where(t => t.Id == trialId).SelectMany(t => t.TrialIdentityUserList).AnyAsync(t => t.TrialUserRoleList.Any(t => + t.UserRole.IdentityUser.Status == UserStateEnum.Enable + && t.UserRole.IsUserRoleDisabled == false + && (t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM) + )); var isSPMjoin = isSPMJoinReReadingApproval && hasSPMOrCPM; diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 83a40e9a1..05edd063d 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -441,7 +441,11 @@ namespace IRaCIS.Core.Application.Contracts { var isTrialSPMJoin = await _trialRepository.AnyAsync(t => t.Id == trialSiteSubmitBackCommand.TrialId && t.IsSPMJoinSiteSurvey); - var hasSPMOrCPM = await _trialSiteSurveyRepository.AnyAsync(t => t.TrialId == trialSiteSubmitBackCommand.TrialId && t.Trial.TrialIdentityUserList.Any(u => u.TrialUserRoleList.Any(u => u.UserRole.UserTypeEnum == UserTypeEnum.SPM || u.UserRole.UserTypeEnum == UserTypeEnum.CPM))); + var hasSPMOrCPM = await _trialSiteSurveyRepository.AnyAsync(t => t.TrialId == trialSiteSubmitBackCommand.TrialId && t.Trial.TrialIdentityUserList.Any(u => u.TrialUserRoleList.Any(t => + t.UserRole.IdentityUser.Status == UserStateEnum.Enable + && t.UserRole.IsUserRoleDisabled == false + && (t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM)) + )); var isSPMjoin = isTrialSPMJoin && hasSPMOrCPM; @@ -792,7 +796,12 @@ namespace IRaCIS.Core.Application.Contracts if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.Undefined || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator) { - var hasSPMOrCPM = await _trialSiteSurveyRepository.AnyAsync(t => t.TrialId == trialId && t.Trial.TrialIdentityUserList.Any(u => u.TrialUserRoleList.Any(u => u.UserRole.UserTypeEnum == UserTypeEnum.SPM || u.UserRole.UserTypeEnum == UserTypeEnum.CPM))); + var hasSPMOrCPM = await _trialSiteSurveyRepository.AnyAsync(t => t.TrialId == trialId && t.Trial.TrialIdentityUserList.Any(u => + u.TrialUserRoleList.Any(t => + t.UserRole.IdentityUser.Status == UserStateEnum.Enable + && t.UserRole.IsUserRoleDisabled == false + && (t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM)) + )); var isTrialSPMJoin = await _trialRepository.AnyAsync(t => t.Id == trialId && t.IsSPMJoinSiteSurvey); diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs index aca922846..0fb47b5ab 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs @@ -171,7 +171,7 @@ namespace IRaCIS.Application.Contracts public bool IsDeleted { get; set; } - + public UserStateEnum Status { get; set; } public DateTime CreateTime { get; set; } public DateTime UpdateTime { get; set; } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs index 2242e9d92..e0fad8e9c 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs @@ -57,6 +57,7 @@ namespace IRaCIS.Core.Application.Service UpdateTime = t.UpdateTime, UserName = t.IdentityUser.UserName, RemoveTime = t.RemoveTime, + Status = t.IdentityUser.Status, TrialUserRoleList = t.TrialUserRoleList.Select(ur => new TrialIdentityUserRoleDto() { Id = ur.Id, diff --git a/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs b/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs index 89519c81e..05ebbfe2a 100644 --- a/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs +++ b/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs @@ -175,7 +175,11 @@ namespace IRaCIS.Core.Application.Service var trial = await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId); - var hasSPMOrCPM = await _trialRepository.Where(t => t.Id == trialId).AnyAsync(t => t.TrialIdentityUserList.SelectMany(t => t.TrialUserRoleList).Any(t => t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM)); + var hasSPMOrCPM = await _trialRepository.Where(t => t.Id == trialId).AnyAsync(t => t.TrialIdentityUserList.SelectMany(t => t.TrialUserRoleList).Any(t => + t.UserRole.IdentityUser.Status==UserStateEnum.Enable + && t.UserRole.IsUserRoleDisabled==false + && (t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM) ) + ); var isSPMjoin = trial.IsSPMJoinReviewerSelect && hasSPMOrCPM;