diff --git a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs index 405d1d974..95c157680 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs @@ -66,16 +66,16 @@ namespace IRaCIS.Core.Application.Services return await trialDocumentQueryable.ToPagedListAsync(queryTrialDocument.PageIndex, queryTrialDocument.PageSize, queryTrialDocument.SortField, queryTrialDocument.Asc); } - + [HttpPost] public async Task> GetTrialSignDocumentList(TrialDocQuery querySystemDocument) { - var trialDocQueryable = from trialDoc in _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == querySystemDocument.TrialId) - .Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)) - .Where(t => t.IsDeleted == false || (t.IsDeleted == true && t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id))) + var trialDocQueryable = from trialDoc in _trialDocumentRepository.AsQueryable(true) + .WhereIf(querySystemDocument.TrialId!=null,t=>t.TrialId==querySystemDocument.TrialId) + .Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)) + .Where(t => t.IsDeleted == false || (t.IsDeleted == true && t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id))) - join trialUser in _repository.Where(t => t.TrialId == querySystemDocument.TrialId && t.UserId == _userInfo.Id) on trialDoc.TrialId equals trialUser.TrialId join confirm in _repository.Where(t => t.TrialDocument.TrialId == querySystemDocument.TrialId) on - new { trialUser.UserId, TrialDocumentId = trialDoc.Id } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc + new { UserId=_userInfo.Id, TrialDocumentId = trialDoc.Id } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc from confirm in cc.DefaultIfEmpty() select new UnionDocumentWithConfirmInfoView() { @@ -94,10 +94,10 @@ namespace IRaCIS.Core.Application.Services //IsConfirmed = confirm.ConfirmTime != null, ConfirmUserId = confirm.ConfirmUserId, ConfirmTime = confirm.ConfirmTime, - RealName = trialUser.User.FullName, - UserName = trialUser.User.UserName, - UserTypeId = trialUser.User.UserTypeId, - UserTypeShortName = trialUser.User.UserTypeRole.UserTypeShortName + RealName = confirm.User.FullName, + UserName = confirm.User.UserName, + UserTypeId = confirm.User.UserTypeId, + UserTypeShortName = confirm.User.UserTypeRole.UserTypeShortName }; diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs index 67523f2fd..f79c71301 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs @@ -1212,9 +1212,10 @@ namespace IRaCIS.Core.Application .SelectMany(t => t.NeedConfirmedUserTypeList) .CountAsync(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId); - var signedTrialCount = await _trialRepository.Where(t => t.TrialStatusStr != StaticData.TrialState.TrialStopped).Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(c => c.TrialDocumentList.Where(t => t.IsDeleted == false && t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId) - && t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null)).Count() > 0).CountAsync(); + var signedTrialCount = await _trialDocumentRepository.AsQueryable(true) + .Where(t=>t.Trial.TrialUserList.Any(t=>t.UserId==_userInfo.Id)) + .Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)) + .Where(t => t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime!=null)).CountAsync(); var signedSysDocCont = await _systemDocumentRepository .Where(t => t.IsDeleted == false && t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null))