fix Defect

LV2_003 - เช็คการยื่นขอลา (USER)_defect_001#188
LV2_013 - เจ้าหน้าที่อนุมัติการลา (ADMIN)_defect_001#189
This commit is contained in:
Suphonchai Phoonsawat 2023-12-14 09:11:37 +07:00
parent f11f927f7e
commit 3d7313ede7
2 changed files with 13 additions and 6 deletions

View file

@ -79,10 +79,17 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
public override async Task<LeaveRequest> UpdateAsync(LeaveRequest entity)
{
_dbContext.Attatch(entity.LeaveCancelDocument);
_dbContext.Attatch(entity.LeaveDraftDocument);
_dbContext.Attatch(entity.LeaveDocument);
_dbContext.Attatch(entity.Type);
if (entity.LeaveCancelDocument != null)
_dbContext.Attatch(entity.LeaveCancelDocument);
if (entity.LeaveDraftDocument != null)
_dbContext.Attatch(entity.LeaveDraftDocument);
if (entity.LeaveDocument != null)
_dbContext.Attatch(entity.LeaveDocument);
if (entity.Type != null)
_dbContext.Attatch(entity.Type);
return await base.UpdateAsync(entity);
}
@ -301,7 +308,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
throw new Exception(GlobalMessages.DataNotFound);
}
if (rawData.ApproveStep != "st1")
if (rawData.ApproveStep != "st2")
{
throw new Exception("คำขอนี้ยังไม่ได้รับการอนุมัติจากเจ้าหน้าที่ ไม่สามารถทำรายการได้");
}

View file

@ -18,7 +18,7 @@ namespace BMA.EHR.Domain.Extensions
{
throw new ArgumentException("End Date must greater than start date.");
}
return (int)(endDate.Date - startDate.Date).TotalDays;
return (int)(endDate.Date - startDate.Date).TotalDays + 1;
}
public static double DiffYear(this DateTime currentDate)