fix #1352
This commit is contained in:
parent
41bcc2a1ef
commit
496917c34c
2 changed files with 53 additions and 2 deletions
|
|
@ -494,7 +494,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
return data;
|
||||
}
|
||||
|
||||
public async Task<List<LeaveRequest>> GetCancelLeaveRequestForAdminAsync(int year, Guid type, string status)
|
||||
public async Task<List<LeaveRequest>> GetCancelLeaveRequestForAdminAsync(int year, Guid type, string status, string role, string? nodeId, int? node)
|
||||
{
|
||||
var rawData = _dbContext.Set<LeaveRequest>().AsNoTracking()
|
||||
.Include(x => x.Type)
|
||||
|
|
@ -510,6 +510,27 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
if (status.Trim().ToUpper() != "ALL")
|
||||
rawData = rawData.Where(x => x.LeaveCancelStatus == status);
|
||||
|
||||
|
||||
if (role == "OWNER")
|
||||
{
|
||||
node = null;
|
||||
}
|
||||
if (role == "OWNER" || role == "CHILD")
|
||||
{
|
||||
rawData = rawData
|
||||
.Where(x => node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) : (node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) : (node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) : (node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) : (node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) : (node == null ? true : true))))));
|
||||
}
|
||||
else if (role == "ROOT")
|
||||
{
|
||||
rawData = rawData
|
||||
.Where(x => x.RootDnaId == Guid.Parse(nodeId!));
|
||||
}
|
||||
else if (role == "NORMAL")
|
||||
{
|
||||
rawData = rawData
|
||||
.Where(x => node == 0 ? x.Child1DnaId == null : (node == 1 ? x.Child2DnaId == null : (node == 2 ? x.Child3DnaId == null : (node == 3 ? x.Child4DnaId == null : true))));
|
||||
}
|
||||
|
||||
return await rawData.ToListAsync();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue