api บันทึก และ แสดง ข้อมูลผู้สมัคร

This commit is contained in:
Kittapath 2023-03-23 21:41:26 +07:00
parent ffeab6a127
commit a781c375d7
40 changed files with 10433 additions and 2 deletions

View file

@ -0,0 +1,454 @@
using BMA.EHR.Recurit.Exam.Service.Response;
using BMA.EHR.Recurit.Exam.Service.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
namespace BMA.EHR.Recurit.Exam.Service.Controllers
{
[Route("api/v{version:apiVersion}/candidate")]
[ApiVersion("1.0")]
[ApiController]
[Produces("application/json")]
[Authorize]
[SwaggerTag("จัดการข้อมูลศาสนา เพื่อนำไปใช้งานในระบบ")]
public class CandidateController : BaseController
{
#region " Fields "
private readonly CandidateService _candidateService;
#endregion
#region " Constructor and Destructor "
public CandidateController(CandidateService candidateService)
{
_candidateService = candidateService;
}
#endregion
#region " Methods "
/// <summary>
/// ข้อมูล ข้อมูลส่วนตัว ผู้สมัคร
/// </summary>
/// <param name="examId">รหัสการสมัคร</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการดึง ข้อมูล ข้อมูลส่วนตัว ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("information/{examId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsAsyncInformation(string examId)
{
try
{
var items = await _candidateService.GetsAsyncInformation(examId);
return Success(items);
}
catch (Exception ex)
{
return Error(ex);
}
}
/// <summary>
/// ข้อมูล ข้อมูลที่อยู่ ผู้สมัคร
/// </summary>
/// <param name="examId">รหัสการสมัคร</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการดึง ข้อมูล ข้อมูลที่อยู่ ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("address/{examId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsAsyncAddress(string examId)
{
try
{
var items = await _candidateService.GetsAsyncAddress(examId);
return Success(items);
}
catch (Exception ex)
{
return Error(ex);
}
}
/// <summary>
/// ข้อมูล ข้อมูลครอบครัว ผู้สมัคร
/// </summary>
/// <param name="examId">รหัสการสมัคร</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการดึง ข้อมูล ข้อมูลครอบครัว ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("family/{examId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsAsyncFamily(string examId)
{
try
{
var items = await _candidateService.GetsAsyncFamily(examId);
return Success(items);
}
catch (Exception ex)
{
return Error(ex);
}
}
/// <summary>
/// ข้อมูล อาชีพ ผู้สมัคร
/// </summary>
/// <param name="examId">รหัสการสมัคร</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการดึง ข้อมูล อาชีพ ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("occupation/{examId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsAsyncOccupation(string examId)
{
try
{
var items = await _candidateService.GetsAsyncOccupation(examId);
return Success(items);
}
catch (Exception ex)
{
return Error(ex);
}
}
/// <summary>
/// ข้อมูล ประวัติการทำงาน/ฝึกงาน ผู้สมัคร
/// </summary>
/// <param name="examId">รหัสการสมัคร</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการดึง ข้อมูล ประวัติการทำงาน/ฝึกงาน ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("career/{examId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsAsyncCareer(string examId)
{
try
{
var items = await _candidateService.GetsAsyncCareer(examId);
return Success(items);
}
catch (Exception ex)
{
return Error(ex);
}
}
/// <summary>
/// ข้อมูล ประวัติการศีกษา ผู้สมัคร
/// </summary>
/// <param name="examId">รหัสการสมัคร</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการดึง ข้อมูล ประวัติการศีกษา ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("education/{examId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsAsyncEducation(string examId)
{
try
{
var items = await _candidateService.GetsAsyncEducation(examId);
return Success(items);
}
catch (Exception ex)
{
return Error(ex);
}
}
/// <summary>
/// ตรวจสอบว่าผู้ใช้งานสมัครสอบหรือยัง
/// </summary>
/// <param name="examId">รหัสการสมัคร</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการตรวจสอบว่าผู้ใช้งานสมัครสอบหรือยัง สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("check/{examId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsAsyncRegisterExam(string examId)
{
try
{
var items = await _candidateService.GetsAsyncRegisterExam(examId);
return Success(items);
}
catch (Exception ex)
{
return Error(ex);
}
}
/// <summary>
/// อัพเดทข้อมูล ข้อมูลส่วนตัว ผู้สมัคร
/// </summary>
/// <param name="candidateInformation">ข้อมูลส่วนตัว</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอัพเดทข้อมูล ข้อมูลส่วนตัว ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("information/{examId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> UpdateAsyncInformation(string examId, CandidateInformationResponseItem candidateInformation)
{
try
{
await _candidateService.UpdateAsyncInformation(examId, candidateInformation);
return Success();
}
catch (Exception ex)
{
return Error(ex);
}
}
/// <summary>
/// อัพเดทข้อมูล ข้อมูลที่อยู่ ผู้สมัคร
/// </summary>
/// <param name="candidateAddress">ข้อมูลที่อยู่</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอัพเดทข้อมูล ข้อมูลที่อยู่ ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("address/{examId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> UpdateAsyncAddress(string examId, CandidateAddressResponseItem candidateAddress)
{
try
{
await _candidateService.UpdateAsyncAddress(examId, candidateAddress);
return Success();
}
catch (Exception ex)
{
return Error(ex);
}
}
/// <summary>
/// อัพเดทข้อมูล ข้อมูลครอบครัว ผู้สมัคร
/// </summary>
/// <param name="candidateFamily">ข้อมูลครอบครัว</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอัพเดทข้อมูล ข้อมูลครอบครัว ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("family/{examId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> UpdateAsyncFamily(string examId, CandidateFamilyResponseItem candidateFamily)
{
try
{
await _candidateService.UpdateAsyncFamily(examId, candidateFamily);
return Success();
}
catch (Exception ex)
{
return Error(ex);
}
}
/// <summary>
/// อัพเดทข้อมูล อาชีพ ผู้สมัคร
/// </summary>
/// <param name="candidateOccupation">อาชีพ</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอัพเดทข้อมูล อาชีพ ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("occupation/{examId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> UpdateAsyncOccupation(string examId, CandidateOccupationResponseItem candidateOccupation)
{
try
{
await _candidateService.UpdateAsyncOccupation(examId, candidateOccupation);
return Success();
}
catch (Exception ex)
{
return Error(ex);
}
}
/// <summary>
/// สร้างข้อมูล ประวัติการทำงาน/ฝึกงาน ผู้สมัคร
/// </summary>
/// <param name="candidateCareer">ข้อมูลประวัติการทำงาน/ฝึกงาน</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการสร้างข้อมูล ประวัติการทำงาน/ฝึกงาน ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("career/{examId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> CreateAsyncCareer(string examId, CandidateCareerResponseItem candidateCareer)
{
try
{
await _candidateService.CreateAsyncCareer(examId, candidateCareer);
return Success();
}
catch (Exception ex)
{
return Error(ex);
}
}
/// <summary>
/// สร้างข้อมูล ประวัติการศีกษา ผู้สมัคร
/// </summary>
/// <param name="candidateEducation">ข้อมูลประวัติการศีกษา</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการสร้างข้อมูล ประวัติการศีกษา ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("education/{examId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> CreateAsyncEducation(string examId, CandidateEducationResponseItem candidateEducation)
{
try
{
await _candidateService.CreateAsyncEducation(examId, candidateEducation);
return Success();
}
catch (Exception ex)
{
return Error(ex);
}
}
/// <summary>
/// อัพเดทข้อมูล ประวัติการทำงาน/ฝึกงาน ผู้สมัคร
/// </summary>
/// <param name="careerId">รหัสประวัติการทำงาน/ฝึกงาน</param>
/// <param name="candidateCareer">ข้อมูลประวัติการทำงาน/ฝึกงาน</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอัพเดทข้อมูล ประวัติการทำงาน/ฝึกงาน ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("career/{careerId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> UpdateAsyncCareer(string careerId, CandidateCareerResponseItem candidateCareer)
{
try
{
await _candidateService.UpdateAsyncCareer(careerId, candidateCareer);
return Success();
}
catch (Exception ex)
{
return Error(ex);
}
}
/// <summary>
/// อัพเดทข้อมูล ประวัติการศีกษา ผู้สมัคร
/// </summary>
/// <param name="educationId">รหัสประวัติการศีกษา</param>
/// <param name="candidateEducation">ข้อมูลประวัติการศีกษา</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอัพเดทข้อมูล ประวัติการศีกษา ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("career/{educationId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> UpdateAsyncEducation(string educationId, CandidateEducationResponseItem candidateEducation)
{
try
{
await _candidateService.UpdateAsyncEducation(educationId, candidateEducation);
return Success();
}
catch (Exception ex)
{
return Error(ex);
}
}
/// <summary>
/// ผู้สมัครทำการสมัครสอบ
/// </summary>
/// <param name="examId">รหัสการสมัคร</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการผู้สมัครทำการสมัครสอบ สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("register/{examId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> RegisterCandidateService(string examId)
{
try
{
await _candidateService.RegisterCandidateService(examId);
return Success();
}
catch (Exception ex)
{
return Error(ex);
}
}
#endregion
}
}

View file

@ -2,6 +2,7 @@
using BMA.EHR.Recurit.Exam.Service.Services; using BMA.EHR.Recurit.Exam.Service.Services;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
namespace BMA.EHR.Recurit.Exam.Service.Controllers namespace BMA.EHR.Recurit.Exam.Service.Controllers
{ {
@ -10,6 +11,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
[ApiController] [ApiController]
[Produces("application/json")] [Produces("application/json")]
[Authorize] [Authorize]
[SwaggerTag("จัดการข้อมูลระดับการศึกษา เพื่อนำไปใช้งานในระบบ")]
public class EducationLevelController : BaseController public class EducationLevelController : BaseController
{ {
#region " Fields " #region " Fields "

View file

@ -2,6 +2,7 @@ using BMA.EHR.Recurit.Exam.Service.Response;
using BMA.EHR.Recurit.Exam.Service.Services; using BMA.EHR.Recurit.Exam.Service.Services;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
namespace BMA.EHR.Recurit.Exam.Service.Controllers namespace BMA.EHR.Recurit.Exam.Service.Controllers
{ {
@ -10,6 +11,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
[ApiController] [ApiController]
[Produces("application/json")] [Produces("application/json")]
[Authorize] [Authorize]
[SwaggerTag("จัดการข้อมูลคำนำหน้า เพื่อนำไปใช้งานในระบบ")]
public class PrefixController : BaseController public class PrefixController : BaseController
{ {
#region " Fields " #region " Fields "

View file

@ -2,7 +2,7 @@
using BMA.EHR.Recurit.Exam.Service.Services; using BMA.EHR.Recurit.Exam.Service.Services;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
namespace BMA.EHR.Recurit.Exam.Service.Controllers namespace BMA.EHR.Recurit.Exam.Service.Controllers
{ {
@ -11,6 +11,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
[ApiController] [ApiController]
[Produces("application/json")] [Produces("application/json")]
[Authorize] [Authorize]
[SwaggerTag("จัดการข้อมูลสถานะภาพ เพื่อนำไปใช้งานในระบบ")]
public class RelationshipController : BaseController public class RelationshipController : BaseController
{ {
#region " Fields " #region " Fields "

View file

@ -2,6 +2,7 @@
using BMA.EHR.Recurit.Exam.Service.Services; using BMA.EHR.Recurit.Exam.Service.Services;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
namespace BMA.EHR.Recurit.Exam.Service.Controllers namespace BMA.EHR.Recurit.Exam.Service.Controllers
{ {
@ -10,6 +11,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
[ApiController] [ApiController]
[Produces("application/json")] [Produces("application/json")]
[Authorize] [Authorize]
[SwaggerTag("จัดการข้อมูลศาสนา เพื่อนำไปใช้งานในระบบ")]
public class ReligionController : BaseController public class ReligionController : BaseController
{ {
#region " Fields " #region " Fields "

19
Core/GlobalMessages.cs Normal file
View file

@ -0,0 +1,19 @@
namespace BMA.EHR.Recurit.Exam.Service.Core
{
public class GlobalMessages
{
public const string DataExist = "มีข้อมูลดังกล่าวอยู่ในระบบแล้ว";
public const string NameDupicate = "ชื่อวันหยุดนี้มีอยู่ในระบบอยู่แล้ว";
public const string ExamNotFound = "ไม่พบข้อมูลการรับสมัครสอบ";
public const string CandidateNotFound = "ไม่พบข้อมูลผู้สมัครสอบ";
public const string CareerNotFound = "ไม่พบข้อมูลประวัติการทำงาน/ฝึกงาน";
public const string EducationNotFound = "ไม่พบข้อมูลประวัติการศีกษา";
public const string DistrictNotFound = "ไม่พบข้อมูลเขต/อำเภอ";
public const string EducationLevelNotFound = "ไม่พบข้อมูลวุฒิการศีกษา";
public const string PrefixNotFound = "ไม่พบข้อมูลคำนำหน้า";
public const string ProvinceNotFound = "ไม่พบข้อมูลจังหวัด";
public const string RelationshipNotFound = "ไม่พบข้อมูลสถานะภาพ";
public const string ReligionNotFound = "ไม่พบข้อมูลศาสนา";
public const string SubDistrictNotFound = "ไม่พบข้อมูลตำบล/แขวง";
}
}

39
Core/HolidayHelper.cs Normal file
View file

@ -0,0 +1,39 @@
namespace BMA.EHR.Recurit.Exam.Service.Core
{
public static class HolidayHelper
{
public static bool IsHoliday(DateTime date, List<DateTime> holidays)
{
return holidays.Contains(date);
}
public static bool IsWeekend(DateTime date)
{
return date.DayOfWeek == DayOfWeek.Saturday
|| date.DayOfWeek == DayOfWeek.Sunday;
}
public static bool IsWeekend6Days(DateTime date)
{
return date.DayOfWeek == DayOfWeek.Sunday;
}
public static DateTime GetNextWorkingDay(DateTime date, List<DateTime> holidays)
{
do
{
date = date.AddDays(1);
} while (IsHoliday(date, holidays) || IsWeekend(date));
return date;
}
public static DateTime GetNextWorkingDay6Days(DateTime date, List<DateTime> holidays)
{
do
{
date = date.AddDays(1);
} while (IsHoliday(date, holidays) || IsWeekend6Days(date));
return date;
}
}
}

View file

@ -28,5 +28,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Data
public DbSet<SubDistrict> SubDistricts { get; set; } public DbSet<SubDistrict> SubDistricts { get; set; }
public DbSet<PeriodExam> PeriodExams { get; set; }
public DbSet<Candidate> Candidates { get; set; }
public DbSet<Career> Careers { get; set; }
public DbSet<Education> Educations { get; set; }
} }
} }

View file

@ -19,6 +19,360 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasAnnotation("ProductVersion", "7.0.4") .HasAnnotation("ProductVersion", "7.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 64); .HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Candidate", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime?>("CitizenDate")
.HasColumnType("datetime(6)")
.HasComment("วันที่ออกบัตร");
b.Property<Guid?>("CitizenDistrictId")
.HasColumnType("char(36)");
b.Property<string>("CitizenId")
.HasMaxLength(20)
.HasColumnType("varchar(20)")
.HasComment("เลขประจำตัวประชาชน");
b.Property<Guid?>("CitizenProvinceId")
.HasColumnType("char(36)");
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>("CurrentAddress")
.HasColumnType("longtext")
.HasComment("ที่อยู่ปัจจุบัน");
b.Property<Guid?>("CurrentDistrictId")
.HasColumnType("char(36)");
b.Property<Guid?>("CurrentProvinceId")
.HasColumnType("char(36)");
b.Property<Guid?>("CurrentSubDistrictId")
.HasColumnType("char(36)");
b.Property<string>("CurrentZipCode")
.HasMaxLength(10)
.HasColumnType("varchar(10)")
.HasComment("รหัสไปรษณีย์ที่อยู่ปัจจุบัน");
b.Property<DateTime?>("DateOfBirth")
.HasMaxLength(40)
.HasColumnType("datetime(6)")
.HasComment("วันเกิด");
b.Property<string>("Email")
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasComment("อีเมล");
b.Property<string>("FatherFirstName")
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasComment("ชื่อจริงบิดา");
b.Property<string>("FatherLastName")
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasComment("นามสกุลบิดา");
b.Property<Guid?>("FatherPrefixId")
.HasColumnType("char(36)");
b.Property<string>("FirstName")
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasColumnOrder(1)
.HasComment("ชื่อจริง");
b.Property<string>("Knowledge")
.HasColumnType("longtext")
.HasComment("ความสามารถพิเศษ");
b.Property<string>("LastName")
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasColumnOrder(2)
.HasComment("นามสกุล");
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<bool?>("Marry")
.HasColumnType("tinyint(1)")
.HasComment("คู่สมรส");
b.Property<string>("MarryFirstName")
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasComment("ชื่อจริงคู่สมรส");
b.Property<string>("MarryLastName")
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasComment("นามสกุลคู่สมรส");
b.Property<Guid?>("MarryPrefixId")
.HasColumnType("char(36)");
b.Property<string>("MobilePhone")
.HasMaxLength(20)
.HasColumnType("varchar(20)")
.HasComment("โทรศัพท์มือถือ");
b.Property<string>("MotherFirstName")
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasComment("ชื่อจริงมารดา");
b.Property<string>("MotherLastName")
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasComment("นามสกุลมารดา");
b.Property<Guid?>("MotherPrefixId")
.HasColumnType("char(36)");
b.Property<string>("Nationality")
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(3)
.HasComment("สัญชาติ");
b.Property<string>("OccupationCompany")
.HasColumnType("longtext")
.HasComment("สำนัก/บริษัท บริษัท");
b.Property<string>("OccupationDepartment")
.HasColumnType("longtext")
.HasComment("กอง/ฝ่าย บริษัท");
b.Property<string>("OccupationEmail")
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasComment("อีเมล บริษัท");
b.Property<string>("OccupationTelephone")
.HasMaxLength(20)
.HasColumnType("varchar(20)")
.HasComment("โทรศัพท์ บริษัท");
b.Property<string>("OccupationType")
.HasColumnType("longtext")
.HasComment("ประเภทอาชีพที่ทำงานมาก่อน");
b.Property<Guid>("PeriodExamId")
.HasColumnType("char(36)");
b.Property<Guid?>("PrefixId")
.HasColumnType("char(36)");
b.Property<string>("RegistAddress")
.HasColumnType("longtext")
.HasComment("ที่อยู่ตามทะเบียนบ้าน");
b.Property<Guid?>("RegistDistrictId")
.HasColumnType("char(36)");
b.Property<Guid?>("RegistProvinceId")
.HasColumnType("char(36)");
b.Property<bool?>("RegistSame")
.HasColumnType("tinyint(1)")
.HasComment("ที่อยู่ปัจจุบันเหมือนที่อยู่ตามทะเบียนบ้าน");
b.Property<Guid?>("RegistSubDistrictId")
.HasColumnType("char(36)");
b.Property<string>("RegistZipCode")
.HasMaxLength(10)
.HasColumnType("varchar(10)")
.HasComment("รหัสไปรษณีย์ที่อยู่ตามทะเบียนบ้าน");
b.Property<Guid?>("RelationshipId")
.HasColumnType("char(36)");
b.Property<string>("Telephone")
.HasMaxLength(20)
.HasColumnType("varchar(20)")
.HasComment("โทรศัพท์");
b.Property<string>("UserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasComment("User Id ผู้สมัคร");
b.Property<string>("status")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("varchar(20)")
.HasComment("สถานะผู้สมัคร");
b.HasKey("Id");
b.HasIndex("CitizenDistrictId");
b.HasIndex("CitizenProvinceId");
b.HasIndex("CurrentDistrictId");
b.HasIndex("CurrentProvinceId");
b.HasIndex("CurrentSubDistrictId");
b.HasIndex("FatherPrefixId");
b.HasIndex("MarryPrefixId");
b.HasIndex("MotherPrefixId");
b.HasIndex("PeriodExamId");
b.HasIndex("PrefixId");
b.HasIndex("RegistDistrictId");
b.HasIndex("RegistProvinceId");
b.HasIndex("RegistSubDistrictId");
b.HasIndex("RelationshipId");
b.ToTable("Candidates");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Career", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<Guid>("CandidateId")
.HasColumnType("char(36)");
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<DateTime>("DurationEnd")
.HasColumnType("datetime(6)")
.HasColumnOrder(2)
.HasComment("ระยะเวลาสิ้นสุด");
b.Property<DateTime>("DurationStart")
.HasColumnType("datetime(6)")
.HasColumnOrder(1)
.HasComment("ระยะเวลาเริ่ม");
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<string>("Name")
.IsRequired()
.HasColumnType("longtext")
.HasColumnOrder(3)
.HasComment("สถานที่ทำงาน/ฝึกงาน");
b.Property<string>("Position")
.IsRequired()
.HasColumnType("longtext")
.HasColumnOrder(4)
.HasComment("ตำแหน่ง/ลักษณะงาน");
b.Property<string>("Reason")
.IsRequired()
.HasColumnType("longtext")
.HasColumnOrder(6)
.HasComment("เหตุผลที่ออก");
b.Property<int>("Salary")
.HasMaxLength(20)
.HasColumnType("int")
.HasColumnOrder(5)
.HasComment("เงินเดือนสุดท้ายก่อนออก");
b.HasKey("Id");
b.HasIndex("CandidateId");
b.ToTable("Careers");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.District", b => modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.District", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -88,6 +442,96 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.ToTable("Districts"); b.ToTable("Districts");
}); });
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Education", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<Guid>("CandidateId")
.HasColumnType("char(36)");
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<DateTime>("DurationEnd")
.HasColumnType("datetime(6)")
.HasColumnOrder(2)
.HasComment("ระยะเวลาสิ้นสุด");
b.Property<DateTime>("DurationStart")
.HasColumnType("datetime(6)")
.HasColumnOrder(1)
.HasComment("ระยะเวลาเริ่ม");
b.Property<Guid>("EducationLevelId")
.HasColumnType("char(36)");
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<string>("Major")
.IsRequired()
.HasColumnType("longtext")
.HasColumnOrder(4)
.HasComment("สาขาวิชา/วิชาเอก");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext")
.HasColumnOrder(3)
.HasComment("ชื่อสถานศึกษา");
b.Property<int>("Scores")
.HasMaxLength(10)
.HasColumnType("int")
.HasColumnOrder(6)
.HasComment("คะแนนเฉลี่ยตลอดหลักสูตร");
b.HasKey("Id");
b.HasIndex("CandidateId");
b.HasIndex("EducationLevelId");
b.ToTable("Educations");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.EducationLevel", b => modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.EducationLevel", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -152,6 +596,86 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.ToTable("EducationLevels"); b.ToTable("EducationLevels");
}); });
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.PeriodExam", 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>("Detail")
.IsRequired()
.HasColumnType("longtext")
.HasColumnOrder(4)
.HasComment("รายละเอียดสมัครสอบ");
b.Property<DateTime>("EndDate")
.HasColumnType("datetime(6)")
.HasColumnOrder(3)
.HasComment("วันสิ้นสุด");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(5)
.HasComment("สถานะการใช้งาน");
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<string>("Name")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("varchar(150)")
.HasColumnOrder(1)
.HasComment("ชื่อการสอบ");
b.Property<DateTime>("StartDate")
.HasColumnType("datetime(6)")
.HasColumnOrder(2)
.HasComment("วันเริ่มสมัครสอบ");
b.HasKey("Id");
b.ToTable("PeriodExams");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Prefix", b => modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Prefix", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -484,6 +1008,106 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.ToTable("SubDistricts"); b.ToTable("SubDistricts");
}); });
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Candidate", b =>
{
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.District", "CitizenDistrict")
.WithMany()
.HasForeignKey("CitizenDistrictId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Province", "CitizenProvince")
.WithMany()
.HasForeignKey("CitizenProvinceId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.District", "CurrentDistrict")
.WithMany()
.HasForeignKey("CurrentDistrictId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Province", "CurrentProvince")
.WithMany()
.HasForeignKey("CurrentProvinceId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.SubDistrict", "CurrentSubDistrict")
.WithMany()
.HasForeignKey("CurrentSubDistrictId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Prefix", "FatherPrefix")
.WithMany()
.HasForeignKey("FatherPrefixId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Prefix", "MarryPrefix")
.WithMany()
.HasForeignKey("MarryPrefixId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Prefix", "MotherPrefix")
.WithMany()
.HasForeignKey("MotherPrefixId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.PeriodExam", "PeriodExam")
.WithMany()
.HasForeignKey("PeriodExamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Prefix", "Prefix")
.WithMany()
.HasForeignKey("PrefixId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.District", "RegistDistrict")
.WithMany()
.HasForeignKey("RegistDistrictId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Province", "RegistProvince")
.WithMany()
.HasForeignKey("RegistProvinceId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.SubDistrict", "RegistSubDistrict")
.WithMany()
.HasForeignKey("RegistSubDistrictId");
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Relationship", "Relationship")
.WithMany()
.HasForeignKey("RelationshipId");
b.Navigation("CitizenDistrict");
b.Navigation("CitizenProvince");
b.Navigation("CurrentDistrict");
b.Navigation("CurrentProvince");
b.Navigation("CurrentSubDistrict");
b.Navigation("FatherPrefix");
b.Navigation("MarryPrefix");
b.Navigation("MotherPrefix");
b.Navigation("PeriodExam");
b.Navigation("Prefix");
b.Navigation("RegistDistrict");
b.Navigation("RegistProvince");
b.Navigation("RegistSubDistrict");
b.Navigation("Relationship");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Career", b =>
{
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Candidate", "Candidate")
.WithMany()
.HasForeignKey("CandidateId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Candidate");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.District", b => modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.District", b =>
{ {
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Province", "Province") b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Province", "Province")
@ -493,6 +1117,25 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.Navigation("Province"); b.Navigation("Province");
}); });
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Education", b =>
{
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Candidate", "Candidate")
.WithMany()
.HasForeignKey("CandidateId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.EducationLevel", "EducationLevel")
.WithMany()
.HasForeignKey("EducationLevelId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Candidate");
b.Navigation("EducationLevel");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.SubDistrict", b => modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.SubDistrict", b =>
{ {
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.District", "District") 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,385 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recurit.Exam.Service.Migrations
{
/// <inheritdoc />
public partial class createtableCandidate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "PeriodExams",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
Name = table.Column<string>(type: "varchar(150)", maxLength: 150, nullable: false, comment: "ชื่อการสอบ")
.Annotation("MySql:CharSet", "utf8mb4"),
StartDate = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "วันเริ่มสมัครสอบ"),
EndDate = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "วันสิ้นสุด"),
Detail = table.Column<string>(type: "longtext", nullable: false, comment: "รายละเอียดสมัครสอบ")
.Annotation("MySql:CharSet", "utf8mb4"),
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
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")
},
constraints: table =>
{
table.PrimaryKey("PK_PeriodExams", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Candidates",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
FirstName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อจริง")
.Annotation("MySql:CharSet", "utf8mb4"),
LastName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "นามสกุล")
.Annotation("MySql:CharSet", "utf8mb4"),
Nationality = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "สัญชาติ")
.Annotation("MySql:CharSet", "utf8mb4"),
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"),
UserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ผู้สมัคร")
.Annotation("MySql:CharSet", "utf8mb4"),
PrefixId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
DateOfBirth = table.Column<DateTime>(type: "datetime(6)", maxLength: 40, nullable: true, comment: "วันเกิด"),
RelationshipId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
Email = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "อีเมล")
.Annotation("MySql:CharSet", "utf8mb4"),
CitizenId = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: false, comment: "เลขประจำตัวประชาชน")
.Annotation("MySql:CharSet", "utf8mb4"),
CitizenDistrictId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
CitizenProvinceId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
CitizenDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่ออกบัตร"),
Telephone = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: false, comment: "โทรศัพท์")
.Annotation("MySql:CharSet", "utf8mb4"),
MobilePhone = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: false, comment: "โทรศัพท์มือถือ")
.Annotation("MySql:CharSet", "utf8mb4"),
Knowledge = table.Column<string>(type: "longtext", nullable: false, comment: "ความสามารถพิเศษ")
.Annotation("MySql:CharSet", "utf8mb4"),
RegistAddress = table.Column<string>(type: "longtext", nullable: false, comment: "ที่อยู่ตามทะเบียนบ้าน")
.Annotation("MySql:CharSet", "utf8mb4"),
RegistProvinceId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
RegistDistrictId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
RegistSubDistrictId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
RegistZipCode = table.Column<string>(type: "varchar(10)", maxLength: 10, nullable: false, comment: "รหัสไปรษณีย์ที่อยู่ตามทะเบียนบ้าน")
.Annotation("MySql:CharSet", "utf8mb4"),
RegistSame = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "ที่อยู่ปัจจุบันเหมือนที่อยู่ตามทะเบียนบ้าน"),
CurrentAddress = table.Column<string>(type: "longtext", nullable: false, comment: "ที่อยู่ปัจจุบัน")
.Annotation("MySql:CharSet", "utf8mb4"),
CurrentProvinceId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
CurrentDistrictId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
CurrentSubDistrictId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
CurrentZipCode = table.Column<string>(type: "varchar(10)", maxLength: 10, nullable: false, comment: "รหัสไปรษณีย์ที่อยู่ปัจจุบัน")
.Annotation("MySql:CharSet", "utf8mb4"),
Marry = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "คู่สมรส"),
MarryPrefixId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
MarryFirstName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อจริงคู่สมรส")
.Annotation("MySql:CharSet", "utf8mb4"),
MarryLastName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "นามสกุลคู่สมรส")
.Annotation("MySql:CharSet", "utf8mb4"),
FatherPrefixId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
FatherFirstName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อจริงบิดา")
.Annotation("MySql:CharSet", "utf8mb4"),
FatherLastName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "นามสกุลบิดา")
.Annotation("MySql:CharSet", "utf8mb4"),
MotherPrefixId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
MotherFirstName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อจริงมารดา")
.Annotation("MySql:CharSet", "utf8mb4"),
MotherLastName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "นามสกุลมารดา")
.Annotation("MySql:CharSet", "utf8mb4"),
OccupationType = table.Column<string>(type: "longtext", nullable: false, comment: "ประเภทอาชีพที่ทำงานมาก่อน")
.Annotation("MySql:CharSet", "utf8mb4"),
OccupationCompany = table.Column<string>(type: "longtext", nullable: false, comment: "สำนัก/บริษัท บริษัท")
.Annotation("MySql:CharSet", "utf8mb4"),
OccupationDepartment = table.Column<string>(type: "longtext", nullable: false, comment: "กอง/ฝ่าย บริษัท")
.Annotation("MySql:CharSet", "utf8mb4"),
OccupationEmail = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "อีเมล บริษัท")
.Annotation("MySql:CharSet", "utf8mb4"),
OccupationTelephone = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: false, comment: "โทรศัพท์ บริษัท")
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_Candidates", x => x.Id);
table.ForeignKey(
name: "FK_Candidates_Districts_CitizenDistrictId",
column: x => x.CitizenDistrictId,
principalTable: "Districts",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Candidates_Districts_CurrentDistrictId",
column: x => x.CurrentDistrictId,
principalTable: "Districts",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Candidates_Districts_RegistDistrictId",
column: x => x.RegistDistrictId,
principalTable: "Districts",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Candidates_PeriodExams_PeriodExamId",
column: x => x.PeriodExamId,
principalTable: "PeriodExams",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Candidates_Prefixes_FatherPrefixId",
column: x => x.FatherPrefixId,
principalTable: "Prefixes",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Candidates_Prefixes_MarryPrefixId",
column: x => x.MarryPrefixId,
principalTable: "Prefixes",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Candidates_Prefixes_MotherPrefixId",
column: x => x.MotherPrefixId,
principalTable: "Prefixes",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Candidates_Prefixes_PrefixId",
column: x => x.PrefixId,
principalTable: "Prefixes",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Candidates_Provinces_CitizenProvinceId",
column: x => x.CitizenProvinceId,
principalTable: "Provinces",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Candidates_Provinces_CurrentProvinceId",
column: x => x.CurrentProvinceId,
principalTable: "Provinces",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Candidates_Provinces_RegistProvinceId",
column: x => x.RegistProvinceId,
principalTable: "Provinces",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Candidates_Relationships_RelationshipId",
column: x => x.RelationshipId,
principalTable: "Relationships",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Candidates_SubDistricts_CurrentSubDistrictId",
column: x => x.CurrentSubDistrictId,
principalTable: "SubDistricts",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Candidates_SubDistricts_RegistSubDistrictId",
column: x => x.RegistSubDistrictId,
principalTable: "SubDistricts",
principalColumn: "Id");
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Careers",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
DurationStart = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "ระยะเวลาเริ่ม"),
DurationEnd = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "ระยะเวลาสิ้นสุด"),
Name = table.Column<string>(type: "longtext", nullable: false, comment: "สถานที่ทำงาน/ฝึกงาน")
.Annotation("MySql:CharSet", "utf8mb4"),
Position = table.Column<string>(type: "longtext", nullable: false, comment: "ตำแหน่ง/ลักษณะงาน")
.Annotation("MySql:CharSet", "utf8mb4"),
Salary = table.Column<int>(type: "int", maxLength: 20, nullable: false, comment: "เงินเดือนสุดท้ายก่อนออก"),
Reason = table.Column<string>(type: "longtext", nullable: false, comment: "เหตุผลที่ออก")
.Annotation("MySql:CharSet", "utf8mb4"),
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"),
CandidateId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_Careers", x => x.Id);
table.ForeignKey(
name: "FK_Careers_Candidates_CandidateId",
column: x => x.CandidateId,
principalTable: "Candidates",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Educations",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
DurationStart = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "ระยะเวลาเริ่ม"),
DurationEnd = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "ระยะเวลาสิ้นสุด"),
Name = table.Column<string>(type: "longtext", nullable: false, comment: "ชื่อสถานศึกษา")
.Annotation("MySql:CharSet", "utf8mb4"),
Major = table.Column<string>(type: "longtext", nullable: false, comment: "สาขาวิชา/วิชาเอก")
.Annotation("MySql:CharSet", "utf8mb4"),
Scores = table.Column<int>(type: "int", maxLength: 10, nullable: false, comment: "คะแนนเฉลี่ยตลอดหลักสูตร"),
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"),
CandidateId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
EducationLevelId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_Educations", x => x.Id);
table.ForeignKey(
name: "FK_Educations_Candidates_CandidateId",
column: x => x.CandidateId,
principalTable: "Candidates",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Educations_EducationLevels_EducationLevelId",
column: x => x.EducationLevelId,
principalTable: "EducationLevels",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_Candidates_CitizenDistrictId",
table: "Candidates",
column: "CitizenDistrictId");
migrationBuilder.CreateIndex(
name: "IX_Candidates_CitizenProvinceId",
table: "Candidates",
column: "CitizenProvinceId");
migrationBuilder.CreateIndex(
name: "IX_Candidates_CurrentDistrictId",
table: "Candidates",
column: "CurrentDistrictId");
migrationBuilder.CreateIndex(
name: "IX_Candidates_CurrentProvinceId",
table: "Candidates",
column: "CurrentProvinceId");
migrationBuilder.CreateIndex(
name: "IX_Candidates_CurrentSubDistrictId",
table: "Candidates",
column: "CurrentSubDistrictId");
migrationBuilder.CreateIndex(
name: "IX_Candidates_FatherPrefixId",
table: "Candidates",
column: "FatherPrefixId");
migrationBuilder.CreateIndex(
name: "IX_Candidates_MarryPrefixId",
table: "Candidates",
column: "MarryPrefixId");
migrationBuilder.CreateIndex(
name: "IX_Candidates_MotherPrefixId",
table: "Candidates",
column: "MotherPrefixId");
migrationBuilder.CreateIndex(
name: "IX_Candidates_PeriodExamId",
table: "Candidates",
column: "PeriodExamId");
migrationBuilder.CreateIndex(
name: "IX_Candidates_PrefixId",
table: "Candidates",
column: "PrefixId");
migrationBuilder.CreateIndex(
name: "IX_Candidates_RegistDistrictId",
table: "Candidates",
column: "RegistDistrictId");
migrationBuilder.CreateIndex(
name: "IX_Candidates_RegistProvinceId",
table: "Candidates",
column: "RegistProvinceId");
migrationBuilder.CreateIndex(
name: "IX_Candidates_RegistSubDistrictId",
table: "Candidates",
column: "RegistSubDistrictId");
migrationBuilder.CreateIndex(
name: "IX_Candidates_RelationshipId",
table: "Candidates",
column: "RelationshipId");
migrationBuilder.CreateIndex(
name: "IX_Careers_CandidateId",
table: "Careers",
column: "CandidateId");
migrationBuilder.CreateIndex(
name: "IX_Educations_CandidateId",
table: "Educations",
column: "CandidateId");
migrationBuilder.CreateIndex(
name: "IX_Educations_EducationLevelId",
table: "Educations",
column: "EducationLevelId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Careers");
migrationBuilder.DropTable(
name: "Educations");
migrationBuilder.DropTable(
name: "Candidates");
migrationBuilder.DropTable(
name: "PeriodExams");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,866 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recurit.Exam.Service.Migrations
{
/// <inheritdoc />
public partial class updatetableCandidatefeildnull : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Telephone",
table: "Candidates",
type: "varchar(20)",
maxLength: 20,
nullable: true,
comment: "โทรศัพท์",
oldClrType: typeof(string),
oldType: "varchar(20)",
oldMaxLength: 20,
oldComment: "โทรศัพท์")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "RegistZipCode",
table: "Candidates",
type: "varchar(10)",
maxLength: 10,
nullable: true,
comment: "รหัสไปรษณีย์ที่อยู่ตามทะเบียนบ้าน",
oldClrType: typeof(string),
oldType: "varchar(10)",
oldMaxLength: 10,
oldComment: "รหัสไปรษณีย์ที่อยู่ตามทะเบียนบ้าน")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<bool>(
name: "RegistSame",
table: "Candidates",
type: "tinyint(1)",
nullable: true,
comment: "ที่อยู่ปัจจุบันเหมือนที่อยู่ตามทะเบียนบ้าน",
oldClrType: typeof(bool),
oldType: "tinyint(1)",
oldComment: "ที่อยู่ปัจจุบันเหมือนที่อยู่ตามทะเบียนบ้าน");
migrationBuilder.AlterColumn<string>(
name: "RegistAddress",
table: "Candidates",
type: "longtext",
nullable: true,
comment: "ที่อยู่ตามทะเบียนบ้าน",
oldClrType: typeof(string),
oldType: "longtext",
oldComment: "ที่อยู่ตามทะเบียนบ้าน")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "OccupationType",
table: "Candidates",
type: "longtext",
nullable: true,
comment: "ประเภทอาชีพที่ทำงานมาก่อน",
oldClrType: typeof(string),
oldType: "longtext",
oldComment: "ประเภทอาชีพที่ทำงานมาก่อน")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "OccupationTelephone",
table: "Candidates",
type: "varchar(20)",
maxLength: 20,
nullable: true,
comment: "โทรศัพท์ บริษัท",
oldClrType: typeof(string),
oldType: "varchar(20)",
oldMaxLength: 20,
oldComment: "โทรศัพท์ บริษัท")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "OccupationEmail",
table: "Candidates",
type: "varchar(200)",
maxLength: 200,
nullable: true,
comment: "อีเมล บริษัท",
oldClrType: typeof(string),
oldType: "varchar(200)",
oldMaxLength: 200,
oldComment: "อีเมล บริษัท")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "OccupationDepartment",
table: "Candidates",
type: "longtext",
nullable: true,
comment: "กอง/ฝ่าย บริษัท",
oldClrType: typeof(string),
oldType: "longtext",
oldComment: "กอง/ฝ่าย บริษัท")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "OccupationCompany",
table: "Candidates",
type: "longtext",
nullable: true,
comment: "สำนัก/บริษัท บริษัท",
oldClrType: typeof(string),
oldType: "longtext",
oldComment: "สำนัก/บริษัท บริษัท")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Nationality",
table: "Candidates",
type: "varchar(40)",
maxLength: 40,
nullable: true,
comment: "สัญชาติ",
oldClrType: typeof(string),
oldType: "varchar(40)",
oldMaxLength: 40,
oldComment: "สัญชาติ")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "MotherLastName",
table: "Candidates",
type: "varchar(100)",
maxLength: 100,
nullable: true,
comment: "นามสกุลมารดา",
oldClrType: typeof(string),
oldType: "varchar(100)",
oldMaxLength: 100,
oldComment: "นามสกุลมารดา")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "MotherFirstName",
table: "Candidates",
type: "varchar(100)",
maxLength: 100,
nullable: true,
comment: "ชื่อจริงมารดา",
oldClrType: typeof(string),
oldType: "varchar(100)",
oldMaxLength: 100,
oldComment: "ชื่อจริงมารดา")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "MobilePhone",
table: "Candidates",
type: "varchar(20)",
maxLength: 20,
nullable: true,
comment: "โทรศัพท์มือถือ",
oldClrType: typeof(string),
oldType: "varchar(20)",
oldMaxLength: 20,
oldComment: "โทรศัพท์มือถือ")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "MarryLastName",
table: "Candidates",
type: "varchar(100)",
maxLength: 100,
nullable: true,
comment: "นามสกุลคู่สมรส",
oldClrType: typeof(string),
oldType: "varchar(100)",
oldMaxLength: 100,
oldComment: "นามสกุลคู่สมรส")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "MarryFirstName",
table: "Candidates",
type: "varchar(100)",
maxLength: 100,
nullable: true,
comment: "ชื่อจริงคู่สมรส",
oldClrType: typeof(string),
oldType: "varchar(100)",
oldMaxLength: 100,
oldComment: "ชื่อจริงคู่สมรส")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<bool>(
name: "Marry",
table: "Candidates",
type: "tinyint(1)",
nullable: true,
comment: "คู่สมรส",
oldClrType: typeof(bool),
oldType: "tinyint(1)",
oldComment: "คู่สมรส");
migrationBuilder.AlterColumn<string>(
name: "LastName",
table: "Candidates",
type: "varchar(100)",
maxLength: 100,
nullable: true,
comment: "นามสกุล",
oldClrType: typeof(string),
oldType: "varchar(100)",
oldMaxLength: 100,
oldComment: "นามสกุล")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Knowledge",
table: "Candidates",
type: "longtext",
nullable: true,
comment: "ความสามารถพิเศษ",
oldClrType: typeof(string),
oldType: "longtext",
oldComment: "ความสามารถพิเศษ")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "FirstName",
table: "Candidates",
type: "varchar(100)",
maxLength: 100,
nullable: true,
comment: "ชื่อจริง",
oldClrType: typeof(string),
oldType: "varchar(100)",
oldMaxLength: 100,
oldComment: "ชื่อจริง")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "FatherLastName",
table: "Candidates",
type: "varchar(100)",
maxLength: 100,
nullable: true,
comment: "นามสกุลบิดา",
oldClrType: typeof(string),
oldType: "varchar(100)",
oldMaxLength: 100,
oldComment: "นามสกุลบิดา")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "FatherFirstName",
table: "Candidates",
type: "varchar(100)",
maxLength: 100,
nullable: true,
comment: "ชื่อจริงบิดา",
oldClrType: typeof(string),
oldType: "varchar(100)",
oldMaxLength: 100,
oldComment: "ชื่อจริงบิดา")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Email",
table: "Candidates",
type: "varchar(200)",
maxLength: 200,
nullable: true,
comment: "อีเมล",
oldClrType: typeof(string),
oldType: "varchar(200)",
oldMaxLength: 200,
oldComment: "อีเมล")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "CurrentZipCode",
table: "Candidates",
type: "varchar(10)",
maxLength: 10,
nullable: true,
comment: "รหัสไปรษณีย์ที่อยู่ปัจจุบัน",
oldClrType: typeof(string),
oldType: "varchar(10)",
oldMaxLength: 10,
oldComment: "รหัสไปรษณีย์ที่อยู่ปัจจุบัน")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "CurrentAddress",
table: "Candidates",
type: "longtext",
nullable: true,
comment: "ที่อยู่ปัจจุบัน",
oldClrType: typeof(string),
oldType: "longtext",
oldComment: "ที่อยู่ปัจจุบัน")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "CitizenId",
table: "Candidates",
type: "varchar(20)",
maxLength: 20,
nullable: true,
comment: "เลขประจำตัวประชาชน",
oldClrType: typeof(string),
oldType: "varchar(20)",
oldMaxLength: 20,
oldComment: "เลขประจำตัวประชาชน")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "Telephone",
keyValue: null,
column: "Telephone",
value: "");
migrationBuilder.AlterColumn<string>(
name: "Telephone",
table: "Candidates",
type: "varchar(20)",
maxLength: 20,
nullable: false,
comment: "โทรศัพท์",
oldClrType: typeof(string),
oldType: "varchar(20)",
oldMaxLength: 20,
oldNullable: true,
oldComment: "โทรศัพท์")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "RegistZipCode",
keyValue: null,
column: "RegistZipCode",
value: "");
migrationBuilder.AlterColumn<string>(
name: "RegistZipCode",
table: "Candidates",
type: "varchar(10)",
maxLength: 10,
nullable: false,
comment: "รหัสไปรษณีย์ที่อยู่ตามทะเบียนบ้าน",
oldClrType: typeof(string),
oldType: "varchar(10)",
oldMaxLength: 10,
oldNullable: true,
oldComment: "รหัสไปรษณีย์ที่อยู่ตามทะเบียนบ้าน")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<bool>(
name: "RegistSame",
table: "Candidates",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "ที่อยู่ปัจจุบันเหมือนที่อยู่ตามทะเบียนบ้าน",
oldClrType: typeof(bool),
oldType: "tinyint(1)",
oldNullable: true,
oldComment: "ที่อยู่ปัจจุบันเหมือนที่อยู่ตามทะเบียนบ้าน");
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "RegistAddress",
keyValue: null,
column: "RegistAddress",
value: "");
migrationBuilder.AlterColumn<string>(
name: "RegistAddress",
table: "Candidates",
type: "longtext",
nullable: false,
comment: "ที่อยู่ตามทะเบียนบ้าน",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "ที่อยู่ตามทะเบียนบ้าน")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "OccupationType",
keyValue: null,
column: "OccupationType",
value: "");
migrationBuilder.AlterColumn<string>(
name: "OccupationType",
table: "Candidates",
type: "longtext",
nullable: false,
comment: "ประเภทอาชีพที่ทำงานมาก่อน",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "ประเภทอาชีพที่ทำงานมาก่อน")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "OccupationTelephone",
keyValue: null,
column: "OccupationTelephone",
value: "");
migrationBuilder.AlterColumn<string>(
name: "OccupationTelephone",
table: "Candidates",
type: "varchar(20)",
maxLength: 20,
nullable: false,
comment: "โทรศัพท์ บริษัท",
oldClrType: typeof(string),
oldType: "varchar(20)",
oldMaxLength: 20,
oldNullable: true,
oldComment: "โทรศัพท์ บริษัท")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "OccupationEmail",
keyValue: null,
column: "OccupationEmail",
value: "");
migrationBuilder.AlterColumn<string>(
name: "OccupationEmail",
table: "Candidates",
type: "varchar(200)",
maxLength: 200,
nullable: false,
comment: "อีเมล บริษัท",
oldClrType: typeof(string),
oldType: "varchar(200)",
oldMaxLength: 200,
oldNullable: true,
oldComment: "อีเมล บริษัท")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "OccupationDepartment",
keyValue: null,
column: "OccupationDepartment",
value: "");
migrationBuilder.AlterColumn<string>(
name: "OccupationDepartment",
table: "Candidates",
type: "longtext",
nullable: false,
comment: "กอง/ฝ่าย บริษัท",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "กอง/ฝ่าย บริษัท")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "OccupationCompany",
keyValue: null,
column: "OccupationCompany",
value: "");
migrationBuilder.AlterColumn<string>(
name: "OccupationCompany",
table: "Candidates",
type: "longtext",
nullable: false,
comment: "สำนัก/บริษัท บริษัท",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "สำนัก/บริษัท บริษัท")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "Nationality",
keyValue: null,
column: "Nationality",
value: "");
migrationBuilder.AlterColumn<string>(
name: "Nationality",
table: "Candidates",
type: "varchar(40)",
maxLength: 40,
nullable: false,
comment: "สัญชาติ",
oldClrType: typeof(string),
oldType: "varchar(40)",
oldMaxLength: 40,
oldNullable: true,
oldComment: "สัญชาติ")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "MotherLastName",
keyValue: null,
column: "MotherLastName",
value: "");
migrationBuilder.AlterColumn<string>(
name: "MotherLastName",
table: "Candidates",
type: "varchar(100)",
maxLength: 100,
nullable: false,
comment: "นามสกุลมารดา",
oldClrType: typeof(string),
oldType: "varchar(100)",
oldMaxLength: 100,
oldNullable: true,
oldComment: "นามสกุลมารดา")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "MotherFirstName",
keyValue: null,
column: "MotherFirstName",
value: "");
migrationBuilder.AlterColumn<string>(
name: "MotherFirstName",
table: "Candidates",
type: "varchar(100)",
maxLength: 100,
nullable: false,
comment: "ชื่อจริงมารดา",
oldClrType: typeof(string),
oldType: "varchar(100)",
oldMaxLength: 100,
oldNullable: true,
oldComment: "ชื่อจริงมารดา")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "MobilePhone",
keyValue: null,
column: "MobilePhone",
value: "");
migrationBuilder.AlterColumn<string>(
name: "MobilePhone",
table: "Candidates",
type: "varchar(20)",
maxLength: 20,
nullable: false,
comment: "โทรศัพท์มือถือ",
oldClrType: typeof(string),
oldType: "varchar(20)",
oldMaxLength: 20,
oldNullable: true,
oldComment: "โทรศัพท์มือถือ")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "MarryLastName",
keyValue: null,
column: "MarryLastName",
value: "");
migrationBuilder.AlterColumn<string>(
name: "MarryLastName",
table: "Candidates",
type: "varchar(100)",
maxLength: 100,
nullable: false,
comment: "นามสกุลคู่สมรส",
oldClrType: typeof(string),
oldType: "varchar(100)",
oldMaxLength: 100,
oldNullable: true,
oldComment: "นามสกุลคู่สมรส")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "MarryFirstName",
keyValue: null,
column: "MarryFirstName",
value: "");
migrationBuilder.AlterColumn<string>(
name: "MarryFirstName",
table: "Candidates",
type: "varchar(100)",
maxLength: 100,
nullable: false,
comment: "ชื่อจริงคู่สมรส",
oldClrType: typeof(string),
oldType: "varchar(100)",
oldMaxLength: 100,
oldNullable: true,
oldComment: "ชื่อจริงคู่สมรส")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<bool>(
name: "Marry",
table: "Candidates",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "คู่สมรส",
oldClrType: typeof(bool),
oldType: "tinyint(1)",
oldNullable: true,
oldComment: "คู่สมรส");
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "LastName",
keyValue: null,
column: "LastName",
value: "");
migrationBuilder.AlterColumn<string>(
name: "LastName",
table: "Candidates",
type: "varchar(100)",
maxLength: 100,
nullable: false,
comment: "นามสกุล",
oldClrType: typeof(string),
oldType: "varchar(100)",
oldMaxLength: 100,
oldNullable: true,
oldComment: "นามสกุล")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "Knowledge",
keyValue: null,
column: "Knowledge",
value: "");
migrationBuilder.AlterColumn<string>(
name: "Knowledge",
table: "Candidates",
type: "longtext",
nullable: false,
comment: "ความสามารถพิเศษ",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "ความสามารถพิเศษ")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "FirstName",
keyValue: null,
column: "FirstName",
value: "");
migrationBuilder.AlterColumn<string>(
name: "FirstName",
table: "Candidates",
type: "varchar(100)",
maxLength: 100,
nullable: false,
comment: "ชื่อจริง",
oldClrType: typeof(string),
oldType: "varchar(100)",
oldMaxLength: 100,
oldNullable: true,
oldComment: "ชื่อจริง")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "FatherLastName",
keyValue: null,
column: "FatherLastName",
value: "");
migrationBuilder.AlterColumn<string>(
name: "FatherLastName",
table: "Candidates",
type: "varchar(100)",
maxLength: 100,
nullable: false,
comment: "นามสกุลบิดา",
oldClrType: typeof(string),
oldType: "varchar(100)",
oldMaxLength: 100,
oldNullable: true,
oldComment: "นามสกุลบิดา")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "FatherFirstName",
keyValue: null,
column: "FatherFirstName",
value: "");
migrationBuilder.AlterColumn<string>(
name: "FatherFirstName",
table: "Candidates",
type: "varchar(100)",
maxLength: 100,
nullable: false,
comment: "ชื่อจริงบิดา",
oldClrType: typeof(string),
oldType: "varchar(100)",
oldMaxLength: 100,
oldNullable: true,
oldComment: "ชื่อจริงบิดา")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "Email",
keyValue: null,
column: "Email",
value: "");
migrationBuilder.AlterColumn<string>(
name: "Email",
table: "Candidates",
type: "varchar(200)",
maxLength: 200,
nullable: false,
comment: "อีเมล",
oldClrType: typeof(string),
oldType: "varchar(200)",
oldMaxLength: 200,
oldNullable: true,
oldComment: "อีเมล")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "CurrentZipCode",
keyValue: null,
column: "CurrentZipCode",
value: "");
migrationBuilder.AlterColumn<string>(
name: "CurrentZipCode",
table: "Candidates",
type: "varchar(10)",
maxLength: 10,
nullable: false,
comment: "รหัสไปรษณีย์ที่อยู่ปัจจุบัน",
oldClrType: typeof(string),
oldType: "varchar(10)",
oldMaxLength: 10,
oldNullable: true,
oldComment: "รหัสไปรษณีย์ที่อยู่ปัจจุบัน")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "CurrentAddress",
keyValue: null,
column: "CurrentAddress",
value: "");
migrationBuilder.AlterColumn<string>(
name: "CurrentAddress",
table: "Candidates",
type: "longtext",
nullable: false,
comment: "ที่อยู่ปัจจุบัน",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "ที่อยู่ปัจจุบัน")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Candidates",
keyColumn: "CitizenId",
keyValue: null,
column: "CitizenId",
value: "");
migrationBuilder.AlterColumn<string>(
name: "CitizenId",
table: "Candidates",
type: "varchar(20)",
maxLength: 20,
nullable: false,
comment: "เลขประจำตัวประชาชน",
oldClrType: typeof(string),
oldType: "varchar(20)",
oldMaxLength: 20,
oldNullable: true,
oldComment: "เลขประจำตัวประชาชน")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,32 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recurit.Exam.Service.Migrations
{
/// <inheritdoc />
public partial class updatetableCandidatestatus : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "status",
table: "Candidates",
type: "varchar(20)",
maxLength: 20,
nullable: false,
defaultValue: "",
comment: "สถานะผู้สมัคร")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "status",
table: "Candidates");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recurit.Exam.Service.Migrations
{
/// <inheritdoc />
public partial class updatetableCandidateconsend : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "consend",
table: "Candidates",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "ยอมรับเงื่อนไข");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "consend",
table: "Candidates");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recurit.Exam.Service.Migrations
{
/// <inheritdoc />
public partial class deletetableCandidatefeildnull : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "consend",
table: "Candidates");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "consend",
table: "Candidates",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "ยอมรับเงื่อนไข");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recurit.Exam.Service.Migrations
{
/// <inheritdoc />
public partial class UpdatetableCandidatemarrynull : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

147
Models/Candidate.cs Normal file
View file

@ -0,0 +1,147 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
namespace BMA.EHR.Recurit.Exam.Service.Models
{
public class Candidate : EntityBase
{
[Required, Comment("Id การสอบ")]
public virtual PeriodExam? PeriodExam { get; set; }
[Required, MaxLength(40), Comment("User Id ผู้สมัคร")]
public string UserId { get; set; } = string.Empty;
[Required, MaxLength(20), Comment("สถานะผู้สมัคร")]
public string status { get; set; } = "draft";
[Comment("คำนำหน้าชื่อ")]
public virtual Prefix? Prefix { get; set; }
[MaxLength(100), Column(Order = 1), Comment("ชื่อจริง")]
public string? FirstName { get; set; }
[MaxLength(100), Column(Order = 2), Comment("นามสกุล")]
public string? LastName { get; set; }
[MaxLength(40), Column(Order = 3), Comment("สัญชาติ")]
public string? Nationality { get; set; }
[MaxLength(40), Comment("วันเกิด")]
public DateTime? DateOfBirth { get; set; }
[Comment("ศาสนา")]
public virtual Relationship? Relationship { get; set; }
[MaxLength(200), Comment("อีเมล")]
public string? Email { get; set; }
[MaxLength(20), Comment("เลขประจำตัวประชาชน")]
public string? CitizenId { get; set; }
[Comment("เขตที่ออกบัตรประชาชน")]
public virtual District? CitizenDistrict { get; set; }
[Comment("จังหวัดที่ออกบัตรประชาชน")]
public virtual Province? CitizenProvince { get; set; }
[Comment("วันที่ออกบัตร")]
public DateTime? CitizenDate { get; set; }
[MaxLength(20), Comment("โทรศัพท์")]
public string? Telephone { get; set; }
[MaxLength(20), Comment("โทรศัพท์มือถือ")]
public string? MobilePhone { get; set; }
[Comment("ความสามารถพิเศษ")]
public string? Knowledge { get; set; }
[Comment("ที่อยู่ตามทะเบียนบ้าน")]
public string? RegistAddress { get; set; }
[Comment("จังหวัดที่อยู่ตามทะเบียนบ้าน")]
public virtual Province? RegistProvince { get; set; }
[Comment("อำเภอที่อยู่ตามทะเบียนบ้าน")]
public virtual District? RegistDistrict { get; set; }
[Comment("ตำบลที่อยู่ตามทะเบียนบ้าน")]
public virtual SubDistrict? RegistSubDistrict { get; set; }
[MaxLength(10), Comment("รหัสไปรษณีย์ที่อยู่ตามทะเบียนบ้าน")]
public string? RegistZipCode { get; set; }
[Comment("ที่อยู่ปัจจุบันเหมือนที่อยู่ตามทะเบียนบ้าน")]
public bool? RegistSame { get; set; }
[Comment("ที่อยู่ปัจจุบัน")]
public string? CurrentAddress { get; set; }
[Comment("จังหวัดที่อยู่ปัจจุบัน")]
public virtual Province? CurrentProvince { get; set; }
[Comment("อำเภอที่อยู่ปัจจุบัน")]
public virtual District? CurrentDistrict { get; set; }
[Comment("ตำบลที่อยู่ปัจจุบัน")]
public virtual SubDistrict? CurrentSubDistrict { get; set; }
[MaxLength(10), Comment("รหัสไปรษณีย์ที่อยู่ปัจจุบัน")]
public string? CurrentZipCode { get; set; }
[Comment("คู่สมรส")]
public bool? Marry { get; set; }
[Comment("คำนำหน้าชื่อคู่สมรส")]
public virtual Prefix? MarryPrefix { get; set; }
[MaxLength(100), Comment("ชื่อจริงคู่สมรส")]
public string? MarryFirstName { get; set; }
[MaxLength(100), Comment("นามสกุลคู่สมรส")]
public string? MarryLastName { get; set; }
[Comment("คำนำหน้าชื่อบิดา")]
public virtual Prefix? FatherPrefix { get; set; }
[MaxLength(100), Comment("ชื่อจริงบิดา")]
public string? FatherFirstName { get; set; }
[MaxLength(100), Comment("นามสกุลบิดา")]
public string? FatherLastName { get; set; }
[Comment("คำนำหน้าชื่อมารดา")]
public virtual Prefix? MotherPrefix { get; set; }
[MaxLength(100), Comment("ชื่อจริงมารดา")]
public string? MotherFirstName { get; set; }
[MaxLength(100), Comment("นามสกุลมารดา")]
public string? MotherLastName { get; set; }
[Comment("ประเภทอาชีพที่ทำงานมาก่อน")]
public string? OccupationType { get; set; }
[Comment("สำนัก/บริษัท บริษัท")]
public string? OccupationCompany { get; set; }
[Comment("กอง/ฝ่าย บริษัท")]
public string? OccupationDepartment { get; set; }
[MaxLength(200), Comment("อีเมล บริษัท")]
public string? OccupationEmail { get; set; }
[MaxLength(20), Comment("โทรศัพท์ บริษัท")]
public string? OccupationTelephone { get; set; }
}
}

30
Models/Career.cs Normal file
View file

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
namespace BMA.EHR.Recurit.Exam.Service.Models
{
public class Career : EntityBase
{
[Required, Column(Order = 7), Comment("Id ผู้สมัคร")]
public virtual Candidate? Candidate { get; set; }
[Required, Column(Order = 3), Comment("สถานที่ทำงาน/ฝึกงาน")]
public string Name { get; set; } = string.Empty;
[Required, Column(Order = 4), Comment("ตำแหน่ง/ลักษณะงาน")]
public string Position { get; set; } = string.Empty;
[Required, MaxLength(20), Column(Order = 5), Comment("เงินเดือนสุดท้ายก่อนออก")]
public int Salary { get; set; }
[Required, Column(Order = 1), Comment("ระยะเวลาเริ่ม")]
public DateTime DurationStart { get; set; } = DateTime.Now.Date;
[Required, Column(Order = 2), Comment("ระยะเวลาสิ้นสุด")]
public DateTime DurationEnd { get; set; } = DateTime.Now.Date;
[Required, Column(Order = 6), Comment("เหตุผลที่ออก")]
public string Reason { get; set; } = string.Empty;
}
}

30
Models/Education.cs Normal file
View file

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
namespace BMA.EHR.Recurit.Exam.Service.Models
{
public class Education : EntityBase
{
[Required, Column(Order = 7), Comment("Id ผู้สมัคร")]
public virtual Candidate? Candidate { get; set; }
[Required, Column(Order = 5), Comment("วุฒิที่ได้รับ")]
public virtual EducationLevel? EducationLevel { get; set; }
[Required, Column(Order = 4), Comment("สาขาวิชา/วิชาเอก")]
public string Major { get; set; } = string.Empty;
[Required, MaxLength(10), Column(Order = 6), Comment("คะแนนเฉลี่ยตลอดหลักสูตร")]
public int Scores { get; set; }
[Required, Column(Order = 3), Comment("ชื่อสถานศึกษา")]
public string Name { get; set; } = string.Empty;
[Required, Column(Order = 1), Comment("ระยะเวลาเริ่ม")]
public DateTime DurationStart { get; set; } = DateTime.Now.Date;
[Required, Column(Order = 2), Comment("ระยะเวลาสิ้นสุด")]
public DateTime DurationEnd { get; set; } = DateTime.Now.Date;
}
}

24
Models/PeriodExam.cs Normal file
View file

@ -0,0 +1,24 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
namespace BMA.EHR.Recurit.Exam.Service.Models
{
public class PeriodExam : EntityBase
{
[Required, MaxLength(150), Column(Order = 1), Comment("ชื่อการสอบ")]
public string Name { get; set; } = string.Empty;
[Required, Column(Order = 2), Comment("วันเริ่มสมัครสอบ")]
public DateTime StartDate { get; set; } = DateTime.Now.Date;
[Required, Column(Order = 3), Comment("วันสิ้นสุด")]
public DateTime EndDate { get; set; } = DateTime.Now.Date;
[Required, Column(Order = 4), Comment("รายละเอียดสมัครสอบ")]
public string Detail { get; set; } = string.Empty;
[Column(Order = 5), Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true;
}
}

View file

@ -85,6 +85,7 @@ builder.Services.AddTransient<RelationshipService>();
builder.Services.AddTransient<ProvinceService>(); builder.Services.AddTransient<ProvinceService>();
builder.Services.AddTransient<DistrictService>(); builder.Services.AddTransient<DistrictService>();
builder.Services.AddTransient<SubDistrictService>(); builder.Services.AddTransient<SubDistrictService>();
builder.Services.AddTransient<CandidateService>();
// Add services to the container. // Add services to the container.
builder.Services.AddControllers(options => builder.Services.AddControllers(options =>

View file

@ -0,0 +1,25 @@

namespace BMA.EHR.Recurit.Exam.Service.Response
{
public class CandidateAddressResponseItem
{
public string? RegistAddress { get; set; }
public Models.Province? RegistProvince { get; set; }
public string? RegistProvinceId { get; set; }
public Models.District? RegistDistrict { get; set; }
public string? RegistDistrictId { get; set; }
public Models.SubDistrict? RegistSubDistrict { get; set; }
public string? RegistSubDistrictId { get; set; }
public string? RegistZipCode { get; set; }
public bool? RegistSame { get; set; }
public string? CurrentAddress { get; set; }
public Models.Province? CurrentProvince { get; set; }
public string? CurrentProvinceId { get; set; }
public Models.District? CurrentDistrict { get; set; }
public string? CurrentDistrictId { get; set; }
public Models.SubDistrict? CurrentSubDistrict { get; set; }
public string? CurrentSubDistrictId { get; set; }
public string? CurrentZipCode { get; set; }
}
}

View file

@ -0,0 +1,13 @@

namespace BMA.EHR.Recurit.Exam.Service.Response
{
public class CandidateCareerResponseItem
{
public string Name { get; set; } = string.Empty;
public string Position { get; set; } = string.Empty;
public int Salary { get; set; }
public DateTime DurationStart { get; set; }
public DateTime DurationEnd { get; set; }
public string Reason { get; set; } = string.Empty;
}
}

View file

@ -0,0 +1,13 @@

namespace BMA.EHR.Recurit.Exam.Service.Response
{
public class CandidateEducationResponseItem
{
public string EducationLevelId { get; set; } = string.Empty;
public string Major { get; set; } = string.Empty;
public int Scores { get; set; }
public string Name { get; set; } = string.Empty;
public DateTime DurationStart { get; set; }
public DateTime DurationEnd { get; set; }
}
}

View file

@ -0,0 +1,20 @@

namespace BMA.EHR.Recurit.Exam.Service.Response
{
public class CandidateFamilyResponseItem
{
public bool? Marry { get; set; }
public Models.Prefix? MarryPrefix { get; set; }
public string? MarryPrefixId { get; set; }
public string? MarryFirstName { get; set; }
public string? MarryLastName { get; set; }
public Models.Prefix? FatherPrefix { get; set; }
public string? FatherPrefixId { get; set; }
public string? FatherFirstName { get; set; }
public string? FatherLastName { get; set; }
public Models.Prefix? MotherPrefix { get; set; }
public string? MotherPrefixId { get; set; }
public string? MotherFirstName { get; set; }
public string? MotherLastName { get; set; }
}
}

View file

@ -0,0 +1,17 @@

namespace BMA.EHR.Recurit.Exam.Service.Response
{
public class CandidateInformationResponseItem
{
public Models.Prefix? Prefix { get; set; }
public string? PrefixId { get; set; }
public string? FirstName { get; set; } = string.Empty;
public string? LastName { get; set; } = string.Empty;
public string? Nationality { get; set; } = string.Empty;
public DateTime? DateOfBirth { get; set; }
public Models.Relationship? Relationship { get; set; }
public string? RelationshipId { get; set; }
public string? Email { get; set; } = string.Empty;
public string? CitizenId { get; set; } = string.Empty;
}
}

View file

@ -0,0 +1,16 @@

namespace BMA.EHR.Recurit.Exam.Service.Response
{
public class CandidateOccupationResponseItem
{
public string? OccupationType { get; set; }
public string? OccupationCompany { get; set; }
public string? OccupationDepartment { get; set; }
public string? OccupationEmail { get; set; }
public string? OccupationTelephone { get; set; }
}
}

View file

@ -0,0 +1,567 @@
using System.Security.Claims;
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.Response;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Recurit.Exam.Service.Services
{
public class CandidateService
{
#region " Fields "
private readonly ApplicationDbContext _context;
private readonly IHttpContextAccessor _httpContextAccessor;
#endregion
#region " Constructor and Destructor "
public CandidateService(ApplicationDbContext context,
IHttpContextAccessor httpContextAccessor)
{
_context = context;
_httpContextAccessor = httpContextAccessor;
}
#endregion
#region " Properties "
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
#endregion
#region " Methods "
public async Task<CandidateInformationResponseItem?> GetsAsyncInformation(string examId)
{
var exam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
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,
FirstName = x.FirstName,
LastName = x.LastName,
Nationality = x.Nationality,
DateOfBirth = x.DateOfBirth,
Relationship = x.Relationship,
Email = x.Email,
CitizenId = x.CitizenId,
})
.FirstOrDefaultAsync();
}
public async Task<CandidateAddressResponseItem?> GetsAsyncAddress(string examId)
{
var exam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
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,
RegistDistrict = x.RegistDistrict,
RegistSubDistrict = x.RegistSubDistrict,
RegistZipCode = x.RegistZipCode,
RegistSame = x.RegistSame,
CurrentAddress = x.CurrentAddress,
CurrentProvince = x.CurrentProvince,
CurrentDistrict = x.CurrentDistrict,
CurrentSubDistrict = x.CurrentSubDistrict,
CurrentZipCode = x.CurrentZipCode,
})
.FirstOrDefaultAsync();
}
public async Task<CandidateFamilyResponseItem?> GetsAsyncFamily(string examId)
{
var exam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
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,
MarryFirstName = x.MarryFirstName,
MarryLastName = x.MarryLastName,
FatherPrefix = x.FatherPrefix,
FatherFirstName = x.FatherFirstName,
FatherLastName = x.FatherLastName,
MotherPrefix = x.MotherPrefix,
MotherFirstName = x.MotherFirstName,
MotherLastName = x.MotherLastName,
})
.FirstOrDefaultAsync();
}
public async Task<CandidateOccupationResponseItem?> GetsAsyncOccupation(string examId)
{
var exam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
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,
})
.FirstOrDefaultAsync();
}
public async Task<IEnumerable<Career?>> GetsAsyncCareer(string examId)
{
var exam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
if (exam == null)
throw new Exception(GlobalMessages.ExamNotFound);
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId) && x.UserId == UserId);
return await _context.Careers.AsQueryable()
.Where(x => x.Candidate == candidate)
.OrderBy(d => d.DurationStart)
.ToListAsync();
}
public async Task<IEnumerable<Education?>> GetsAsyncEducation(string examId)
{
var exam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
if (exam == null)
throw new Exception(GlobalMessages.ExamNotFound);
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId) && x.UserId == UserId);
return await _context.Educations.AsQueryable()
.Where(x => x.Candidate == candidate)
.OrderBy(d => d.DurationStart)
.ToListAsync();
}
public async Task<bool> GetsAsyncRegisterExam(string examId)
{
var exam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
if (exam == null)
throw new Exception(GlobalMessages.ExamNotFound);
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId) && x.UserId == UserId);
return candidate != null;
}
public async Task<string> CreateAsyncCandidate(string examId)
{
var exam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
if (exam == null)
throw new Exception(GlobalMessages.ExamNotFound);
var _candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId);
if (_candidate == null)
{
var candidate = new Candidate
{
PeriodExam = exam,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
LastUpdateUserId = UserId ?? "",
CreatedFullName = FullName ?? "",
LastUpdateFullName = FullName ?? "",
UserId = UserId ?? "",
};
await _context.Candidates.AddAsync(candidate);
await _context.SaveChangesAsync();
return candidate.Id.ToString();
}
else
{
_candidate.LastUpdatedAt = DateTime.Now;
_candidate.LastUpdateUserId = UserId ?? "";
_candidate.LastUpdateFullName = FullName ?? "";
return _candidate.Id.ToString();
}
}
public async Task UpdateAsyncInformation(string examId, CandidateInformationResponseItem updated)
{
var candidateId = await CreateAsyncCandidate(examId);
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
if (candidate == null)
throw new Exception(GlobalMessages.ExamNotFound);
if (updated.PrefixId != null)
{
var prefix = await _context.Prefixes.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.PrefixId));
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.Prefix = prefix;
}
if (updated.RelationshipId != null)
{
var relationship = await _context.Relationships.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RelationshipId));
if (relationship == null)
throw new Exception(GlobalMessages.RelationshipNotFound);
candidate.Relationship = relationship;
}
candidate.FirstName = updated.FirstName;
candidate.LastName = updated.LastName;
candidate.Nationality = updated.Nationality;
candidate.DateOfBirth = updated.DateOfBirth;
candidate.Email = updated.Email;
candidate.CitizenId = updated.CitizenId;
await _context.SaveChangesAsync();
}
public async Task UpdateAsyncAddress(string examId, CandidateAddressResponseItem updated)
{
var candidateId = await CreateAsyncCandidate(examId);
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
if (candidate == null)
throw new Exception(GlobalMessages.ExamNotFound);
if (updated.RegistProvinceId != null)
{
var registProvince = await _context.Provinces.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistProvinceId));
if (registProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.RegistProvince = registProvince;
}
if (updated.RegistProvinceId != null)
{
var registProvince = await _context.Provinces.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistProvinceId));
if (registProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.RegistProvince = registProvince;
}
if (updated.RegistDistrictId != null)
{
var registDistrict = await _context.Districts.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistDistrictId));
if (registDistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound);
candidate.RegistDistrict = registDistrict;
}
if (updated.RegistSubDistrictId != null)
{
var registSubDistrict = await _context.SubDistricts.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistSubDistrictId));
if (registSubDistrict == null)
throw new Exception(GlobalMessages.SubDistrictNotFound);
candidate.RegistSubDistrict = registSubDistrict;
candidate.RegistZipCode = registSubDistrict.ZipCode;
}
if (updated.CurrentProvinceId != null)
{
var currentProvince = await _context.Provinces.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentProvinceId));
if (currentProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.CurrentProvince = currentProvince;
}
if (updated.CurrentProvinceId != null)
{
var currentProvince = await _context.Provinces.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentProvinceId));
if (currentProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.CurrentProvince = currentProvince;
}
if (updated.CurrentDistrictId != null)
{
var currentDistrict = await _context.Districts.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentDistrictId));
if (currentDistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound);
candidate.CurrentDistrict = currentDistrict;
}
if (updated.CurrentSubDistrictId != null)
{
var currentSubDistrict = await _context.SubDistricts.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentSubDistrictId));
if (currentSubDistrict == null)
throw new Exception(GlobalMessages.SubDistrictNotFound);
candidate.CurrentSubDistrict = currentSubDistrict;
candidate.CurrentZipCode = currentSubDistrict.ZipCode;
}
candidate.RegistAddress = updated.RegistAddress;
candidate.RegistSame = updated.RegistSame;
candidate.CurrentAddress = updated.CurrentAddress;
await _context.SaveChangesAsync();
}
public async Task UpdateAsyncFamily(string examId, CandidateFamilyResponseItem updated)
{
var candidateId = await CreateAsyncCandidate(examId);
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
if (candidate == null)
throw new Exception(GlobalMessages.ExamNotFound);
if (updated.MarryPrefixId != null)
{
var prefix = await _context.Prefixes.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.MarryPrefixId));
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.MarryPrefix = prefix;
}
if (updated.FatherPrefixId != null)
{
var prefix = await _context.Prefixes.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.FatherPrefixId));
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.FatherPrefix = prefix;
}
if (updated.MotherPrefixId != null)
{
var prefix = await _context.Prefixes.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.MotherPrefixId));
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.MotherPrefix = prefix;
}
candidate.Marry = updated.Marry;
candidate.MarryFirstName = updated.MarryFirstName;
candidate.MarryLastName = updated.MarryLastName;
candidate.FatherFirstName = updated.FatherFirstName;
candidate.FatherLastName = updated.FatherLastName;
candidate.MotherFirstName = updated.MotherFirstName;
candidate.MotherLastName = updated.MotherLastName;
await _context.SaveChangesAsync();
}
public async Task UpdateAsyncOccupation(string examId, CandidateOccupationResponseItem updated)
{
var candidateId = await CreateAsyncCandidate(examId);
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
if (candidate == null)
throw new Exception(GlobalMessages.ExamNotFound);
candidate.OccupationType = updated.OccupationType;
candidate.OccupationCompany = updated.OccupationCompany;
candidate.OccupationDepartment = updated.OccupationDepartment;
candidate.OccupationEmail = updated.OccupationEmail;
candidate.OccupationTelephone = updated.OccupationTelephone;
await _context.SaveChangesAsync();
}
public async Task CreateAsyncCareer(string examId, CandidateCareerResponseItem updated)
{
var candidateId = await CreateAsyncCandidate(examId);
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
var career = new Career
{
Candidate = candidate,
Name = updated.Name,
Position = updated.Position,
Salary = updated.Salary,
DurationStart = updated.DurationStart,
DurationEnd = updated.DurationEnd,
Reason = updated.Reason,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
LastUpdateUserId = UserId ?? "",
CreatedFullName = FullName ?? "",
LastUpdateFullName = FullName ?? "",
};
await _context.Careers.AddAsync(career);
await _context.SaveChangesAsync();
}
public async Task CreateAsyncEducation(string examId, CandidateEducationResponseItem updated)
{
var candidateId = await CreateAsyncCandidate(examId);
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
var educationLevel = await _context.EducationLevels.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.EducationLevelId));
if (educationLevel == null)
throw new Exception(GlobalMessages.EducationLevelNotFound);
var education = new Education
{
Candidate = candidate,
EducationLevel = educationLevel,
Major = updated.Major,
Scores = updated.Scores,
Name = updated.Name,
DurationStart = updated.DurationStart,
DurationEnd = updated.DurationEnd,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
LastUpdateUserId = UserId ?? "",
CreatedFullName = FullName ?? "",
LastUpdateFullName = FullName ?? "",
};
await _context.Educations.AddAsync(education);
await _context.SaveChangesAsync();
}
public async Task UpdateAsyncCareer(string careerId, CandidateCareerResponseItem updated)
{
var career = await _context.Careers.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(careerId));
if (career == null)
throw new Exception(GlobalMessages.CareerNotFound);
career.Name = updated.Name;
career.Position = updated.Position;
career.Salary = updated.Salary;
career.DurationStart = updated.DurationStart;
career.DurationEnd = updated.DurationEnd;
career.Reason = updated.Reason;
career.LastUpdatedAt = DateTime.Now;
career.LastUpdateUserId = UserId ?? "";
career.LastUpdateFullName = FullName ?? "";
await _context.SaveChangesAsync();
}
public async Task UpdateAsyncEducation(string educationId, CandidateEducationResponseItem updated)
{
var education = await _context.Educations.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(educationId));
if (education == null)
throw new Exception(GlobalMessages.EducationNotFound);
var educationLevel = await _context.EducationLevels.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.EducationLevelId));
if (educationLevel == null)
throw new Exception(GlobalMessages.EducationLevelNotFound);
education.EducationLevel = educationLevel;
education.Major = updated.Major;
education.Scores = updated.Scores;
education.Name = updated.Name;
education.DurationStart = updated.DurationStart;
education.DurationEnd = updated.DurationEnd;
education.LastUpdatedAt = DateTime.Now;
education.LastUpdateUserId = UserId ?? "";
education.LastUpdateFullName = FullName ?? "";
await _context.SaveChangesAsync();
}
public async Task RegisterCandidateService(string examId)
{
var exam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
if (exam == null)
throw new Exception(GlobalMessages.ExamNotFound);
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId);
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
candidate.status = "registered";
await _context.SaveChangesAsync();
}
#endregion
}
}

View file

@ -1 +1 @@
c7bf28559ceebe7592323d156f2a33ca24e588b7 f28e709d0ae471c3251171cbc4d3332dfd93616d