Refactor LeaveRequestController to improve filtering logic and update appsettings.json to modify connection strings
All checks were successful
Build & Deploy Leave Service / build (push) Successful in 1m12s
All checks were successful
Build & Deploy Leave Service / build (push) Successful in 1m12s
This commit is contained in:
parent
4f28b4e9e0
commit
54c8152752
2 changed files with 19 additions and 10 deletions
|
|
@ -1906,11 +1906,20 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
var rawData =
|
||||
await _leaveRequestRepository.GetCancelLeaveRequestForAdminAsync(req.Year, req.Type, req.Status, role, nodeId, profileAdmin?.Node);
|
||||
|
||||
var recCount = rawData.Count;
|
||||
|
||||
if (req.Keyword != "")
|
||||
rawData = rawData.Where(x => ($"{x.Prefix}{x.FirstName} {x.LastName}").Contains(req.Keyword)).ToList();
|
||||
if (!string.IsNullOrEmpty(req.ProfileType) && req.ProfileType.ToUpper() != "ALL")
|
||||
rawData = rawData.Where(x => x.ProfileType.ToUpper().Contains(req.ProfileType.ToUpper())).ToList();
|
||||
|
||||
rawData = rawData.Skip((req.Page - 1) * req.PageSize).Take(req.PageSize).ToList();
|
||||
|
||||
var result = new List<GetLeaveCancelRequestResultDto>();
|
||||
|
||||
foreach (var item in rawData)
|
||||
{
|
||||
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(item.KeycloakUserId, AccessToken);
|
||||
var profile = await _userProfileRepository.GetProfileByKeycloakIdNewAsync(item.KeycloakUserId, AccessToken);
|
||||
var res = new GetLeaveCancelRequestResultDto
|
||||
{
|
||||
Id = item.Id,
|
||||
|
|
@ -1925,13 +1934,13 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
result.Add(res);
|
||||
}
|
||||
|
||||
if (req.Keyword != "")
|
||||
result = result.Where(x => x.FullName.Contains(req.Keyword)).ToList();
|
||||
if (!string.IsNullOrEmpty(req.ProfileType) && req.ProfileType.ToUpper() != "ALL")
|
||||
result = result.Where(x => x.ProfileType.ToUpper().Contains(req.ProfileType.ToUpper())).ToList();
|
||||
var pageResult = result.Skip((req.Page - 1) * req.PageSize).Take(req.PageSize).ToList();
|
||||
// if (req.Keyword != "")
|
||||
// result = result.Where(x => x.FullName.Contains(req.Keyword)).ToList();
|
||||
// if (!string.IsNullOrEmpty(req.ProfileType) && req.ProfileType.ToUpper() != "ALL")
|
||||
// result = result.Where(x => x.ProfileType.ToUpper().Contains(req.ProfileType.ToUpper())).ToList();
|
||||
// var pageResult = result.Skip((req.Page - 1) * req.PageSize).Take(req.PageSize).ToList();
|
||||
|
||||
return Success(new { data = pageResult, total = result.Count });
|
||||
return Success(new { data = result, total = recCount });
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@
|
|||
"ExamConnection": "server=192.168.1.63;user=root;password=12345678;port=3306;database=hrms_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||
"LeaveConnection": "server=192.168.1.63;user=root;password=12345678;port=3306;database=hrms_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||
|
||||
//"DefaultConnection": "server=172.27.17.68;user=user;password=cDldaqkwESWvuZ37Gr0n;port=3306;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||
//"ExamConnection": "server=172.27.17.68;user=user;password=cDldaqkwESWvuZ37Gr0n;port=3306;database=hrms_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||
//"LeaveConnection": "server=172.27.17.68;user=user;password=cDldaqkwESWvuZ37Gr0n;port=3306;database=hrms_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||
// "DefaultConnection": "server=172.27.17.68;user=user;password=cDldaqkwESWvuZ37Gr0n;port=3306;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||
// "ExamConnection": "server=172.27.17.68;user=user;password=cDldaqkwESWvuZ37Gr0n;port=3306;database=hrms_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||
// "LeaveConnection": "server=172.27.17.68;user=user;password=cDldaqkwESWvuZ37Gr0n;port=3306;database=hrms_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||
},
|
||||
"Jwt": {
|
||||
//"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue