修改仓储批量更新和批量删除方法
parent
7c1fdde2f3
commit
eda7ac40bf
|
@ -118,7 +118,7 @@ namespace IRaCIS.Application.Services
|
||||||
return ResponseOutput.NotOk("This item is referenced by content of the trial infomation.");
|
return ResponseOutput.NotOk("This item is referenced by content of the trial infomation.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var success = await _dicRepository.DeleteFromQueryAsync(t => t.Id == id);
|
var success = await _dicRepository.BatchDeleteAsync(t => t.Id == id);
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
[HttpDelete("{emailNoticeConfigId:guid}")]
|
[HttpDelete("{emailNoticeConfigId:guid}")]
|
||||||
public async Task<IResponseOutput> DeleteEmailNoticeConfig(Guid emailNoticeConfigId)
|
public async Task<IResponseOutput> DeleteEmailNoticeConfig(Guid emailNoticeConfigId)
|
||||||
{
|
{
|
||||||
var success = await repository.DeleteFromQueryAsync(t => t.Id == emailNoticeConfigId);
|
var success = await repository.BatchDeleteAsync(t => t.Id == emailNoticeConfigId);
|
||||||
|
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,7 +214,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
{
|
{
|
||||||
foreach (var item in sortDto.SortData)
|
foreach (var item in sortDto.SortData)
|
||||||
{
|
{
|
||||||
await _frontAuditConfigRepository.UpdateFromQueryAsync(x => x.Id == item.Id, x => new FrontAuditConfig
|
await _frontAuditConfigRepository.BatchUpdateAsync(x => x.Id == item.Id, x => new FrontAuditConfig
|
||||||
{
|
{
|
||||||
Sort = item.Sort
|
Sort = item.Sort
|
||||||
});
|
});
|
||||||
|
@ -270,7 +270,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
{
|
{
|
||||||
return ResponseOutput.NotOk("存在子类 无法删除");
|
return ResponseOutput.NotOk("存在子类 无法删除");
|
||||||
}
|
}
|
||||||
var success = await _repository.DeleteFromQueryAsync<FrontAuditConfig>(t => t.Id == frontAuditConfigId);
|
var success = await _repository.BatchDeleteAsync<FrontAuditConfig>(t => t.Id == frontAuditConfigId);
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ namespace IRaCIS.Core.Application.Services
|
||||||
[HttpDelete("{systemBasicDataId:guid}")]
|
[HttpDelete("{systemBasicDataId:guid}")]
|
||||||
public async Task<IResponseOutput> DeleteSystemBasicData(Guid systemBasicDataId)
|
public async Task<IResponseOutput> DeleteSystemBasicData(Guid systemBasicDataId)
|
||||||
{
|
{
|
||||||
var success = await _repository.DeleteFromQueryAsync<SystemBasicData>(t => t.Id == systemBasicDataId);
|
var success = await _repository.BatchDeleteAsync<SystemBasicData>(t => t.Id == systemBasicDataId);
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace IRaCIS.Application.Services
|
||||||
// File.Delete(temp);
|
// File.Delete(temp);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
var success =await _attachmentrepository.DeleteFromQueryAsync(a => a.Id == param.Id);
|
var success =await _attachmentrepository.BatchDeleteAsync(a => a.Id == param.Id);
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ namespace IRaCIS.Application.Services
|
||||||
//重传的时候,发现 相同语言的官方简历数量为2 那么将重传的简历设置为非官方
|
//重传的时候,发现 相同语言的官方简历数量为2 那么将重传的简历设置为非官方
|
||||||
if (attachments.Count(t => t.Language == reUpload.Language && t.IsOfficial) == 2)
|
if (attachments.Count(t => t.Language == reUpload.Language && t.IsOfficial) == 2)
|
||||||
{
|
{
|
||||||
await _attachmentrepository.UpdateFromQueryAsync(t => t.Id == reUpload.Id, u => new Attachment()
|
await _attachmentrepository.BatchUpdateAsync(t => t.Id == reUpload.Id, u => new Attachment()
|
||||||
{
|
{
|
||||||
Path = reUpload.Path,
|
Path = reUpload.Path,
|
||||||
CreateTime = DateTime.Now,
|
CreateTime = DateTime.Now,
|
||||||
|
@ -150,7 +150,7 @@ namespace IRaCIS.Application.Services
|
||||||
}
|
}
|
||||||
else //相同语言的重传
|
else //相同语言的重传
|
||||||
{
|
{
|
||||||
await _attachmentrepository.UpdateFromQueryAsync(t => t.Id == reUpload.Id, u => new Attachment()
|
await _attachmentrepository.BatchUpdateAsync(t => t.Id == reUpload.Id, u => new Attachment()
|
||||||
{
|
{
|
||||||
Path = reUpload.Path,
|
Path = reUpload.Path,
|
||||||
CreateTime = DateTime.Now,
|
CreateTime = DateTime.Now,
|
||||||
|
@ -241,7 +241,7 @@ namespace IRaCIS.Application.Services
|
||||||
[HttpPost("{doctorId:guid}/{attachmentId:guid}/{language}")]
|
[HttpPost("{doctorId:guid}/{attachmentId:guid}/{language}")]
|
||||||
public async Task<IResponseOutput> SetLanguage(Guid doctorId, Guid attachmentId, int language)
|
public async Task<IResponseOutput> SetLanguage(Guid doctorId, Guid attachmentId, int language)
|
||||||
{
|
{
|
||||||
bool result =await _attachmentrepository.UpdateFromQueryAsync(t => t.Id == attachmentId, a => new Attachment
|
bool result =await _attachmentrepository.BatchUpdateAsync(t => t.Id == attachmentId, a => new Attachment
|
||||||
{
|
{
|
||||||
Language = language,
|
Language = language,
|
||||||
IsOfficial = false
|
IsOfficial = false
|
||||||
|
|
|
@ -113,7 +113,7 @@ namespace IRaCIS.Application.Services
|
||||||
var doctor = await _doctorRepository.FirstOrDefaultAsync(t => t.Id == updateModel.Id).IfNullThrowException();
|
var doctor = await _doctorRepository.FirstOrDefaultAsync(t => t.Id == updateModel.Id).IfNullThrowException();
|
||||||
|
|
||||||
//删除中间表 Title对应的记录
|
//删除中间表 Title对应的记录
|
||||||
await _repository.DeleteFromQueryAsync<DoctorDictionary>(t => t.DoctorId == updateModel.Id && t.KeyName == StaticData.Title);
|
await _repository.BatchDeleteAsync<DoctorDictionary>(t => t.DoctorId == updateModel.Id && t.KeyName == StaticData.Title);
|
||||||
|
|
||||||
|
|
||||||
var adddata=new List<DoctorDictionary>();
|
var adddata=new List<DoctorDictionary>();
|
||||||
|
@ -383,7 +383,7 @@ namespace IRaCIS.Application.Services
|
||||||
//_doctorDictionaryRepository.Delete(t =>
|
//_doctorDictionaryRepository.Delete(t =>
|
||||||
// t.DoctorId == specialtyUpdateModel.Id && t.KeyName == StaticData.ReadingType);
|
// t.DoctorId == specialtyUpdateModel.Id && t.KeyName == StaticData.ReadingType);
|
||||||
|
|
||||||
await _repository.DeleteFromQueryAsync<DoctorDictionary>(t =>
|
await _repository.BatchDeleteAsync<DoctorDictionary>(t =>
|
||||||
t.DoctorId == specialtyUpdateModel.Id && (t.KeyName == StaticData.Subspeciality || t.KeyName == StaticData.ReadingType));
|
t.DoctorId == specialtyUpdateModel.Id && (t.KeyName == StaticData.Subspeciality || t.KeyName == StaticData.ReadingType));
|
||||||
|
|
||||||
|
|
||||||
|
@ -431,7 +431,7 @@ namespace IRaCIS.Application.Services
|
||||||
{
|
{
|
||||||
return ResponseOutput.NotOk("Resume & Consultant Agreement must be upload ");
|
return ResponseOutput.NotOk("Resume & Consultant Agreement must be upload ");
|
||||||
}
|
}
|
||||||
var success = await _doctorRepository.UpdateFromQueryAsync(o => o.Id == auditResumeParam.Id, u => new Doctor()
|
var success = await _doctorRepository.BatchUpdateAsync(o => o.Id == auditResumeParam.Id, u => new Doctor()
|
||||||
{
|
{
|
||||||
CooperateStatus = auditResumeParam.CooperateStatus,
|
CooperateStatus = auditResumeParam.CooperateStatus,
|
||||||
ResumeStatus = auditResumeParam.ResumeStatus,
|
ResumeStatus = auditResumeParam.ResumeStatus,
|
||||||
|
|
|
@ -92,7 +92,7 @@ namespace IRaCIS.Application.Services
|
||||||
[HttpDelete, Route("{doctorId:guid}")]
|
[HttpDelete, Route("{doctorId:guid}")]
|
||||||
public async Task<IResponseOutput> DeleteEducationInfo(Guid id)
|
public async Task<IResponseOutput> DeleteEducationInfo(Guid id)
|
||||||
{
|
{
|
||||||
var success = await _educationRepository.DeleteFromQueryAsync(o => o.Id == id);
|
var success = await _educationRepository.BatchDeleteAsync(o => o.Id == id);
|
||||||
|
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ namespace IRaCIS.Application.Services
|
||||||
[HttpDelete("{doctorId:guid}")]
|
[HttpDelete("{doctorId:guid}")]
|
||||||
public async Task<IResponseOutput> DeletePostgraduateInfo(Guid doctorId)
|
public async Task<IResponseOutput> DeletePostgraduateInfo(Guid doctorId)
|
||||||
{
|
{
|
||||||
var success = await _repository.DeleteFromQueryAsync<Postgraduate>(o => o.Id == doctorId);
|
var success = await _repository.BatchDeleteAsync<Postgraduate>(o => o.Id == doctorId);
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ namespace IRaCIS.Application.Services
|
||||||
_mapper.Map(trialExperienceViewModel, needUpdate);
|
_mapper.Map(trialExperienceViewModel, needUpdate);
|
||||||
await _repository.UpdateAsync(needUpdate);
|
await _repository.UpdateAsync(needUpdate);
|
||||||
|
|
||||||
await _repository.DeleteFromQueryAsync<TrialExperienceCriteria>(t => t.TrialExperienceId == needUpdate.Id);
|
await _repository.BatchDeleteAsync<TrialExperienceCriteria>(t => t.TrialExperienceId == needUpdate.Id);
|
||||||
|
|
||||||
List<TrialExperienceCriteria> criteriaList = new List<TrialExperienceCriteria>();
|
List<TrialExperienceCriteria> criteriaList = new List<TrialExperienceCriteria>();
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ namespace IRaCIS.Application.Services
|
||||||
[HttpDelete, Route("{doctorId:guid}")]
|
[HttpDelete, Route("{doctorId:guid}")]
|
||||||
public async Task<IResponseOutput> DeleteTrialExperience(Guid doctorId)
|
public async Task<IResponseOutput> DeleteTrialExperience(Guid doctorId)
|
||||||
{
|
{
|
||||||
var success = await _repository.DeleteFromQueryAsync<TrialExperience>(o => o.Id == doctorId);
|
var success = await _repository.BatchDeleteAsync<TrialExperience>(o => o.Id == doctorId);
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -152,7 +152,7 @@ namespace IRaCIS.Application.Services
|
||||||
{
|
{
|
||||||
//_attachmentRepository.Delete(t => t.DoctorId == updateGCPExperienceParam.Id && t.Type == StaticData.GCP);
|
//_attachmentRepository.Delete(t => t.DoctorId == updateGCPExperienceParam.Id && t.Type == StaticData.GCP);
|
||||||
|
|
||||||
var successs = await _repository.UpdateFromQueryAsync<Doctor>(o => o.Id == updateGCPExperienceParam.Id, u => new Doctor()
|
var successs = await _repository.BatchUpdateAsync<Doctor>(o => o.Id == updateGCPExperienceParam.Id, u => new Doctor()
|
||||||
{
|
{
|
||||||
GCP = updateGCPExperienceParam.GCP,
|
GCP = updateGCPExperienceParam.GCP,
|
||||||
GCPId = updateGCPExperienceParam.GCP==0&&updateGCPExperienceParam.GCPId==null?Guid.Empty: updateGCPExperienceParam.GCPId!.Value
|
GCPId = updateGCPExperienceParam.GCP==0&&updateGCPExperienceParam.GCPId==null?Guid.Empty: updateGCPExperienceParam.GCPId!.Value
|
||||||
|
@ -160,7 +160,7 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
if (updateGCPExperienceParam.GCP == 0 && updateGCPExperienceParam.GCPId != null)
|
if (updateGCPExperienceParam.GCP == 0 && updateGCPExperienceParam.GCPId != null)
|
||||||
{
|
{
|
||||||
await _repository.DeleteFromQueryAsync<Attachment>(a => a.Id == updateGCPExperienceParam.GCPId);
|
await _repository.BatchDeleteAsync<Attachment>(a => a.Id == updateGCPExperienceParam.GCPId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ namespace IRaCIS.Application.Services
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<IResponseOutput> UpdateOtherExperience(ClinicalExperienceCommand updateOtherClinicalExperience)
|
public async Task<IResponseOutput> UpdateOtherExperience(ClinicalExperienceCommand updateOtherClinicalExperience)
|
||||||
{
|
{
|
||||||
var success = await _repository.UpdateFromQueryAsync<Doctor>(o => o.Id == updateOtherClinicalExperience.DoctorId, u => new Doctor()
|
var success = await _repository.BatchUpdateAsync<Doctor>(o => o.Id == updateOtherClinicalExperience.DoctorId, u => new Doctor()
|
||||||
{
|
{
|
||||||
OtherClinicalExperience = updateOtherClinicalExperience.OtherClinicalExperience ?? string.Empty,
|
OtherClinicalExperience = updateOtherClinicalExperience.OtherClinicalExperience ?? string.Empty,
|
||||||
OtherClinicalExperienceCN = updateOtherClinicalExperience.OtherClinicalExperienceCN ?? string.Empty
|
OtherClinicalExperienceCN = updateOtherClinicalExperience.OtherClinicalExperienceCN ?? string.Empty
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace IRaCIS.Application.Services
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var success = await _vacationRepository.UpdateFromQueryAsync(u => u.Id == param.Id,
|
var success = await _vacationRepository.BatchUpdateAsync(u => u.Id == param.Id,
|
||||||
h => new Vacation
|
h => new Vacation
|
||||||
{
|
{
|
||||||
StartDate = param.StartDate,
|
StartDate = param.StartDate,
|
||||||
|
@ -56,7 +56,7 @@ namespace IRaCIS.Application.Services
|
||||||
[HttpDelete("{holidayId:guid}")]
|
[HttpDelete("{holidayId:guid}")]
|
||||||
public async Task<IResponseOutput> DeleteVacation(Guid holidayId)
|
public async Task<IResponseOutput> DeleteVacation(Guid holidayId)
|
||||||
{
|
{
|
||||||
var success = await _vacationRepository.DeleteFromQueryAsync(u => u.Id == holidayId);
|
var success = await _vacationRepository.BatchDeleteAsync(u => u.Id == holidayId);
|
||||||
|
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ namespace IRaCIS.Core.Application.Services
|
||||||
return ResponseOutput.NotOk("该文档下已有签名的用户");
|
return ResponseOutput.NotOk("该文档下已有签名的用户");
|
||||||
}
|
}
|
||||||
|
|
||||||
var success = await _repository.DeleteFromQueryAsync<SystemDocument>(t => t.Id == systemDocumentId);
|
var success = await _repository.BatchDeleteAsync<SystemDocument>(t => t.Id == systemDocumentId);
|
||||||
|
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
|
|
|
@ -464,7 +464,7 @@ namespace IRaCIS.Core.Application.Services
|
||||||
return ResponseOutput.NotOk("该文档,已有用户签名 不允许删除");
|
return ResponseOutput.NotOk("该文档,已有用户签名 不允许删除");
|
||||||
}
|
}
|
||||||
|
|
||||||
var success = await _trialDocumentRepository.DeleteFromQueryAsync(t => t.Id == trialDocumentId);
|
var success = await _trialDocumentRepository.BatchDeleteAsync(t => t.Id == trialDocumentId);
|
||||||
|
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
|
@ -580,11 +580,11 @@ namespace IRaCIS.Core.Application.Services
|
||||||
{
|
{
|
||||||
if (isSystemDoc)
|
if (isSystemDoc)
|
||||||
{
|
{
|
||||||
await _repository.UpdateFromQueryAsync<SystemDocument>(t => t.Id == documentId, u => new SystemDocument() { IsDeleted = true });
|
await _repository.BatchUpdateAsync<SystemDocument>(t => t.Id == documentId, u => new SystemDocument() { IsDeleted = true });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await _trialDocumentRepository.UpdateFromQueryAsync(t => t.Id == documentId, u => new TrialDocument() { IsDeleted = true });
|
await _trialDocumentRepository.BatchUpdateAsync(t => t.Id == documentId, u => new TrialDocument() { IsDeleted = true });
|
||||||
}
|
}
|
||||||
return ResponseOutput.Ok();
|
return ResponseOutput.Ok();
|
||||||
}
|
}
|
||||||
|
|
|
@ -595,7 +595,7 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
foreach (var reviewer in needUpdatePayment)
|
foreach (var reviewer in needUpdatePayment)
|
||||||
{
|
{
|
||||||
await _paymentRepository.UpdateFromQueryAsync(u => u.YearMonth == yearMonth &&
|
await _paymentRepository.BatchUpdateAsync(u => u.YearMonth == yearMonth &&
|
||||||
!u.IsLock && u.DoctorId == reviewer.ReviewerId, t => new Payment()
|
!u.IsLock && u.DoctorId == reviewer.ReviewerId, t => new Payment()
|
||||||
{
|
{
|
||||||
AdjustmentUSD = reviewer.AdjustUSD,
|
AdjustmentUSD = reviewer.AdjustUSD,
|
||||||
|
@ -638,12 +638,12 @@ namespace IRaCIS.Application.Services
|
||||||
// 如果是 当月计算的工作量费用 和 调整费用都为0,则删除该行记录
|
// 如果是 当月计算的工作量费用 和 调整费用都为0,则删除该行记录
|
||||||
if (addOrUpdateModel.PaymentUSD == 0 && paymentModel.AdjustmentUSD == 0)
|
if (addOrUpdateModel.PaymentUSD == 0 && paymentModel.AdjustmentUSD == 0)
|
||||||
{
|
{
|
||||||
success =await _paymentRepository.DeleteFromQueryAsync(u => u.Id == paymentModel.Id);
|
success =await _paymentRepository.BatchDeleteAsync(u => u.Id == paymentModel.Id);
|
||||||
//_paymentDetailRepository.Delete(u=>u.PaymentId==paymentModel.Id);
|
//_paymentDetailRepository.Delete(u=>u.PaymentId==paymentModel.Id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
success = await _paymentRepository.UpdateFromQueryAsync(t => t.Id == paymentModel.Id, u => new Payment()
|
success = await _paymentRepository.BatchUpdateAsync(t => t.Id == paymentModel.Id, u => new Payment()
|
||||||
{
|
{
|
||||||
PaymentUSD = addOrUpdateModel.PaymentUSD,
|
PaymentUSD = addOrUpdateModel.PaymentUSD,
|
||||||
CalculateTime = addOrUpdateModel.CalculateTime,
|
CalculateTime = addOrUpdateModel.CalculateTime,
|
||||||
|
@ -670,7 +670,7 @@ namespace IRaCIS.Application.Services
|
||||||
private async Task<bool> AddOrUpdateMonthlyPaymentDetail(List<PaymentDetailCommand> addOrUpdateList, Guid paymentId)
|
private async Task<bool> AddOrUpdateMonthlyPaymentDetail(List<PaymentDetailCommand> addOrUpdateList, Guid paymentId)
|
||||||
{
|
{
|
||||||
//var paymentDetailIds = addOrUpdateList.Select(t => t.PaymentId).ToList();
|
//var paymentDetailIds = addOrUpdateList.Select(t => t.PaymentId).ToList();
|
||||||
await _paymentDetailRepository.DeleteFromQueryAsync(t => t.PaymentId == paymentId);
|
await _paymentDetailRepository.BatchDeleteAsync(t => t.PaymentId == paymentId);
|
||||||
await _paymentDetailRepository.AddRangeAsync(_mapper.Map<List<PaymentDetail>>(addOrUpdateList));
|
await _paymentDetailRepository.AddRangeAsync(_mapper.Map<List<PaymentDetail>>(addOrUpdateList));
|
||||||
return await _paymentDetailRepository.SaveChangesAsync();
|
return await _paymentDetailRepository.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace IRaCIS.Application.Services
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var success = await _exchangeRateRepository.UpdateFromQueryAsync(t => t.Id == model.Id, u => new ExchangeRate()
|
var success = await _exchangeRateRepository.BatchUpdateAsync(t => t.Id == model.Id, u => new ExchangeRate()
|
||||||
{
|
{
|
||||||
//YearMonth = model.YearMonth,
|
//YearMonth = model.YearMonth,
|
||||||
Rate = model.Rate,
|
Rate = model.Rate,
|
||||||
|
@ -72,7 +72,7 @@ namespace IRaCIS.Application.Services
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var success = await _exchangeRateRepository.DeleteFromQueryAsync(t => t.Id == id);
|
var success = await _exchangeRateRepository.BatchDeleteAsync(t => t.Id == id);
|
||||||
|
|
||||||
return ResponseOutput.Ok(success);
|
return ResponseOutput.Ok(success);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1256,18 +1256,18 @@ namespace IRaCIS.Application.Services
|
||||||
var isLock = param.IsLock;
|
var isLock = param.IsLock;
|
||||||
|
|
||||||
|
|
||||||
var paymentLockSuccess = await _paymentRepository.UpdateFromQueryAsync(u => reviewerIds.Contains(u.DoctorId) && u.YearMonth == yearMonth, t => new Payment
|
var paymentLockSuccess = await _paymentRepository.BatchUpdateAsync(u => reviewerIds.Contains(u.DoctorId) && u.YearMonth == yearMonth, t => new Payment
|
||||||
{
|
{
|
||||||
IsLock = isLock
|
IsLock = isLock
|
||||||
});
|
});
|
||||||
|
|
||||||
var adjustmentLockSuccess = await _payAdjustmentRepository.UpdateFromQueryAsync(
|
var adjustmentLockSuccess = await _payAdjustmentRepository.BatchUpdateAsync(
|
||||||
t => t.YearMonth == yearMonth && reviewerIds.Contains(t.ReviewerId), u =>
|
t => t.YearMonth == yearMonth && reviewerIds.Contains(t.ReviewerId), u =>
|
||||||
new PaymentAdjustment()
|
new PaymentAdjustment()
|
||||||
{
|
{
|
||||||
IsLock = true
|
IsLock = true
|
||||||
});
|
});
|
||||||
await _doctorWorkloadRepository.UpdateFromQueryAsync(u => reviewerIds.Contains(u.DoctorId) && u.YearMonth == yearMonth,
|
await _doctorWorkloadRepository.BatchUpdateAsync(u => reviewerIds.Contains(u.DoctorId) && u.YearMonth == yearMonth,
|
||||||
t => new Workload { IsLock = true });
|
t => new Workload { IsLock = true });
|
||||||
|
|
||||||
return ResponseOutput.Result(paymentLockSuccess || adjustmentLockSuccess);
|
return ResponseOutput.Result(paymentLockSuccess || adjustmentLockSuccess);
|
||||||
|
|
|
@ -255,7 +255,7 @@ namespace IRaCIS.Application.Services
|
||||||
{
|
{
|
||||||
|
|
||||||
//如果是double 不会保留两位小数
|
//如果是double 不会保留两位小数
|
||||||
await _payAdjustmentRepository.UpdateFromQueryAsync(u => u.YearMonth == yearMonth &&
|
await _payAdjustmentRepository.BatchUpdateAsync(u => u.YearMonth == yearMonth &&
|
||||||
!u.IsLock, t => new PaymentAdjustment
|
!u.IsLock, t => new PaymentAdjustment
|
||||||
{
|
{
|
||||||
AdjustmentCNY = t.AdjustmentUSD * rate,
|
AdjustmentCNY = t.AdjustmentUSD * rate,
|
||||||
|
@ -277,7 +277,7 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
foreach (var reviewer in needUpdatePayment)
|
foreach (var reviewer in needUpdatePayment)
|
||||||
{
|
{
|
||||||
await _paymentRepository.UpdateFromQueryAsync(u => u.YearMonth == yearMonth &&
|
await _paymentRepository.BatchUpdateAsync(u => u.YearMonth == yearMonth &&
|
||||||
!u.IsLock && u.DoctorId == reviewer.ReviewerId, t => new Payment()
|
!u.IsLock && u.DoctorId == reviewer.ReviewerId, t => new Payment()
|
||||||
{
|
{
|
||||||
AdjustmentUSD = reviewer.AdjustUSD,
|
AdjustmentUSD = reviewer.AdjustUSD,
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace IRaCIS.Application.Services
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var success =await _rankPriceRepository.UpdateFromQueryAsync(t => t.Id == addOrUpdateModel.Id, u => new RankPrice()
|
var success =await _rankPriceRepository.BatchUpdateAsync(t => t.Id == addOrUpdateModel.Id, u => new RankPrice()
|
||||||
{
|
{
|
||||||
UpdateUserId = userId,
|
UpdateUserId = userId,
|
||||||
UpdateTime = DateTime.Now,
|
UpdateTime = DateTime.Now,
|
||||||
|
@ -76,7 +76,7 @@ namespace IRaCIS.Application.Services
|
||||||
return ResponseOutput.NotOk("This title has been used by reviewer payment information");
|
return ResponseOutput.NotOk("This title has been used by reviewer payment information");
|
||||||
}
|
}
|
||||||
|
|
||||||
var success = await _rankPriceRepository.DeleteFromQueryAsync(t => t.Id == id);
|
var success = await _rankPriceRepository.BatchDeleteAsync(t => t.Id == id);
|
||||||
|
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ namespace IRaCIS.Application.Services
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<IResponseOutput> DeleteTrialSOW(DeleteSowPathDTO trialSowPath)
|
public async Task<IResponseOutput> DeleteTrialSOW(DeleteSowPathDTO trialSowPath)
|
||||||
{
|
{
|
||||||
var success = await _trialExtRepository.UpdateFromQueryAsync(u => u.TrialId == trialSowPath.TrialId, s => new TrialPaymentPrice
|
var success = await _trialExtRepository.BatchUpdateAsync(u => u.TrialId == trialSowPath.TrialId, s => new TrialPaymentPrice
|
||||||
{
|
{
|
||||||
SowPath = "",
|
SowPath = "",
|
||||||
SowName = "",
|
SowName = "",
|
||||||
|
|
|
@ -63,7 +63,7 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
// 完善价格的 将对应的列设置为true 变更为有价格了
|
// 完善价格的 将对应的列设置为true 变更为有价格了
|
||||||
|
|
||||||
var aaa = await _trialRevenuesPriceVerificationRepository.UpdateFromQueryAsync(t => t.TrialId == model.TrialId, u => new TrialRevenuesPriceVerification()
|
var aaa = await _trialRevenuesPriceVerificationRepository.BatchUpdateAsync(t => t.TrialId == model.TrialId, u => new TrialRevenuesPriceVerification()
|
||||||
{
|
{
|
||||||
//有价格 则设置为true 否则 该列不变
|
//有价格 则设置为true 否则 该列不变
|
||||||
Timepoint = model.Timepoint > 0 || u.Timepoint,
|
Timepoint = model.Timepoint > 0 || u.Timepoint,
|
||||||
|
@ -81,7 +81,7 @@ namespace IRaCIS.Application.Services
|
||||||
});
|
});
|
||||||
|
|
||||||
//删除所有有价格的记录 为true 表示有价格或者不需要价格 缺价格的为false
|
//删除所有有价格的记录 为true 表示有价格或者不需要价格 缺价格的为false
|
||||||
await _trialRevenuesPriceVerificationRepository.DeleteFromQueryAsync(t => t.TrialId == model.TrialId &&
|
await _trialRevenuesPriceVerificationRepository.BatchDeleteAsync(t => t.TrialId == model.TrialId &&
|
||||||
t.Timepoint&&
|
t.Timepoint&&
|
||||||
t.TimepointIn24H&&
|
t.TimepointIn24H&&
|
||||||
t.TimepointIn48H &&
|
t.TimepointIn48H &&
|
||||||
|
@ -101,7 +101,7 @@ namespace IRaCIS.Application.Services
|
||||||
[NonDynamicMethod]
|
[NonDynamicMethod]
|
||||||
public async Task<bool> DeleteTrialCost(Guid id)
|
public async Task<bool> DeleteTrialCost(Guid id)
|
||||||
{
|
{
|
||||||
return await _trialRevenuesPriceRepository.DeleteFromQueryAsync(u => u.Id == id);
|
return await _trialRevenuesPriceRepository.BatchDeleteAsync(u => u.Id == id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace IRaCIS.Application.Services
|
||||||
[NonDynamicMethod]
|
[NonDynamicMethod]
|
||||||
public async Task<IResponseOutput> AddOrUpdateVolumeRewardPriceList(IEnumerable<AwardPriceCommand> addOrUpdateModel)
|
public async Task<IResponseOutput> AddOrUpdateVolumeRewardPriceList(IEnumerable<AwardPriceCommand> addOrUpdateModel)
|
||||||
{
|
{
|
||||||
await _volumeRewardRepository.DeleteFromQueryAsync(t => t.Id != Guid.Empty);
|
await _volumeRewardRepository.BatchDeleteAsync(t => t.Id != Guid.Empty);
|
||||||
var temp = _mapper.Map<List<VolumeReward>>(addOrUpdateModel);
|
var temp = _mapper.Map<List<VolumeReward>>(addOrUpdateModel);
|
||||||
|
|
||||||
await _volumeRewardRepository.AddRangeAsync(temp);
|
await _volumeRewardRepository.AddRangeAsync(temp);
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
[HttpDelete("{systemAnonymizationId:guid}")]
|
[HttpDelete("{systemAnonymizationId:guid}")]
|
||||||
public async Task<IResponseOutput> DeleteSystemAnonymization(Guid systemAnonymizationId)
|
public async Task<IResponseOutput> DeleteSystemAnonymization(Guid systemAnonymizationId)
|
||||||
{
|
{
|
||||||
var success = await systemAnonymizationRepository.DeleteFromQueryAsync(t => t.Id == systemAnonymizationId);
|
var success = await systemAnonymizationRepository.BatchDeleteAsync(t => t.Id == systemAnonymizationId);
|
||||||
|
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,7 +212,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
||||||
|
|
||||||
if (AuditInfo.IsSign)
|
if (AuditInfo.IsSign)
|
||||||
{
|
{
|
||||||
var signSuccess = await _repository.UpdateFromQueryAsync<TrialSign>(t => t.Id == signId, u => new TrialSign() { IsCompleted = true });
|
var signSuccess = await _repository.BatchUpdateAsync<TrialSign>(t => t.Id == signId, u => new TrialSign() { IsCompleted = true });
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断是否需要前面
|
// 判断是否需要前面
|
||||||
|
|
|
@ -70,7 +70,7 @@ namespace IRaCIS.Application.Services
|
||||||
//{
|
//{
|
||||||
// return ResponseOutput.NotOk("该CRO下存在用户,暂时无法删除。");
|
// return ResponseOutput.NotOk("该CRO下存在用户,暂时无法删除。");
|
||||||
//}
|
//}
|
||||||
var success = await _croRepository.DeleteFromQueryAsync(x=>x.Id== cROCompanyId);
|
var success = await _croRepository.BatchDeleteAsync(x=>x.Id== cROCompanyId);
|
||||||
|
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace IRaCIS.Application.Services
|
||||||
// return ResponseOutput.NotOk("该医院下存在用户,暂时无法删除。");
|
// return ResponseOutput.NotOk("该医院下存在用户,暂时无法删除。");
|
||||||
//}
|
//}
|
||||||
|
|
||||||
var success = await _hospitalRepository.DeleteFromQueryAsync(x => x.Id == hospitalId);
|
var success = await _hospitalRepository.BatchDeleteAsync(x => x.Id == hospitalId);
|
||||||
|
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ namespace IRaCIS.Application.Services
|
||||||
return ResponseOutput.NotOk("This site has participated in the trial and couldn't be deleted.");
|
return ResponseOutput.NotOk("This site has participated in the trial and couldn't be deleted.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var success = await _siteRepository.DeleteFromQueryAsync(x => x.Id == siteId);
|
var success = await _siteRepository.BatchDeleteAsync(x => x.Id == siteId);
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ namespace IRaCIS.Application.Services
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
var success = await _sponsorRepository.DeleteFromQueryAsync(x => x.Id == sponsorId);
|
var success = await _sponsorRepository.BatchDeleteAsync(x => x.Id == sponsorId);
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,7 @@ namespace IRaCIS.Application.Services
|
||||||
return ResponseOutput.NotOk("不允许直接删除父节点");
|
return ResponseOutput.NotOk("不允许直接删除父节点");
|
||||||
}
|
}
|
||||||
|
|
||||||
var success =await menuRepository.DeleteFromQueryAsync(u => u.Id == menuId);
|
var success =await menuRepository.BatchDeleteAsync(u => u.Id == menuId);
|
||||||
|
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,13 +108,13 @@ namespace IRaCIS.Application.Services
|
||||||
return ResponseOutput.NotOk("The mailbox for this user type already exists");
|
return ResponseOutput.NotOk("The mailbox for this user type already exists");
|
||||||
}
|
}
|
||||||
|
|
||||||
var success = await _userRepository.UpdateFromQueryAsync(t => t.Id == _userInfo.Id, u => new User()
|
var success = await _userRepository.BatchUpdateAsync(t => t.Id == _userInfo.Id, u => new User()
|
||||||
{
|
{
|
||||||
EMail = newEmail
|
EMail = newEmail
|
||||||
});
|
});
|
||||||
|
|
||||||
//删除验证码历史记录
|
//删除验证码历史记录
|
||||||
await _verificationCodeRepository.DeleteFromQueryAsync(t => t.UserId == _userInfo.Id && t.CodeType == 0);
|
await _verificationCodeRepository.BatchDeleteAsync(t => t.UserId == _userInfo.Id && t.CodeType == 0);
|
||||||
|
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ namespace IRaCIS.Application.Services
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
var success = await _userRepository.UpdateFromQueryAsync(t => t.Id == _userInfo.Id, u => new User()
|
var success = await _userRepository.BatchUpdateAsync(t => t.Id == _userInfo.Id, u => new User()
|
||||||
{
|
{
|
||||||
Phone = newPhone
|
Phone = newPhone
|
||||||
});
|
});
|
||||||
|
@ -145,7 +145,7 @@ namespace IRaCIS.Application.Services
|
||||||
{
|
{
|
||||||
return ResponseOutput.NotOk("UserId already exists");
|
return ResponseOutput.NotOk("UserId already exists");
|
||||||
}
|
}
|
||||||
var success = await _userRepository.UpdateFromQueryAsync(t => t.Id == _userInfo.Id, u => new User()
|
var success = await _userRepository.BatchUpdateAsync(t => t.Id == _userInfo.Id, u => new User()
|
||||||
{
|
{
|
||||||
UserName = newUserName
|
UserName = newUserName
|
||||||
});
|
});
|
||||||
|
@ -163,7 +163,7 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
public async Task<IResponseOutput> ResetPassword(Guid userId)
|
public async Task<IResponseOutput> ResetPassword(Guid userId)
|
||||||
{
|
{
|
||||||
var success = await _userRepository.UpdateFromQueryAsync(t => t.Id == userId, u => new User()
|
var success = await _userRepository.BatchUpdateAsync(t => t.Id == userId, u => new User()
|
||||||
{
|
{
|
||||||
Password = MD5Helper.Md5(StaticData.DefaultPassword),
|
Password = MD5Helper.Md5(StaticData.DefaultPassword),
|
||||||
IsFirstAdd = true
|
IsFirstAdd = true
|
||||||
|
@ -243,7 +243,7 @@ namespace IRaCIS.Application.Services
|
||||||
{
|
{
|
||||||
|
|
||||||
//删除验证码历史记录
|
//删除验证码历史记录
|
||||||
await _verificationCodeRepository.DeleteFromQueryAsync(t => t.Id == verificationRecord.Id);
|
await _verificationCodeRepository.BatchDeleteAsync(t => t.Id == verificationRecord.Id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ namespace IRaCIS.Application.Services
|
||||||
return ResponseOutput.NotOk("password not change");
|
return ResponseOutput.NotOk("password not change");
|
||||||
}
|
}
|
||||||
|
|
||||||
var success = await _userRepository.UpdateFromQueryAsync(t => t.Id == userId, u => new User()
|
var success = await _userRepository.BatchUpdateAsync(t => t.Id == userId, u => new User()
|
||||||
{
|
{
|
||||||
Password = newPwd,
|
Password = newPwd,
|
||||||
IsFirstAdd = false
|
IsFirstAdd = false
|
||||||
|
@ -312,14 +312,14 @@ namespace IRaCIS.Application.Services
|
||||||
return ResponseOutput.NotOk("UserId already exists");
|
return ResponseOutput.NotOk("UserId already exists");
|
||||||
}
|
}
|
||||||
|
|
||||||
await _userRepository.UpdateFromQueryAsync(t => t.Id == _userInfo.Id, u => new User()
|
await _userRepository.BatchUpdateAsync(t => t.Id == _userInfo.Id, u => new User()
|
||||||
{
|
{
|
||||||
UserName = editPwModel.NewUserName,
|
UserName = editPwModel.NewUserName,
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var success = await _userRepository.UpdateFromQueryAsync(t => t.Id == _userInfo.Id, u => new User()
|
var success = await _userRepository.BatchUpdateAsync(t => t.Id == _userInfo.Id, u => new User()
|
||||||
{
|
{
|
||||||
Password = editPwModel.NewPassWord,
|
Password = editPwModel.NewPassWord,
|
||||||
IsFirstAdd = false
|
IsFirstAdd = false
|
||||||
|
@ -333,7 +333,7 @@ namespace IRaCIS.Application.Services
|
||||||
//医生密码
|
//医生密码
|
||||||
if (await _doctorRepository.AnyAsync(t => t.Id == _userInfo.Id && t.Password == editPwModel.OldPassWord))
|
if (await _doctorRepository.AnyAsync(t => t.Id == _userInfo.Id && t.Password == editPwModel.OldPassWord))
|
||||||
{
|
{
|
||||||
var success = await _doctorRepository.UpdateFromQueryAsync(t => t.Id == _userInfo.Id, u => new Doctor()
|
var success = await _doctorRepository.BatchUpdateAsync(t => t.Id == _userInfo.Id, u => new Doctor()
|
||||||
{
|
{
|
||||||
|
|
||||||
Password = editPwModel.NewPassWord
|
Password = editPwModel.NewPassWord
|
||||||
|
@ -460,7 +460,7 @@ namespace IRaCIS.Application.Services
|
||||||
return ResponseOutput.NotOk("This user has participated in the trial and couldn't be deleted");
|
return ResponseOutput.NotOk("This user has participated in the trial and couldn't be deleted");
|
||||||
}
|
}
|
||||||
|
|
||||||
var success = await _userRepository.DeleteFromQueryAsync(t => t.Id == userId);
|
var success = await _userRepository.BatchDeleteAsync(t => t.Id == userId);
|
||||||
|
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
|
@ -475,7 +475,7 @@ namespace IRaCIS.Application.Services
|
||||||
[HttpPost("{userId:guid}/{state:int}")]
|
[HttpPost("{userId:guid}/{state:int}")]
|
||||||
public async Task<IResponseOutput> UpdateUserState(Guid userId, UserStateEnum state)
|
public async Task<IResponseOutput> UpdateUserState(Guid userId, UserStateEnum state)
|
||||||
{
|
{
|
||||||
var success = await _userRepository.UpdateFromQueryAsync(u => u.Id == userId, t => new User
|
var success = await _userRepository.BatchUpdateAsync(u => u.Id == userId, t => new User
|
||||||
{
|
{
|
||||||
Status = state
|
Status = state
|
||||||
});
|
});
|
||||||
|
|
|
@ -83,7 +83,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
return ResponseOutput.NotOk("该用户类型,被某些用户已使用,不能删除");
|
return ResponseOutput.NotOk("该用户类型,被某些用户已使用,不能删除");
|
||||||
}
|
}
|
||||||
|
|
||||||
var success = await userTypeServiceRepository.DeleteFromQueryAsync(t => t.Id == userTypeId);
|
var success = await userTypeServiceRepository.BatchDeleteAsync(t => t.Id == userTypeId);
|
||||||
|
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
[HttpDelete("{trialId:guid}/{previousHistoryId:guid}")]
|
[HttpDelete("{trialId:guid}/{previousHistoryId:guid}")]
|
||||||
public async Task<IResponseOutput> DeletePreviousHistory(Guid previousHistoryId)
|
public async Task<IResponseOutput> DeletePreviousHistory(Guid previousHistoryId)
|
||||||
{
|
{
|
||||||
var success = await _previousHistoryRepository.DeleteFromQueryAsync(t => t.Id == previousHistoryId);
|
var success = await _previousHistoryRepository.BatchDeleteAsync(t => t.Id == previousHistoryId);
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
[HttpDelete("{trialId:guid}/{previousOtherId:guid}")]
|
[HttpDelete("{trialId:guid}/{previousOtherId:guid}")]
|
||||||
public async Task<IResponseOutput> DeletePreviousOther(Guid previousOtherId)
|
public async Task<IResponseOutput> DeletePreviousOther(Guid previousOtherId)
|
||||||
{
|
{
|
||||||
var success = await _previousOtherRepository.DeleteFromQueryAsync(t => t.Id == previousOtherId);
|
var success = await _previousOtherRepository.BatchDeleteAsync(t => t.Id == previousOtherId);
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
[HttpDelete("{trialId:guid}/{previousSurgeryId:guid}")]
|
[HttpDelete("{trialId:guid}/{previousSurgeryId:guid}")]
|
||||||
public async Task<IResponseOutput> DeletePreviousSurgery(Guid previousSurgeryId)
|
public async Task<IResponseOutput> DeletePreviousSurgery(Guid previousSurgeryId)
|
||||||
{
|
{
|
||||||
var success = await _previousSurgeryRepository.DeleteFromQueryAsync(t => t.Id == previousSurgeryId);
|
var success = await _previousSurgeryRepository.BatchDeleteAsync(t => t.Id == previousSurgeryId);
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,7 +242,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
public async Task<IResponseOutput> DeletePreviousPDF(Guid previousPDFId)
|
public async Task<IResponseOutput> DeletePreviousPDF(Guid previousPDFId)
|
||||||
{
|
{
|
||||||
|
|
||||||
var success = await _previousPdfRepository.DeleteFromQueryAsync(t => t.Id == previousPDFId);
|
var success = await _previousPdfRepository.BatchDeleteAsync(t => t.Id == previousPDFId);
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
var minArray = new DateTime?[] { svTime.DicomStudyMinStudyTime, svTime.NoneDicomStudyMinStudyTime, addOrEditNoneDicomStudy.ImageDate };
|
var minArray = new DateTime?[] { svTime.DicomStudyMinStudyTime, svTime.NoneDicomStudyMinStudyTime, addOrEditNoneDicomStudy.ImageDate };
|
||||||
var maxArray = new DateTime?[] { svTime.DicomStudyMaxStudyTime, svTime.NoneDicomStudyMaxStudyTime, addOrEditNoneDicomStudy.ImageDate };
|
var maxArray = new DateTime?[] { svTime.DicomStudyMaxStudyTime, svTime.NoneDicomStudyMaxStudyTime, addOrEditNoneDicomStudy.ImageDate };
|
||||||
|
|
||||||
await _repository.UpdateFromQueryAsync<SubjectVisit>(t => t.Id == addOrEditNoneDicomStudy.SubjectVisitId, u => new SubjectVisit()
|
await _repository.BatchUpdateAsync<SubjectVisit>(t => t.Id == addOrEditNoneDicomStudy.SubjectVisitId, u => new SubjectVisit()
|
||||||
{
|
{
|
||||||
VisitExecuted = VisitExecutedEnum.Executed,
|
VisitExecuted = VisitExecutedEnum.Executed,
|
||||||
|
|
||||||
|
@ -112,8 +112,8 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
if (noneDicomStudy == null) return Null404NotFound(noneDicomStudy);
|
if (noneDicomStudy == null) return Null404NotFound(noneDicomStudy);
|
||||||
|
|
||||||
await _noneDicomStudyRepository.DeleteFromQueryAsync(t => t.Id == noneDicomStudyId);
|
await _noneDicomStudyRepository.BatchDeleteAsync(t => t.Id == noneDicomStudyId);
|
||||||
await _noneDicomStudyFileRepository.DeleteFromQueryAsync(t => t.NoneDicomStudyId == noneDicomStudyId);
|
await _noneDicomStudyFileRepository.BatchDeleteAsync(t => t.NoneDicomStudyId == noneDicomStudyId);
|
||||||
|
|
||||||
var svTime = await _repository.Where<SubjectVisit>(t => t.Id == noneDicomStudy.SubjectVisitId).Select(t => new
|
var svTime = await _repository.Where<SubjectVisit>(t => t.Id == noneDicomStudy.SubjectVisitId).Select(t => new
|
||||||
{
|
{
|
||||||
|
@ -126,7 +126,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
var minArray = new DateTime?[] { svTime.DicomStudyMinStudyTime, svTime.NoneDicomStudyMinStudyTime };
|
var minArray = new DateTime?[] { svTime.DicomStudyMinStudyTime, svTime.NoneDicomStudyMinStudyTime };
|
||||||
var maxArray = new DateTime?[] { svTime.DicomStudyMaxStudyTime, svTime.NoneDicomStudyMaxStudyTime };
|
var maxArray = new DateTime?[] { svTime.DicomStudyMaxStudyTime, svTime.NoneDicomStudyMaxStudyTime };
|
||||||
|
|
||||||
await _repository.UpdateFromQueryAsync<SubjectVisit>(t => t.Id == noneDicomStudy.SubjectVisitId, u => new SubjectVisit()
|
await _repository.BatchUpdateAsync<SubjectVisit>(t => t.Id == noneDicomStudy.SubjectVisitId, u => new SubjectVisit()
|
||||||
{
|
{
|
||||||
EarliestScanDate = minArray.Min(),
|
EarliestScanDate = minArray.Min(),
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
//如果既没有 dicom数据 也没有非dicom 文件 那么提交状态变更回去
|
//如果既没有 dicom数据 也没有非dicom 文件 那么提交状态变更回去
|
||||||
if (await _repository.CountAsync<DicomStudy>(t => t.SubjectVisitId == noneDicomStudy.SubjectVisitId) == 0 && await _repository.CountAsync<NoneDicomStudyFile>(t => t.NoneDicomStudy.SubjectVisitId == noneDicomStudy.SubjectVisitId) == 0)
|
if (await _repository.CountAsync<DicomStudy>(t => t.SubjectVisitId == noneDicomStudy.SubjectVisitId) == 0 && await _repository.CountAsync<NoneDicomStudyFile>(t => t.NoneDicomStudy.SubjectVisitId == noneDicomStudy.SubjectVisitId) == 0)
|
||||||
{
|
{
|
||||||
await _repository.UpdateFromQueryAsync<SubjectVisit>(t => t.Id == noneDicomStudy.SubjectVisitId && t.SubmitState == SubmitStateEnum.ToSubmit, u => new SubjectVisit() { VisitExecuted = 0, SubmitState = SubmitStateEnum.None });
|
await _repository.BatchUpdateAsync<SubjectVisit>(t => t.Id == noneDicomStudy.SubjectVisitId && t.SubmitState == SubmitStateEnum.ToSubmit, u => new SubjectVisit() { VisitExecuted = 0, SubmitState = SubmitStateEnum.None });
|
||||||
}
|
}
|
||||||
return ResponseOutput.Ok();
|
return ResponseOutput.Ok();
|
||||||
}
|
}
|
||||||
|
@ -147,12 +147,12 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
{
|
{
|
||||||
var subjectVisitId = await _noneDicomStudyFileRepository.Where(t=>t.Id== noneDicomStudyFileId).Select(t => t.NoneDicomStudy.SubjectVisitId).FirstOrDefaultAsync();
|
var subjectVisitId = await _noneDicomStudyFileRepository.Where(t=>t.Id== noneDicomStudyFileId).Select(t => t.NoneDicomStudy.SubjectVisitId).FirstOrDefaultAsync();
|
||||||
|
|
||||||
var success = await _noneDicomStudyFileRepository.DeleteFromQueryAsync(t => t.Id == noneDicomStudyFileId);
|
var success = await _noneDicomStudyFileRepository.BatchDeleteAsync(t => t.Id == noneDicomStudyFileId);
|
||||||
|
|
||||||
//如果既没有 dicom数据 也没有非dicom 文件 那么提交状态变更回去
|
//如果既没有 dicom数据 也没有非dicom 文件 那么提交状态变更回去
|
||||||
if (await _repository.CountAsync<DicomStudy>(t => t.SubjectVisitId == subjectVisitId) == 0 && await _repository.CountAsync<NoneDicomStudyFile>(t => t.NoneDicomStudy.SubjectVisitId == subjectVisitId) == 0)
|
if (await _repository.CountAsync<DicomStudy>(t => t.SubjectVisitId == subjectVisitId) == 0 && await _repository.CountAsync<NoneDicomStudyFile>(t => t.NoneDicomStudy.SubjectVisitId == subjectVisitId) == 0)
|
||||||
{
|
{
|
||||||
await _repository.UpdateFromQueryAsync<SubjectVisit>(t => t.Id == subjectVisitId && t.SubmitState == SubmitStateEnum.ToSubmit, u => new SubjectVisit() { VisitExecuted = 0, SubmitState = SubmitStateEnum.None });
|
await _repository.BatchUpdateAsync<SubjectVisit>(t => t.Id == subjectVisitId && t.SubmitState == SubmitStateEnum.ToSubmit, u => new SubjectVisit() { VisitExecuted = 0, SubmitState = SubmitStateEnum.None });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -296,7 +296,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
}
|
}
|
||||||
|
|
||||||
// 上传非Dicom 后 将状态改为待提交 分为普通上传 和QC后重传 普通上传时才改为待提交
|
// 上传非Dicom 后 将状态改为待提交 分为普通上传 和QC后重传 普通上传时才改为待提交
|
||||||
await _repository.UpdateFromQueryAsync<SubjectVisit>(t => t.Id == subjectVisitId && t.SubmitState == SubmitStateEnum.None, u => new SubjectVisit() { SubmitState = SubmitStateEnum.ToSubmit });
|
await _repository.BatchUpdateAsync<SubjectVisit>(t => t.Id == subjectVisitId && t.SubmitState == SubmitStateEnum.None, u => new SubjectVisit() { SubmitState = SubmitStateEnum.ToSubmit });
|
||||||
|
|
||||||
await _repository.AddAsync(new StudyMonitor()
|
await _repository.AddAsync(new StudyMonitor()
|
||||||
{
|
{
|
||||||
|
|
|
@ -464,7 +464,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
{
|
{
|
||||||
return ResponseOutput.NotOk("核查通过的数据不允许申请回退");
|
return ResponseOutput.NotOk("核查通过的数据不允许申请回退");
|
||||||
}
|
}
|
||||||
await _subjectVisitRepository.UpdateFromQueryAsync(t => t.Id == subjectVisitId, u => new SubjectVisit() { RequestBackState = RequestBackStateEnum.CRC_RequestBack });
|
await _subjectVisitRepository.BatchUpdateAsync(t => t.Id == subjectVisitId, u => new SubjectVisit() { RequestBackState = RequestBackStateEnum.CRC_RequestBack });
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
return ResponseOutput.Ok();
|
||||||
|
|
||||||
|
@ -528,7 +528,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
//_checkChallengeDialogRepository.Delete(t => t.SubjectVisitId == subjectVisitId);
|
//_checkChallengeDialogRepository.Delete(t => t.SubjectVisitId == subjectVisitId);
|
||||||
await _repository.AddAsync(new CheckChallengeDialog() { SubjectVisitId = subjectVisitId, TalkContent = "PM执行了一致性核查回退", UserTypeEnum = (UserTypeEnum)_userInfo.UserTypeEnumInt });
|
await _repository.AddAsync(new CheckChallengeDialog() { SubjectVisitId = subjectVisitId, TalkContent = "PM执行了一致性核查回退", UserTypeEnum = (UserTypeEnum)_userInfo.UserTypeEnumInt });
|
||||||
|
|
||||||
await _repository.DeleteFromQueryAsync<TrialQCQuestionAnswer>(t => t.SubjectVisitId == subjectVisitId);
|
await _repository.BatchDeleteAsync<TrialQCQuestionAnswer>(t => t.SubjectVisitId == subjectVisitId);
|
||||||
|
|
||||||
var success = await _repository.SaveChangesAsync();
|
var success = await _repository.SaveChangesAsync();
|
||||||
|
|
||||||
|
@ -908,7 +908,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
|
|
||||||
study.BodyPartForEdit = bodyPart;
|
study.BodyPartForEdit = bodyPart;
|
||||||
study.Modalities = modality;
|
study.Modalities = modality;
|
||||||
await _repository.UpdateFromQueryAsync<DicomSeries>(t => t.StudyId == id, r => new DicomSeries() { BodyPartForEdit = bodyPart, Modality = modality });
|
await _repository.BatchUpdateAsync<DicomSeries>(t => t.StudyId == id, r => new DicomSeries() { BodyPartForEdit = bodyPart, Modality = modality });
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (type == 2)
|
else if (type == 2)
|
||||||
|
@ -1008,9 +1008,9 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
|
|
||||||
foreach (var id in ids)
|
foreach (var id in ids)
|
||||||
{
|
{
|
||||||
var success1 = await _repository.DeleteFromQueryAsync<DicomStudy>(t => t.Id == id);
|
var success1 = await _repository.BatchDeleteAsync<DicomStudy>(t => t.Id == id);
|
||||||
var succeess2 = await _repository.DeleteFromQueryAsync<DicomInstance>(t => t.StudyId == id);
|
var succeess2 = await _repository.BatchDeleteAsync<DicomInstance>(t => t.StudyId == id);
|
||||||
var success3 = await _repository.DeleteFromQueryAsync<DicomSeries>(t => t.StudyId == id);
|
var success3 = await _repository.BatchDeleteAsync<DicomSeries>(t => t.StudyId == id);
|
||||||
|
|
||||||
//删除 物理文件
|
//删除 物理文件
|
||||||
|
|
||||||
|
@ -1034,7 +1034,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
//一个访视下面有多个检查,所以需要检测 没有的时候才清空 非dicom 是检查文件 不是表记录
|
//一个访视下面有多个检查,所以需要检测 没有的时候才清空 非dicom 是检查文件 不是表记录
|
||||||
if (await _repository.CountAsync<DicomStudy>(t => t.SubjectVisitId == subjectVisitId) == 0 && await _repository.CountAsync<NoneDicomStudyFile>(t => t.NoneDicomStudy.SubjectVisitId == subjectVisitId) == 0)
|
if (await _repository.CountAsync<DicomStudy>(t => t.SubjectVisitId == subjectVisitId) == 0 && await _repository.CountAsync<NoneDicomStudyFile>(t => t.NoneDicomStudy.SubjectVisitId == subjectVisitId) == 0)
|
||||||
{
|
{
|
||||||
await _repository.UpdateFromQueryAsync<SubjectVisit>(t => t.Id == subjectVisitId && t.SubmitState == SubmitStateEnum.ToSubmit,
|
await _repository.BatchUpdateAsync<SubjectVisit>(t => t.Id == subjectVisitId && t.SubmitState == SubmitStateEnum.ToSubmit,
|
||||||
u => new SubjectVisit() { VisitExecuted = 0, SVENDTC = null, SVSTDTC = null, SubmitState = SubmitStateEnum.None });
|
u => new SubjectVisit() { VisitExecuted = 0, SVENDTC = null, SVSTDTC = null, SubmitState = SubmitStateEnum.None });
|
||||||
|
|
||||||
//_qaNoticeRepository.Delete(t => t.SubjectVisitId == subjectVisitId);
|
//_qaNoticeRepository.Delete(t => t.SubjectVisitId == subjectVisitId);
|
||||||
|
@ -1057,7 +1057,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
var minArray = new DateTime?[] { svTime.DicomStudyMinStudyTime, svTime.NoneDicomStudyMinStudyTime };
|
var minArray = new DateTime?[] { svTime.DicomStudyMinStudyTime, svTime.NoneDicomStudyMinStudyTime };
|
||||||
var maxArray = new DateTime?[] { svTime.DicomStudyMaxStudyTime, svTime.NoneDicomStudyMaxStudyTime };
|
var maxArray = new DateTime?[] { svTime.DicomStudyMaxStudyTime, svTime.NoneDicomStudyMaxStudyTime };
|
||||||
|
|
||||||
await _repository.UpdateFromQueryAsync<SubjectVisit>(t => t.Id == subjectVisitId, u => new SubjectVisit()
|
await _repository.BatchUpdateAsync<SubjectVisit>(t => t.Id == subjectVisitId, u => new SubjectVisit()
|
||||||
{
|
{
|
||||||
EarliestScanDate = minArray.Min(),
|
EarliestScanDate = minArray.Min(),
|
||||||
|
|
||||||
|
@ -1546,7 +1546,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
|
|
||||||
await _repository.SaveChangesAsync();
|
await _repository.SaveChangesAsync();
|
||||||
|
|
||||||
var success = await _repository.UpdateFromQueryAsync<TrialSign>(t => t.Id == signId, u => new TrialSign() { IsCompleted = true });
|
var success = await _repository.BatchUpdateAsync<TrialSign>(t => t.Id == signId, u => new TrialSign() { IsCompleted = true });
|
||||||
|
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
|
|
||||||
|
@ -1615,7 +1615,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
qcChallenge.LatestMsgTime = DateTime.Now;
|
qcChallenge.LatestMsgTime = DateTime.Now;
|
||||||
qcChallenge.LatestReplyUserId = _userInfo.Id;
|
qcChallenge.LatestReplyUserId = _userInfo.Id;
|
||||||
|
|
||||||
await _subjectVisitRepository.UpdateFromQueryAsync(t => t.Id == qcChallenge.SubjectVisitId, c => new SubjectVisit() { IsQCConfirmedReupload = true });
|
await _subjectVisitRepository.BatchUpdateAsync(t => t.Id == qcChallenge.SubjectVisitId, c => new SubjectVisit() { IsQCConfirmedReupload = true });
|
||||||
|
|
||||||
qcChallenge.DialogList.Add(new QCChallengeDialog()
|
qcChallenge.DialogList.Add(new QCChallengeDialog()
|
||||||
{
|
{
|
||||||
|
@ -1651,11 +1651,11 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
|
|
||||||
//删除1QC 填写的问题答案
|
//删除1QC 填写的问题答案
|
||||||
|
|
||||||
await _repository.DeleteFromQueryAsync<TrialQCQuestionAnswer>(t => t.SubjectVisitId == qcChallenge.SubjectVisitId && t.CurrentQCEnum == CurrentQC.First);
|
await _repository.BatchDeleteAsync<TrialQCQuestionAnswer>(t => t.SubjectVisitId == qcChallenge.SubjectVisitId && t.CurrentQCEnum == CurrentQC.First);
|
||||||
|
|
||||||
//2QC 数据变为1QC
|
//2QC 数据变为1QC
|
||||||
await _repository.UpdateFromQueryAsync<QCChallenge>(t => t.SubjectVisitId == qcChallenge.SubjectVisitId && t.CurrentQCEnum == CurrentQC.Second, k => new QCChallenge() { CurrentQCEnum = CurrentQC.First });
|
await _repository.BatchUpdateAsync<QCChallenge>(t => t.SubjectVisitId == qcChallenge.SubjectVisitId && t.CurrentQCEnum == CurrentQC.Second, k => new QCChallenge() { CurrentQCEnum = CurrentQC.First });
|
||||||
await _repository.UpdateFromQueryAsync<TrialQCQuestionAnswer>(t => t.SubjectVisitId == qcChallenge.SubjectVisitId && t.CurrentQCEnum == CurrentQC.Second, k => new TrialQCQuestionAnswer() { CurrentQCEnum = CurrentQC.First });
|
await _repository.BatchUpdateAsync<TrialQCQuestionAnswer>(t => t.SubjectVisitId == qcChallenge.SubjectVisitId && t.CurrentQCEnum == CurrentQC.Second, k => new TrialQCQuestionAnswer() { CurrentQCEnum = CurrentQC.First });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1707,7 +1707,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
var dbSubjectVisit = await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == qcChallenge.SubjectVisitId).IfNullThrowException();
|
var dbSubjectVisit = await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == qcChallenge.SubjectVisitId).IfNullThrowException();
|
||||||
|
|
||||||
|
|
||||||
await _subjectVisitRepository.UpdateFromQueryAsync(t => t.Id == qcChallenge.SubjectVisitId, c => new SubjectVisit() { IsQCConfirmedReupload = false });
|
await _subjectVisitRepository.BatchUpdateAsync(t => t.Id == qcChallenge.SubjectVisitId, c => new SubjectVisit() { IsQCConfirmedReupload = false });
|
||||||
|
|
||||||
qcChallenge.DialogList.Add(new QCChallengeDialog()
|
qcChallenge.DialogList.Add(new QCChallengeDialog()
|
||||||
{
|
{
|
||||||
|
@ -1727,7 +1727,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
//已确认临床数据完整性
|
//已确认临床数据完整性
|
||||||
dbSubjectVisit.IsConfirmedClinicalData = true;
|
dbSubjectVisit.IsConfirmedClinicalData = true;
|
||||||
|
|
||||||
var signSuccess = await _repository.UpdateFromQueryAsync<TrialSign>(t => t.Id == cRCReuploadFinishedCommand.SignId, u => new TrialSign() { IsCompleted = true });
|
var signSuccess = await _repository.BatchUpdateAsync<TrialSign>(t => t.Id == cRCReuploadFinishedCommand.SignId, u => new TrialSign() { IsCompleted = true });
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1798,7 +1798,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
return ResponseOutput.NotOk("回退的访视,不允许修改PD确认状态");
|
return ResponseOutput.NotOk("回退的访视,不允许修改PD确认状态");
|
||||||
}
|
}
|
||||||
|
|
||||||
await _repository.UpdateFromQueryAsync<SubjectVisit>(t => t.Id == command.SubjectVisitId, u => new SubjectVisit()
|
await _repository.BatchUpdateAsync<SubjectVisit>(t => t.Id == command.SubjectVisitId, u => new SubjectVisit()
|
||||||
{
|
{
|
||||||
IsEnrollmentConfirm = command.IsEnrollmentConfirm.Value,
|
IsEnrollmentConfirm = command.IsEnrollmentConfirm.Value,
|
||||||
});
|
});
|
||||||
|
@ -1812,7 +1812,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
{
|
{
|
||||||
List<DataInspection> datas = new List<DataInspection>();
|
List<DataInspection> datas = new List<DataInspection>();
|
||||||
var data = await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == command.SubjectVisitId);
|
var data = await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == command.SubjectVisitId);
|
||||||
await _repository.UpdateFromQueryAsync<Subject>(t => t.Id == command.SubjectId, u => new Subject()
|
await _repository.BatchUpdateAsync<Subject>(t => t.Id == command.SubjectId, u => new Subject()
|
||||||
{
|
{
|
||||||
FirstGiveMedicineTime = command.SubjectFirstGiveMedicineTime,
|
FirstGiveMedicineTime = command.SubjectFirstGiveMedicineTime,
|
||||||
|
|
||||||
|
@ -1928,7 +1928,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
|
|
||||||
if (!result.IsSuccess)
|
if (!result.IsSuccess)
|
||||||
{
|
{
|
||||||
await _subjectVisitRepository.UpdateFromQueryAsync(t => t.Id == subjectVisitId,
|
await _subjectVisitRepository.BatchUpdateAsync(t => t.Id == subjectVisitId,
|
||||||
u => new SubjectVisit() { ForwardState = ForwardStateEnum.ForwardFailed });
|
u => new SubjectVisit() { ForwardState = ForwardStateEnum.ForwardFailed });
|
||||||
|
|
||||||
return ResponseOutput.NotOk("Forward Failed" + result.Failures.ToString() + result.ToJson());
|
return ResponseOutput.NotOk("Forward Failed" + result.Failures.ToString() + result.ToJson());
|
||||||
|
@ -1943,11 +1943,11 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
||||||
await _subjectVisitRepository.UpdateFromQueryAsync(t => t.Id == subjectVisitId,
|
await _subjectVisitRepository.BatchUpdateAsync(t => t.Id == subjectVisitId,
|
||||||
u => new SubjectVisit() { ForwardState = ForwardStateEnum.ForwardFailed });
|
u => new SubjectVisit() { ForwardState = ForwardStateEnum.ForwardFailed });
|
||||||
}
|
}
|
||||||
|
|
||||||
await _subjectVisitRepository.UpdateFromQueryAsync(t => t.Id == subjectVisitId,
|
await _subjectVisitRepository.BatchUpdateAsync(t => t.Id == subjectVisitId,
|
||||||
u => new SubjectVisit() { ForwardState = ForwardStateEnum.Forwarded,ForwardUserId = _userInfo.Id,ForwardTime = DateTime.Now});
|
u => new SubjectVisit() { ForwardState = ForwardStateEnum.Forwarded,ForwardUserId = _userInfo.Id,ForwardTime = DateTime.Now});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
[HttpDelete("{qCQuestionConfigureId:guid}")]
|
[HttpDelete("{qCQuestionConfigureId:guid}")]
|
||||||
public async Task<IResponseOutput> DeleteQCQuestionConfigure(Guid qCQuestionConfigureId)
|
public async Task<IResponseOutput> DeleteQCQuestionConfigure(Guid qCQuestionConfigureId)
|
||||||
{
|
{
|
||||||
var success = await _qcQuestionRepository.DeleteFromQueryAsync(t => t.Id == qCQuestionConfigureId);
|
var success = await _qcQuestionRepository.BatchDeleteAsync(t => t.Id == qCQuestionConfigureId);
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
return ResponseOutput.NotOk("已有QC审核记录,不允许删除问题项");
|
return ResponseOutput.NotOk("已有QC审核记录,不允许删除问题项");
|
||||||
}
|
}
|
||||||
|
|
||||||
var success = await _trialQcQuestionRepository.DeleteFromQueryAsync(t => t.Id == trialQCQuestionConfigureId);
|
var success = await _trialQcQuestionRepository.BatchDeleteAsync(t => t.Id == trialQCQuestionConfigureId);
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
{
|
{
|
||||||
return ResponseOutput.NotOk("已锁定,不允许操作");
|
return ResponseOutput.NotOk("已锁定,不允许操作");
|
||||||
}
|
}
|
||||||
var success = await _trialSiteEquipmentSurveyRepository.DeleteFromQueryAsync(t => t.Id == trialSiteEquipmentSurveyId);
|
var success = await _trialSiteEquipmentSurveyRepository.BatchDeleteAsync(t => t.Id == trialSiteEquipmentSurveyId);
|
||||||
|
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,7 +273,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
|
|
||||||
//删除验证码历史记录
|
//删除验证码历史记录
|
||||||
await _repository.DeleteFromQueryAsync<VerificationCode>(t => t.EmailOrPhone == userInfo.EmailOrPhone && t.Code == userInfo.verificationCode && t.CodeType == userInfo.verificationType);
|
await _repository.BatchDeleteAsync<VerificationCode>(t => t.EmailOrPhone == userInfo.EmailOrPhone && t.Code == userInfo.verificationCode && t.CodeType == userInfo.verificationType);
|
||||||
|
|
||||||
await _repository.SaveChangesAsync();
|
await _repository.SaveChangesAsync();
|
||||||
|
|
||||||
|
@ -349,7 +349,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
return ResponseOutput.NotOk("已锁定,不允许操作");
|
return ResponseOutput.NotOk("已锁定,不允许操作");
|
||||||
}
|
}
|
||||||
|
|
||||||
var success = await _trialSiteSurveyRepository.DeleteFromQueryAsync(t => t.Id == trialSiteSurveyId);
|
var success = await _trialSiteSurveyRepository.BatchDeleteAsync(t => t.Id == trialSiteSurveyId);
|
||||||
|
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
|
@ -600,7 +600,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM)
|
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM)
|
||||||
{
|
{
|
||||||
await _repository.UpdateFromQueryAsync<TrialSiteSurvey>(t => t.Id == trialSiteSurveyId, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.ToSubmit });
|
await _repository.BatchUpdateAsync<TrialSiteSurvey>(t => t.Id == trialSiteSurveyId, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.ToSubmit });
|
||||||
}
|
}
|
||||||
else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM)
|
else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM)
|
||||||
{
|
{
|
||||||
|
@ -608,12 +608,12 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
if (hasSPMOrCPM)
|
if (hasSPMOrCPM)
|
||||||
{
|
{
|
||||||
await _trialSiteSurveyRepository.UpdateFromQueryAsync(t => t.Id == trialSiteSurveyId, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.CRCSubmitted });
|
await _trialSiteSurveyRepository.BatchUpdateAsync(t => t.Id == trialSiteSurveyId, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.CRCSubmitted });
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await _trialSiteSurveyRepository.UpdateFromQueryAsync(t => t.Id == trialSiteSurveyId, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.ToSubmit });
|
await _trialSiteSurveyRepository.BatchUpdateAsync(t => t.Id == trialSiteSurveyId, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.ToSubmit });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ResponseOutput.Ok();
|
return ResponseOutput.Ok();
|
||||||
|
@ -725,7 +725,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
smtp.MessageSent += (sender, args) =>
|
smtp.MessageSent += (sender, args) =>
|
||||||
{
|
{
|
||||||
|
|
||||||
_ = _trialSiteUserSurveyRepository.UpdateFromQueryAsync(t => t.Id == item.Id, u => new TrialSiteUserSurvey() { IsGenerateSuccess = true, InviteState = TrialSiteUserStateEnum.HasSend, IsJoin = null, ConfirmTime = null, RejectReason = String.Empty, SystemUserId = sysUserInfo.Id, ExpireTime = DateTime.Now.AddDays(7) }).Result;
|
_ = _trialSiteUserSurveyRepository.BatchUpdateAsync(t => t.Id == item.Id, u => new TrialSiteUserSurvey() { IsGenerateSuccess = true, InviteState = TrialSiteUserStateEnum.HasSend, IsJoin = null, ConfirmTime = null, RejectReason = String.Empty, SystemUserId = sysUserInfo.Id, ExpireTime = DateTime.Now.AddDays(7) }).Result;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -773,12 +773,12 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
if (hasSPMOrCPM)
|
if (hasSPMOrCPM)
|
||||||
{
|
{
|
||||||
await _trialSiteSurveyRepository.UpdateFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.ToSubmit, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.CRCSubmitted });
|
await _trialSiteSurveyRepository.BatchUpdateAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.ToSubmit, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.CRCSubmitted });
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await _trialSiteSurveyRepository.UpdateFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.ToSubmit, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved });
|
await _trialSiteSurveyRepository.BatchUpdateAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.ToSubmit, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -786,7 +786,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM)
|
else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM)
|
||||||
{
|
{
|
||||||
|
|
||||||
await _trialSiteSurveyRepository.UpdateFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.CRCSubmitted, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved, PreliminaryUserId = _userInfo.Id, PreliminaryTime = DateTime.Now });
|
await _trialSiteSurveyRepository.BatchUpdateAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.CRCSubmitted, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved, PreliminaryUserId = _userInfo.Id, PreliminaryTime = DateTime.Now });
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager)
|
else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager)
|
||||||
|
@ -803,7 +803,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
await SendInviteEmail(new InviteEmailCommand() { TrialId = trialId, RouteUrl = siteSurvyeSubmit.RouteUrl, UserList = needGenerateList });
|
await SendInviteEmail(new InviteEmailCommand() { TrialId = trialId, RouteUrl = siteSurvyeSubmit.RouteUrl, UserList = needGenerateList });
|
||||||
|
|
||||||
await _trialSiteSurveyRepository.UpdateFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.SPMApproved, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.PMCreatedAndLock, ReviewerUserId = _userInfo.Id, ReviewerTime = DateTime.Now });
|
await _trialSiteSurveyRepository.BatchUpdateAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.SPMApproved, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.PMCreatedAndLock, ReviewerUserId = _userInfo.Id, ReviewerTime = DateTime.Now });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
return ResponseOutput.NotOk("已锁定,不允许操作");
|
return ResponseOutput.NotOk("已锁定,不允许操作");
|
||||||
}
|
}
|
||||||
|
|
||||||
var success = await _trialSiteUserSurveyRepository.DeleteFromQueryAsync(t => t.Id == trialSiteUserSurveyId);
|
var success = await _trialSiteUserSurveyRepository.BatchDeleteAsync(t => t.Id == trialSiteUserSurveyId);
|
||||||
|
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ namespace IRaCIS.Core.Application
|
||||||
[Obsolete]
|
[Obsolete]
|
||||||
public async Task<IResponseOutput> MakeSignEffective(Guid signId)
|
public async Task<IResponseOutput> MakeSignEffective(Guid signId)
|
||||||
{
|
{
|
||||||
var success = await _repository.UpdateFromQueryAsync<TrialSign>(t => t.Id == signId, u => new TrialSign() { IsCompleted = true });
|
var success = await _repository.BatchUpdateAsync<TrialSign>(t => t.Id == signId, u => new TrialSign() { IsCompleted = true });
|
||||||
|
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
}
|
}
|
||||||
|
@ -109,15 +109,15 @@ namespace IRaCIS.Core.Application
|
||||||
|
|
||||||
if (signConfirmDTO.SignCode == ((int)SignEnum.TrialLogicConfim).ToString())
|
if (signConfirmDTO.SignCode == ((int)SignEnum.TrialLogicConfim).ToString())
|
||||||
{
|
{
|
||||||
await _trialRepository.UpdateFromQueryAsync(t => t.Id == signConfirmDTO.TrialId, u => new Trial() { IsTrialBasicLogicConfirmed = true });
|
await _trialRepository.BatchUpdateAsync(t => t.Id == signConfirmDTO.TrialId, u => new Trial() { IsTrialBasicLogicConfirmed = true });
|
||||||
}
|
}
|
||||||
else if (signConfirmDTO.SignCode == ((int)SignEnum.TrialProcessConfim).ToString())
|
else if (signConfirmDTO.SignCode == ((int)SignEnum.TrialProcessConfim).ToString())
|
||||||
{
|
{
|
||||||
await _trialRepository.UpdateFromQueryAsync(t => t.Id == signConfirmDTO.TrialId, u => new Trial() { IsTrialProcessConfirmed = true });
|
await _trialRepository.BatchUpdateAsync(t => t.Id == signConfirmDTO.TrialId, u => new Trial() { IsTrialProcessConfirmed = true });
|
||||||
}
|
}
|
||||||
else if (signConfirmDTO.SignCode == ((int)SignEnum.TrialUrgentConfim).ToString())
|
else if (signConfirmDTO.SignCode == ((int)SignEnum.TrialUrgentConfim).ToString())
|
||||||
{
|
{
|
||||||
await _trialRepository.UpdateFromQueryAsync(t => t.Id == signConfirmDTO.TrialId, u => new Trial() { IsTrialUrgentConfirmed = true });
|
await _trialRepository.BatchUpdateAsync(t => t.Id == signConfirmDTO.TrialId, u => new Trial() { IsTrialUrgentConfirmed = true });
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (signConfirmDTO.SignCode == ((int)SignEnum.TrialQCQuestionConfirm).ToString())
|
else if (signConfirmDTO.SignCode == ((int)SignEnum.TrialQCQuestionConfirm).ToString())
|
||||||
|
@ -135,7 +135,7 @@ namespace IRaCIS.Core.Application
|
||||||
return ResponseOutput.NotOk("父问题的序号要比子问题序号小,请确认");
|
return ResponseOutput.NotOk("父问题的序号要比子问题序号小,请确认");
|
||||||
}
|
}
|
||||||
|
|
||||||
await _trialRepository.UpdateFromQueryAsync(t => t.Id == signConfirmDTO.TrialId, u => new Trial() { QCQuestionConfirmedTime = DateTime.Now, QCQuestionConfirmedUserId = _userInfo.Id, IsQCQuestionConfirmed = true });
|
await _trialRepository.BatchUpdateAsync(t => t.Id == signConfirmDTO.TrialId, u => new Trial() { QCQuestionConfirmedTime = DateTime.Now, QCQuestionConfirmedUserId = _userInfo.Id, IsQCQuestionConfirmed = true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -204,12 +204,12 @@ namespace IRaCIS.Core.Application
|
||||||
//Paused、 添加工总量 算医生读片中
|
//Paused、 添加工总量 算医生读片中
|
||||||
if (trialStatusStr.Contains(StaticData.TrialCompleted))
|
if (trialStatusStr.Contains(StaticData.TrialCompleted))
|
||||||
{
|
{
|
||||||
await _repository.UpdateFromQueryAsync<Enroll>(u => u.TrialId == trialId, e => new Enroll
|
await _repository.BatchUpdateAsync<Enroll>(u => u.TrialId == trialId, e => new Enroll
|
||||||
{
|
{
|
||||||
EnrollStatus = (int)EnrollStatus.Finished
|
EnrollStatus = (int)EnrollStatus.Finished
|
||||||
});
|
});
|
||||||
|
|
||||||
await _trialRepository.UpdateFromQueryAsync(u => u.Id == trialId, s => new Trial { TrialFinishedTime = DateTime.UtcNow.AddHours(8) });
|
await _trialRepository.BatchUpdateAsync(u => u.Id == trialId, s => new Trial { TrialFinishedTime = DateTime.UtcNow.AddHours(8) });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ namespace IRaCIS.Core.Application
|
||||||
await _repository.SaveChangesAsync();
|
await _repository.SaveChangesAsync();
|
||||||
|
|
||||||
|
|
||||||
var success = await _repository.UpdateFromQueryAsync<TrialSign>(t => t.Id == signId, u => new TrialSign() { IsCompleted = true });
|
var success = await _repository.BatchUpdateAsync<TrialSign>(t => t.Id == signId, u => new TrialSign() { IsCompleted = true });
|
||||||
|
|
||||||
|
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
|
@ -248,10 +248,10 @@ namespace IRaCIS.Core.Application
|
||||||
public async Task<IResponseOutput> AbandonTrial(Guid trialId, Guid signId, bool isAbandon)
|
public async Task<IResponseOutput> AbandonTrial(Guid trialId, Guid signId, bool isAbandon)
|
||||||
{
|
{
|
||||||
|
|
||||||
await _trialRepository.UpdateFromQueryAsync(t => t.Id == trialId, u => new Trial() { IsDeleted = isAbandon });
|
await _trialRepository.BatchUpdateAsync(t => t.Id == trialId, u => new Trial() { IsDeleted = isAbandon });
|
||||||
|
|
||||||
|
|
||||||
var success = await _repository.UpdateFromQueryAsync<TrialSign>(t => t.Id == signId, u => new TrialSign() { IsCompleted = true });
|
var success = await _repository.BatchUpdateAsync<TrialSign>(t => t.Id == signId, u => new TrialSign() { IsCompleted = true });
|
||||||
|
|
||||||
|
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
|
@ -323,7 +323,7 @@ namespace IRaCIS.Core.Application
|
||||||
if (trialConfig.IsUrgent)
|
if (trialConfig.IsUrgent)
|
||||||
{
|
{
|
||||||
|
|
||||||
await _repository.UpdateFromQueryAsync<SubjectVisit>(t => t.TrialId == trialInfo.Id && t.SubmitState == SubmitStateEnum.Submitted && t.ForwardState < ForwardStateEnum.Forwarded,
|
await _repository.BatchUpdateAsync<SubjectVisit>(t => t.TrialId == trialInfo.Id && t.SubmitState == SubmitStateEnum.Submitted && t.ForwardState < ForwardStateEnum.Forwarded,
|
||||||
s => new SubjectVisit() { IsUrgent = trialConfig.IsUrgent });
|
s => new SubjectVisit() { IsUrgent = trialConfig.IsUrgent });
|
||||||
}
|
}
|
||||||
else //之前设置为加急的访视状态不变。后续提交的访视,为不加急。
|
else //之前设置为加急的访视状态不变。后续提交的访视,为不加急。
|
||||||
|
|
|
@ -193,11 +193,11 @@ namespace IRaCIS.Core.Application.Service
|
||||||
[HttpDelete("{trialExternalUserId:guid}/{isSystemUser:bool}/{systemUserId}")]
|
[HttpDelete("{trialExternalUserId:guid}/{isSystemUser:bool}/{systemUserId}")]
|
||||||
public async Task<IResponseOutput> DeleteTrialExternalUser(Guid trialExternalUserId, bool isSystemUser, Guid systemUserId)
|
public async Task<IResponseOutput> DeleteTrialExternalUser(Guid trialExternalUserId, bool isSystemUser, Guid systemUserId)
|
||||||
{
|
{
|
||||||
var success = await _trialExternalUseRepository.DeleteFromQueryAsync(t => t.Id == trialExternalUserId);
|
var success = await _trialExternalUseRepository.BatchDeleteAsync(t => t.Id == trialExternalUserId);
|
||||||
|
|
||||||
if (isSystemUser == false)
|
if (isSystemUser == false)
|
||||||
{
|
{
|
||||||
await _userRepository.DeleteFromQueryAsync(t => t.Id == systemUserId);
|
await _userRepository.BatchDeleteAsync(t => t.Id == systemUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
|
@ -263,7 +263,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
smtp.MessageSent += (sender, args) =>
|
smtp.MessageSent += (sender, args) =>
|
||||||
{
|
{
|
||||||
|
|
||||||
_ = _trialExternalUseRepository.UpdateFromQueryAsync(t => t.Id == userInfo.Id, u => new TrialExternalUser() { InviteState = TrialExternalUserStateEnum.HasSend, IsJoin = null, ConfirmTime = null, RejectReason = String.Empty, ExpireTime = DateTime.Now.AddDays(7) }).Result;
|
_ = _trialExternalUseRepository.BatchUpdateAsync(t => t.Id == userInfo.Id, u => new TrialExternalUser() { InviteState = TrialExternalUserStateEnum.HasSend, IsJoin = null, ConfirmTime = null, RejectReason = String.Empty, ExpireTime = DateTime.Now.AddDays(7) }).Result;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
if (sysUserInfo.IsFirstAdd)
|
if (sysUserInfo.IsFirstAdd)
|
||||||
{
|
{
|
||||||
await _userRepository.UpdateFromQueryAsync(t => t.Id == sysUserInfo.Id,
|
await _userRepository.BatchUpdateAsync(t => t.Id == sysUserInfo.Id,
|
||||||
u => new User() { Password = MD5Helper.Md5(verificationCode.ToString()) });
|
u => new User() { Password = MD5Helper.Md5(verificationCode.ToString()) });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,7 +400,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
await smtp.DisconnectAsync(true);
|
await smtp.DisconnectAsync(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
await _userRepository.UpdateFromQueryAsync(t => t.Id == userId, u => new User() { Status = UserStateEnum.Enable });
|
await _userRepository.BatchUpdateAsync(t => t.Id == userId, u => new User() { Status = UserStateEnum.Enable });
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -486,7 +486,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
await _trialSiteUserRepository.AddAsync(new TrialSiteUser() { TrialId = trialId, SiteId = siteId, UserId = userId });
|
await _trialSiteUserRepository.AddAsync(new TrialSiteUser() { TrialId = trialId, SiteId = siteId, UserId = userId });
|
||||||
|
|
||||||
await _userRepository.UpdateFromQueryAsync(t => t.Id == needUpdate.SystemUserId, u => new User() { Status = UserStateEnum.Enable });
|
await _userRepository.BatchUpdateAsync(t => t.Id == needUpdate.SystemUserId, u => new User() { Status = UserStateEnum.Enable });
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -512,7 +512,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
if (sysUserInfo.IsFirstAdd)
|
if (sysUserInfo.IsFirstAdd)
|
||||||
{
|
{
|
||||||
await _userRepository.UpdateFromQueryAsync(t => t.Id == sysUserInfo.Id,
|
await _userRepository.BatchUpdateAsync(t => t.Id == sysUserInfo.Id,
|
||||||
u => new User() { Password = MD5Helper.Md5(verificationCode.ToString()) });
|
u => new User() { Password = MD5Helper.Md5(verificationCode.ToString()) });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -661,10 +661,10 @@ namespace IRaCIS.Core.Application.Service
|
||||||
{
|
{
|
||||||
await _repository.AddAsync(new TrialUser() { TrialId = trialId, UserId = (Guid)externalUser.SystemUserId });
|
await _repository.AddAsync(new TrialUser() { TrialId = trialId, UserId = (Guid)externalUser.SystemUserId });
|
||||||
|
|
||||||
await _trialExternalUseRepository.UpdateFromQueryAsync(t => t.Id == trialExternalUserId,
|
await _trialExternalUseRepository.BatchUpdateAsync(t => t.Id == trialExternalUserId,
|
||||||
u => new TrialExternalUser() { InviteState = TrialExternalUserStateEnum.UserConfirmed });
|
u => new TrialExternalUser() { InviteState = TrialExternalUserStateEnum.UserConfirmed });
|
||||||
|
|
||||||
await _userRepository.UpdateFromQueryAsync(t => t.Id == externalUser.SystemUserId, u => new User() { Status = UserStateEnum.Enable });
|
await _userRepository.BatchUpdateAsync(t => t.Id == externalUser.SystemUserId, u => new User() { Status = UserStateEnum.Enable });
|
||||||
|
|
||||||
await _userRepository.SaveChangesAsync();
|
await _userRepository.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IQC)
|
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IQC)
|
||||||
{
|
{
|
||||||
await _repository.UpdateFromQueryAsync<SubjectVisit>(t => t.CurrentActionUserId == trialUser.UserId && t.TrialId == trialUser.TrialId && t.IsTake, u => new SubjectVisit() { CurrentActionUserId = null, CurrentActionUserExpireTime = null, IsTake = false });
|
await _repository.BatchUpdateAsync<SubjectVisit>(t => t.CurrentActionUserId == trialUser.UserId && t.TrialId == trialUser.TrialId && t.IsTake, u => new SubjectVisit() { CurrentActionUserId = null, CurrentActionUserExpireTime = null, IsTake = false });
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -201,10 +201,10 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IQC && isDelete)
|
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IQC && isDelete)
|
||||||
{
|
{
|
||||||
await _repository.UpdateFromQueryAsync<SubjectVisit>(t => t.CurrentActionUserId == trialUser.UserId && t.TrialId == trialUser.TrialId && t.IsTake, u => new SubjectVisit() { CurrentActionUserId = null, CurrentActionUserExpireTime = null, IsTake = false });
|
await _repository.BatchUpdateAsync<SubjectVisit>(t => t.CurrentActionUserId == trialUser.UserId && t.TrialId == trialUser.TrialId && t.IsTake, u => new SubjectVisit() { CurrentActionUserId = null, CurrentActionUserExpireTime = null, IsTake = false });
|
||||||
}
|
}
|
||||||
|
|
||||||
await _trialUseRepository.UpdateFromQueryAsync(t => t.Id == id, u => new TrialUser() { IsDeleted = isDelete, RemoveTime = isDelete ? DateTime.Now : null });
|
await _trialUseRepository.BatchUpdateAsync(t => t.Id == id, u => new TrialUser() { IsDeleted = isDelete, RemoveTime = isDelete ? DateTime.Now : null });
|
||||||
|
|
||||||
await _repository.SaveChangesAsync();
|
await _repository.SaveChangesAsync();
|
||||||
|
|
||||||
|
|
|
@ -210,7 +210,7 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
|
|
||||||
//删除中间表 Title对应的记录
|
//删除中间表 Title对应的记录
|
||||||
await _repository.DeleteFromQueryAsync<TrialDictionary>(t => t.TrialId == updateModel.Id);
|
await _repository.BatchDeleteAsync<TrialDictionary>(t => t.TrialId == updateModel.Id);
|
||||||
|
|
||||||
//重新插入新的 Title记录
|
//重新插入新的 Title记录
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ namespace IRaCIS.Application.Services
|
||||||
switch (newState)
|
switch (newState)
|
||||||
{
|
{
|
||||||
case (int)TrialExpedited.ExpeditedIn24H:
|
case (int)TrialExpedited.ExpeditedIn24H:
|
||||||
await _repository.UpdateFromQueryAsync<Workload>(t => t.IsLock == false && t.TrialId == trialId, u => new Workload()
|
await _repository.BatchUpdateAsync<Workload>(t => t.IsLock == false && t.TrialId == trialId, u => new Workload()
|
||||||
{
|
{
|
||||||
TimepointIn24H = u.Timepoint,
|
TimepointIn24H = u.Timepoint,
|
||||||
AdjudicationIn24H = u.Adjudication,
|
AdjudicationIn24H = u.Adjudication,
|
||||||
|
@ -254,7 +254,7 @@ namespace IRaCIS.Application.Services
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case (int)TrialExpedited.ExpeditedIn48H:
|
case (int)TrialExpedited.ExpeditedIn48H:
|
||||||
await _repository.UpdateFromQueryAsync<Workload>(t => t.IsLock == false && t.TrialId == trialId, u => new Workload()
|
await _repository.BatchUpdateAsync<Workload>(t => t.IsLock == false && t.TrialId == trialId, u => new Workload()
|
||||||
{
|
{
|
||||||
TimepointIn48H = u.Timepoint,
|
TimepointIn48H = u.Timepoint,
|
||||||
AdjudicationIn48H = u.Adjudication,
|
AdjudicationIn48H = u.Adjudication,
|
||||||
|
@ -275,7 +275,7 @@ namespace IRaCIS.Application.Services
|
||||||
switch (newState)
|
switch (newState)
|
||||||
{
|
{
|
||||||
case (int)TrialExpedited.None:
|
case (int)TrialExpedited.None:
|
||||||
await _repository.UpdateFromQueryAsync<Workload>(t => t.IsLock == false && t.TrialId == trialId, u => new Workload()
|
await _repository.BatchUpdateAsync<Workload>(t => t.IsLock == false && t.TrialId == trialId, u => new Workload()
|
||||||
{
|
{
|
||||||
Timepoint = u.TimepointIn24H,
|
Timepoint = u.TimepointIn24H,
|
||||||
Adjudication = u.AdjudicationIn24H,
|
Adjudication = u.AdjudicationIn24H,
|
||||||
|
@ -284,7 +284,7 @@ namespace IRaCIS.Application.Services
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case (int)TrialExpedited.ExpeditedIn48H:
|
case (int)TrialExpedited.ExpeditedIn48H:
|
||||||
await _repository.UpdateFromQueryAsync<Workload>(t => t.IsLock == false && t.TrialId == trialId, u => new Workload()
|
await _repository.BatchUpdateAsync<Workload>(t => t.IsLock == false && t.TrialId == trialId, u => new Workload()
|
||||||
{
|
{
|
||||||
TimepointIn48H = u.TimepointIn24H,
|
TimepointIn48H = u.TimepointIn24H,
|
||||||
AdjudicationIn48H = u.AdjudicationIn24H,
|
AdjudicationIn48H = u.AdjudicationIn24H,
|
||||||
|
@ -306,7 +306,7 @@ namespace IRaCIS.Application.Services
|
||||||
switch (newState)
|
switch (newState)
|
||||||
{
|
{
|
||||||
case (int)TrialExpedited.None:
|
case (int)TrialExpedited.None:
|
||||||
await _repository.UpdateFromQueryAsync<Workload>(t => t.IsLock == false && t.TrialId == trialId, u => new Workload()
|
await _repository.BatchUpdateAsync<Workload>(t => t.IsLock == false && t.TrialId == trialId, u => new Workload()
|
||||||
{
|
{
|
||||||
Timepoint = u.TimepointIn48H,
|
Timepoint = u.TimepointIn48H,
|
||||||
Adjudication = u.AdjudicationIn48H,
|
Adjudication = u.AdjudicationIn48H,
|
||||||
|
@ -315,7 +315,7 @@ namespace IRaCIS.Application.Services
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case (int)TrialExpedited.ExpeditedIn24H:
|
case (int)TrialExpedited.ExpeditedIn24H:
|
||||||
await _repository.UpdateFromQueryAsync<Workload>(t => t.IsLock == false && t.TrialId == trialId, u => new Workload()
|
await _repository.BatchUpdateAsync<Workload>(t => t.IsLock == false && t.TrialId == trialId, u => new Workload()
|
||||||
{
|
{
|
||||||
TimepointIn24H = u.TimepointIn48H,
|
TimepointIn24H = u.TimepointIn48H,
|
||||||
AdjudicationIn24H = u.AdjudicationIn48H,
|
AdjudicationIn24H = u.AdjudicationIn48H,
|
||||||
|
@ -370,9 +370,9 @@ namespace IRaCIS.Application.Services
|
||||||
if (await _trialUserRepository.CountAsync(t => t.TrialId == trialId) == 1)
|
if (await _trialUserRepository.CountAsync(t => t.TrialId == trialId) == 1)
|
||||||
{
|
{
|
||||||
|
|
||||||
var success1 = await _repository.DeleteFromQueryAsync<Trial>(o => o.Id == trialId) ||
|
var success1 = await _repository.BatchDeleteAsync<Trial>(o => o.Id == trialId) ||
|
||||||
await _repository.DeleteFromQueryAsync<TrialUser>(t => t.TrialId == trialId) ||
|
await _repository.BatchDeleteAsync<TrialUser>(t => t.TrialId == trialId) ||
|
||||||
await _repository.DeleteFromQueryAsync<TrialDictionary>(t => t.TrialId == trialId);
|
await _repository.BatchDeleteAsync<TrialDictionary>(t => t.TrialId == trialId);
|
||||||
|
|
||||||
return ResponseOutput.Result(success1);
|
return ResponseOutput.Result(success1);
|
||||||
}
|
}
|
||||||
|
@ -382,10 +382,10 @@ namespace IRaCIS.Application.Services
|
||||||
{
|
{
|
||||||
return ResponseOutput.NotOk("该Trial下面有参与者,无法删除");
|
return ResponseOutput.NotOk("该Trial下面有参与者,无法删除");
|
||||||
}
|
}
|
||||||
var success = await _repository.DeleteFromQueryAsync<Trial>(o => o.Id == trialId) ||
|
var success = await _repository.BatchDeleteAsync<Trial>(o => o.Id == trialId) ||
|
||||||
await _repository.DeleteFromQueryAsync<TrialUser>(t => t.TrialId == trialId) ||
|
await _repository.BatchDeleteAsync<TrialUser>(t => t.TrialId == trialId) ||
|
||||||
await _repository.DeleteFromQueryAsync<TrialDictionary>(t => t.TrialId == trialId) ||
|
await _repository.BatchDeleteAsync<TrialDictionary>(t => t.TrialId == trialId) ||
|
||||||
await _repository.DeleteFromQueryAsync<TrialSiteUser>(t => t.TrialId == trialId);
|
await _repository.BatchDeleteAsync<TrialSiteUser>(t => t.TrialId == trialId);
|
||||||
|
|
||||||
|
|
||||||
return ResponseOutput.Result(success);
|
return ResponseOutput.Result(success);
|
||||||
|
@ -434,9 +434,9 @@ namespace IRaCIS.Application.Services
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await _trialRepository.UpdateFromQueryAsync(u => u.Id == trialId, t => new Trial() { VisitPlanConfirmed = confirmOrCancel });
|
await _trialRepository.BatchUpdateAsync(u => u.Id == trialId, t => new Trial() { VisitPlanConfirmed = confirmOrCancel });
|
||||||
|
|
||||||
await _repository.UpdateFromQueryAsync<VisitStage>(u => u.Id == trialId, t => new VisitStage() { IsConfirmed = true });
|
await _repository.BatchUpdateAsync<VisitStage>(u => u.Id == trialId, t => new VisitStage() { IsConfirmed = true });
|
||||||
|
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
return ResponseOutput.Ok();
|
||||||
|
@ -484,7 +484,7 @@ namespace IRaCIS.Application.Services
|
||||||
EnrollStatus = status,
|
EnrollStatus = status,
|
||||||
OptUserType = (int)SystemUserType.DoctorUser,
|
OptUserType = (int)SystemUserType.DoctorUser,
|
||||||
});
|
});
|
||||||
return ResponseOutput.Result(await _repository.UpdateFromQueryAsync<Enroll>(u => u.TrialId == trialId && u.DoctorId == _userInfo.Id, e => new Enroll
|
return ResponseOutput.Result(await _repository.BatchUpdateAsync<Enroll>(u => u.TrialId == trialId && u.DoctorId == _userInfo.Id, e => new Enroll
|
||||||
{
|
{
|
||||||
EnrollStatus = status
|
EnrollStatus = status
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -299,7 +299,7 @@ namespace IRaCIS.Core.Application.Services
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
var isSuccess = await _trialSiteUserRepository.UpdateFromQueryAsync(u => u.Id == id, u => new TrialSiteUser()
|
var isSuccess = await _trialSiteUserRepository.BatchUpdateAsync(u => u.Id == id, u => new TrialSiteUser()
|
||||||
{ IsDeleted = isDelete, DeletedTime = isDelete ? DateTime.Now : null });
|
{ IsDeleted = isDelete, DeletedTime = isDelete ? DateTime.Now : null });
|
||||||
|
|
||||||
return ResponseOutput.Ok(isSuccess);
|
return ResponseOutput.Ok(isSuccess);
|
||||||
|
|
|
@ -100,7 +100,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
await _trialUserRepository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId });
|
await _trialUserRepository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId });
|
||||||
|
|
||||||
|
|
||||||
await _trialExternalUseRepository.UpdateFromQueryAsync(t => t.TrialId == trialId && t.SystemUserId == userId,
|
await _trialExternalUseRepository.BatchUpdateAsync(t => t.TrialId == trialId && t.SystemUserId == userId,
|
||||||
u => new TrialExternalUser() { InviteState = TrialExternalUserStateEnum.UserConfirmed });
|
u => new TrialExternalUser() { InviteState = TrialExternalUserStateEnum.UserConfirmed });
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await _userRepository.UpdateFromQueryAsync(t => t.Id == userId, u => new User() { Status = UserStateEnum.Enable });
|
await _userRepository.BatchUpdateAsync(t => t.Id == userId, u => new User() { Status = UserStateEnum.Enable });
|
||||||
|
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
return ResponseOutput.Ok();
|
||||||
|
|
|
@ -70,10 +70,10 @@ namespace IRaCIS.Application.Services
|
||||||
if (mapedSubject.SiteId != subjectCommand.SiteId)
|
if (mapedSubject.SiteId != subjectCommand.SiteId)
|
||||||
{
|
{
|
||||||
|
|
||||||
await _repository.UpdateFromQueryAsync<SubjectVisit>(t => t.SubjectId == mapedSubject.Id,
|
await _repository.BatchUpdateAsync<SubjectVisit>(t => t.SubjectId == mapedSubject.Id,
|
||||||
u => new SubjectVisit() { SiteId = mapedSubject.SiteId });
|
u => new SubjectVisit() { SiteId = mapedSubject.SiteId });
|
||||||
|
|
||||||
await _repository.UpdateFromQueryAsync<DicomStudy>(t => t.SubjectId == mapedSubject.Id,
|
await _repository.BatchUpdateAsync<DicomStudy>(t => t.SubjectId == mapedSubject.Id,
|
||||||
u => new DicomStudy() { SiteId = mapedSubject.SiteId });
|
u => new DicomStudy() { SiteId = mapedSubject.SiteId });
|
||||||
|
|
||||||
|
|
||||||
|
@ -210,13 +210,13 @@ namespace IRaCIS.Application.Services
|
||||||
sv.IsFinalVisit = true;
|
sv.IsFinalVisit = true;
|
||||||
|
|
||||||
//末次访视后的 访视设置为不可用
|
//末次访视后的 访视设置为不可用
|
||||||
await _repository.UpdateFromQueryAsync<SubjectVisit>(t => t.SubjectId == subjectStatusChangeCommand.SubjectId && t.VisitNum > sv.VisitNum, u => new SubjectVisit() { VisitExecuted = VisitExecutedEnum.Unavailable });
|
await _repository.BatchUpdateAsync<SubjectVisit>(t => t.SubjectId == subjectStatusChangeCommand.SubjectId && t.VisitNum > sv.VisitNum, u => new SubjectVisit() { VisitExecuted = VisitExecutedEnum.Unavailable });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//将受试者未执行的 设置为不可用
|
//将受试者未执行的 设置为不可用
|
||||||
await _repository.UpdateFromQueryAsync<SubjectVisit>(t => t.SubjectId == subject.Id && t.VisitExecuted == VisitExecutedEnum.UnExecuted, u => new SubjectVisit() { VisitExecuted = VisitExecutedEnum.Unavailable });
|
await _repository.BatchUpdateAsync<SubjectVisit>(t => t.SubjectId == subject.Id && t.VisitExecuted == VisitExecutedEnum.UnExecuted, u => new SubjectVisit() { VisitExecuted = VisitExecutedEnum.Unavailable });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -263,8 +263,8 @@ namespace IRaCIS.Application.Services
|
||||||
return ResponseOutput.NotOk("This subject has executed a visit with uploading study images,and couldn't be deleted.");
|
return ResponseOutput.NotOk("This subject has executed a visit with uploading study images,and couldn't be deleted.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var isSuccess = await _subjectRepository.DeleteFromQueryAsync(u => u.Id == id);
|
var isSuccess = await _subjectRepository.BatchDeleteAsync(u => u.Id == id);
|
||||||
await _repository.DeleteFromQueryAsync<SubjectVisit>(u => u.SubjectId == id);
|
await _repository.BatchDeleteAsync<SubjectVisit>(u => u.SubjectId == id);
|
||||||
var subvisit = await _repository.GetQueryable<SubjectVisit>().Where(x=>x.SubjectId==id).ToListAsync();
|
var subvisit = await _repository.GetQueryable<SubjectVisit>().Where(x=>x.SubjectId==id).ToListAsync();
|
||||||
|
|
||||||
List<DataInspection> datas = new List<DataInspection>();
|
List<DataInspection> datas = new List<DataInspection>();
|
||||||
|
|
|
@ -96,7 +96,7 @@ namespace IRaCIS.Core.Application.Services
|
||||||
subject.Status = SubjectStatus.OutOfVisit;
|
subject.Status = SubjectStatus.OutOfVisit;
|
||||||
|
|
||||||
//末次访视后的 访视设置为不可用
|
//末次访视后的 访视设置为不可用
|
||||||
await _subjectVisitRepository.UpdateFromQueryAsync(t => t.SubjectId == svCommand.SubjectId && t.VisitNum > svCommand.VisitNum, u => new SubjectVisit() { VisitExecuted = VisitExecutedEnum.Unavailable });
|
await _subjectVisitRepository.BatchUpdateAsync(t => t.SubjectId == svCommand.SubjectId && t.VisitNum > svCommand.VisitNum, u => new SubjectVisit() { VisitExecuted = VisitExecutedEnum.Unavailable });
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -104,7 +104,7 @@ namespace IRaCIS.Core.Application.Services
|
||||||
//回退
|
//回退
|
||||||
subject.Status = SubjectStatus.OnVisit;
|
subject.Status = SubjectStatus.OnVisit;
|
||||||
|
|
||||||
await _subjectVisitRepository.UpdateFromQueryAsync(t => t.SubjectId == svCommand.SubjectId && t.VisitExecuted == VisitExecutedEnum.Unavailable, u => new SubjectVisit() { VisitExecuted = VisitExecutedEnum.UnExecuted });
|
await _subjectVisitRepository.BatchUpdateAsync(t => t.SubjectId == svCommand.SubjectId && t.VisitExecuted == VisitExecutedEnum.Unavailable, u => new SubjectVisit() { VisitExecuted = VisitExecutedEnum.UnExecuted });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (svCommand.IsLostVisit && svCommand.Id == null)
|
if (svCommand.IsLostVisit && svCommand.Id == null)
|
||||||
|
@ -145,7 +145,7 @@ namespace IRaCIS.Core.Application.Services
|
||||||
if (svCommand.IsEnrollmentConfirm != null)
|
if (svCommand.IsEnrollmentConfirm != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
await _subjectVisitRepository.UpdateFromQueryAsync(t => t.SubjectId == svCommand.SubjectId && t.IsBaseLine , u => new SubjectVisit() { IsEnrollmentConfirm = svCommand.IsEnrollmentConfirm.Value });
|
await _subjectVisitRepository.BatchUpdateAsync(t => t.SubjectId == svCommand.SubjectId && t.IsBaseLine , u => new SubjectVisit() { IsEnrollmentConfirm = svCommand.IsEnrollmentConfirm.Value });
|
||||||
|
|
||||||
|
|
||||||
//needDealEntity.IsUrgent = true;
|
//needDealEntity.IsUrgent = true;
|
||||||
|
@ -209,7 +209,7 @@ namespace IRaCIS.Core.Application.Services
|
||||||
[HttpPut("{trialId:guid}/{subjectVisitId:guid}/{isUrgent:bool}")]
|
[HttpPut("{trialId:guid}/{subjectVisitId:guid}/{isUrgent:bool}")]
|
||||||
public async Task<IResponseOutput> SetSubjectVisitUrgent(Guid subjectVisitId, bool isUrgent)
|
public async Task<IResponseOutput> SetSubjectVisitUrgent(Guid subjectVisitId, bool isUrgent)
|
||||||
{
|
{
|
||||||
await _subjectVisitRepository.UpdateFromQueryAsync(t => t.Id == subjectVisitId, u => new SubjectVisit() { IsUrgent = isUrgent });
|
await _subjectVisitRepository.BatchUpdateAsync(t => t.Id == subjectVisitId, u => new SubjectVisit() { IsUrgent = isUrgent });
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
return ResponseOutput.Ok();
|
||||||
}
|
}
|
||||||
|
@ -232,7 +232,7 @@ namespace IRaCIS.Core.Application.Services
|
||||||
{
|
{
|
||||||
return ResponseOutput.NotOk("This visit is OutPlanPreviousVisitId and couldn't be deleted.");
|
return ResponseOutput.NotOk("This visit is OutPlanPreviousVisitId and couldn't be deleted.");
|
||||||
}
|
}
|
||||||
return ResponseOutput.Result(await _repository.DeleteFromQueryAsync<SubjectVisit>(s => s.Id == id));
|
return ResponseOutput.Result(await _repository.BatchDeleteAsync<SubjectVisit>(s => s.Id == id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -245,7 +245,7 @@ namespace IRaCIS.Core.Application.Services
|
||||||
[TypeFilter(typeof(TrialResourceFilter))]
|
[TypeFilter(typeof(TrialResourceFilter))]
|
||||||
public async Task<IResponseOutput> SetSVExecuted(Guid subjectVisitId)
|
public async Task<IResponseOutput> SetSVExecuted(Guid subjectVisitId)
|
||||||
{
|
{
|
||||||
return ResponseOutput.Result(await _subjectVisitRepository.UpdateFromQueryAsync(s => s.Id == subjectVisitId, u => new SubjectVisit() { VisitExecuted = VisitExecutedEnum.Executed }));
|
return ResponseOutput.Result(await _subjectVisitRepository.BatchUpdateAsync(s => s.Id == subjectVisitId, u => new SubjectVisit() { VisitExecuted = VisitExecutedEnum.Executed }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,7 @@ namespace IRaCIS.Application.Services
|
||||||
//});
|
//});
|
||||||
|
|
||||||
//更新项目访视计划状态为未确认
|
//更新项目访视计划状态为未确认
|
||||||
await _trialRepository.UpdateFromQueryAsync(u => u.Id == visitPlan.TrialId, t => new Trial() { VisitPlanConfirmed = false });
|
await _trialRepository.BatchUpdateAsync(u => u.Id == visitPlan.TrialId, t => new Trial() { VisitPlanConfirmed = false });
|
||||||
|
|
||||||
await _repository.SaveChangesAsync();
|
await _repository.SaveChangesAsync();
|
||||||
|
|
||||||
|
@ -292,9 +292,9 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
|
|
||||||
await _inspectionService.AddListInspectionRecordAsync(datas);
|
await _inspectionService.AddListInspectionRecordAsync(datas);
|
||||||
await _repository.DeleteFromQueryAsync<SubjectVisit>(t => t.TrialId == visitPlan.TrialId && t.VisitName == visitPlan.VisitName);
|
await _repository.BatchDeleteAsync<SubjectVisit>(t => t.TrialId == visitPlan.TrialId && t.VisitName == visitPlan.VisitName);
|
||||||
|
|
||||||
var result = await _visitStageRepository.DeleteFromQueryAsync(u => u.Id == id);
|
var result = await _visitStageRepository.BatchDeleteAsync(u => u.Id == id);
|
||||||
|
|
||||||
return ResponseOutput.Result(result);
|
return ResponseOutput.Result(result);
|
||||||
}
|
}
|
||||||
|
@ -333,7 +333,7 @@ namespace IRaCIS.Application.Services
|
||||||
var addvisitStages = await _visitStageRepository.Where(x => !x.IsHaveFirstConfirmed&&x.TrialId== trialId).ToListAsync();
|
var addvisitStages = await _visitStageRepository.Where(x => !x.IsHaveFirstConfirmed&&x.TrialId== trialId).ToListAsync();
|
||||||
|
|
||||||
//更新项目访视计划状态为已确认
|
//更新项目访视计划状态为已确认
|
||||||
await _trialRepository.UpdateFromQueryAsync(u => u.Id == trialId, t => new Trial() { VisitPlanConfirmed = true });
|
await _trialRepository.BatchUpdateAsync(u => u.Id == trialId, t => new Trial() { VisitPlanConfirmed = true });
|
||||||
|
|
||||||
//找到访视计划修改的Item
|
//找到访视计划修改的Item
|
||||||
var changedList = await _visitStageRepository.Where(t => t.TrialId == trialId && t.IsConfirmed == false)
|
var changedList = await _visitStageRepository.Where(t => t.TrialId == trialId && t.IsConfirmed == false)
|
||||||
|
@ -358,7 +358,7 @@ namespace IRaCIS.Application.Services
|
||||||
});
|
});
|
||||||
|
|
||||||
//访视计划 整体状态变更为 确认
|
//访视计划 整体状态变更为 确认
|
||||||
await _visitStageRepository.UpdateFromQueryAsync(u => u.TrialId == trialId, t => new VisitStage() { IsConfirmed = true ,IsHaveFirstConfirmed = true});
|
await _visitStageRepository.BatchUpdateAsync(u => u.TrialId == trialId, t => new VisitStage() { IsConfirmed = true ,IsHaveFirstConfirmed = true});
|
||||||
|
|
||||||
var stat = new VisitPlanInfluenceStat() { TrialId = trialId };
|
var stat = new VisitPlanInfluenceStat() { TrialId = trialId };
|
||||||
|
|
||||||
|
@ -509,7 +509,7 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
|
|
||||||
//变更某一访视计划Item 受试者访视相关字段
|
//变更某一访视计划Item 受试者访视相关字段
|
||||||
await _repository.UpdateFromQueryAsync<SubjectVisit>(t => t.TrialId == trialId && t.VisitStageId == changedItem.Id, k => new SubjectVisit()
|
await _repository.BatchUpdateAsync<SubjectVisit>(t => t.TrialId == trialId && t.VisitStageId == changedItem.Id, k => new SubjectVisit()
|
||||||
{
|
{
|
||||||
IsBaseLine = changedItem.IsBaseLine,
|
IsBaseLine = changedItem.IsBaseLine,
|
||||||
VisitName = changedItem.VisitName,
|
VisitName = changedItem.VisitName,
|
||||||
|
|
|
@ -60,7 +60,7 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
if (attachmentViewModel.Id != Guid.Empty)
|
if (attachmentViewModel.Id != Guid.Empty)
|
||||||
{
|
{
|
||||||
await _attachmentRepository.DeleteFromQueryAsync(t => t.Id == attachmentViewModel.Id);
|
await _attachmentRepository.BatchDeleteAsync(t => t.Id == attachmentViewModel.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
var attach = _mapper.Map<Attachment>(attachmentViewModel);
|
var attach = _mapper.Map<Attachment>(attachmentViewModel);
|
||||||
|
@ -83,8 +83,8 @@ namespace IRaCIS.Application.Services
|
||||||
[TypeFilter(typeof(TrialResourceFilter))]
|
[TypeFilter(typeof(TrialResourceFilter))]
|
||||||
public async Task<IResponseOutput> DeleteReviewerAckSOW(Guid trialId, Guid doctorId, Guid attachmentId)
|
public async Task<IResponseOutput> DeleteReviewerAckSOW(Guid trialId, Guid doctorId, Guid attachmentId)
|
||||||
{
|
{
|
||||||
var success1 = await _attachmentRepository.DeleteFromQueryAsync(a => a.Id == attachmentId);
|
var success1 = await _attachmentRepository.BatchDeleteAsync(a => a.Id == attachmentId);
|
||||||
var success2 = await _enrollRepository.UpdateFromQueryAsync(t => t.TrialId == trialId && t.DoctorId == doctorId, u =>
|
var success2 = await _enrollRepository.BatchUpdateAsync(t => t.TrialId == trialId && t.DoctorId == doctorId, u =>
|
||||||
new Enroll()
|
new Enroll()
|
||||||
{
|
{
|
||||||
AttachmentId = Guid.Empty
|
AttachmentId = Guid.Empty
|
||||||
|
@ -100,7 +100,7 @@ namespace IRaCIS.Application.Services
|
||||||
[TypeFilter(typeof(TrialResourceFilter))]
|
[TypeFilter(typeof(TrialResourceFilter))]
|
||||||
public async Task<IResponseOutput> UpdateReviewerReadingType(Guid trialId, Guid doctorId, int type)
|
public async Task<IResponseOutput> UpdateReviewerReadingType(Guid trialId, Guid doctorId, int type)
|
||||||
{
|
{
|
||||||
var success2 = await _enrollRepository.UpdateFromQueryAsync(t => t.TrialId == trialId && t.DoctorId == doctorId, u =>
|
var success2 = await _enrollRepository.BatchUpdateAsync(t => t.TrialId == trialId && t.DoctorId == doctorId, u =>
|
||||||
new Enroll()
|
new Enroll()
|
||||||
{
|
{
|
||||||
ReviewerReadingType = type
|
ReviewerReadingType = type
|
||||||
|
@ -625,7 +625,7 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
await _doctorWorkloadRepository.AddAsync(workLoad);
|
await _doctorWorkloadRepository.AddAsync(workLoad);
|
||||||
|
|
||||||
await _enrollRepository.UpdateFromQueryAsync(
|
await _enrollRepository.BatchUpdateAsync(
|
||||||
t => t.DoctorId == workLoadAddOrUpdateModel.DoctorId && t.TrialId == workLoadAddOrUpdateModel.TrialId, u => new Enroll()
|
t => t.DoctorId == workLoadAddOrUpdateModel.DoctorId && t.TrialId == workLoadAddOrUpdateModel.TrialId, u => new Enroll()
|
||||||
{
|
{
|
||||||
EnrollStatus = (int)EnrollStatus.DoctorReading,
|
EnrollStatus = (int)EnrollStatus.DoctorReading,
|
||||||
|
@ -649,7 +649,7 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var success = await _doctorWorkloadRepository.UpdateFromQueryAsync(t => t.Id == workLoadAddOrUpdateModel.Id,
|
var success = await _doctorWorkloadRepository.BatchUpdateAsync(t => t.Id == workLoadAddOrUpdateModel.Id,
|
||||||
u => new Workload()
|
u => new Workload()
|
||||||
{
|
{
|
||||||
Timepoint = workLoadAddOrUpdateModel.Timepoint,
|
Timepoint = workLoadAddOrUpdateModel.Timepoint,
|
||||||
|
@ -681,7 +681,7 @@ namespace IRaCIS.Application.Services
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task<IResponseOutput> DeleteWorkload(Guid workloadId)
|
public async Task<IResponseOutput> DeleteWorkload(Guid workloadId)
|
||||||
{
|
{
|
||||||
return ResponseOutput.Result(await _doctorWorkloadRepository.DeleteFromQueryAsync(t => t.Id == workloadId));
|
return ResponseOutput.Result(await _doctorWorkloadRepository.BatchDeleteAsync(t => t.Id == workloadId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -11,9 +11,9 @@ namespace IRaCIS.Application.Services
|
||||||
public class TestService : BaseService
|
public class TestService : BaseService
|
||||||
{
|
{
|
||||||
private readonly IRepository<Dictionary> _dicRepository;
|
private readonly IRepository<Dictionary> _dicRepository;
|
||||||
private readonly IRepository<Trial> _trialRepository;
|
private readonly IRepository<SubjectVisit> _trialRepository;
|
||||||
|
|
||||||
public TestService(IRepository<Dictionary> dicRepository,IRepository<Trial> trialRepository)
|
public TestService(IRepository<Dictionary> dicRepository,IRepository<SubjectVisit> trialRepository)
|
||||||
{
|
{
|
||||||
_dicRepository = dicRepository;
|
_dicRepository = dicRepository;
|
||||||
_trialRepository = trialRepository;
|
_trialRepository = trialRepository;
|
||||||
|
@ -27,19 +27,19 @@ namespace IRaCIS.Application.Services
|
||||||
var c = _dicRepository.Where(t => t.ParentId != null).Select(t => t.MappedValue).First();
|
var c = _dicRepository.Where(t => t.ParentId != null).Select(t => t.MappedValue).First();
|
||||||
CultureInfo culture = CultureInfo.CurrentUICulture;
|
CultureInfo culture = CultureInfo.CurrentUICulture;
|
||||||
|
|
||||||
//var dd= _dicRepository.UpdatePartialFields(Guid.Parse("8a90c96e-0776-4f7b-82a6-18933d339584"),
|
var dd = _dicRepository.UpdatePartialFields(Guid.Parse("8a90c96e-0776-4f7b-82a6-18933d339584"),
|
||||||
// u => new Dictionary() { ParentId = null, Code = "test" }, true).Result;
|
u => new Dictionary() { ParentId = null, Code = "test" }, true).Result;
|
||||||
|
|
||||||
var aaaa = _dicRepository.BatchDeleteAsync(t => t.Id == Guid.Empty).Result;
|
var aaaa = _dicRepository.BatchDeleteAsync(t => t.Id == Guid.Empty).Result;
|
||||||
|
|
||||||
//var ggggg = _dicRepository.UpdateFromQueryAsync(t => t.ParentId == Guid.Parse("8a90c96e-0776-4f7b-82a6-18933d339584"), u=>new Dictionary(){Code = "test"}).Result;
|
//var ggggg = _dicRepository.UpdateFromQueryAsync(t => t.ParentId == Guid.Parse("8a90c96e-0776-4f7b-82a6-18933d339584"), u=>new Dictionary(){Code = "test"}).Result;
|
||||||
|
|
||||||
var ddd = _dicRepository.BatchUpdateAsync(t => t.Id == Guid.Parse("8a90c96e-0776-4f7b-82a6-18933d339584"),
|
//var ddd = _dicRepository.BatchUpdateAsync(t => t.Id == Guid.Parse("8a90c96e-0776-4f7b-82a6-18933d339584"),
|
||||||
u => new Dictionary() { ParentId = null, Code = "test" }).Result;
|
// u => new Dictionary() { /*ParentId = null,*/ Code = "test" }).Result;
|
||||||
|
|
||||||
|
|
||||||
var aaaaa= _trialRepository.BatchUpdateAsync(t => t.Id == Guid.Empty,
|
var aaaaa= _trialRepository.BatchUpdateAsync(t => t.Id == Guid.Empty,
|
||||||
u => new Trial { TrialCode = "test" }).Result;
|
u => new SubjectVisit() { CurrentActionUserId = null }).Result;
|
||||||
|
|
||||||
|
|
||||||
//var d = _dicRepository.UpdateFromDTOAsync(new AddOrEditBasicDic() { Id = Guid.Parse("60d86683-c33b-4349-b672-08da1e91b622"), ParentId = null, ChildGroup = null, Code = null }, true, true).Result;
|
//var d = _dicRepository.UpdateFromDTOAsync(new AddOrEditBasicDic() { Id = Guid.Parse("60d86683-c33b-4349-b672-08da1e91b622"), ParentId = null, ChildGroup = null, Code = null }, true, true).Result;
|
||||||
|
|
|
@ -12,7 +12,6 @@ using IRaCIS.Core.IdentityServer4.Account;
|
||||||
using IdentityServer4.Configuration;
|
using IdentityServer4.Configuration;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using IRaCIS.Core.Infra.EFCore;
|
using IRaCIS.Core.Infra.EFCore;
|
||||||
using IRaCIS.Core.Infra.EFCore.AuthUser;
|
|
||||||
using IdentityServer4.Services;
|
using IdentityServer4.Services;
|
||||||
using ReturnUrlParser = IRaCIS.Core.IdentityServer4.Account.ReturnUrlParser;
|
using ReturnUrlParser = IRaCIS.Core.IdentityServer4.Account.ReturnUrlParser;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
@ -47,7 +46,6 @@ namespace IRaCIS.Core.IdentityServer4
|
||||||
|
|
||||||
}, ServiceLifetime.Scoped);
|
}, ServiceLifetime.Scoped);
|
||||||
|
|
||||||
services.AddScoped<IUserInfo, UserInfo>();
|
|
||||||
services.AddTransient<IReturnUrlParser, ReturnUrlParser>();
|
services.AddTransient<IReturnUrlParser, ReturnUrlParser>();
|
||||||
|
|
||||||
services.AddScoped(typeof(IRepository<>), typeof(Repository<>));
|
services.AddScoped(typeof(IRepository<>), typeof(Repository<>));
|
||||||
|
|
|
@ -37,8 +37,6 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||||
optionsBuilder.UseLoggerFactory(MyLoggerFactory)
|
optionsBuilder.UseLoggerFactory(MyLoggerFactory)
|
||||||
.ReplaceService<IModelCacheKeyFactory, DynamicModelCacheKeyFactoryDesignTimeSupport>();
|
.ReplaceService<IModelCacheKeyFactory, DynamicModelCacheKeyFactoryDesignTimeSupport>();
|
||||||
|
|
||||||
optionsBuilder.UseBatchEF_MSSQL();
|
|
||||||
|
|
||||||
//var config = new ConfigurationBuilder()
|
//var config = new ConfigurationBuilder()
|
||||||
// .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true).Build();
|
// .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true).Build();
|
||||||
//connectionString = config.GetSection("ConnectionStrings:RemoteNew").Value;
|
//connectionString = config.GetSection("ConnectionStrings:RemoteNew").Value;
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.1" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" />
|
||||||
<PackageReference Include="Z.EntityFramework.Plus.EFCore" Version="6.13.6" />
|
<PackageReference Include="Z.EntityFramework.Plus.EFCore" Version="6.13.6" />
|
||||||
<PackageReference Include="Zack.EFCore.Batch.MSSQL_NET6" Version="6.0.12" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -23,10 +23,8 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||||
Task<TEntity> UpdatePartialFields(Guid id, Expression<Func<TEntity, TEntity>> updateFactory, bool autoSave = false, params EntityVerifyExp<TEntity>[] verify);
|
Task<TEntity> UpdatePartialFields(Guid id, Expression<Func<TEntity, TEntity>> updateFactory, bool autoSave = false, params EntityVerifyExp<TEntity>[] verify);
|
||||||
|
|
||||||
|
|
||||||
Task<bool> BatchUpdateAsync(Expression<Func<TEntity, bool>> where,
|
|
||||||
Expression<Func<TEntity, TEntity>> updateFactory);
|
|
||||||
|
|
||||||
Task<bool> BatchDeleteAsync(Expression<Func<TEntity, bool>> deleteFilter);
|
Task<bool> BatchDeleteAsync(Expression<Func<TEntity, bool>> deleteFilter);
|
||||||
|
Task<bool> BatchUpdateAsync(Expression<Func<TEntity, bool>> where, Expression<Func<TEntity, TEntity>> updateFactory);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,8 +54,7 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||||
Task<bool> DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default);
|
Task<bool> DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default);
|
||||||
Task<bool> DeleteManyAsync(IEnumerable<TEntity> entities, bool autoSave = false, CancellationToken cancellationToken = default);
|
Task<bool> DeleteManyAsync(IEnumerable<TEntity> entities, bool autoSave = false, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
Task<bool> DeleteFromQueryAsync(Expression<Func<TEntity, bool>> deleteFilter) ;
|
|
||||||
Task<bool> UpdateFromQueryAsync(Expression<Func<TEntity, bool>> where, Expression<Func<TEntity, TEntity>> updateFactory);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using EFCore.BulkExtensions;
|
||||||
|
using IRaCIS.Core.Domain.Share;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Infra.EFCore
|
namespace IRaCIS.Core.Infra.EFCore
|
||||||
{
|
{
|
||||||
|
@ -59,9 +61,9 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||||
|
|
||||||
Task<bool> SaveChangesAsync();
|
Task<bool> SaveChangesAsync();
|
||||||
|
|
||||||
Task<bool> DeleteFromQueryAsync<T>(Expression<Func<T, bool>> deleteFilter) where T : Entity;
|
Task<bool> BatchDeleteAsync<T>(Expression<Func<T, bool>> deleteFilter) where T : Entity;
|
||||||
|
|
||||||
Task<bool> UpdateFromQueryAsync<T>(Expression<Func<T, bool>> where, Expression<Func<T, T>> updateFactory) where T : Entity;
|
Task<bool> BatchUpdateAsync<T>(Expression<Func<T, bool>> where, Expression<Func<T, T>> updateFactory) where T : Entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Repository : IRepository
|
public class Repository : IRepository
|
||||||
|
@ -70,10 +72,13 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||||
|
|
||||||
public IMapper _mapper { get; set; }
|
public IMapper _mapper { get; set; }
|
||||||
|
|
||||||
public Repository(IRaCISDBContext dbContext, IMapper mapper)
|
public IUserInfo _userInfo { get; set; }
|
||||||
|
|
||||||
|
public Repository(IRaCISDBContext dbContext, IMapper mapper, IUserInfo userInfo)
|
||||||
{
|
{
|
||||||
_dbContext = dbContext;
|
_dbContext = dbContext;
|
||||||
_mapper = mapper;
|
_mapper = mapper;
|
||||||
|
_userInfo = userInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -396,18 +401,32 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public async Task<bool> DeleteFromQueryAsync<T>(Expression<Func<T, bool>> deleteFilter) where T : Entity
|
public async Task<bool> BatchDeleteAsync<T>(Expression<Func<T, bool>> deleteFilter) where T : Entity
|
||||||
{
|
{
|
||||||
if (deleteFilter == null) throw new ArgumentNullException(nameof(deleteFilter));
|
if (deleteFilter == null) throw new ArgumentNullException(nameof(deleteFilter));
|
||||||
|
|
||||||
return await _dbContext.Set<T>().AsNoTracking().Where(deleteFilter).DeleteFromQueryAsync().ConfigureAwait(false) > 0;
|
return await _dbContext.Set<T>().AsNoTracking().Where(deleteFilter).BatchDeleteAsync().ConfigureAwait(false) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> UpdateFromQueryAsync<T>(Expression<Func<T, bool>> whereFilter, Expression<Func<T, T>> updateFactory) where T : Entity
|
public async Task<bool> BatchUpdateAsync<T>(Expression<Func<T, bool>> whereFilter, Expression<Func<T, T>> updateFactory) where T : Entity
|
||||||
{
|
{
|
||||||
if (whereFilter == null) throw new ArgumentNullException(nameof(whereFilter));
|
if (whereFilter == null) throw new ArgumentNullException(nameof(whereFilter));
|
||||||
|
|
||||||
return await _dbContext.Set<T>().AsNoTracking().IgnoreQueryFilters().Where(whereFilter).UpdateFromQueryAsync(updateFactory).ConfigureAwait(false) > 0;
|
var bindings = ((MemberInitExpression)updateFactory.Body).Bindings.ToList();
|
||||||
|
|
||||||
|
if (typeof(IAuditUpdate).IsAssignableFrom(typeof(T)))
|
||||||
|
{
|
||||||
|
|
||||||
|
bindings.Add(Expression.Bind(typeof(T).GetMember(nameof(IAuditUpdate.UpdateTime))[0], Expression.Constant(DateTime.Now)));
|
||||||
|
bindings.Add(Expression.Bind(typeof(TR).GetMember(nameof(IAuditUpdate.UpdateUserId))[0], Expression.Constant(_userInfo.Id)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var member = Expression.MemberInit(Expression.New(typeof(T)), bindings);
|
||||||
|
|
||||||
|
var factory = Expression.Lambda<Func<T, T>>(member, Expression.Parameter(typeof(T), "x"));
|
||||||
|
|
||||||
|
return await _dbContext.Set<T>().AsNoTracking().IgnoreQueryFilters().Where(whereFilter).BatchUpdateAsync(updateFactory).ConfigureAwait(false) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||||
using AutoMapper.QueryableExtensions;
|
using AutoMapper.QueryableExtensions;
|
||||||
using EFCore.BulkExtensions;
|
using EFCore.BulkExtensions;
|
||||||
|
using IRaCIS.Core.Domain.Share;
|
||||||
using IRaCIS.Core.Infrastructure;
|
using IRaCIS.Core.Infrastructure;
|
||||||
using IRaCIS.Core.Infrastructure.Extention;
|
using IRaCIS.Core.Infrastructure.Extention;
|
||||||
using Microsoft.Data.SqlClient;
|
using Microsoft.Data.SqlClient;
|
||||||
|
@ -28,11 +29,13 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||||
|
|
||||||
public DbSet<TEntity> _dbSet => _dbContext.Set<TEntity>();
|
public DbSet<TEntity> _dbSet => _dbContext.Set<TEntity>();
|
||||||
|
|
||||||
|
public IUserInfo _userInfo { get; set; }
|
||||||
|
|
||||||
public Repository(IRaCISDBContext dbContext, IMapper mapper)
|
public Repository(IRaCISDBContext dbContext, IMapper mapper,IUserInfo userInfo)
|
||||||
{
|
{
|
||||||
_dbContext = dbContext;
|
_dbContext = dbContext;
|
||||||
_mapper = mapper;
|
_mapper = mapper;
|
||||||
|
_userInfo = userInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 异步部分
|
#region 异步部分
|
||||||
|
@ -155,6 +158,16 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用前端传递的视图模型字段,更新,同时返回数据库该条记录的原始信息,方便对比某些字段是否更改,进行相应的逻辑操作
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TFrom"></typeparam>
|
||||||
|
/// <param name="from"></param>
|
||||||
|
/// <param name="autoSave"></param>
|
||||||
|
/// <param name="ignoreDtoNullProperty"></param>
|
||||||
|
/// <param name="verify"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="BusinessValidationFailedException"></exception>
|
||||||
public async Task<TEntity> UpdateFromDTOAsync<TFrom>(TFrom from, bool autoSave = false, bool ignoreDtoNullProperty = true, params EntityVerifyExp<TEntity>[] verify)
|
public async Task<TEntity> UpdateFromDTOAsync<TFrom>(TFrom from, bool autoSave = false, bool ignoreDtoNullProperty = true, params EntityVerifyExp<TEntity>[] verify)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -180,9 +193,10 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||||
// Guid?属性 为null 时 映射到 Guid 时 默认会变成 Guid.Empty
|
// Guid?属性 为null 时 映射到 Guid 时 默认会变成 Guid.Empty
|
||||||
if (ignoreDtoNullProperty)
|
if (ignoreDtoNullProperty)
|
||||||
{
|
{
|
||||||
|
var dbEntityProp = typeof(TEntity).GetProperties();
|
||||||
foreach (var propertyInfo in from.GetType().GetProperties())
|
foreach (var propertyInfo in from.GetType().GetProperties())
|
||||||
{
|
{
|
||||||
if (propertyInfo.GetValue(from) == null)
|
if (propertyInfo.GetValue(from) == null && dbEntityProp.Any(t=>t.Name== propertyInfo.Name))
|
||||||
{
|
{
|
||||||
_dbContext.Entry(dbEntity).Property(propertyInfo.Name).IsModified = false;
|
_dbContext.Entry(dbEntity).Property(propertyInfo.Name).IsModified = false;
|
||||||
}
|
}
|
||||||
|
@ -196,46 +210,6 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 通过主键id 和表达式树 更新部分字段 例如 Guid.Parse("8a90c96e-0776-4f7b-82a6-18933d339584"),u => new Dictionary() { ParentId = null, Code = "test" } 默认会去处理更新更新人 更新时间
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id"></param>
|
|
||||||
/// <param name="updateFactory"></param>
|
|
||||||
/// <param name="autoSave"></param>
|
|
||||||
/// <param name="verify"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task<TEntity> UpdatePartialFields(Guid id, Expression<Func<TEntity, TEntity>> updateFactory, bool autoSave = false, params EntityVerifyExp<TEntity>[] verify)
|
|
||||||
{
|
|
||||||
await EntityVerifyAsync(false, verify, id);
|
|
||||||
|
|
||||||
var entity = new TEntity() { Id = id };
|
|
||||||
|
|
||||||
var entityEntry = _dbContext.Entry(entity);
|
|
||||||
entityEntry.State = EntityState.Detached;
|
|
||||||
|
|
||||||
|
|
||||||
Func<TEntity, TEntity> func = updateFactory.Compile();
|
|
||||||
|
|
||||||
List<PropertyInfo> list = ((MemberInitExpression)updateFactory.Body).Bindings.Select<MemberBinding, string>((Func<MemberBinding, string>)(_param1 => _param1.Member.Name)).Select<string, PropertyInfo>((Func<string, PropertyInfo>)(_param1 => (PropertyInfo)typeof(TEntity).GetProperty(_param1, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))).ToList<PropertyInfo>();
|
|
||||||
|
|
||||||
|
|
||||||
TEntity applyObj = func(entity);
|
|
||||||
|
|
||||||
foreach (PropertyInfo prop in list)
|
|
||||||
{
|
|
||||||
object value = prop.GetValue((object)applyObj);
|
|
||||||
prop.SetValue((object)entity, value);
|
|
||||||
|
|
||||||
_dbContext.Entry(entity).Property(prop.Name).IsModified = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
await SaveChangesAsync(autoSave);
|
|
||||||
|
|
||||||
return entityEntry.Entity;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private async Task<bool> SaveChangesAsync(bool autoSave)
|
private async Task<bool> SaveChangesAsync(bool autoSave)
|
||||||
{
|
{
|
||||||
if (autoSave)
|
if (autoSave)
|
||||||
|
@ -248,8 +222,65 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 通过主键id 和表达式树 更新部分字段 例如 Guid.Parse("8a90c96e-0776-4f7b-82a6-18933d339584"),u => new Dictionary() { ParentId = null, Code = "test" } 默认会去处理更新更新人 更新时间
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="updateFactory"></param>
|
||||||
|
/// <param name="autoSave"></param>
|
||||||
|
/// <param name="verify"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<TEntity> UpdatePartialFields(Guid id, Expression<Func<TEntity, TEntity>> updateFactory, bool autoSave = false, params EntityVerifyExp<TEntity>[] verify)
|
||||||
|
{
|
||||||
|
await EntityVerifyAsync(false, verify, id);
|
||||||
|
|
||||||
|
var entity = new TEntity() { Id = id };
|
||||||
|
|
||||||
|
var entityEntry = _dbContext.Entry(entity);
|
||||||
|
|
||||||
|
entityEntry.State = EntityState.Detached;
|
||||||
|
|
||||||
|
|
||||||
|
List<PropertyInfo> list = ((MemberInitExpression)updateFactory.Body).Bindings.Select(mb => mb.Member.Name)
|
||||||
|
.Select(propName => typeof(TEntity).GetProperty(propName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)).ToList();
|
||||||
|
|
||||||
|
Func<TEntity, TEntity> func = updateFactory.Compile();
|
||||||
|
|
||||||
|
TEntity applyObj = func(entity);
|
||||||
|
|
||||||
|
foreach (PropertyInfo prop in list)
|
||||||
|
{
|
||||||
|
object value = prop.GetValue((object)applyObj);
|
||||||
|
prop.SetValue((object)entity, value);
|
||||||
|
|
||||||
|
_dbContext.Entry(entity).Property(prop.Name).IsModified = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
await SaveChangesAsync(autoSave);
|
||||||
|
|
||||||
|
return entityEntry.Entity;
|
||||||
|
|
||||||
|
#region Test
|
||||||
|
|
||||||
|
|
||||||
|
//updateFactory.Compile()(entity);
|
||||||
|
|
||||||
|
//List<string> propNameList = ((MemberInitExpression)updateFactory.Body).Bindings.Select(mb => mb.Member.Name).ToList();
|
||||||
|
|
||||||
|
//foreach (string propName in propNameList)
|
||||||
|
//{
|
||||||
|
// _dbContext.Entry(entity).Property(propName).IsModified = true;
|
||||||
|
//}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 部分字段更新 (只更新传递的字段名 new[] {nameof(User.Name), nameof(User.Age))
|
/// 部分字段更新 (只更新传递的字段名 new[] {nameof(User.Name), nameof(User.Age))
|
||||||
|
/// new Dictionary() { ParentId = null, Code = "test",Id=Guid.Parse("8a90c96e-0776-4f7b-82a6-18933d339584")},new[] {nameof(Dictionary.Name), nameof(Dictionary.Age))
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="entity"></param>
|
/// <param name="entity"></param>
|
||||||
/// <param name="propertyNames"> 更新的字段数组 </param>
|
/// <param name="propertyNames"> 更新的字段数组 </param>
|
||||||
|
@ -501,16 +532,6 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||||
return whereLambda == null ? await query.AsNoTracking().CountAsync() : await query.AsNoTracking().CountAsync(whereLambda);
|
return whereLambda == null ? await query.AsNoTracking().CountAsync() : await query.AsNoTracking().CountAsync(whereLambda);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Z.EntityFramework.Plus.EFCore
|
|
||||||
public async Task<bool> DeleteFromQueryAsync(Expression<Func<TEntity, bool>> deleteFilter)
|
|
||||||
{
|
|
||||||
return await _dbSet.IgnoreQueryFilters().Where(deleteFilter).DeleteFromQueryAsync() > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<bool> UpdateFromQueryAsync(Expression<Func<TEntity, bool>> where, Expression<Func<TEntity, TEntity>> updateFactory)
|
|
||||||
{
|
|
||||||
return await _dbSet.IgnoreQueryFilters().Where(where).UpdateFromQueryAsync(updateFactory) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public async Task<bool> BatchDeleteAsync(Expression<Func<TEntity, bool>> deleteFilter)
|
public async Task<bool> BatchDeleteAsync(Expression<Func<TEntity, bool>> deleteFilter)
|
||||||
|
@ -523,7 +544,27 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||||
Expression<Func<TEntity, TEntity>> updateFactory)
|
Expression<Func<TEntity, TEntity>> updateFactory)
|
||||||
{
|
{
|
||||||
|
|
||||||
return await _dbSet.IgnoreQueryFilters().Where(where).BatchUpdateAsync(updateFactory) > 0;
|
//return await _dbSet.IgnoreQueryFilters().Where(where).BatchUpdateAsync(updateFactory) > 0;
|
||||||
|
|
||||||
|
var bindings = ((MemberInitExpression)updateFactory.Body).Bindings.ToList();
|
||||||
|
|
||||||
|
if (typeof(IAuditUpdate).IsAssignableFrom(typeof(TEntity)))
|
||||||
|
{
|
||||||
|
|
||||||
|
bindings.Add(Expression.Bind(typeof(TEntity).GetMember(nameof(IAuditUpdate.UpdateTime))[0], Expression.Constant(DateTime.Now)));
|
||||||
|
bindings.Add(Expression.Bind(typeof(TEntity).GetMember(nameof(IAuditUpdate.UpdateUserId))[0], Expression.Constant(_userInfo.Id)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var member = Expression.MemberInit(Expression.New(typeof(TEntity)), bindings);
|
||||||
|
|
||||||
|
var factory = Expression.Lambda<Func<TEntity, TEntity>>(member, Expression.Parameter(typeof(TEntity), "x"));
|
||||||
|
|
||||||
|
|
||||||
|
return await _dbSet.IgnoreQueryFilters().Where(where).BatchUpdateAsync(factory) > 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -570,6 +611,16 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||||
// return await builder.Where(where).ExecuteAsync()>0;
|
// return await builder.Where(where).ExecuteAsync()>0;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
//// Z.EntityFramework.Plus.EFCore
|
||||||
|
//public async Task<bool> BatchDeleteAsync(Expression<Func<TEntity, bool>> deleteFilter)
|
||||||
|
//{
|
||||||
|
// return await _dbSet.IgnoreQueryFilters().Where(deleteFilter).DeleteFromQueryAsync() > 0;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//public async Task<bool> BatchUpdateAsync(Expression<Func<TEntity, bool>> where, Expression<Func<TEntity, TEntity>> updateFactory)
|
||||||
|
//{
|
||||||
|
// return await _dbSet.IgnoreQueryFilters().Where(where).UpdateFromQueryAsync(updateFactory) > 0;
|
||||||
|
//}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue