fix defect
This commit is contained in:
parent
21b8c0450c
commit
fadb544566
6 changed files with 494 additions and 19 deletions
|
|
@ -68,12 +68,24 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
|
||||
.Include(x => x.LeaveDocument)
|
||||
.Include(x => x.LeaveDraftDocument)
|
||||
.Include(x => x.LeaveCancelDocument)
|
||||
.Include(x => x.Type)
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public override async Task<LeaveRequest> UpdateAsync(LeaveRequest entity)
|
||||
{
|
||||
_dbContext.Attatch(entity.LeaveCancelDocument);
|
||||
_dbContext.Attatch(entity.LeaveDraftDocument);
|
||||
_dbContext.Attatch(entity.LeaveDocument);
|
||||
_dbContext.Attatch(entity.Type);
|
||||
|
||||
return await base.UpdateAsync(entity);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
public async Task<List<LeaveRequest>> GetLeaveRequestByYearAsync(int year)
|
||||
|
|
@ -182,18 +194,19 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
public async Task<List<LeaveRequest>> GetCancelLeaveRequestForAdminAsync(int year, Guid type, string status)
|
||||
{
|
||||
var rawData = _dbContext.Set<LeaveRequest>().AsQueryable()
|
||||
var rawData = _dbContext.Set<LeaveRequest>()
|
||||
.Include(x => x.Type)
|
||||
.Where(x => x.LeaveStatus == "DELETE");
|
||||
.Where(x => x.LeaveStatus == "DELETE")
|
||||
.AsQueryable();
|
||||
|
||||
if (year != 0)
|
||||
rawData = (IIncludableQueryable<LeaveRequest, LeaveType>)rawData.Where(x => x.LeaveStartDate.Year == year);
|
||||
rawData = rawData.Where(x => x.LeaveStartDate.Year == year);
|
||||
|
||||
if (type != Guid.Empty)
|
||||
rawData = (IIncludableQueryable<LeaveRequest, LeaveType>)rawData.Where(x => x.Type.Id == type);
|
||||
rawData = rawData.Where(x => x.Type.Id == type);
|
||||
|
||||
if (status.Trim().ToUpper() != "ALL")
|
||||
rawData = (IIncludableQueryable<LeaveRequest, LeaveType>)rawData.Where(x => x.LeaveCancelStatus == status);
|
||||
rawData = rawData.Where(x => x.LeaveCancelStatus == status);
|
||||
|
||||
return await rawData.ToListAsync();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue