fix LV1_003 - ลบรอบการปฏิบัติงาน (ADMIN)#3
This commit is contained in:
parent
0a080b09e4
commit
7c2a4c0280
2 changed files with 11 additions and 1 deletions
|
|
@ -112,6 +112,15 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<UserDutyTime?> GetFirstInUseRound(Guid id)
|
||||||
|
{
|
||||||
|
var data = await _dbContext.Set<UserDutyTime>()
|
||||||
|
.Where(x => x.DutyTimeId == id)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -277,7 +277,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (oldData.IsActive || oldData.IsDefault)
|
var inUseRound = _userDutyTimeRepository.GetFirstInUseRound(oldData.Id);
|
||||||
|
if (inUseRound != null || oldData.IsActive || oldData.IsDefault)
|
||||||
{
|
{
|
||||||
throw new Exception("ไม่สามารถลบรอบการปฏิบัติงานที่ยังใช้งานอยู่ได้");
|
throw new Exception("ไม่สามารถลบรอบการปฏิบัติงานที่ยังใช้งานอยู่ได้");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue