api ลา 04,05 และ 11
This commit is contained in:
parent
cffb53c1f5
commit
e130ce00d7
7 changed files with 198 additions and 4 deletions
|
|
@ -58,6 +58,35 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
#region " Methods "
|
||||
|
||||
public async Task<List<LeaveRequest>> GetLeaveRequestByYearAsync(int year)
|
||||
{
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
|
||||
.Include(x => x.Type)
|
||||
.Where(x => x.LeaveStartDate.Year == year)
|
||||
.ToListAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<LeaveRequest>> GetLeaveRequestByUserIdAsync(Guid keycloakUserId, int year, Guid type, string status)
|
||||
{
|
||||
var rawData = _dbContext.Set<LeaveRequest>().AsQueryable()
|
||||
.Include(x => x.Type)
|
||||
.Where(x => x.KeycloakUserId == keycloakUserId);
|
||||
|
||||
if (year != 0)
|
||||
rawData = rawData.Where(x => x.LeaveStartDate.Year == year);
|
||||
|
||||
if (type != Guid.Empty)
|
||||
rawData = rawData.Where(x => x.Type.Id == type);
|
||||
|
||||
if (status.Trim().ToUpper() != "ALL")
|
||||
rawData = rawData.Where(x => x.LeaveStatus == status);
|
||||
|
||||
return await rawData.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<int> GetRestDayTotalByYearForUserAsync(Guid keycloakUserId, int year)
|
||||
{
|
||||
var leaveType = await _dbContext.Set<LeaveType>().AsQueryable().FirstOrDefaultAsync(l => l.Code.Trim().ToUpper() == "LV-005");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue