เพิ่มลูกจ้างวินัย #874
Some checks failed
release-dev / release-dev (push) Failing after 10s

This commit is contained in:
Bright 2024-12-18 11:02:24 +07:00
parent 72a7a73673
commit b042f471b4
8 changed files with 54 additions and 28 deletions

View file

@ -58,7 +58,7 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet()]
public async Task<ActionResult<ResponseObject>> GetDisciplineSuspend(int page = 1, int pageSize = 25, string keyword = "")
public async Task<ActionResult<ResponseObject>> GetDisciplineSuspend(int page = 1, int pageSize = 25, string keyword = "", string profileType = "")
{
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_DISCIPLINE_SUSPENDED");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
@ -67,18 +67,22 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
var data_search = (from x in _context.DisciplineReport_Profiles.Include(x => x.DisciplineDisciplinary)
where (x.CitizenId == null ? false : x.CitizenId.Contains(keyword)) ||
//(x.Prefix == null ? false : x.Prefix.Contains(keyword)) ||
//(x.FirstName == null ? false : x.FirstName.Contains(keyword)) ||
//(x.LastName == null ? false : x.LastName.Contains(keyword)) ||
((x.Prefix ?? "") + (x.FirstName ?? "") + " " + (x.LastName ?? "")).Contains(keyword) ||
(x.Organization == null ? false : x.Organization.Contains(keyword)) ||
(x.Position == null ? false : x.Position.Contains(keyword)) ||
(x.PosNo == null ? false : x.PosNo.Contains(keyword)) ||
//(x.posTypeName == null ? false : x.posTypeName.Contains(keyword)) ||
//(x.posLevelName == null ? false : x.posLevelName.Contains(keyword)) ||
((x.posTypeName ?? "") + " (" + (x.posLevelName ?? "") + ")").Contains(keyword) ||
(x.Title == null ? false : x.Title.Contains(keyword))
where
(
(x.CitizenId != null && x.CitizenId.Contains(keyword)) ||
((x.Prefix ?? "") + (x.FirstName ?? "") + " " + (x.LastName ?? "")).Contains(keyword) ||
(x.Organization != null && x.Organization.Contains(keyword)) ||
(x.Position != null && x.Position.Contains(keyword)) ||
(x.PosNo != null && x.PosNo.Contains(keyword)) ||
((x.posTypeName ?? "") + " (" + (x.posLevelName ?? "") + ")").Contains(keyword) ||
(x.Title != null && x.Title.Contains(keyword))
)
&&
(
string.IsNullOrEmpty(profileType) ||
(profileType.ToUpper() == "OFFICER" && x.profileType == "OFFICER") ||
(profileType.ToUpper() == "EMPLOYEE" && x.profileType == "EMPLOYEE")
)
select x).ToList();
var data = data_search
.Select(x => new
@ -110,7 +114,7 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers
posTypeName = x.posTypeName,
posLevelId = x.posLevelId,
posLevelName = x.posLevelName,
Position = x.Position,
PosNo = x.PosNo,
PositionLevel = x.PositionLevel == null ? "" : x.PositionLevel,
@ -124,8 +128,11 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers
OffenseDetails = x.DisciplineDisciplinary.OffenseDetails,//ลักษณะความผิด
DisciplinaryFaultLevel = x.DisciplineDisciplinary.DisciplinaryFaultLevel,//ระดับโทษความผิด
DisciplinaryCaseFault = x.DisciplineDisciplinary.DisciplinaryCaseFault,//กรณีความผิด
profileType = x.profileType,
CreatedAt = x.CreatedAt,
})
.OrderByDescending(x => x.CitizenId)
.OrderByDescending(x => x.CreatedAt)
.ThenByDescending(x => x.CitizenId)
.Skip((page - 1) * pageSize)
.Take(pageSize)
.ToList();