แก้ defet

ลงเวลาเข้า-ออกปฏิบัติงาน (เช็คเอ้าท์ออกงานไม่ได้)#220
การลา >> ประเภทลา ลาพักผ่อน (ลาซ้ำ)#361
This commit is contained in:
Suphonchai Phoonsawat 2024-01-11 10:13:56 +07:00
parent 01309ceceb
commit 305d2d9dc5
3 changed files with 31 additions and 3 deletions

View file

@ -563,6 +563,18 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
return 0;
}
public async Task<bool> CheckDuplicateLeave(Guid keycloakUserId, DateTime startDate, DateTime endDate)
{
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
.Include(x => x.Type)
.Where(x => x.KeycloakUserId == keycloakUserId)
.Where(x => x.LeaveStartDate.Date == startDate.Date || x.LeaveEndDate.Date == endDate.Date)
.Where(x => x.LeaveStatus == "DELETE" && x.LeaveStatus == "REJECT")
.ToListAsync();
return data.Count > 0;
}
#endregion
}
}