เพิ่มฟิวตำแหน่งตอนสร้างรอบสมัคร

This commit is contained in:
Kittapath 2023-04-05 00:58:22 +07:00
parent dee47f326d
commit bed23f911a
19 changed files with 3228 additions and 568 deletions

View file

@ -40,19 +40,20 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// ข้อมูล สถานะ ผู้สมัครสอบ
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <param name="positionId">Id ตำแหน่งสมัครสอบ</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการดึง ข้อมูล สถานะ ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("status/{examId:length(36)}")]
[HttpGet("status/{examId:length(36)}/{positionId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetStatusCandidateService(string examId)
public async Task<ActionResult<ResponseObject>> GetStatusCandidateService(string examId, string positionId)
{
try
{
var items = await _candidateService.GetStatusCandidateService(examId);
var items = await _candidateService.GetStatusCandidateService(examId, positionId);
return Success(GlobalMessages.Success, items);
}
@ -65,7 +66,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// <summary>
/// ข้อมูลผู้สมัครสอบ
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <param name="candidateId">Id ผู้สมัคร</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการดึง ข้อมูลผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
@ -92,19 +93,20 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// ข้อมูล ข้อมูลส่วนตัว ผู้สมัคร
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <param name="positionId">Id ตำแหน่งสมัครสอบ</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการดึง ข้อมูล ข้อมูลส่วนตัว ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("information/{examId:length(36)}")]
[HttpGet("information/{examId:length(36)}/{positionId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsAsyncInformation(string examId)
public async Task<ActionResult<ResponseObject>> GetsAsyncInformation(string examId, string positionId)
{
try
{
var items = await _candidateService.GetsAsyncInformation(examId);
var items = await _candidateService.GetsAsyncInformation(examId, positionId);
return Success(items);
}
@ -118,19 +120,20 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// ข้อมูล ข้อมูลที่อยู่ ผู้สมัคร
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <param name="positionId">Id ตำแหน่งสมัครสอบ</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการดึง ข้อมูล ข้อมูลที่อยู่ ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("address/{examId:length(36)}")]
[HttpGet("address/{examId:length(36)}/{positionId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsAsyncAddress(string examId)
public async Task<ActionResult<ResponseObject>> GetsAsyncAddress(string examId, string positionId)
{
try
{
var items = await _candidateService.GetsAsyncAddress(examId);
var items = await _candidateService.GetsAsyncAddress(examId, positionId);
return Success(items);
}
@ -144,19 +147,20 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// ข้อมูล ข้อมูลครอบครัว ผู้สมัคร
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <param name="positionId">Id ตำแหน่งสมัครสอบ</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการดึง ข้อมูล ข้อมูลครอบครัว ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("family/{examId:length(36)}")]
[HttpGet("family/{examId:length(36)}/{positionId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsAsyncFamily(string examId)
public async Task<ActionResult<ResponseObject>> GetsAsyncFamily(string examId, string positionId)
{
try
{
var items = await _candidateService.GetsAsyncFamily(examId);
var items = await _candidateService.GetsAsyncFamily(examId, positionId);
return Success(items);
}
@ -170,19 +174,20 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// ข้อมูล อาชีพ ผู้สมัคร
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <param name="positionId">Id ตำแหน่งสมัครสอบ</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการดึง ข้อมูล อาชีพ ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("occupation/{examId:length(36)}")]
[HttpGet("occupation/{examId:length(36)}/{positionId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsAsyncOccupation(string examId)
public async Task<ActionResult<ResponseObject>> GetsAsyncOccupation(string examId, string positionId)
{
try
{
var items = await _candidateService.GetsAsyncOccupation(examId);
var items = await _candidateService.GetsAsyncOccupation(examId, positionId);
return Success(items);
}
@ -196,19 +201,20 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// ข้อมูล ประวัติการทำงาน/ฝึกงาน ผู้สมัคร
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <param name="positionId">Id ตำแหน่งสมัครสอบ</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการดึง ข้อมูล ประวัติการทำงาน/ฝึกงาน ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("career/{examId:length(36)}")]
[HttpGet("career/{examId:length(36)}/{positionId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsAsyncCareer(string examId)
public async Task<ActionResult<ResponseObject>> GetsAsyncCareer(string examId, string positionId)
{
try
{
var items = await _candidateService.GetsAsyncCareer(examId);
var items = await _candidateService.GetsAsyncCareer(examId, positionId);
return Success(items);
}
@ -222,19 +228,20 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// ข้อมูล ประวัติการศีกษา ผู้สมัคร
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <param name="positionId">Id ตำแหน่งสมัครสอบ</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการดึง ข้อมูล ประวัติการศีกษา ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("education/{examId:length(36)}")]
[HttpGet("education/{examId:length(36)}/{positionId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsAsyncEducation(string examId)
public async Task<ActionResult<ResponseObject>> GetsAsyncEducation(string examId, string positionId)
{
try
{
var items = await _candidateService.GetsAsyncEducation(examId);
var items = await _candidateService.GetsAsyncEducation(examId, positionId);
return Success(items);
}
@ -248,19 +255,20 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// ตรวจสอบว่าผู้ใช้งานสมัครสอบหรือยัง
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <param name="positionId">Id ตำแหน่งสมัครสอบ</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการตรวจสอบว่าผู้ใช้งานสมัครสอบหรือยัง สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("check/{examId:length(36)}")]
[HttpGet("check/{examId:length(36)}/{positionId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsAsyncRegisterExam(string examId)
public async Task<ActionResult<ResponseObject>> GetsAsyncRegisterExam(string examId, string positionId)
{
try
{
var items = await _candidateService.GetsAsyncRegisterExam(examId);
var items = await _candidateService.GetsAsyncRegisterExam(examId, positionId);
return Success(items);
}
@ -273,20 +281,22 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// <summary>
/// อัพเดทข้อมูล ข้อมูลส่วนตัว ผู้สมัคร
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <param name="positionId">Id ตำแหน่งสมัครสอบ</param>
/// <param name="candidateInformation">ข้อมูลส่วนตัว</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอัพเดทข้อมูล ข้อมูลส่วนตัว ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("{examId:length(36)}")]
[HttpPost("{examId:length(36)}/{positionId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> UpdateAsync(string examId, CandidateResponseItem candidateInformation)
public async Task<ActionResult<ResponseObject>> UpdateAsync(string examId, string positionId, CandidateResponseItem candidateInformation)
{
try
{
await _candidateService.UpdateAsync(examId, candidateInformation);
await _candidateService.UpdateAsync(examId, positionId, candidateInformation);
return Success();
}
@ -299,20 +309,22 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// <summary>
/// อัพเดทข้อมูล ข้อมูลส่วนตัว ผู้สมัคร
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <param name="positionId">Id ตำแหน่งสมัครสอบ</param>
/// <param name="candidateInformation">ข้อมูลส่วนตัว</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอัพเดทข้อมูล ข้อมูลส่วนตัว ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("information/{examId:length(36)}")]
[HttpPost("information/{examId:length(36)}/{positionId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> UpdateAsyncInformation(string examId, CandidateInformationResponseItem candidateInformation)
public async Task<ActionResult<ResponseObject>> UpdateAsyncInformation(string examId, string positionId, CandidateInformationResponseItem candidateInformation)
{
try
{
await _candidateService.UpdateAsyncInformation(examId, candidateInformation);
await _candidateService.UpdateAsyncInformation(examId, positionId, candidateInformation);
return Success();
}
@ -325,20 +337,22 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// <summary>
/// อัพเดทข้อมูล ข้อมูลที่อยู่ ผู้สมัคร
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <param name="positionId">Id ตำแหน่งสมัครสอบ</param>
/// <param name="candidateAddress">ข้อมูลที่อยู่</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอัพเดทข้อมูล ข้อมูลที่อยู่ ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("address/{examId:length(36)}")]
[HttpPost("address/{examId:length(36)}/{positionId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> UpdateAsyncAddress(string examId, CandidateAddressResponseItem candidateAddress)
public async Task<ActionResult<ResponseObject>> UpdateAsyncAddress(string examId, string positionId, CandidateAddressResponseItem candidateAddress)
{
try
{
await _candidateService.UpdateAsyncAddress(examId, candidateAddress);
await _candidateService.UpdateAsyncAddress(examId, positionId, candidateAddress);
return Success();
}
@ -351,20 +365,22 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// <summary>
/// อัพเดทข้อมูล ข้อมูลครอบครัว ผู้สมัคร
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <param name="positionId">Id ตำแหน่งสมัครสอบ</param>
/// <param name="candidateFamily">ข้อมูลครอบครัว</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอัพเดทข้อมูล ข้อมูลครอบครัว ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("family/{examId:length(36)}")]
[HttpPost("family/{examId:length(36)}/{positionId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> UpdateAsyncFamily(string examId, CandidateFamilyResponseItem candidateFamily)
public async Task<ActionResult<ResponseObject>> UpdateAsyncFamily(string examId, string positionId, CandidateFamilyResponseItem candidateFamily)
{
try
{
await _candidateService.UpdateAsyncFamily(examId, candidateFamily);
await _candidateService.UpdateAsyncFamily(examId, positionId, candidateFamily);
return Success();
}
@ -377,20 +393,22 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// <summary>
/// อัพเดทข้อมูล อาชีพ ผู้สมัคร
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <param name="positionId">Id ตำแหน่งสมัครสอบ</param>
/// <param name="candidateOccupation">อาชีพ</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอัพเดทข้อมูล อาชีพ ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("occupation/{examId:length(36)}")]
[HttpPost("occupation/{examId:length(36)}/{positionId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> UpdateAsyncOccupation(string examId, CandidateOccupationResponseItem candidateOccupation)
public async Task<ActionResult<ResponseObject>> UpdateAsyncOccupation(string examId, string positionId, CandidateOccupationResponseItem candidateOccupation)
{
try
{
await _candidateService.UpdateAsyncOccupation(examId, candidateOccupation);
await _candidateService.UpdateAsyncOccupation(examId, positionId, candidateOccupation);
return Success();
}
@ -403,20 +421,22 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// <summary>
/// สร้างข้อมูล ประวัติการทำงาน/ฝึกงาน ผู้สมัคร
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <param name="positionId">Id ตำแหน่งสมัครสอบ</param>
/// <param name="candidateCareer">ข้อมูลประวัติการทำงาน/ฝึกงาน</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการสร้างข้อมูล ประวัติการทำงาน/ฝึกงาน ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("career/{examId:length(36)}")]
[HttpPost("career/{examId:length(36)}/{positionId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> CreateAsyncCareer(string examId, CandidateCareerResponseItem candidateCareer)
public async Task<ActionResult<ResponseObject>> CreateAsyncCareer(string examId, string positionId, CandidateCareerResponseItem candidateCareer)
{
try
{
await _candidateService.CreateAsyncCareer(examId, candidateCareer);
await _candidateService.CreateAsyncCareer(examId, positionId, candidateCareer);
return Success();
}
@ -429,20 +449,22 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// <summary>
/// สร้างข้อมูล ประวัติการศีกษา ผู้สมัคร
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <param name="positionId">Id ตำแหน่งสมัครสอบ</param>
/// <param name="candidateEducation">ข้อมูลประวัติการศีกษา</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการสร้างข้อมูล ประวัติการศีกษา ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("education/{examId:length(36)}")]
[HttpPost("education/{examId:length(36)}/{positionId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> CreateAsyncEducation(string examId, CandidateEducationResponseItem candidateEducation)
public async Task<ActionResult<ResponseObject>> CreateAsyncEducation(string examId, string positionId, CandidateEducationResponseItem candidateEducation)
{
try
{
await _candidateService.CreateAsyncEducation(examId, candidateEducation);
await _candidateService.CreateAsyncEducation(examId, positionId, candidateEducation);
return Success();
}
@ -564,19 +586,20 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// ผู้สมัครทำการสมัครสอบ
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <param name="positionId">Id ตำแหน่งสมัครสอบ</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการผู้สมัครทำการสมัครสอบ สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("register/{examId:length(36)}")]
[HttpGet("register/{examId:length(36)}/{positionId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> RegisterCandidateService(string examId)
public async Task<ActionResult<ResponseObject>> RegisterCandidateService(string examId, string positionId)
{
try
{
await _candidateService.UserCheckCandidateService(examId, "checkRegister");
await _candidateService.UserCheckCandidateService(examId, positionId, "checkRegister");
return Success();
}
@ -589,7 +612,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// <summary>
/// เจ้าหน้าที่ตรวจคุณสมบัติผู้สมัคร
/// </summary>
/// <param name="candidate">รหัสใบสมัคร</param>
/// <param name="candidateId">รหัสใบสมัคร</param>
/// <returns></returns>
/// <response code="200">เมื่อเจ้าหน้าที่ตรวจคุณสมบัติผู้สมัครสำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
@ -598,11 +621,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> CheckRegisterCandidateService(string candidate, RequestApprove item)
public async Task<ActionResult<ResponseObject>> CheckRegisterCandidateService(string candidateId, RequestApprove item)
{
try
{
await _candidateService.AdminCheckCandidateService(candidate, item.Status ? "payment" : "rejectRegister", item);
await _candidateService.AdminCheckCandidateService(candidateId, item.Status ? "payment" : "rejectRegister", item);
return Success();
}
@ -615,7 +638,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// <summary>
/// เจ้าหน้าที่ตรวจคุณสมบัติผู้สมัครไม่ผ่านและให้สมัครใหม่
/// </summary>
/// <param name="candidate">รหัสใบสมัคร</param>
/// <param name="candidateId">รหัสใบสมัคร</param>
/// <returns></returns>
/// <response code="200">เมื่อเจ้าหน้าที่ตรวจคุณสมบัติผู้สมัครไม่ผ่านและให้สมัครใหม่สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
@ -624,11 +647,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> RejectRegisterCandidateService(string candidate, RequestApprove item)
public async Task<ActionResult<ResponseObject>> RejectRegisterCandidateService(string candidateId, RequestApprove item)
{
try
{
await _candidateService.AdminCheckCandidateService(candidate, "rejectDelete", item);
await _candidateService.AdminCheckCandidateService(candidateId, "rejectDelete", item);
return Success();
}
@ -638,36 +661,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
}
}
// /// <summary>
// /// ผู้สมัครทำการบันทึกหลักฐานชำระเงิน
// /// </summary>
// /// <param name="examId">รหัสรอบสมัคร</param>
// /// <returns></returns>
// /// <response code="200">เมื่อทำการผู้สมัครทำการบันทึกหลักฐานชำระเงิน สำเร็จ</response>
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
// [HttpGet("payment/{examId:length(36)}")]
// [ProducesResponseType(StatusCodes.Status200OK)]
// [ProducesResponseType(StatusCodes.Status401Unauthorized)]
// [ProducesResponseType(StatusCodes.Status500InternalServerError)]
// public async Task<ActionResult<ResponseObject>> PaymentedCandidateService(string examId)
// {
// try
// {
// await _candidateService.UserCheckCandidateService(examId, "checkPayment");
// return Success();
// }
// catch (Exception ex)
// {
// return Error(ex);
// }
// }
/// <summary>
/// เจ้าหน้าที่ตรวจการชำระเงิน
/// </summary>
/// <param name="candidate">รหัสใบสมัคร</param>
/// <param name="candidateId">รหัสใบสมัคร</param>
/// <returns></returns>
/// <response code="200">เมื่อเจ้าหน้าที่ตรวจการชำระเงินสำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
@ -676,11 +673,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> CheckPaymentCandidateService(string candidate, RequestApprove item)
public async Task<ActionResult<ResponseObject>> CheckPaymentCandidateService(string candidateId, RequestApprove item)
{
try
{
await _candidateService.AdminCheckCandidateService(candidate, item.Status ? "done" : "rejectPayment", item);
await _candidateService.AdminCheckCandidateService(candidateId, item.Status ? "checkSeat" : "rejectPayment", item);
return Success();
}
@ -693,20 +690,46 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// <summary>
/// เจ้าหน้าที่บันทึกสถานที่สอบ
/// </summary>
/// <param name="candidate">รหัสใบสมัคร</param>
/// <param name="candidateId">รหัสใบสมัคร</param>
/// <returns></returns>
/// <response code="200">เมื่อเจ้าหน้าที่บันทึกสถานที่สอบสำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("pass-done/{candidate:length(36)}")]
[HttpGet("pass-seat/{candidate:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> CheckDoneCandidateService(string candidate)
public async Task<ActionResult<ResponseObject>> CheckCheckSeatCandidateService(string candidateId)
{
try
{
await _candidateService.AdminPassCandidateService(candidate, "done");
await _candidateService.AdminPassCandidateService(candidateId, "checkPoint");
return Success();
}
catch (Exception ex)
{
return Error(ex);
}
}
/// <summary>
/// เจ้าหน้าที่บันทึกคะแนนสอบ
/// </summary>
/// <param name="candidateId">รหัสใบสมัคร</param>
/// <returns></returns>
/// <response code="200">เมื่อเจ้าหน้าที่บันทึกคะแนนสอบสำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("pass-point/{candidate:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> CheckPointCandidateService(string candidateId)
{
try
{
await _candidateService.AdminPassCandidateService(candidateId, "done");
return Success();
}
@ -720,19 +743,20 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// get id รูปถ่าย
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <param name="positionId">Id ตำแหน่งสมัครสอบ</param>
/// <returns></returns>
/// <response code="200">เมื่อ get id รูปถ่ายสำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("profile-image/{examId:length(36)}")]
[HttpGet("profile-image/{examId:length(36)}/{positionId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsAsyncProfileImage(string examId)
public async Task<ActionResult<ResponseObject>> GetsAsyncProfileImage(string examId, string positionId)
{
try
{
var doc = await _candidateService.GetsAsyncProfileImage(examId);
var doc = await _candidateService.GetsAsyncProfileImage(examId, positionId);
if (doc == "")
return Success();
@ -756,18 +780,19 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// อัปโหลดรูปถ่ายผู้สมัคร
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <param name="positionId">Id ตำแหน่งสมัครสอบ</param>
/// <returns></returns>
/// <response code="200">เมื่ออัปโหลดรูปถ่ายผู้สมัครสำเร็จ</response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("profile-image/{examId:length(36)}"), DisableRequestSizeLimit]
[HttpPut("profile-image/{examId:length(36)}/{positionId:length(36)}"), DisableRequestSizeLimit]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[AllowAnonymous]
public async Task<ActionResult<ResponseObject>> UpdateProfileImageCandidateService(string examId)
public async Task<ActionResult<ResponseObject>> UpdateProfileImageCandidateService(string examId, string positionId)
{
try
{
@ -777,7 +802,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
}
var file = Request.Form.Files[0];
await _candidateService.UpdateAsyncProfileImage(examId, file);
await _candidateService.UpdateAsyncProfileImage(examId, positionId, file);
return Success();
}
@ -791,19 +816,20 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// get id หลักฐานชำระ
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <param name="positionId">Id ตำแหน่งสมัครสอบ</param>
/// <returns></returns>
/// <response code="200">เมื่อ get id หลักฐานชำระสำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("payment-image/{examId:length(36)}")]
[HttpGet("payment-image/{examId:length(36)}/{positionId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsAsyncPaymentImg(string examId)
public async Task<ActionResult<ResponseObject>> GetsAsyncPaymentImg(string examId, string positionId)
{
try
{
var doc = await _candidateService.GetsAsyncPaymentImg(examId);
var doc = await _candidateService.GetsAsyncPaymentImg(examId, positionId);
if (doc == "")
return Success();
@ -827,15 +853,16 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// อัปเอกสารหลักฐานการชำระเงิน
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <param name="positionId">Id ตำแหน่งสมัครสอบ</param>
/// <returns></returns>
/// <response code="200">เมื่ออัปเอกสารหลักฐานสำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("payment-image/{examId:length(36)}"), DisableRequestSizeLimit]
[HttpPut("payment-image/{examId:length(36)}/{positionId:length(36)}"), DisableRequestSizeLimit]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> UploadPaymentCandidateService(string examId)
public async Task<ActionResult<ResponseObject>> UploadPaymentCandidateService(string examId, string positionId)
{
try
{
@ -845,8 +872,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
}
var file = Request.Form.Files[0];
await _candidateService.UpdateAsyncPaymentImage(examId, file);
await _candidateService.UserCheckCandidateService(examId, "checkPayment");
await _candidateService.UpdateAsyncPaymentImage(examId, positionId, file);
await _candidateService.UserCheckCandidateService(examId, positionId, "checkPayment");
return Success();
}
@ -860,19 +887,20 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// list เอกสารหลักฐาน
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <param name="positionId">Id ตำแหน่งสมัครสอบ</param>
/// <returns></returns>
/// <response code="200">เมื่อ list เอกสารหลักฐานสำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("upload/{examId:length(36)}")]
[HttpGet("upload/{examId:length(36)}/{positionId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetFileCandidateService(string examId)
public async Task<ActionResult<ResponseObject>> GetFileCandidateService(string examId, string positionId)
{
try
{
var doc = await _candidateService.GetsAsyncFileUpload(examId);
var doc = await _candidateService.GetsAsyncFileUpload(examId, positionId);
return Success(doc);
}
@ -886,15 +914,16 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// อัปโหลดเอกสารหลักฐาน
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <param name="positionId">Id ตำแหน่งสมัครสอบ</param>
/// <returns></returns>
/// <response code="200">เมื่ออัปโหลดเอกสารหลักฐานสำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("upload/{examId:length(36)}"), DisableRequestSizeLimit]
[HttpPut("upload/{examId:length(36)}/{positionId:length(36)}"), DisableRequestSizeLimit]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> CreateFileCandidateService(string examId)
public async Task<ActionResult<ResponseObject>> CreateFileCandidateService(string examId, string positionId)
{
try
{
@ -904,7 +933,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
}
var file = Request.Form.Files[0];
await _candidateService.UpdateAsyncDocument(examId, file);
await _candidateService.UpdateAsyncDocument(examId, positionId, file);
return Success();
}
@ -922,7 +951,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// <response code="200">เมื่อลบเอกสารหลักฐานสำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpDelete("upload/{examId:length(36)}"), DisableRequestSizeLimit]
[HttpDelete("upload/{documentId:length(36)}"), DisableRequestSizeLimit]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
@ -942,7 +971,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// <summary>
/// โหลดไฟล์
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <param name="id">Id ไฟล์ที่ต้องการโหลด</param>
/// <returns></returns>
/// <response code="200">เมื่อโหลดไฟล์สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>

View file

@ -1,4 +1,5 @@
using BMA.EHR.Recurit.Exam.Service.Models;
using BMA.EHR.Recurit.Exam.Service.Request;
using BMA.EHR.Recurit.Exam.Service.Response;
using BMA.EHR.Recurit.Exam.Service.Services;
using Microsoft.AspNetCore.Authorization;
@ -95,7 +96,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> CreateAsync(PeriodExam item)
public async Task<ActionResult<ResponseObject>> CreateAsync(RequestPeriodExam item)
{
try
{
@ -122,7 +123,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> UpdateAsync(string examId, PeriodExam item)
public async Task<ActionResult<ResponseObject>> UpdateAsync(string examId, RequestPeriodExam item)
{
try
{

View file

@ -10,6 +10,7 @@
public const string DataExist = "มีข้อมูลดังกล่าวอยู่ในระบบแล้ว";
public const string NameDupicate = "ชื่อวันหยุดนี้มีอยู่ในระบบอยู่แล้ว";
public const string ExamNotFound = "ไม่พบข้อมูลการรับสมัครสอบ";
public const string PositionExamNotFound = "ไม่พบข้อมูลตำแหน่งการรับสมัครสอบ";
public const string CandidateNotFound = "ไม่พบข้อมูลผู้สมัครสอบ";
public const string CareerNotFound = "ไม่พบข้อมูลประวัติการทำงาน/ฝึกงาน";
public const string EducationNotFound = "ไม่พบข้อมูลประวัติการศีกษา";

View file

@ -38,7 +38,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Data
public DbSet<Education> Educations { get; set; }
public DbSet<Document> Documents { get; set; }
public DbSet<CandidateDocument> CandidateDocuments { get; set; }
public DbSet<PositionExam> PositionExams { get; set; }
public DbSet<BankExam> BankExams { get; set; }
}
}

View file

@ -311,54 +311,54 @@ namespace BMA.EHR.Recurit.Exam.Service.Data
}
public static async Task SeedPeriodExamAsync(WebApplication app)
{
using var scope = app.Services.CreateScope();
var service = scope.ServiceProvider.GetRequiredService<PeriodExamService>();
// using var scope = app.Services.CreateScope();
// var service = scope.ServiceProvider.GetRequiredService<PeriodExamService>();
var insertedPeriodExam = new List<PeriodExam>();
// var insertedPeriodExam = new List<PeriodExam>();
if ((await service.GetsAsync()).Count() == 0)
{
// read excels into object
var excelFile = "SeedPeriodExam.xlsx";
using (var excel = new ExcelPackage(new FileInfo(excelFile)))
{
// 1. Seed PeriodExam
var workSheet = excel.Workbook.Worksheets.FirstOrDefault(x => x.Name.ToLower() == "periodexam");
var totalRows = workSheet?.Dimension.Rows;
// if ((await service.GetsAsync()).Count() == 0)
// {
// // read excels into object
// var excelFile = "SeedPeriodExam.xlsx";
// using (var excel = new ExcelPackage(new FileInfo(excelFile)))
// {
// // 1. Seed PeriodExam
// var workSheet = excel.Workbook.Worksheets.FirstOrDefault(x => x.Name.ToLower() == "periodexam");
// var totalRows = workSheet?.Dimension.Rows;
int row = 2;
// int row = 2;
while (row <= totalRows)
{
var cell1 = workSheet?.Cells[row, 1]?.GetValue<string>();
if (cell1 == "" || cell1 == null) break;
// while (row <= totalRows)
// {
// var cell1 = workSheet?.Cells[row, 1]?.GetValue<string>();
// if (cell1 == "" || cell1 == null) break;
var PeriodExam = insertedPeriodExam.Where(x => x.Name == (workSheet?.Cells[row, 1]?.GetValue<string>() ?? "")).FirstOrDefault();
if (PeriodExam == null)
{
// var PeriodExam = insertedPeriodExam.Where(x => x.Name == (workSheet?.Cells[row, 1]?.GetValue<string>() ?? "")).FirstOrDefault();
// if (PeriodExam == null)
// {
var inserted = new PeriodExam
{
Id = Guid.NewGuid(),
Name = workSheet?.Cells[row, 1]?.GetValue<string>() ?? "",
Round = workSheet?.Cells[row, 2]?.GetValue<int>() ?? 0,
Fee = workSheet?.Cells[row, 3]?.GetValue<float>() ?? 0,
StartDate = workSheet?.Cells[row, 4]?.GetValue<DateTime>() ?? DateTime.Now.Date,
EndDate = workSheet?.Cells[row, 5]?.GetValue<DateTime>() ?? DateTime.Now.Date,
Year = workSheet?.Cells[row, 6]?.GetValue<int>() ?? 0,
AnnounceDate = workSheet?.Cells[row, 7]?.GetValue<DateTime>() ?? DateTime.Now.Date,
IsActive = true,
CreatedFullName = "System Administrator",
CreatedAt = DateTime.Now
};
insertedPeriodExam.Add(inserted);
// var inserted = new PeriodExam
// {
// Id = Guid.NewGuid(),
// Name = workSheet?.Cells[row, 1]?.GetValue<string>() ?? "",
// Round = workSheet?.Cells[row, 2]?.GetValue<int>() ?? 0,
// Fee = workSheet?.Cells[row, 3]?.GetValue<float>() ?? 0,
// // StartDate = workSheet?.Cells[row, 4]?.GetValue<DateTime>() ?? DateTime.Now.Date,
// // EndDate = workSheet?.Cells[row, 5]?.GetValue<DateTime>() ?? DateTime.Now.Date,
// Year = workSheet?.Cells[row, 6]?.GetValue<int>() ?? 0,
// // AnnounceDate = workSheet?.Cells[row, 7]?.GetValue<DateTime>() ?? DateTime.Now.Date,
// IsActive = true,
// CreatedFullName = "System Administrator",
// CreatedAt = DateTime.Now
// };
// insertedPeriodExam.Add(inserted);
await service.CreateAsync(inserted);
}
row++;
}
}
}
// await service.CreateAsync(inserted);
// }
// row++;
// }
// }
// }
}
#endregion
}

View file

@ -19,6 +19,75 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasAnnotation("ProductVersion", "7.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.BankExam", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<string>("AccountName")
.HasColumnType("longtext")
.HasComment("ชื่อบัญชี");
b.Property<string>("AccountNumber")
.HasColumnType("longtext")
.HasComment("เลขบัญชี");
b.Property<string>("BankName")
.HasColumnType("longtext")
.HasComment("ธนาคาร");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<Guid>("PeriodExamId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("PeriodExamId");
b.ToTable("BankExams");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Candidate", b =>
{
b.Property<Guid>("Id")
@ -753,10 +822,23 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("AnnounceDate")
b.Property<DateTime>("AnnouncementEndDate")
.HasColumnType("datetime(6)")
.HasColumnOrder(3)
.HasComment("วันประกาศ");
.HasColumnOrder(6)
.HasComment("วันสิ้นสุดประกาศ");
b.Property<DateTime>("AnnouncementStartDate")
.HasColumnType("datetime(6)")
.HasColumnOrder(5)
.HasComment("วันเริ่มประกาศ");
b.Property<bool>("CheckDisability")
.HasColumnType("tinyint(1)")
.HasComment("คนพิการ");
b.Property<bool>("CheckDocument")
.HasColumnType("tinyint(1)")
.HasComment("ตรวจสอบเอกสารหลังประกาศผลสอบ");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
@ -781,11 +863,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnType("longtext")
.HasComment("รายละเอียดสมัครสอบ");
b.Property<DateTime>("EndDate")
.HasColumnType("datetime(6)")
.HasColumnOrder(2)
.HasComment("วันสิ้นสุด");
b.Property<float?>("Fee")
.HasColumnType("float")
.HasComment("ค่าธรรมเนียม");
@ -817,19 +894,58 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.IsRequired()
.HasMaxLength(150)
.HasColumnType("varchar(150)")
.HasColumnOrder(4)
.HasColumnOrder(7)
.HasComment("ชื่อการสอบ");
b.Property<int?>("Round")
.HasColumnType("int")
.HasColumnOrder(5)
.HasComment("รอบการสอบ");
b.Property<string>("Note")
.HasColumnType("longtext")
.HasComment("หมายเหตุ");
b.Property<DateTime>("StartDate")
b.Property<Guid?>("OrganizationCodeId")
.HasColumnType("char(36)")
.HasComment("Id รหัสส่วนราชการ");
b.Property<string>("OrganizationCodeName")
.HasColumnType("longtext")
.HasComment("ชื่อรหัสส่วนราชการ");
b.Property<Guid?>("OrganizationId")
.HasColumnType("char(36)")
.HasComment("Id หน่วยงาน");
b.Property<string>("OrganizationName")
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน");
b.Property<DateTime>("PaymentEndDate")
.HasColumnType("datetime(6)")
.HasColumnOrder(4)
.HasComment("วันสิ้นสุดชำระเงิน");
b.Property<string>("PaymentKrungThai")
.HasColumnType("longtext")
.HasComment("ชำระเงินผ่านกรุงไทย");
b.Property<DateTime>("PaymentStartDate")
.HasColumnType("datetime(6)")
.HasColumnOrder(3)
.HasComment("วันเริ่มชำระเงิน");
b.Property<DateTime>("RegisterEndDate")
.HasColumnType("datetime(6)")
.HasColumnOrder(2)
.HasComment("วันสิ้นสุดสมัครสอบ");
b.Property<DateTime>("RegisterStartDate")
.HasColumnType("datetime(6)")
.HasColumnOrder(1)
.HasComment("วันเริ่มสมัครสอบ");
b.Property<int?>("Round")
.HasColumnType("int")
.HasColumnOrder(8)
.HasComment("รอบการสอบ");
b.Property<int?>("Year")
.HasColumnType("int")
.HasComment("ปีงบประมาณ");
@ -839,6 +955,75 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.ToTable("PeriodExams");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.PositionExam", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<Guid>("PeriodExamId")
.HasColumnType("char(36)");
b.Property<Guid?>("PositionId")
.HasColumnType("char(36)")
.HasComment("Id ตำแหน่ง");
b.Property<string>("PositionName")
.HasColumnType("longtext")
.HasComment("ชื่อตำแหน่ง");
b.Property<string>("TypeName")
.HasColumnType("longtext")
.HasComment("ชื่อประเภทแบบฟอร์ม");
b.HasKey("Id");
b.HasIndex("PeriodExamId");
b.ToTable("PositionExams");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Prefix", b =>
{
b.Property<Guid>("Id")
@ -1171,6 +1356,17 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.ToTable("SubDistricts");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.BankExam", b =>
{
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.PeriodExam", "PeriodExam")
.WithMany()
.HasForeignKey("PeriodExamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("PeriodExam");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Candidate", b =>
{
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.District", "CitizenDistrict")
@ -1330,6 +1526,17 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.Navigation("EducationLevel");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.PositionExam", b =>
{
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.PeriodExam", "PeriodExam")
.WithMany()
.HasForeignKey("PeriodExamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("PeriodExam");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.SubDistrict", b =>
{
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.District", "District")

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,359 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recurit.Exam.Service.Migrations
{
/// <inheritdoc />
public partial class UpdatetableCandidateaddbank : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "AnnounceDate",
table: "PeriodExams");
migrationBuilder.DropColumn(
name: "EndDate",
table: "PeriodExams");
migrationBuilder.RenameColumn(
name: "StartDate",
table: "PeriodExams",
newName: "RegisterStartDate");
migrationBuilder.AlterColumn<int>(
name: "Round",
table: "PeriodExams",
type: "int",
nullable: true,
comment: "รอบการสอบ",
oldClrType: typeof(int),
oldType: "int",
oldNullable: true,
oldComment: "รอบการสอบ")
.Annotation("Relational:ColumnOrder", 8)
.OldAnnotation("Relational:ColumnOrder", 5);
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "PeriodExams",
type: "varchar(150)",
maxLength: 150,
nullable: false,
comment: "ชื่อการสอบ",
oldClrType: typeof(string),
oldType: "varchar(150)",
oldMaxLength: 150,
oldComment: "ชื่อการสอบ")
.Annotation("MySql:CharSet", "utf8mb4")
.Annotation("Relational:ColumnOrder", 7)
.OldAnnotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:ColumnOrder", 4);
migrationBuilder.AddColumn<DateTime>(
name: "AnnouncementEndDate",
table: "PeriodExams",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
comment: "วันสิ้นสุดประกาศ")
.Annotation("Relational:ColumnOrder", 6);
migrationBuilder.AddColumn<DateTime>(
name: "AnnouncementStartDate",
table: "PeriodExams",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
comment: "วันเริ่มประกาศ")
.Annotation("Relational:ColumnOrder", 5);
migrationBuilder.AddColumn<bool>(
name: "CheckDisability",
table: "PeriodExams",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "คนพิการ");
migrationBuilder.AddColumn<bool>(
name: "CheckDocument",
table: "PeriodExams",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "ตรวจสอบเอกสารหลังประกาศผลสอบ");
migrationBuilder.AddColumn<string>(
name: "Note",
table: "PeriodExams",
type: "longtext",
nullable: true,
comment: "หมายเหตุ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<Guid>(
name: "OrganizationCodeId",
table: "PeriodExams",
type: "char(36)",
nullable: true,
comment: "Id รหัสส่วนราชการ",
collation: "ascii_general_ci");
migrationBuilder.AddColumn<string>(
name: "OrganizationCodeName",
table: "PeriodExams",
type: "longtext",
nullable: true,
comment: "ชื่อรหัสส่วนราชการ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<Guid>(
name: "OrganizationId",
table: "PeriodExams",
type: "char(36)",
nullable: true,
comment: "Id หน่วยงาน",
collation: "ascii_general_ci");
migrationBuilder.AddColumn<string>(
name: "OrganizationName",
table: "PeriodExams",
type: "longtext",
nullable: true,
comment: "ชื่อหน่วยงาน")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<DateTime>(
name: "PaymentEndDate",
table: "PeriodExams",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
comment: "วันสิ้นสุดชำระเงิน")
.Annotation("Relational:ColumnOrder", 4);
migrationBuilder.AddColumn<string>(
name: "PaymentKrungThai",
table: "PeriodExams",
type: "longtext",
nullable: true,
comment: "ชำระเงินผ่านกรุงไทย")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<DateTime>(
name: "PaymentStartDate",
table: "PeriodExams",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
comment: "วันเริ่มชำระเงิน")
.Annotation("Relational:ColumnOrder", 3);
migrationBuilder.AddColumn<DateTime>(
name: "RegisterEndDate",
table: "PeriodExams",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
comment: "วันสิ้นสุดสมัครสอบ")
.Annotation("Relational:ColumnOrder", 2);
migrationBuilder.CreateTable(
name: "BankExams",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
.Annotation("MySql:CharSet", "utf8mb4"),
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
.Annotation("MySql:CharSet", "utf8mb4"),
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
.Annotation("MySql:CharSet", "utf8mb4"),
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
.Annotation("MySql:CharSet", "utf8mb4"),
PeriodExamId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
AccountNumber = table.Column<string>(type: "longtext", nullable: true, comment: "เลขบัญชี")
.Annotation("MySql:CharSet", "utf8mb4"),
BankName = table.Column<string>(type: "longtext", nullable: true, comment: "ธนาคาร")
.Annotation("MySql:CharSet", "utf8mb4"),
AccountName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อบัญชี")
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_BankExams", x => x.Id);
table.ForeignKey(
name: "FK_BankExams_PeriodExams_PeriodExamId",
column: x => x.PeriodExamId,
principalTable: "PeriodExams",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "PositionExams",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
.Annotation("MySql:CharSet", "utf8mb4"),
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
.Annotation("MySql:CharSet", "utf8mb4"),
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
.Annotation("MySql:CharSet", "utf8mb4"),
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
.Annotation("MySql:CharSet", "utf8mb4"),
PeriodExamId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
PositionId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "Id ตำแหน่ง", collation: "ascii_general_ci"),
PositionName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อตำแหน่ง")
.Annotation("MySql:CharSet", "utf8mb4"),
TypeName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อประเภทแบบฟอร์ม")
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_PositionExams", x => x.Id);
table.ForeignKey(
name: "FK_PositionExams_PeriodExams_PeriodExamId",
column: x => x.PeriodExamId,
principalTable: "PeriodExams",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_BankExams_PeriodExamId",
table: "BankExams",
column: "PeriodExamId");
migrationBuilder.CreateIndex(
name: "IX_PositionExams_PeriodExamId",
table: "PositionExams",
column: "PeriodExamId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "BankExams");
migrationBuilder.DropTable(
name: "PositionExams");
migrationBuilder.DropColumn(
name: "AnnouncementEndDate",
table: "PeriodExams");
migrationBuilder.DropColumn(
name: "AnnouncementStartDate",
table: "PeriodExams");
migrationBuilder.DropColumn(
name: "CheckDisability",
table: "PeriodExams");
migrationBuilder.DropColumn(
name: "CheckDocument",
table: "PeriodExams");
migrationBuilder.DropColumn(
name: "Note",
table: "PeriodExams");
migrationBuilder.DropColumn(
name: "OrganizationCodeId",
table: "PeriodExams");
migrationBuilder.DropColumn(
name: "OrganizationCodeName",
table: "PeriodExams");
migrationBuilder.DropColumn(
name: "OrganizationId",
table: "PeriodExams");
migrationBuilder.DropColumn(
name: "OrganizationName",
table: "PeriodExams");
migrationBuilder.DropColumn(
name: "PaymentEndDate",
table: "PeriodExams");
migrationBuilder.DropColumn(
name: "PaymentKrungThai",
table: "PeriodExams");
migrationBuilder.DropColumn(
name: "PaymentStartDate",
table: "PeriodExams");
migrationBuilder.DropColumn(
name: "RegisterEndDate",
table: "PeriodExams");
migrationBuilder.RenameColumn(
name: "RegisterStartDate",
table: "PeriodExams",
newName: "StartDate");
migrationBuilder.AlterColumn<int>(
name: "Round",
table: "PeriodExams",
type: "int",
nullable: true,
comment: "รอบการสอบ",
oldClrType: typeof(int),
oldType: "int",
oldNullable: true,
oldComment: "รอบการสอบ")
.Annotation("Relational:ColumnOrder", 5)
.OldAnnotation("Relational:ColumnOrder", 8);
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "PeriodExams",
type: "varchar(150)",
maxLength: 150,
nullable: false,
comment: "ชื่อการสอบ",
oldClrType: typeof(string),
oldType: "varchar(150)",
oldMaxLength: 150,
oldComment: "ชื่อการสอบ")
.Annotation("MySql:CharSet", "utf8mb4")
.Annotation("Relational:ColumnOrder", 4)
.OldAnnotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:ColumnOrder", 7);
migrationBuilder.AddColumn<DateTime>(
name: "AnnounceDate",
table: "PeriodExams",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
comment: "วันประกาศ")
.Annotation("Relational:ColumnOrder", 3);
migrationBuilder.AddColumn<DateTime>(
name: "EndDate",
table: "PeriodExams",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
comment: "วันสิ้นสุด")
.Annotation("Relational:ColumnOrder", 2);
}
}
}

22
Models/BankExam.cs Normal file
View file

@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using BMA.EHR.Recurit.Exam.Service.Models.Documents;
namespace BMA.EHR.Recurit.Exam.Service.Models
{
public class BankExam : EntityBase
{
[Required, Comment("Id การสอบ")]
public virtual PeriodExam? PeriodExam { get; set; }
[Comment("เลขบัญชี")]
public string? AccountNumber { get; set; }
[Comment("ธนาคาร")]
public string? BankName { get; set; }
[Comment("ชื่อบัญชี")]
public string? AccountName { get; set; }
}
}

View file

@ -10,6 +10,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[Required, Comment("Id การสอบ")]
public virtual PeriodExam? PeriodExam { get; set; }
[Comment("Id ตำแหน่งสอบ")]
public virtual PositionExam? PositionExam { get; set; }
[Required, MaxLength(40), Comment("User Id ผู้สมัคร")]
public string UserId { get; set; } = string.Empty;

View file

@ -6,29 +6,62 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
{
public class PeriodExam : EntityBase
{
[Required, MaxLength(150), Column(Order = 4), Comment("ชื่อการสอบ")]
[Required, MaxLength(150), Column(Order = 7), Comment("ชื่อการสอบ")]
public string Name { get; set; } = string.Empty;
[Required, Column(Order = 1), Comment("วันเริ่มสมัครสอบ")]
public DateTime StartDate { get; set; } = DateTime.Now.Date;
[Required, Comment("ตรวจสอบเอกสารหลังประกาศผลสอบ")]
public bool CheckDocument { get; set; } = false;
[Required, Column(Order = 2), Comment("วันสิ้นสุด")]
public DateTime EndDate { get; set; } = DateTime.Now.Date;
[Required, Comment("คนพิการ")]
public bool CheckDisability { get; set; } = false;
[Column(Order = 5), Comment("รอบการสอบ")]
[Column(Order = 8), Comment("รอบการสอบ")]
public int? Round { get; set; }
[Comment("ค่าธรรมเนียม")]
public float? Fee { get; set; } = 0;
[Comment("ปีงบประมาณ")]
public int? Year { get; set; }
[Comment("ค่าธรรมเนียม")]
public float? Fee { get; set; } = 0;
[Required, Column(Order = 1), Comment("วันเริ่มสมัครสอบ")]
public DateTime RegisterStartDate { get; set; } = DateTime.Now.Date;
[Required, Column(Order = 2), Comment("วันสิ้นสุดสมัครสอบ")]
public DateTime RegisterEndDate { get; set; } = DateTime.Now.Date;
[Required, Column(Order = 3), Comment("วันเริ่มชำระเงิน")]
public DateTime PaymentStartDate { get; set; } = DateTime.Now.Date;
[Required, Column(Order = 4), Comment("วันสิ้นสุดชำระเงิน")]
public DateTime PaymentEndDate { get; set; } = DateTime.Now.Date;
[Required, Column(Order = 5), Comment("วันเริ่มประกาศ")]
public DateTime AnnouncementStartDate { get; set; } = DateTime.Now.Date;
[Required, Column(Order = 6), Comment("วันสิ้นสุดประกาศ")]
public DateTime AnnouncementEndDate { get; set; } = DateTime.Now.Date;
[Comment("Id รหัสส่วนราชการ")]
public Guid? OrganizationCodeId { get; set; }
[Comment("ชื่อรหัสส่วนราชการ")]
public string? OrganizationCodeName { get; set; }
[Comment("Id หน่วยงาน")]
public Guid? OrganizationId { get; set; }
[Comment("ชื่อหน่วยงาน")]
public string? OrganizationName { get; set; }
[Comment("ชำระเงินผ่านกรุงไทย")]
public string? PaymentKrungThai { get; set; }
[Comment("รายละเอียดสมัครสอบ")]
public string? Detail { get; set; }
[Required, Column(Order = 3), Comment("วันประกาศ")]
public DateTime AnnounceDate { get; set; } = DateTime.Now.Date;
[Comment("หมายเหตุ")]
public string? Note { get; set; }
[Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true;

22
Models/PositionExam.cs Normal file
View file

@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using BMA.EHR.Recurit.Exam.Service.Models.Documents;
namespace BMA.EHR.Recurit.Exam.Service.Models
{
public class PositionExam : EntityBase
{
[Required, Comment("Id การสอบ")]
public virtual PeriodExam? PeriodExam { get; set; }
[Comment("Id ตำแหน่ง")]
public Guid? PositionId { get; set; }
[Comment("ชื่อตำแหน่ง")]
public string? PositionName { get; set; }
[Comment("ชื่อประเภทแบบฟอร์ม")]
public string? TypeName { get; set; }
}
}

View file

@ -0,0 +1,11 @@
using System.Net;
namespace BMA.EHR.Recurit.Exam.Service.Request
{
public class RequestBankExam
{
public string? AccountNumber { get; set; }
public string? BankName { get; set; }
public string? AccountName { get; set; }
}
}

View file

@ -0,0 +1,29 @@
using System.Net;
namespace BMA.EHR.Recurit.Exam.Service.Request
{
public class RequestPeriodExam
{
public string Name { get; set; } = string.Empty;
public bool CheckDocument { get; set; } = false;
public bool CheckDisability { get; set; } = false;
public int? Round { get; set; }
public int? Year { get; set; }
public float? Fee { get; set; } = 0;
public DateTime RegisterStartDate { get; set; } = DateTime.Now.Date;
public DateTime RegisterEndDate { get; set; } = DateTime.Now.Date;
public DateTime PaymentStartDate { get; set; } = DateTime.Now.Date;
public DateTime PaymentEndDate { get; set; } = DateTime.Now.Date;
public DateTime AnnouncementStartDate { get; set; } = DateTime.Now.Date;
public DateTime AnnouncementEndDate { get; set; } = DateTime.Now.Date;
public Guid? OrganizationCodeId { get; set; }
public string? OrganizationCodeName { get; set; }
public Guid? OrganizationId { get; set; }
public string? OrganizationName { get; set; }
public string? PaymentKrungThai { get; set; }
public string? Detail { get; set; }
public string? Note { get; set; }
public List<RequestBankExam> BankExam { get; set; } = new();
public List<RequestPositionExam> PositionExam { get; set; } = new();
}
}

View file

@ -0,0 +1,11 @@
using System.Net;
namespace BMA.EHR.Recurit.Exam.Service.Request
{
public class RequestPositionExam
{
public Guid? PositionId { get; set; }
public string? PositionName { get; set; }
public string? TypeName { get; set; }
}
}

View file

@ -0,0 +1,13 @@
using System.Net;
using BMA.EHR.Recurit.Exam.Service.Models;
namespace BMA.EHR.Recurit.Exam.Service.Request
{
public class RequestStatusRegistry
{
public bool Consend { get; set; }
public bool Poition { get; set; }
public string? Status { get; set; }
public PositionExam? PositionExam { get; set; }
}
}

View file

@ -67,7 +67,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
return candidate;
}
public async Task<CandidateInformationResponseItem?> GetsAsyncInformation(string examId)
public async Task<CandidateInformationResponseItem?> GetsAsyncInformation(string examId, string positionId)
{
var exam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
@ -75,33 +75,69 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (exam == null)
throw new Exception(GlobalMessages.ExamNotFound);
return await _context.Candidates.AsQueryable()
.Where(x => x.PeriodExam == exam && x.UserId == UserId)
.Select(x => new CandidateInformationResponseItem
{
Prefix = x.Prefix,
PrefixId = x.Prefix != null ? x.Prefix.Id.ToString() : null,
FirstName = x.FirstName,
LastName = x.LastName,
Nationality = x.Nationality,
DateOfBirth = x.DateOfBirth,
Relationship = x.Relationship,
RelationshipId = x.Relationship != null ? x.Relationship.Id.ToString() : null,
CitizenProvince = x.CitizenProvince,
CitizenProvinceId = x.CitizenProvince != null ? x.CitizenProvince.Id.ToString() : null,
CitizenDistrict = x.CitizenDistrict,
CitizenDistrictId = x.CitizenDistrict != null ? x.CitizenDistrict.Id.ToString() : null,
CitizenDate = x.CitizenDate,
Email = x.Email,
CitizenId = x.CitizenId,
Telephone = x.Telephone,
MobilePhone = x.MobilePhone,
Knowledge = x.Knowledge,
})
.FirstOrDefaultAsync();
if (positionId != "00000000-0000-0000-0000-000000000000")
{
var position = await _context.PositionExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId));
if (position == null)
throw new Exception(GlobalMessages.PositionExamNotFound);
return await _context.Candidates.AsQueryable()
.Where(x => x.PeriodExam == exam && x.UserId == UserId && x.PositionExam == position)
.Select(x => new CandidateInformationResponseItem
{
Prefix = x.Prefix,
PrefixId = x.Prefix != null ? x.Prefix.Id.ToString() : null,
FirstName = x.FirstName,
LastName = x.LastName,
Nationality = x.Nationality,
DateOfBirth = x.DateOfBirth,
Relationship = x.Relationship,
RelationshipId = x.Relationship != null ? x.Relationship.Id.ToString() : null,
CitizenProvince = x.CitizenProvince,
CitizenProvinceId = x.CitizenProvince != null ? x.CitizenProvince.Id.ToString() : null,
CitizenDistrict = x.CitizenDistrict,
CitizenDistrictId = x.CitizenDistrict != null ? x.CitizenDistrict.Id.ToString() : null,
CitizenDate = x.CitizenDate,
Email = x.Email,
CitizenId = x.CitizenId,
Telephone = x.Telephone,
MobilePhone = x.MobilePhone,
Knowledge = x.Knowledge,
})
.FirstOrDefaultAsync();
}
else
{
return await _context.Candidates.AsQueryable()
.Where(x => x.PeriodExam == exam && x.UserId == UserId)
.Select(x => new CandidateInformationResponseItem
{
Prefix = x.Prefix,
PrefixId = x.Prefix != null ? x.Prefix.Id.ToString() : null,
FirstName = x.FirstName,
LastName = x.LastName,
Nationality = x.Nationality,
DateOfBirth = x.DateOfBirth,
Relationship = x.Relationship,
RelationshipId = x.Relationship != null ? x.Relationship.Id.ToString() : null,
CitizenProvince = x.CitizenProvince,
CitizenProvinceId = x.CitizenProvince != null ? x.CitizenProvince.Id.ToString() : null,
CitizenDistrict = x.CitizenDistrict,
CitizenDistrictId = x.CitizenDistrict != null ? x.CitizenDistrict.Id.ToString() : null,
CitizenDate = x.CitizenDate,
Email = x.Email,
CitizenId = x.CitizenId,
Telephone = x.Telephone,
MobilePhone = x.MobilePhone,
Knowledge = x.Knowledge,
})
.FirstOrDefaultAsync();
}
}
public async Task<CandidateAddressResponseItem?> GetsAsyncAddress(string examId)
public async Task<CandidateAddressResponseItem?> GetsAsyncAddress(string examId, string positionId)
{
var exam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
@ -109,32 +145,67 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (exam == null)
throw new Exception(GlobalMessages.ExamNotFound);
return await _context.Candidates.AsQueryable()
.Where(x => x.PeriodExam == exam && x.UserId == UserId)
.Select(x => new CandidateAddressResponseItem
{
RegistAddress = x.RegistAddress,
RegistProvince = x.RegistProvince,
RegistProvinceId = x.RegistProvince != null ? x.RegistProvince.Id.ToString() : null,
RegistDistrict = x.RegistDistrict,
RegistDistrictId = x.RegistDistrict != null ? x.RegistDistrict.Id.ToString() : null,
RegistSubDistrict = x.RegistSubDistrict,
RegistSubDistrictId = x.RegistSubDistrict != null ? x.RegistSubDistrict.Id.ToString() : null,
RegistZipCode = x.RegistZipCode,
RegistSame = x.RegistSame,
CurrentAddress = x.CurrentAddress,
CurrentProvince = x.CurrentProvince,
CurrentProvinceId = x.CurrentProvince != null ? x.CurrentProvince.Id.ToString() : null,
CurrentDistrict = x.CurrentDistrict,
CurrentDistrictId = x.CurrentDistrict != null ? x.CurrentDistrict.Id.ToString() : null,
CurrentSubDistrict = x.CurrentSubDistrict,
CurrentSubDistrictId = x.CurrentSubDistrict != null ? x.CurrentSubDistrict.Id.ToString() : null,
CurrentZipCode = x.CurrentZipCode,
})
.FirstOrDefaultAsync();
if (positionId != "00000000-0000-0000-0000-000000000000")
{
var position = await _context.PositionExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId));
if (position == null)
throw new Exception(GlobalMessages.PositionExamNotFound);
return await _context.Candidates.AsQueryable()
.Where(x => x.PeriodExam == exam && x.UserId == UserId && x.PositionExam == position)
.Select(x => new CandidateAddressResponseItem
{
RegistAddress = x.RegistAddress,
RegistProvince = x.RegistProvince,
RegistProvinceId = x.RegistProvince != null ? x.RegistProvince.Id.ToString() : null,
RegistDistrict = x.RegistDistrict,
RegistDistrictId = x.RegistDistrict != null ? x.RegistDistrict.Id.ToString() : null,
RegistSubDistrict = x.RegistSubDistrict,
RegistSubDistrictId = x.RegistSubDistrict != null ? x.RegistSubDistrict.Id.ToString() : null,
RegistZipCode = x.RegistZipCode,
RegistSame = x.RegistSame,
CurrentAddress = x.CurrentAddress,
CurrentProvince = x.CurrentProvince,
CurrentProvinceId = x.CurrentProvince != null ? x.CurrentProvince.Id.ToString() : null,
CurrentDistrict = x.CurrentDistrict,
CurrentDistrictId = x.CurrentDistrict != null ? x.CurrentDistrict.Id.ToString() : null,
CurrentSubDistrict = x.CurrentSubDistrict,
CurrentSubDistrictId = x.CurrentSubDistrict != null ? x.CurrentSubDistrict.Id.ToString() : null,
CurrentZipCode = x.CurrentZipCode,
})
.FirstOrDefaultAsync();
}
else
{
return await _context.Candidates.AsQueryable()
.Where(x => x.PeriodExam == exam && x.UserId == UserId)
.Select(x => new CandidateAddressResponseItem
{
RegistAddress = x.RegistAddress,
RegistProvince = x.RegistProvince,
RegistProvinceId = x.RegistProvince != null ? x.RegistProvince.Id.ToString() : null,
RegistDistrict = x.RegistDistrict,
RegistDistrictId = x.RegistDistrict != null ? x.RegistDistrict.Id.ToString() : null,
RegistSubDistrict = x.RegistSubDistrict,
RegistSubDistrictId = x.RegistSubDistrict != null ? x.RegistSubDistrict.Id.ToString() : null,
RegistZipCode = x.RegistZipCode,
RegistSame = x.RegistSame,
CurrentAddress = x.CurrentAddress,
CurrentProvince = x.CurrentProvince,
CurrentProvinceId = x.CurrentProvince != null ? x.CurrentProvince.Id.ToString() : null,
CurrentDistrict = x.CurrentDistrict,
CurrentDistrictId = x.CurrentDistrict != null ? x.CurrentDistrict.Id.ToString() : null,
CurrentSubDistrict = x.CurrentSubDistrict,
CurrentSubDistrictId = x.CurrentSubDistrict != null ? x.CurrentSubDistrict.Id.ToString() : null,
CurrentZipCode = x.CurrentZipCode,
})
.FirstOrDefaultAsync();
}
}
public async Task<CandidateFamilyResponseItem?> GetsAsyncFamily(string examId)
public async Task<CandidateFamilyResponseItem?> GetsAsyncFamily(string examId, string positionId)
{
var exam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
@ -142,34 +213,71 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (exam == null)
throw new Exception(GlobalMessages.ExamNotFound);
return await _context.Candidates.AsQueryable()
.Where(x => x.PeriodExam == exam && x.UserId == UserId)
.Select(x => new CandidateFamilyResponseItem
{
Marry = x.Marry,
MarryPrefix = x.MarryPrefix,
MarryPrefixId = x.MarryPrefix != null ? x.MarryPrefix.Id.ToString() : null,
MarryFirstName = x.MarryFirstName,
MarryLastName = x.MarryLastName,
MarryOccupation = x.MarryOccupation,
MarryNationality = x.MarryNationality,
FatherPrefix = x.FatherPrefix,
FatherPrefixId = x.FatherPrefix != null ? x.FatherPrefix.Id.ToString() : null,
FatherFirstName = x.FatherFirstName,
FatherLastName = x.FatherLastName,
FatherOccupation = x.FatherOccupation,
FatherNationality = x.FatherNationality,
MotherPrefix = x.MotherPrefix,
MotherPrefixId = x.MotherPrefix != null ? x.MotherPrefix.Id.ToString() : null,
MotherFirstName = x.MotherFirstName,
MotherLastName = x.MotherLastName,
MotherOccupation = x.MotherOccupation,
MotherNationality = x.MotherNationality,
})
.FirstOrDefaultAsync();
if (positionId != "00000000-0000-0000-0000-000000000000")
{
var position = await _context.PositionExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId));
if (position == null)
throw new Exception(GlobalMessages.PositionExamNotFound);
return await _context.Candidates.AsQueryable()
.Where(x => x.PeriodExam == exam && x.UserId == UserId && x.PositionExam == position)
.Select(x => new CandidateFamilyResponseItem
{
Marry = x.Marry,
MarryPrefix = x.MarryPrefix,
MarryPrefixId = x.MarryPrefix != null ? x.MarryPrefix.Id.ToString() : null,
MarryFirstName = x.MarryFirstName,
MarryLastName = x.MarryLastName,
MarryOccupation = x.MarryOccupation,
MarryNationality = x.MarryNationality,
FatherPrefix = x.FatherPrefix,
FatherPrefixId = x.FatherPrefix != null ? x.FatherPrefix.Id.ToString() : null,
FatherFirstName = x.FatherFirstName,
FatherLastName = x.FatherLastName,
FatherOccupation = x.FatherOccupation,
FatherNationality = x.FatherNationality,
MotherPrefix = x.MotherPrefix,
MotherPrefixId = x.MotherPrefix != null ? x.MotherPrefix.Id.ToString() : null,
MotherFirstName = x.MotherFirstName,
MotherLastName = x.MotherLastName,
MotherOccupation = x.MotherOccupation,
MotherNationality = x.MotherNationality,
})
.FirstOrDefaultAsync();
}
else
{
return await _context.Candidates.AsQueryable()
.Where(x => x.PeriodExam == exam && x.UserId == UserId)
.Select(x => new CandidateFamilyResponseItem
{
Marry = x.Marry,
MarryPrefix = x.MarryPrefix,
MarryPrefixId = x.MarryPrefix != null ? x.MarryPrefix.Id.ToString() : null,
MarryFirstName = x.MarryFirstName,
MarryLastName = x.MarryLastName,
MarryOccupation = x.MarryOccupation,
MarryNationality = x.MarryNationality,
FatherPrefix = x.FatherPrefix,
FatherPrefixId = x.FatherPrefix != null ? x.FatherPrefix.Id.ToString() : null,
FatherFirstName = x.FatherFirstName,
FatherLastName = x.FatherLastName,
FatherOccupation = x.FatherOccupation,
FatherNationality = x.FatherNationality,
MotherPrefix = x.MotherPrefix,
MotherPrefixId = x.MotherPrefix != null ? x.MotherPrefix.Id.ToString() : null,
MotherFirstName = x.MotherFirstName,
MotherLastName = x.MotherLastName,
MotherOccupation = x.MotherOccupation,
MotherNationality = x.MotherNationality,
})
.FirstOrDefaultAsync();
}
}
public async Task<CandidateOccupationResponseItem?> GetsAsyncOccupation(string examId)
public async Task<CandidateOccupationResponseItem?> GetsAsyncOccupation(string examId, string positionId)
{
var exam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
@ -177,21 +285,45 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (exam == null)
throw new Exception(GlobalMessages.ExamNotFound);
return await _context.Candidates.AsQueryable()
.Where(x => x.PeriodExam == exam && x.UserId == UserId)
.Select(x => new CandidateOccupationResponseItem
{
OccupationType = x.OccupationType,
OccupationCompany = x.OccupationCompany,
OccupationDepartment = x.OccupationDepartment,
OccupationEmail = x.OccupationEmail,
OccupationTelephone = x.OccupationTelephone,
OccupationPosition = x.OccupationPosition,
})
.FirstOrDefaultAsync();
if (positionId != "00000000-0000-0000-0000-000000000000")
{
var position = await _context.PositionExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId));
if (position == null)
throw new Exception(GlobalMessages.PositionExamNotFound);
return await _context.Candidates.AsQueryable()
.Where(x => x.PeriodExam == exam && x.UserId == UserId && x.PositionExam == position)
.Select(x => new CandidateOccupationResponseItem
{
OccupationType = x.OccupationType,
OccupationCompany = x.OccupationCompany,
OccupationDepartment = x.OccupationDepartment,
OccupationEmail = x.OccupationEmail,
OccupationTelephone = x.OccupationTelephone,
OccupationPosition = x.OccupationPosition,
})
.FirstOrDefaultAsync();
}
else
{
return await _context.Candidates.AsQueryable()
.Where(x => x.PeriodExam == exam && x.UserId == UserId)
.Select(x => new CandidateOccupationResponseItem
{
OccupationType = x.OccupationType,
OccupationCompany = x.OccupationCompany,
OccupationDepartment = x.OccupationDepartment,
OccupationEmail = x.OccupationEmail,
OccupationTelephone = x.OccupationTelephone,
OccupationPosition = x.OccupationPosition,
})
.FirstOrDefaultAsync();
}
}
public async Task<IEnumerable<Career?>> GetsAsyncCareer(string examId)
public async Task<IEnumerable<Career?>> GetsAsyncCareer(string examId, string positionId)
{
var exam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
@ -202,13 +334,28 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId);
if (positionId != "00000000-0000-0000-0000-000000000000")
{
var position = await _context.PositionExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId));
if (position == null)
throw new Exception(GlobalMessages.PositionExamNotFound);
candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId && x.PositionExam == position);
}
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
return await _context.Careers.AsQueryable()
.Where(x => x.Candidate == candidate)
.OrderBy(d => d.DurationStart)
.ToListAsync();
}
public async Task<IEnumerable<Education?>> GetsAsyncEducation(string examId)
public async Task<IEnumerable<Education?>> GetsAsyncEducation(string examId, string positionId)
{
var exam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
@ -219,6 +366,21 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId);
if (positionId != "00000000-0000-0000-0000-000000000000")
{
var position = await _context.PositionExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId));
if (position == null)
throw new Exception(GlobalMessages.PositionExamNotFound);
candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId && x.PositionExam == position);
}
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
return await _context.Educations.AsQueryable()
.Include(x => x.EducationLevel)
.Where(x => x.Candidate == candidate)
@ -226,7 +388,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.ToListAsync();
}
public async Task<IEnumerable<FileListResponse?>> GetsAsyncFileUpload(string examId)
public async Task<IEnumerable<FileListResponse?>> GetsAsyncFileUpload(string examId, string positionId)
{
var exam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
@ -237,6 +399,21 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId);
if (positionId != "00000000-0000-0000-0000-000000000000")
{
var position = await _context.PositionExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId));
if (position == null)
throw new Exception(GlobalMessages.PositionExamNotFound);
candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId && x.PositionExam == position);
}
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
return await _context.CandidateDocuments.AsQueryable()
.Where(x => x.Candidate == candidate)
.Select(x => new FileListResponse
@ -246,10 +423,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
FileType = x.Document == null ? "" : x.Document.FileType,
FileSize = x.Document == null ? 0 : x.Document.FileSize,
})
.ToListAsync(); ;
.ToListAsync();
}
public async Task<string> GetsAsyncProfileImage(string examId)
public async Task<string> GetsAsyncProfileImage(string examId, string positionId)
{
var exam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
@ -262,13 +439,27 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Where(x => x.PeriodExam == exam && x.UserId == UserId)
.FirstOrDefaultAsync();
if (positionId != "00000000-0000-0000-0000-000000000000")
{
var position = await _context.PositionExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId));
if (position == null)
throw new Exception(GlobalMessages.PositionExamNotFound);
candidate = await _context.Candidates.AsQueryable()
.Include(x => x.ProfileImg)
.Where(x => x.PeriodExam == exam && x.UserId == UserId && x.PositionExam == position)
.FirstOrDefaultAsync();
}
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
return candidate.ProfileImg == null ? "" : candidate.ProfileImg.Id.ToString();
}
public async Task<string> GetsAsyncPaymentImg(string examId)
public async Task<string> GetsAsyncPaymentImg(string examId, string positionId)
{
var exam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
@ -281,13 +472,27 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Where(x => x.PeriodExam == exam && x.UserId == UserId)
.FirstOrDefaultAsync();
if (positionId != "00000000-0000-0000-0000-000000000000")
{
var position = await _context.PositionExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId));
if (position == null)
throw new Exception(GlobalMessages.PositionExamNotFound);
candidate = await _context.Candidates.AsQueryable()
.Include(x => x.PaymentImg)
.Where(x => x.PeriodExam == exam && x.UserId == UserId && x.PositionExam == position)
.FirstOrDefaultAsync();
}
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
return candidate.PaymentImg == null ? "" : candidate.PaymentImg.Id.ToString();
}
public async Task<bool> GetsAsyncRegisterExam(string examId)
public async Task<RequestStatusRegistry> GetsAsyncRegisterExam(string examId, string positionId)
{
var exam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
@ -298,10 +503,31 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId);
return candidate != null;
if (positionId != "00000000-0000-0000-0000-000000000000")
{
var position = await _context.PositionExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId));
if (position == null)
throw new Exception(GlobalMessages.PositionExamNotFound);
candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId && x.PositionExam == position);
}
var candidatePosition = await _context.Candidates.AsQueryable()
.Include(x => x.PositionExam)
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId && x.Status != "register" && x.Status != "rejectRegister");
return new RequestStatusRegistry
{
Consend = candidate != null,
Status = candidate == null ? null : candidate.Status,
PositionExam = candidatePosition?.PositionExam
};
}
public async Task<string> CreateAsyncCandidate(string examId)
public async Task<string> CreateAsyncCandidate(string examId, string positionId)
{
var exam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
@ -309,11 +535,21 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (exam == null)
throw new Exception(GlobalMessages.ExamNotFound);
var _candidateNumber = await _context.Candidates.AsQueryable()
.CountAsync(x => x.PeriodExam == exam);
var _candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId);
if (positionId != "00000000-0000-0000-0000-000000000000")
{
var position = await _context.PositionExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId));
if (position == null)
throw new Exception(GlobalMessages.PositionExamNotFound);
_candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId && x.PositionExam == position);
}
if (_candidate == null)
{
var candidate = new Candidate
@ -326,13 +562,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
CreatedFullName = FullName ?? "",
LastUpdateFullName = FullName ?? "",
UserId = UserId ?? "",
SeatNumber = "CDC-" + (_candidateNumber + 1),
};
await _context.Candidates.AddAsync(candidate);
await _context.SaveChangesAsync();
return candidate.Id.ToString();
}
else
@ -344,9 +576,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
}
}
public async Task UpdateAsync(string examId, CandidateResponseItem updated)
public async Task UpdateAsync(string examId, string positionId, CandidateResponseItem updated)
{
var candidateId = await CreateAsyncCandidate(examId);
var candidateId = await CreateAsyncCandidate(examId, positionId);
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
@ -361,6 +593,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.Prefix = prefix;
}
@ -371,6 +604,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (relationship == null)
throw new Exception(GlobalMessages.RelationshipNotFound);
candidate.Relationship = relationship;
}
@ -381,6 +615,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (citizenProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.CitizenProvince = citizenProvince;
}
@ -391,6 +626,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (citizenDistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound);
candidate.CitizenDistrict = citizenDistrict;
}
@ -401,6 +637,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (registProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.RegistProvince = registProvince;
}
@ -411,6 +648,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (registDistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound);
candidate.RegistDistrict = registDistrict;
}
@ -421,6 +659,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (registSubDistrict == null)
throw new Exception(GlobalMessages.SubDistrictNotFound);
candidate.RegistSubDistrict = registSubDistrict;
candidate.RegistZipCode = registSubDistrict.ZipCode;
}
@ -432,6 +671,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (currentProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.CurrentProvince = currentProvince;
}
@ -442,6 +682,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (currentDistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound);
candidate.CurrentDistrict = currentDistrict;
}
@ -452,6 +693,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (currentSubDistrict == null)
throw new Exception(GlobalMessages.SubDistrictNotFound);
candidate.CurrentSubDistrict = currentSubDistrict;
candidate.CurrentZipCode = currentSubDistrict.ZipCode;
}
@ -463,6 +705,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.MarryPrefix = prefix;
}
@ -473,6 +716,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.FatherPrefix = prefix;
}
@ -483,6 +727,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.MotherPrefix = prefix;
}
@ -525,9 +770,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
await _context.SaveChangesAsync();
}
public async Task UpdateAsyncInformation(string examId, CandidateInformationResponseItem updated)
public async Task UpdateAsyncInformation(string examId, string positionId, CandidateInformationResponseItem updated)
{
var candidateId = await CreateAsyncCandidate(examId);
var candidateId = await CreateAsyncCandidate(examId, positionId);
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
@ -542,6 +787,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.Prefix = prefix;
}
@ -552,6 +798,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (relationship == null)
throw new Exception(GlobalMessages.RelationshipNotFound);
candidate.Relationship = relationship;
}
@ -562,6 +809,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (citizenProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.CitizenProvince = citizenProvince;
}
@ -572,6 +820,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (citizenDistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound);
candidate.CitizenDistrict = citizenDistrict;
}
@ -589,9 +838,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
await _context.SaveChangesAsync();
}
public async Task UpdateAsyncProfileImage(string examId, IFormFile file)
public async Task UpdateAsyncProfileImage(string examId, string positionId, IFormFile file)
{
var candidateId = await CreateAsyncCandidate(examId);
var candidateId = await CreateAsyncCandidate(examId, positionId);
var candidate = await _context.Candidates.AsQueryable()
.Include(x => x.ProfileImg)
@ -614,9 +863,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
await _context.SaveChangesAsync();
}
public async Task UpdateAsyncAddress(string examId, CandidateAddressResponseItem updated)
public async Task UpdateAsyncAddress(string examId, string positionId, CandidateAddressResponseItem updated)
{
var candidateId = await CreateAsyncCandidate(examId);
var candidateId = await CreateAsyncCandidate(examId, positionId);
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
@ -631,6 +880,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (registProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.RegistProvince = registProvince;
}
@ -641,6 +891,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (registDistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound);
candidate.RegistDistrict = registDistrict;
}
@ -651,6 +902,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (registSubDistrict == null)
throw new Exception(GlobalMessages.SubDistrictNotFound);
candidate.RegistSubDistrict = registSubDistrict;
candidate.RegistZipCode = registSubDistrict.ZipCode;
}
@ -662,6 +914,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (currentProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.CurrentProvince = currentProvince;
}
@ -672,6 +925,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (currentDistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound);
candidate.CurrentDistrict = currentDistrict;
}
@ -682,6 +936,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (currentSubDistrict == null)
throw new Exception(GlobalMessages.SubDistrictNotFound);
candidate.CurrentSubDistrict = currentSubDistrict;
candidate.CurrentZipCode = currentSubDistrict.ZipCode;
}
@ -693,9 +948,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
await _context.SaveChangesAsync();
}
public async Task UpdateAsyncFamily(string examId, CandidateFamilyResponseItem updated)
public async Task UpdateAsyncFamily(string examId, string positionId, CandidateFamilyResponseItem updated)
{
var candidateId = await CreateAsyncCandidate(examId);
var candidateId = await CreateAsyncCandidate(examId, positionId);
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
@ -710,6 +965,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.MarryPrefix = prefix;
}
@ -720,6 +976,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.FatherPrefix = prefix;
}
@ -730,6 +987,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.MotherPrefix = prefix;
}
@ -750,9 +1008,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
await _context.SaveChangesAsync();
}
public async Task UpdateAsyncOccupation(string examId, CandidateOccupationResponseItem updated)
public async Task UpdateAsyncOccupation(string examId, string positionId, CandidateOccupationResponseItem updated)
{
var candidateId = await CreateAsyncCandidate(examId);
var candidateId = await CreateAsyncCandidate(examId, positionId);
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
@ -770,9 +1028,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
await _context.SaveChangesAsync();
}
public async Task UpdateAsyncDocument(string examId, IFormFile file)
public async Task UpdateAsyncDocument(string examId, string positionId, IFormFile file)
{
var candidateId = await CreateAsyncCandidate(examId);
var candidateId = await CreateAsyncCandidate(examId, positionId);
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
@ -785,6 +1043,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var document = await _context.Documents.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == doc.Id);
if (document == null)
throw new Exception(GlobalMessages.NoFileToUpload);
var candidateDocument = new CandidateDocument
{
Candidate = candidate,
@ -800,9 +1061,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
await _minioService.DeleteFileAsync(Guid.Parse(documentId));
}
public async Task CreateAsyncCareer(string examId, CandidateCareerResponseItem updated)
public async Task CreateAsyncCareer(string examId, string positionId, CandidateCareerResponseItem updated)
{
var candidateId = await CreateAsyncCandidate(examId);
var candidateId = await CreateAsyncCandidate(examId, positionId);
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
@ -825,13 +1086,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
};
await _context.Careers.AddAsync(career);
await _context.SaveChangesAsync();
}
public async Task CreateAsyncEducation(string examId, CandidateEducationResponseItem updated)
public async Task CreateAsyncEducation(string examId, string positionId, CandidateEducationResponseItem updated)
{
var candidateId = await CreateAsyncCandidate(examId);
var candidateId = await CreateAsyncCandidate(examId, positionId);
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
@ -860,7 +1120,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
};
await _context.Educations.AddAsync(education);
await _context.SaveChangesAsync();
}
@ -938,7 +1197,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
await _context.SaveChangesAsync();
}
public async Task<string> GetStatusCandidateService(string examId)
public async Task<string> GetStatusCandidateService(string examId, string positionId)
{
var exam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
@ -949,13 +1208,25 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId);
if (positionId != "00000000-0000-0000-0000-000000000000")
{
var position = await _context.PositionExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId));
if (position == null)
throw new Exception(GlobalMessages.PositionExamNotFound);
candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId && x.PositionExam == position);
}
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
return candidate.Status;
}
public async Task UserCheckCandidateService(string examId, string status)
public async Task UserCheckCandidateService(string examId, string positionId, string status)
{
var exam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
@ -966,6 +1237,18 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId);
if (positionId != "00000000-0000-0000-0000-000000000000")
{
var position = await _context.PositionExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId));
if (position == null)
throw new Exception(GlobalMessages.PositionExamNotFound);
candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId && x.PositionExam == position);
}
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
@ -977,11 +1260,15 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
public async Task AdminCheckCandidateService(string candidateId, string status, RequestApprove item)
{
var candidate = await _context.Candidates.AsQueryable()
.Include(x => x.PeriodExam)
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
if (candidate.PeriodExam == null)
throw new Exception(GlobalMessages.ExamNotFound);
if (status != "rejectDelete")
{
candidate.Status = status;
@ -989,6 +1276,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
{
candidate.RejectDetail = item.Reason;
}
else if (status == "payment" && candidate.PeriodExam.Fee == 0)
{
candidate.Status = "checkSeat";
}
}
else
{
@ -1011,9 +1302,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
await _context.SaveChangesAsync();
}
public async Task UpdateAsyncPaymentImage(string examId, IFormFile file)
public async Task UpdateAsyncPaymentImage(string examId, string positionId, IFormFile file)
{
var candidateId = await CreateAsyncCandidate(examId);
var candidateId = await CreateAsyncCandidate(examId, positionId);
var candidate = await _context.Candidates.AsQueryable()
.Include(x => x.PaymentImg)

View file

@ -2,6 +2,7 @@
using BMA.EHR.Recurit.Exam.Service.Core;
using BMA.EHR.Recurit.Exam.Service.Data;
using BMA.EHR.Recurit.Exam.Service.Models;
using BMA.EHR.Recurit.Exam.Service.Request;
using BMA.EHR.Recurit.Exam.Service.Response;
using Microsoft.EntityFrameworkCore;
@ -61,18 +62,29 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
return periodExam;
}
public async Task CreateAsync(PeriodExam inserted)
public async Task CreateAsync(RequestPeriodExam inserted)
{
var periodExam = new PeriodExam
{
Name = inserted.Name,
StartDate = inserted.StartDate,
EndDate = inserted.EndDate,
CheckDocument = inserted.CheckDocument,
CheckDisability = inserted.CheckDisability,
Round = inserted.Round,
Fee = inserted.Fee,
Year = inserted.Year,
Fee = inserted.Fee,
RegisterStartDate = inserted.RegisterStartDate,
RegisterEndDate = inserted.RegisterEndDate,
PaymentStartDate = inserted.PaymentStartDate,
PaymentEndDate = inserted.PaymentEndDate,
AnnouncementStartDate = inserted.AnnouncementStartDate,
AnnouncementEndDate = inserted.AnnouncementEndDate,
OrganizationCodeId = inserted.OrganizationCodeId,
OrganizationCodeName = inserted.OrganizationCodeName,
OrganizationId = inserted.OrganizationId,
OrganizationName = inserted.OrganizationName,
PaymentKrungThai = inserted.PaymentKrungThai,
Detail = inserted.Detail,
AnnounceDate = inserted.AnnounceDate,
Note = inserted.Note,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
@ -81,12 +93,48 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
LastUpdateFullName = FullName ?? "",
};
foreach (var bank in inserted.BankExam)
{
var bankExam = new BankExam
{
PeriodExam = periodExam,
AccountName = bank.AccountName,
AccountNumber = bank.AccountNumber,
BankName = bank.BankName,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
LastUpdateUserId = UserId ?? "",
CreatedFullName = FullName ?? "",
LastUpdateFullName = FullName ?? "",
};
await _context.BankExams.AddAsync(bankExam);
}
foreach (var position in inserted.PositionExam)
{
var positionExam = new PositionExam
{
PeriodExam = periodExam,
PositionId = position.PositionId,
PositionName = position.PositionName,
TypeName = position.TypeName,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
LastUpdateUserId = UserId ?? "",
CreatedFullName = FullName ?? "",
LastUpdateFullName = FullName ?? "",
};
await _context.PositionExams.AddAsync(positionExam);
}
await _context.PeriodExams.AddAsync(periodExam);
await _context.SaveChangesAsync();
}
public async Task UpdateAsync(string examId, PeriodExam updated)
public async Task UpdateAsync(string examId, RequestPeriodExam updated)
{
var periodExam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
@ -95,16 +143,29 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
throw new Exception(GlobalMessages.ExamNotFound);
periodExam.Name = updated.Name;
periodExam.StartDate = updated.StartDate;
periodExam.EndDate = updated.EndDate;
periodExam.CheckDocument = updated.CheckDocument;
periodExam.CheckDisability = updated.CheckDisability;
periodExam.Round = updated.Round;
periodExam.Fee = updated.Fee;
periodExam.Year = updated.Year;
periodExam.Fee = updated.Fee;
periodExam.RegisterStartDate = updated.RegisterStartDate;
periodExam.RegisterEndDate = updated.RegisterEndDate;
periodExam.PaymentStartDate = updated.PaymentStartDate;
periodExam.PaymentEndDate = updated.PaymentEndDate;
periodExam.AnnouncementStartDate = updated.AnnouncementStartDate;
periodExam.AnnouncementEndDate = updated.AnnouncementEndDate;
periodExam.OrganizationCodeId = updated.OrganizationCodeId;
periodExam.OrganizationCodeName = updated.OrganizationCodeName;
periodExam.OrganizationId = updated.OrganizationId;
periodExam.OrganizationName = updated.OrganizationName;
periodExam.PaymentKrungThai = updated.PaymentKrungThai;
periodExam.Detail = updated.Detail;
periodExam.AnnounceDate = updated.AnnounceDate;
periodExam.IsActive = updated.IsActive;
periodExam.Note = updated.Note;
periodExam.CreatedAt = DateTime.Now;
periodExam.CreatedUserId = UserId ?? "";
periodExam.LastUpdatedAt = DateTime.Now;
periodExam.LastUpdateUserId = UserId ?? "";
periodExam.CreatedFullName = FullName ?? "";
periodExam.LastUpdateFullName = FullName ?? "";
await _context.SaveChangesAsync();

File diff suppressed because it is too large Load diff