|
|
|
@ -8,6 +8,7 @@ using System.Linq; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
using System.Text; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Volo.Abp; |
|
|
|
using Volo.Abp.Domain.Entities; |
|
|
|
using Volo.Abp.Domain.Repositories; |
|
|
|
using Volo.Abp.Domain.Services; |
|
|
|
@ -17,12 +18,13 @@ namespace Shentun.WebPeis.QuestionAnswers |
|
|
|
public class QuestionAnswerManager : DomainService |
|
|
|
{ |
|
|
|
private readonly IRepository<QuestionAnswer> _questionAnswerRepository; |
|
|
|
|
|
|
|
private readonly IRepository<QuestionRegisterAnswer> _questionRegisterAnswerRepository; |
|
|
|
public QuestionAnswerManager( |
|
|
|
IRepository<QuestionAnswer> questionAnswerRepository |
|
|
|
) |
|
|
|
IRepository<QuestionAnswer> questionAnswerRepository, |
|
|
|
IRepository<QuestionRegisterAnswer> questionRegisterAnswerRepository) |
|
|
|
{ |
|
|
|
_questionAnswerRepository = questionAnswerRepository; |
|
|
|
_questionRegisterAnswerRepository = questionRegisterAnswerRepository; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -71,7 +73,7 @@ namespace Shentun.WebPeis.QuestionAnswers |
|
|
|
DataHelper.CheckEntityIsNull(targetEntity); |
|
|
|
//DataHelper.CheckStringIsNull(sourceEntity.QuestionTypeName, "名称");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
targetEntity.HealthGuidance = sourceEntity.HealthGuidance; |
|
|
|
targetEntity.Aliases = sourceEntity.Aliases; |
|
|
|
@ -85,7 +87,7 @@ namespace Shentun.WebPeis.QuestionAnswers |
|
|
|
targetEntity.Reason = sourceEntity.Reason; |
|
|
|
targetEntity.QuestionId = sourceEntity.QuestionId; |
|
|
|
targetEntity.SimpleCode = LanguageConverter.GetPYSimpleCode(sourceEntity.QuestionAnswerName); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -99,11 +101,11 @@ namespace Shentun.WebPeis.QuestionAnswers |
|
|
|
public async Task CheckAndDeleteAsync(Guid QuestionAnswerId) |
|
|
|
{ |
|
|
|
|
|
|
|
//var questionEnt = await _questionRepository.FirstOrDefaultAsync(m => m.QuestionTypeId == QuestionTypeId);
|
|
|
|
//if (questionEnt != null)
|
|
|
|
//{
|
|
|
|
// throw new UserFriendlyException($"问卷类别已被使用,不能删除");
|
|
|
|
//}
|
|
|
|
var questionRegisterAnswerEnt = await _questionRegisterAnswerRepository.FirstOrDefaultAsync(m => m.QuestionAnswerId == QuestionAnswerId); |
|
|
|
if (questionRegisterAnswerEnt != null) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"问卷答案已被人员登记使用,不能删除"); |
|
|
|
} |
|
|
|
|
|
|
|
await _questionAnswerRepository.DeleteAsync(d => d.QuestionAnswerId == QuestionAnswerId); |
|
|
|
|
|
|
|
|