Uat_Study
parent
9dc4bfc635
commit
1b12855aac
|
@ -281,27 +281,52 @@ namespace IRaCIS.Application.Services
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<IResponseOutput> DeleteReadingRowAnswer(DeleteReadingRowAnswerInDto inDto)
|
public async Task<IResponseOutput> DeleteReadingRowAnswer(DeleteReadingRowAnswerInDto inDto)
|
||||||
{
|
{
|
||||||
|
var deleteRowIndex = inDto.RowIndex;
|
||||||
await _readingTableQuestionAnswerRepository.DeleteFromQueryAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == inDto.RowIndex && x.QuestionId == inDto.QuestionId);
|
await _readingTableQuestionAnswerRepository.DeleteFromQueryAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == inDto.RowIndex && x.QuestionId == inDto.QuestionId);
|
||||||
await _readingTableAnswerRowInfoRepository.DeleteFromQueryAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == inDto.RowIndex && x.QuestionId == inDto.QuestionId);
|
await _readingTableAnswerRowInfoRepository.DeleteFromQueryAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == inDto.RowIndex && x.QuestionId == inDto.QuestionId);
|
||||||
await _readingTableAnswerRowInfoRepository.SaveChangesAsync();
|
await _readingTableAnswerRowInfoRepository.SaveChangesAsync();
|
||||||
|
|
||||||
var indexs = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId).Select(x => x.RowIndex).Distinct().OrderBy(x => x).ToListAsync();
|
|
||||||
|
var rowInfoList = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId).OrderBy(x => x.RowIndex).ToListAsync();
|
||||||
|
|
||||||
var index = 1;
|
var index = 1;
|
||||||
foreach (var item in indexs)
|
foreach (var item in rowInfoList.Where(x=>x.RowIndex%1==0))
|
||||||
{
|
{
|
||||||
await _readingTableQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == item && x.QuestionId == inDto.QuestionId, x => new ReadingTableQuestionAnswer()
|
|
||||||
|
|
||||||
|
|
||||||
|
await _readingTableQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == item.RowIndex && x.QuestionId == inDto.QuestionId, x => new ReadingTableQuestionAnswer()
|
||||||
{
|
{
|
||||||
RowIndex = index
|
RowIndex = index
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
await _readingTableAnswerRowInfoRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == item && x.QuestionId == inDto.QuestionId, x => new ReadingTableAnswerRowInfo()
|
await _readingTableAnswerRowInfoRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == item.RowIndex && x.QuestionId == inDto.QuestionId, x => new ReadingTableAnswerRowInfo()
|
||||||
{
|
{
|
||||||
RowIndex = index
|
RowIndex = index
|
||||||
});
|
});
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
|
|
||||||
|
var spiltList = rowInfoList.Where(x => x.RowIndex % 1 != 0 && x.RowIndex > item.RowIndex && x.RowIndex < Math.Floor(item.RowIndex + 1)).OrderBy(x=>x.RowIndex).ToList();
|
||||||
|
|
||||||
|
decimal spiltindex = 0.01M;
|
||||||
|
foreach (var spiltitem in spiltList)
|
||||||
|
{
|
||||||
|
await _readingTableQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == spiltitem.RowIndex && x.QuestionId == inDto.QuestionId, x => new ReadingTableQuestionAnswer()
|
||||||
|
{
|
||||||
|
RowIndex = index+spiltindex
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
await _readingTableAnswerRowInfoRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == spiltitem.RowIndex && x.QuestionId == inDto.QuestionId, x => new ReadingTableAnswerRowInfo()
|
||||||
|
{
|
||||||
|
RowIndex = index+spiltindex
|
||||||
|
});
|
||||||
|
|
||||||
|
spiltindex += 0.01M;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResponseOutput.Ok(true);
|
return ResponseOutput.Ok(true);
|
||||||
|
|
Loading…
Reference in New Issue