refactor LeaveReportController to enhance employee sorting by remark and check-in/check-out times #2193
All checks were successful
Build & Deploy Leave Service / build (push) Successful in 1m16s
All checks were successful
Build & Deploy Leave Service / build (push) Successful in 1m16s
This commit is contained in:
parent
127909d29d
commit
86790cf9f3
1 changed files with 5 additions and 1 deletions
|
|
@ -2250,7 +2250,11 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//employees = employees.OrderBy(x => x.checkInDate).ThenBy(x => x.checkInTimeRaw ?? DateTime.MaxValue).ThenBy(x => x.checkOutTimeRaw ?? DateTime.MaxValue).ToList();
|
//employees = employees.OrderBy(x => x.checkInDate).ThenBy(x => x.checkInTimeRaw ?? DateTime.MaxValue).ThenBy(x => x.checkOutTimeRaw ?? DateTime.MaxValue).ToList();
|
||||||
employees = employees.OrderBy(x => x.checkInTimeRaw ?? DateTime.MaxValue).ThenBy(x => x.checkOutTimeRaw ?? DateTime.MaxValue).ToList();
|
employees = employees
|
||||||
|
.OrderBy(x => x.remark.Trim() == "" ? 0 : 1) // ข้อมูลที่ไม่มี remark ให้ขึ้นก่อน
|
||||||
|
.ThenBy(x => x.checkInTimeRaw ?? DateTime.MaxValue).ThenBy(x => x.checkOutTimeRaw ?? DateTime.MaxValue)
|
||||||
|
.ThenBy(x => x.remark) // จากนั้นจัดเรียงตาม remark
|
||||||
|
.ToList();
|
||||||
for (int i = 0; i < employees.Count; i++)
|
for (int i = 0; i < employees.Count; i++)
|
||||||
{
|
{
|
||||||
employees[i].no = i + 1;
|
employees[i].no = i + 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue