|
|
|
@@ -25,8 +25,10 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
IRepository<Trial> _trialRepository,
|
|
|
|
|
ISystemDocumentService _systemDocumentService,
|
|
|
|
|
IRepository<SystemDocConfirmedUser> _systemDocConfirmedUserRepository,
|
|
|
|
|
IRepository<SystemDocNeedConfirmedUserType> _systemDocNeedConfirmedUserTypeRepository,
|
|
|
|
|
IRepository<SystemDocument> _systemDocumentRepository,
|
|
|
|
|
IRepository<TrialUser> _trialUserRepository,
|
|
|
|
|
IRepository<TrialDocConfirmedUser> _trialDocConfirmedUserRepository,
|
|
|
|
|
IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrialRepository) : BaseService, ITrialDocumentService
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
@@ -60,7 +62,7 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
.Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
|
|
|
|
|
|
|
|
|
join trialUser in _trialUserRepository.Where(t => t.UserId == _userInfo.Id) on trialDoc.TrialId equals trialUser.TrialId
|
|
|
|
|
join confirm in _repository.Where<TrialDocConfirmedUser>() on
|
|
|
|
|
join confirm in _trialDocConfirmedUserRepository.Where() on
|
|
|
|
|
new { trialUser.UserId, TrialDocumentId = trialDoc.Id } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
|
|
|
|
|
|
|
|
|
|
from confirm in cc.DefaultIfEmpty()
|
|
|
|
@@ -228,7 +230,7 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
|
|
|
|
|
join trialUser in _trialUserRepository.Where(t => t.TrialId == inQuery.TrialId && t.UserId == _userInfo.Id)
|
|
|
|
|
on needConfirmedUserType.NeedConfirmUserTypeId equals trialUser.User.UserTypeId
|
|
|
|
|
join confirm in _repository.GetQueryable<SystemDocConfirmedUser>() on new { ConfirmUserId = trialUser.UserId, SystemDocumentId = needConfirmedUserType.SystemDocumentId } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
|
|
|
|
|
join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = trialUser.UserId, SystemDocumentId = needConfirmedUserType.SystemDocumentId } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
|
|
|
|
|
from confirm in cc.DefaultIfEmpty()
|
|
|
|
|
select new UnionDocumentWithConfirmInfoView()
|
|
|
|
|
{
|
|
|
|
@@ -261,7 +263,7 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
.WhereIf(!_userInfo.IsAdmin, t => t.IsDeleted == false || (t.IsDeleted == true && t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id)))
|
|
|
|
|
|
|
|
|
|
join trialUser in _trialUserRepository.Where(t => t.TrialId == inQuery.TrialId && t.UserId == _userInfo.Id) on trialDoc.TrialId equals trialUser.TrialId
|
|
|
|
|
join confirm in _repository.Where<TrialDocConfirmedUser>(t => t.TrialDocument.TrialId == inQuery.TrialId) on
|
|
|
|
|
join confirm in _trialDocConfirmedUserRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId) on
|
|
|
|
|
new { trialUser.UserId, TrialDocumentId = trialDoc.Id } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
|
|
|
|
|
from confirm in cc.DefaultIfEmpty()
|
|
|
|
|
select new UnionDocumentWithConfirmInfoView()
|
|
|
|
@@ -398,7 +400,7 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
.WhereIf(inQuery.UserTypeId != null, t => t.User.UserTypeId == inQuery.UserTypeId)
|
|
|
|
|
on trialDocumentNeedConfirmedUserType.NeedConfirmUserTypeId equals trialUser.User.UserTypeId
|
|
|
|
|
|
|
|
|
|
join confirm in _repository.Where<TrialDocConfirmedUser>(t => t.TrialDocument.TrialId == inQuery.TrialId) on
|
|
|
|
|
join confirm in _trialDocConfirmedUserRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId) on
|
|
|
|
|
new { trialUser.UserId, TrialDocumentId = trialDocumentNeedConfirmedUserType.TrialDocumentId } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
|
|
|
|
|
from confirm in cc.DefaultIfEmpty()
|
|
|
|
|
select new UnionDocumentWithConfirmInfoView()
|
|
|
|
@@ -430,12 +432,12 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var systemDocQuery = from needConfirmEdUserType in _repository.WhereIf<SystemDocNeedConfirmedUserType>(trialInfo.TrialFinishedTime != null, u => u.SystemDocument.CreateTime < trialInfo.TrialFinishedTime)
|
|
|
|
|
var systemDocQuery = from needConfirmEdUserType in _systemDocNeedConfirmedUserTypeRepository.WhereIf(trialInfo.TrialFinishedTime != null, u => u.SystemDocument.CreateTime < trialInfo.TrialFinishedTime)
|
|
|
|
|
|
|
|
|
|
join trialUser in _trialUserRepository.Where(t => t.TrialId == inQuery.TrialId)
|
|
|
|
|
.WhereIf(inQuery.UserId != null, t => t.UserId == inQuery.UserId)
|
|
|
|
|
on needConfirmEdUserType.NeedConfirmUserTypeId equals trialUser.User.UserTypeId
|
|
|
|
|
join confirm in _repository.GetQueryable<SystemDocConfirmedUser>() on new { ConfirmUserId = trialUser.UserId, SystemDocumentId = needConfirmEdUserType.SystemDocumentId } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
|
|
|
|
|
join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = trialUser.UserId, SystemDocumentId = needConfirmEdUserType.SystemDocumentId } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
|
|
|
|
|
from confirm in cc.DefaultIfEmpty()
|
|
|
|
|
select new UnionDocumentWithConfirmInfoView()
|
|
|
|
|
{
|
|
|
|
@@ -619,7 +621,7 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
{
|
|
|
|
|
if (!await _systemDocConfirmedUserRepository.AnyAsync(t => t.SystemDocumentId == documentId && t.ConfirmUserId == _userInfo.Id))
|
|
|
|
|
{
|
|
|
|
|
await _repository.AddAsync(new SystemDocConfirmedUser() { SystemDocumentId = documentId, ConfirmUserId = _userInfo.Id, SignFirstViewTime = DateTime.Now });
|
|
|
|
|
await _systemDocConfirmedUserRepository.AddAsync(new SystemDocConfirmedUser() { SystemDocumentId = documentId, ConfirmUserId = _userInfo.Id, SignFirstViewTime = DateTime.Now });
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -630,7 +632,7 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
if (!await _trialDocUserTypeConfirmedUserRepository.AnyAsync(t => t.TrialDocumentId == documentId && t.ConfirmUserId == _userInfo.Id))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
await _repository.AddAsync(new TrialDocConfirmedUser() { TrialDocumentId = documentId, ConfirmUserId = _userInfo.Id, SignFirstViewTime = DateTime.Now });
|
|
|
|
|
await _trialDocConfirmedUserRepository.AddAsync(new TrialDocConfirmedUser() { TrialDocumentId = documentId, ConfirmUserId = _userInfo.Id, SignFirstViewTime = DateTime.Now });
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -647,7 +649,7 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
{
|
|
|
|
|
if (!await _systemDocConfirmedUserRepository.AnyAsync(t => t.SystemDocumentId == documentId && t.ConfirmUserId == _userInfo.Id))
|
|
|
|
|
{
|
|
|
|
|
await _repository.AddAsync(new SystemDocConfirmedUser() { SystemDocumentId = documentId, ConfirmUserId = _userInfo.Id, SignFirstViewTime = DateTime.Now });
|
|
|
|
|
await _systemDocConfirmedUserRepository.AddAsync(new SystemDocConfirmedUser() { SystemDocumentId = documentId, ConfirmUserId = _userInfo.Id, SignFirstViewTime = DateTime.Now });
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -662,7 +664,7 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
if (!await _trialDocUserTypeConfirmedUserRepository.AnyAsync(t => t.TrialDocumentId == documentId && t.ConfirmUserId == _userInfo.Id))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
await _repository.AddAsync(new TrialDocConfirmedUser() { TrialDocumentId = documentId, ConfirmUserId = _userInfo.Id, SignFirstViewTime = DateTime.Now });
|
|
|
|
|
await _trialDocConfirmedUserRepository.AddAsync(new TrialDocConfirmedUser() { TrialDocumentId = documentId, ConfirmUserId = _userInfo.Id, SignFirstViewTime = DateTime.Now });
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
var success = await _repository.SaveChangesAsync();
|
|
|
|
@@ -806,8 +808,8 @@ namespace IRaCIS.Core.Application.Services
|
|
|
|
|
[Obsolete]
|
|
|
|
|
public async Task<PageOutput<DocumentUnionWithUserStatView>> GetTrialSystemDocumentList(DocumentTrialUnionQuery inQuery)
|
|
|
|
|
{
|
|
|
|
|
var systemDocumentQueryable = _repository
|
|
|
|
|
.WhereIf<SystemDocument>(!_userInfo.IsAdmin, t => t.IsDeleted == false)
|
|
|
|
|
var systemDocumentQueryable = _systemDocumentRepository
|
|
|
|
|
.WhereIf(!_userInfo.IsAdmin, t => t.IsDeleted == false)
|
|
|
|
|
.Select(t => new DocumentUnionWithUserStatView()
|
|
|
|
|
{
|
|
|
|
|
Id = t.Id,
|
|
|
|
|