Uat_Study
parent
81a0a7d02d
commit
d461ceaa21
|
@ -13,6 +13,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
public Guid SourceSystemCriterionId { get; set; }
|
public Guid SourceSystemCriterionId { get; set; }
|
||||||
|
|
||||||
public Guid NewSystemCriterionId { get; set; }
|
public Guid NewSystemCriterionId { get; set; }
|
||||||
|
|
||||||
|
public bool IsCopyQuestion { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ namespace IRaCIS.Application.Services
|
||||||
private readonly IRepository<ReadingTableQuestionTrial> _readingTableQuestionTrialRepository;
|
private readonly IRepository<ReadingTableQuestionTrial> _readingTableQuestionTrialRepository;
|
||||||
private readonly IRepository<ReadingCriterionPage> _readingCriterionPageRepository;
|
private readonly IRepository<ReadingCriterionPage> _readingCriterionPageRepository;
|
||||||
private readonly IRepository<Trial> _trialRepository;
|
private readonly IRepository<Trial> _trialRepository;
|
||||||
|
private readonly IRepository<OrganInfo> _organInfoRepository;
|
||||||
private readonly IRepository<ReadingTableQuestionSystem> _readingTableQuestionSystemRepository;
|
private readonly IRepository<ReadingTableQuestionSystem> _readingTableQuestionSystemRepository;
|
||||||
private readonly IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswer;
|
private readonly IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswer;
|
||||||
private readonly IRepository<PreviousPDF> _previousPDFRepository;
|
private readonly IRepository<PreviousPDF> _previousPDFRepository;
|
||||||
|
@ -50,6 +51,7 @@ namespace IRaCIS.Application.Services
|
||||||
IRepository<ReadingTableQuestionTrial> readingTableQuestionTrialRepository,
|
IRepository<ReadingTableQuestionTrial> readingTableQuestionTrialRepository,
|
||||||
IRepository<ReadingCriterionPage> readingCriterionPageRepository,
|
IRepository<ReadingCriterionPage> readingCriterionPageRepository,
|
||||||
IRepository<Trial> trialRepository,
|
IRepository<Trial> trialRepository,
|
||||||
|
IRepository<OrganInfo> organInfoRepository,
|
||||||
IRepository<ReadingTableQuestionSystem> readingTableQuestionSystemRepository,
|
IRepository<ReadingTableQuestionSystem> readingTableQuestionSystemRepository,
|
||||||
IRepository<ReadingTaskQuestionAnswer> readingTaskQuestionAnswer,
|
IRepository<ReadingTaskQuestionAnswer> readingTaskQuestionAnswer,
|
||||||
IRepository<PreviousPDF> previousPDFRepository
|
IRepository<PreviousPDF> previousPDFRepository
|
||||||
|
@ -66,6 +68,7 @@ namespace IRaCIS.Application.Services
|
||||||
this._readingTableQuestionTrialRepository = readingTableQuestionTrialRepository;
|
this._readingTableQuestionTrialRepository = readingTableQuestionTrialRepository;
|
||||||
this._readingCriterionPageRepository = readingCriterionPageRepository;
|
this._readingCriterionPageRepository = readingCriterionPageRepository;
|
||||||
this._trialRepository = trialRepository;
|
this._trialRepository = trialRepository;
|
||||||
|
this._organInfoRepository = organInfoRepository;
|
||||||
this._readingTableQuestionSystemRepository = readingTableQuestionSystemRepository;
|
this._readingTableQuestionSystemRepository = readingTableQuestionSystemRepository;
|
||||||
this._readingTaskQuestionAnswer = readingTaskQuestionAnswer;
|
this._readingTaskQuestionAnswer = readingTaskQuestionAnswer;
|
||||||
this._previousPDFRepository = previousPDFRepository;
|
this._previousPDFRepository = previousPDFRepository;
|
||||||
|
@ -78,6 +81,8 @@ namespace IRaCIS.Application.Services
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<IResponseOutput> CopySystemCriterionData(CopySystemCriterionDataInDto inDto)
|
public async Task<IResponseOutput> CopySystemCriterionData(CopySystemCriterionDataInDto inDto)
|
||||||
|
{
|
||||||
|
if (inDto.IsCopyQuestion)
|
||||||
{
|
{
|
||||||
var newSystemQuestionList = await _readingQuestionSystemRepository.Where(x => x.ReadingQuestionCriterionSystemId == inDto.SourceSystemCriterionId)
|
var newSystemQuestionList = await _readingQuestionSystemRepository.Where(x => x.ReadingQuestionCriterionSystemId == inDto.SourceSystemCriterionId)
|
||||||
.ProjectTo<ReadingQuestionSystemData>(_mapper.ConfigurationProvider).ToListAsync();
|
.ProjectTo<ReadingQuestionSystemData>(_mapper.ConfigurationProvider).ToListAsync();
|
||||||
|
@ -132,6 +137,24 @@ namespace IRaCIS.Application.Services
|
||||||
await _readingTableQuestionSystemRepository.BatchDeleteNoTrackingAsync(x => x.SystemCriterionId == inDto.NewSystemCriterionId);
|
await _readingTableQuestionSystemRepository.BatchDeleteNoTrackingAsync(x => x.SystemCriterionId == inDto.NewSystemCriterionId);
|
||||||
await _readingTableQuestionSystemRepository.AddRangeAsync(needAddTableDatas);
|
await _readingTableQuestionSystemRepository.AddRangeAsync(needAddTableDatas);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var organData = await _organInfoRepository.Where(x => x.SystemCriterionId == inDto.SourceSystemCriterionId).ToListAsync();
|
||||||
|
|
||||||
|
organData.ForEach(x => {
|
||||||
|
x.Id = NewId.NextGuid();
|
||||||
|
x.SystemCriterionId = inDto.NewSystemCriterionId;
|
||||||
|
});
|
||||||
|
await _organInfoRepository.BatchDeleteNoTrackingAsync(x => x.SystemCriterionId == inDto.NewSystemCriterionId);
|
||||||
|
await _organInfoRepository.AddRangeAsync(organData);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
await _readingTableQuestionSystemRepository.SaveChangesAsync();
|
await _readingTableQuestionSystemRepository.SaveChangesAsync();
|
||||||
return ResponseOutput.Ok();
|
return ResponseOutput.Ok();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue