已取消的报名不算报名记录
This commit is contained in:
parent
d735f898dc
commit
82c000e3f5
@ -150,8 +150,9 @@ public class EventService : BaseService<EventInfo>, ITransient
|
||||
|
||||
var output = eventInfo.Adapt<EventDetailOutput>();
|
||||
|
||||
// 检查是否有报名记录,决定是否可以编辑项目(有报名记录时不能编辑项目和组别
|
||||
var hasRegistration = await _registrationRepository.IsAnyAsync(x => x.EventId == id && !x.DeleteMark);
|
||||
// 检查是否有报名记录,决定是否可以编辑项目(有报名记录时不能编辑项目和组别)
|
||||
// 排除已取消(PaymentStatus = 4)和软删除的报名记录
|
||||
var hasRegistration = await _registrationRepository.IsAnyAsync(x => x.EventId == id && !x.DeleteMark && x.PaymentStatus != 4);
|
||||
output.CanEditProject = !hasRegistration;
|
||||
|
||||
// 1. 获取参与单位
|
||||
@ -529,8 +530,8 @@ public class EventService : BaseService<EventInfo>, ITransient
|
||||
var eventInfo = await _repository.GetByIdAsync(input.Id);
|
||||
if (eventInfo == null) throw new InvalidOperationException("赛事不存在");
|
||||
|
||||
// 检查是否有报名记录:如果有人报名,检查是否修改了项目和组别(软删除的不算)
|
||||
var hasRegistration = await _registrationRepository.IsAnyAsync(x => x.EventId == input.Id && !x.DeleteMark);
|
||||
// 检查是否有报名记录:如果有人报名,检查是否修改了项目和组别(软删除和已取消的不算)
|
||||
var hasRegistration = await _registrationRepository.IsAnyAsync(x => x.EventId == input.Id && !x.DeleteMark && x.PaymentStatus != 4);
|
||||
if (hasRegistration)
|
||||
{
|
||||
var hasProjectOrGroupChange = await CheckIfProjectsOrGroupsChanged(input, eventInfo.Id);
|
||||
@ -1071,7 +1072,8 @@ public class EventService : BaseService<EventInfo>, ITransient
|
||||
[DisplayName("删除赛事")]
|
||||
public override async Task Delete(KeyDto dto)
|
||||
{
|
||||
if (await _registrationRepository.IsAnyAsync(x => x.EventId == dto.Id && !x.DeleteMark))
|
||||
// 检查是否有报名记录(排除已取消和软删除的)
|
||||
if (await _registrationRepository.IsAnyAsync(x => x.EventId == dto.Id && !x.DeleteMark && x.PaymentStatus != 4))
|
||||
{
|
||||
throw new InvalidOperationException("已有人员报名此赛事,暂不支持删除");
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user