IsAbandon->IsDeleted

This commit is contained in:
2022-04-08 10:41:15 +08:00
parent 10bc94f9fd
commit 7aa3d7acdf
15 changed files with 159 additions and 107 deletions
@@ -96,7 +96,7 @@ namespace IRaCIS.Core.Application.Contracts
public string TrialSiteAliasName { get; set; } = String.Empty;
public string SiteName { get; set; } = string.Empty;
public bool IsAbandon { get; set; }
public bool IsDeleted { get; set; }
public Guid Id { get; set; }
public Guid TrialId { get; set; }
public Guid SiteId { get; set; }
@@ -255,7 +255,7 @@ namespace IRaCIS.Core.Application.Contracts
public TrialSiteSurveyEnum? State { get; set; }
public bool? IsAbandon { get; set; }
public bool? IsDeleted { get; set; }
public DateTime? UpdateTimeBegin { get; set; }
@@ -364,7 +364,7 @@ namespace IRaCIS.Core.Application.Contracts
{
var trialSiteSurveyQueryable = _trialSiteSurveyRepository.Where(t => t.TrialId == surveyQueryDTO.TrialId).IgnoreQueryFilters()
.WhereIf(surveyQueryDTO.SiteId != null, t => t.SiteId == surveyQueryDTO.SiteId)
.WhereIf(surveyQueryDTO.IsAbandon != null, t => t.IsAbandon == surveyQueryDTO.IsAbandon)
.WhereIf(surveyQueryDTO.IsDeleted != null, t => t.IsDeleted == surveyQueryDTO.IsDeleted)
.WhereIf(!string.IsNullOrWhiteSpace(surveyQueryDTO.UserKeyInfo), t => t.UserName.Contains(surveyQueryDTO.UserKeyInfo) || t.Phone.Contains(surveyQueryDTO.UserKeyInfo) || t.Email.Contains(surveyQueryDTO.UserKeyInfo))
.WhereIf(surveyQueryDTO.State != null, t => t.State == surveyQueryDTO.State)
.WhereIf(surveyQueryDTO.UpdateTimeBegin != null, t => t.UpdateTime >= surveyQueryDTO.UpdateTimeBegin)
@@ -385,7 +385,7 @@ namespace IRaCIS.Core.Application.Contracts
var groupSelectIdQuery =
_trialSiteSurveyRepository.Where(t => t.TrialId == queryParam.TrialId && t.IsAbandon == false)
_trialSiteSurveyRepository.Where(t => t.TrialId == queryParam.TrialId)
.WhereIf(queryParam.SiteId != null, t => t.SiteId == queryParam.SiteId)
.WhereIf(!string.IsNullOrEmpty(queryParam.FormWriterKeyInfo), t => (t.UserName).Contains(queryParam.FormWriterKeyInfo) || t.Email.Contains(queryParam.FormWriterKeyInfo) || t.Phone.Contains(queryParam.FormWriterKeyInfo))
.GroupBy(t => t.SiteId)
@@ -624,14 +624,14 @@ namespace IRaCIS.Core.Application.Contracts
[HttpPut("{trialId:guid}/{trialSiteSurveyId:guid}")]
public async Task<IResponseOutput> AbandonSiteSurvey(Guid trialSiteSurveyId)
{
var survey = (await _trialSiteSurveyRepository.FirstOrDefaultAsync(t => t.Id == trialSiteSurveyId)).IfNullThrowConvertException();
var survey = (await _trialSiteSurveyRepository.FirstOrDefaultAsync(t => t.Id == trialSiteSurveyId,true)).IfNullThrowConvertException();
if (survey.State != TrialSiteSurveyEnum.ToSubmit)
{
return ResponseOutput.NotOk("只允许废除未提交的记录");
}
survey.IsAbandon = true;
survey.IsDeleted = true;
await _repository.SaveChangesAsync();