เพิ่ม paging ระบบบรรจุ แต่งตั้ง ย้าย โอน

This commit is contained in:
Bright 2024-09-13 18:09:56 +07:00
parent bb9e79b06c
commit e59f242427
8 changed files with 152 additions and 15 deletions

View file

@ -69,7 +69,7 @@ namespace BMA.EHR.Placement.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet()]
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
public async Task<ActionResult<ResponseObject>> GetListByAdmin(int page = 1, int pageSize = 10, string keyword = "")
{
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_PROMOTION_OFFICER");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
@ -164,7 +164,30 @@ namespace BMA.EHR.Placement.Service.Controllers
// if (PlacementAdmin == true)
// placementAppointments.Where(x => x.Status.Trim().ToUpper().Contains("PENDING"));
return Success(placementAppointments);
if (keyword != "")
{
var data = placementAppointments.Where(x =>
(x.citizenId != null && x.citizenId.Contains(keyword)) ||
(x.prefix != null && x.prefix.Contains(keyword)) ||
(x.firstName != null && x.firstName.Contains(keyword)) ||
(x.lastName != null && x.lastName.Contains(keyword)) ||
(x.rootShortNameOld != null && x.rootShortNameOld.Contains(keyword)) ||
(x.posMasterNoOld != null && x.posMasterNoOld.ToString().Contains(keyword)) ||
(x.OrganizationOld != null && x.OrganizationOld.Contains(keyword)) ||
(x.posTypeNameOld != null && x.posTypeNameOld.Contains(keyword)) ||
(x.posLevelNameOld != null && x.posLevelNameOld.Contains(keyword)) ||
(x.OrganizationPositionOld != null && x.OrganizationPositionOld.Contains(keyword)) ||
(x.Reason != null && x.Reason.Contains(keyword)) ||
(x.nodeName != null && x.nodeName.Contains(keyword)))
.OrderByDescending(x => x.CreatedAt)
.Skip((page - 1) * pageSize)
.Take(pageSize)
.ToList();
placementAppointments = data;
}
return Success(new { data = placementAppointments, total = placementAppointments.Count });
}
/// <summary>

View file

@ -69,7 +69,7 @@ namespace BMA.EHR.Placement.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet()]
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
public async Task<ActionResult<ResponseObject>> GetListByAdmin(int page = 1, int pageSize = 10, string keyword = "")
{
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_PROMOTION_EMP");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
@ -161,8 +161,30 @@ namespace BMA.EHR.Placement.Service.Controllers
p.typeCommand,
})
.ToListAsync();
if (keyword != "")
{
var data = placementAppointments.Where(x =>
(x.citizenId != null && x.citizenId.Contains(keyword)) ||
(x.prefix != null && x.prefix.Contains(keyword)) ||
(x.firstName != null && x.firstName.Contains(keyword)) ||
(x.lastName != null && x.lastName.Contains(keyword)) ||
(x.rootShortNameOld != null && x.rootShortNameOld.Contains(keyword)) ||
(x.posMasterNoOld != null && x.posMasterNoOld.ToString().Contains(keyword)) ||
(x.OrganizationOld != null && x.OrganizationOld.Contains(keyword)) ||
(x.posTypeNameOld != null && x.posTypeNameOld.Contains(keyword)) ||
(x.posLevelNameOld != null && x.posLevelNameOld.Contains(keyword)) ||
(x.OrganizationPositionOld != null && x.OrganizationPositionOld.Contains(keyword)) ||
(x.Reason != null && x.Reason.Contains(keyword)) ||
(x.nodeName != null && x.nodeName.Contains(keyword)))
.OrderByDescending(x => x.CreatedAt)
.Skip((page - 1) * pageSize)
.Take(pageSize)
.ToList();
return Success(placementAppointments);
placementAppointments = data;
}
return Success(new { data = placementAppointments, total = placementAppointments.Count });
}
/// <summary>

View file

@ -17,6 +17,8 @@ using Microsoft.Extensions.Configuration;
using System.Net.Http.Headers;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Microsoft.AspNetCore.Http.HttpResults;
using System.Drawing.Drawing2D;
namespace BMA.EHR.Placement.Service.Controllers
{
@ -90,7 +92,7 @@ namespace BMA.EHR.Placement.Service.Controllers
}
[HttpGet("exam/{year}")]
public async Task<ActionResult<ResponseObject>> GetExam(int year)
public async Task<ActionResult<ResponseObject>> GetExam(int year, int page = 1, int pageSize = 10, string keyword = "")
{
var data = await _context.Placements.Where(x => year > 0 ? (x.Year == year) : (x.Year > 0))
.OrderByDescending(x => x.CreatedAt)
@ -107,9 +109,22 @@ namespace BMA.EHR.Placement.Service.Controllers
AccountEndDate = x.EndDate,
AccountExpirationDate = x.EndDate,
IsExpired = x.EndDate.Date < DateTime.Now.Date,
CreatedAt = x.CreatedAt,
}).ToListAsync();
if (keyword != "")
{
var data_ = data.Where(x =>
(x.ExamRound != null && x.ExamRound.Contains(keyword)) ||
(x.ExamOrder != null && x.ExamOrder.Contains(keyword)) ||
(x.NumberOfCandidates != null && x.NumberOfCandidates.ToString().Contains(keyword)))
.OrderByDescending(x => x.CreatedAt)
.Skip((page - 1) * pageSize)
.Take(pageSize)
.ToList();
return Success(data);
data = data_;
}
return Success( new { data, total = data.Count });
}
[HttpGet("pass/{examId:length(36)}")]

View file

@ -69,7 +69,7 @@ namespace BMA.EHR.Placement.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet()]
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
public async Task<ActionResult<ResponseObject>> GetListByAdmin(int page = 1, int pageSize = 10, string keyword = "")
{
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_TEMPDUTY");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
@ -142,7 +142,27 @@ namespace BMA.EHR.Placement.Service.Controllers
})
.ToListAsync();
return Success(placementOfficers);
if (keyword != "")
{
var data = placementOfficers.Where(x =>
(x.prefix != null && x.prefix.Contains(keyword)) ||
(x.firstName != null && x.firstName.Contains(keyword)) ||
(x.lastName != null && x.lastName.Contains(keyword)) ||
(x.rootShortNameOld != null && x.rootShortNameOld.Contains(keyword)) ||
(x.posMasterNoOld != null && x.posMasterNoOld.ToString().Contains(keyword)) ||
(x.PositionOld != null && x.PositionOld.Contains(keyword)) ||
(x.posTypeNameOld != null && x.posTypeNameOld.Contains(keyword)) ||
(x.posLevelNameOld != null && x.posLevelNameOld.Contains(keyword)) ||
(x.Organization != null && x.Organization.Contains(keyword)))
.OrderByDescending(x => x.CreatedAt)
.Skip((page - 1) * pageSize)
.Take(pageSize)
.ToList();
placementOfficers = data;
}
return Success(new { data = placementOfficers, total = placementOfficers.Count });
}
}

View file

@ -180,6 +180,7 @@ namespace BMA.EHR.Placement.Service.Controllers
.ToListAsync();
// if (PlacementAdmin == true)
// placementReceives.Where(x => x.Status.Trim().ToUpper().Contains("PENDING"));
if (keyword != "")
{
var data = placementReceives.Where(x =>
@ -197,7 +198,7 @@ namespace BMA.EHR.Placement.Service.Controllers
placementReceives = data;
}
return Success(placementReceives);
return Success(new { data = placementReceives, total = placementReceives.Count });
// }
}

View file

@ -70,7 +70,7 @@ namespace BMA.EHR.Placement.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet()]
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
public async Task<ActionResult<ResponseObject>> GetListByAdmin(int page = 1, int pageSize = 10, string keyword = "")
{
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_TEMPDUTY2");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
@ -148,7 +148,28 @@ namespace BMA.EHR.Placement.Service.Controllers
})
.ToListAsync();
return Success(placementRepatriations);
if (keyword != "")
{
var data = placementRepatriations.Where(x =>
(x.prefix != null && x.prefix.Contains(keyword)) ||
(x.firstName != null && x.firstName.Contains(keyword)) ||
(x.lastName != null && x.lastName.Contains(keyword)) ||
(x.rootShortNameOld != null && x.rootShortNameOld.Contains(keyword)) ||
(x.posMasterNoOld != null && x.posMasterNoOld.ToString().Contains(keyword)) ||
(x.PositionOld != null && x.PositionOld.Contains(keyword)) ||
(x.posTypeNameOld != null && x.posTypeNameOld.Contains(keyword)) ||
(x.posLevelNameOld != null && x.posLevelNameOld.Contains(keyword)) ||
(x.OrganizationPositionOld != null && x.OrganizationPositionOld.Contains(keyword)) ||
(x.Organization != null && x.Organization.Contains(keyword)))
.OrderByDescending(x => x.CreatedAt)
.Skip((page - 1) * pageSize)
.Take(pageSize)
.ToList();
placementRepatriations = data;
}
return Success(new { data = placementRepatriations, total = placementRepatriations.Count });
}
}

View file

@ -142,7 +142,7 @@ namespace BMA.EHR.Placement.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet()]
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
public async Task<ActionResult<ResponseObject>> GetListByAdmin(int page = 1, int pageSize = 10, string keyword = "")
{
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_TRANSFER_REQ");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
@ -219,7 +219,23 @@ namespace BMA.EHR.Placement.Service.Controllers
})
.ToListAsync();
return Success(placementTransfers);
if (keyword != "")
{
var data = placementTransfers.Where(x =>
(x.prefix != null && x.prefix.Contains(keyword)) ||
(x.firstName != null && x.firstName.Contains(keyword)) ||
(x.lastName != null && x.lastName.Contains(keyword)) ||
(x.posTypeNameOld != null && x.posTypeNameOld.Contains(keyword)) ||
(x.posLevelNameOld != null && x.posLevelNameOld.Contains(keyword)))
.OrderByDescending(x => x.CreatedAt)
.Skip((page - 1) * pageSize)
.Take(pageSize)
.ToList();
placementTransfers = data;
}
return Success(new { data = placementTransfers, total = placementTransfers.Count });
}
}