Merge branch 'develop' into dev

* develop:
  no message
  remoce error
  รายงานดาวน์โหลดข้อมูลผู้สมัคร แก้ไขเลขอารบิก #2097
  Fix Bug #2088
  #2041
  User ต้องการให้สามารถ "ปิด" การดาวน์โหลดใบสมัครสอบได้ #2041
  เปลี่ยนข้อความสถานะสมัครสอบทาง email
  no message
  no message
  เปิดให้ดาวน์โหลดใบสมัคร รอบสอบที่มีการชำระเงิน
  no message
  fix สมัครสอบให้เช็ควันและเวลา
  fix
  ปรับระบบสรรหาสอบคัดเลือก (4)
  ปรับระบบสรรหาสอบคัดเลือก (3)
  migrate + ปรับระบบสรรหาสอบคัดเลือก (2)
  migrate + ปรับระบบสรรหาสอบคัดเลือก
This commit is contained in:
Warunee Tamkoo 2025-12-17 09:20:52 +07:00
commit 1143e46ed0
28 changed files with 10046 additions and 204 deletions

View file

@ -818,6 +818,62 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
}
}
/// <summary>
/// เจ้าหน้าอัพเดตสถานะ เปิดให้ดาวน์โหลดใบสมัคร แสดงสถานที่สอบ และเลขประจำตัวสอบ
/// </summary>
/// <param name="candidateId">รหัสใบสมัคร</param>
/// <returns></returns>
/// <response code="200">เมื่อเจ้าหน้าที่ตรวจคุณสมบัติผู้สมัครสำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("check-showExamInfo")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> CheckShowExamInfoService(RequestApproveShowExamInfo item)
{
try
{
if (!string.IsNullOrEmpty(item.ExamId))
{
await _candidateService.AdminCheckShowExamInfoService(item.ExamId, item.Status ?? true);
}
return Success();
}
catch (Exception ex)
{
return Error(ex);
}
}
/// <summary>
/// ผู้สมัครทำการสมัครสอบ
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <param name="positionId">Id ตำแหน่งสมัครสอบ</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการผู้สมัครทำการสมัครสอบ สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("register-confirm/{examId:length(36)}/{positionId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> RegisterCheckSeatService(string examId, string positionId)
{
try
{
await _candidateService.UserConfirmCheckSeatService(examId, positionId);
return Success();
}
catch (Exception ex)
{
return Error(ex);
}
}
/// <summary>
/// เจ้าหน้าที่ย้อนสถานะเป็นตรวจสอบข้อมูล
/// </summary>
@ -1519,7 +1575,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
{
try
{
await _candidateService.CheckCitizen(examId, positionId, item.CitizenId);
// await _candidateService.CheckCitizen(examId, positionId, item.CitizenId);
return Success();
}

View file

@ -16,7 +16,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
[ApiController]
[Produces("application/json")]
[AllowAnonymous]
// [Authorize]
[Authorize]
[SwaggerTag("จัดการข้อมูลรอบการสอบ เพื่อนำไปใช้งานในระบบ")]
public class PeriodExamController : BaseController
{

View file

@ -25,5 +25,7 @@
public const string CMSNotFound = "ไม่พบข้อมูล CMS";
public const string OrganizationNotFound = "ไม่พบข้อมูลสังกัด";
public const string CitizanDupicate = "เลขบัตรประชาชนนี้ได้ทำการสมัครไว้แล้ว";
public const string CitizenIncomplete = "กรุณากรอกข้อมูลรหัสบัตรประจำตัวประชาชนให้ครบ 13 หลัก";
public const string CitizenIncorrect = "ข้อมูลรหัสบัตรประจำตัวประชาชนไม่ถูกต้อง";
}
}

View file

@ -500,6 +500,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnOrder(1)
.HasComment("ชื่อจริง");
b.Property<bool>("IsShowExamInfo")
.HasColumnType("tinyint(1)")
.HasComment("สถานะ เปิดให้ดาวน์โหลดใบสมัคร แสดงสถานที่สอบ และเลขประจำตัวสอบ");
b.Property<string>("Knowledge")
.HasColumnType("longtext")
.HasComment("ความสามารถพิเศษ");
@ -624,8 +628,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnType("longtext")
.HasComment("ตำแหน่งปัจจุบัน ประเภทราชการ");
b.Property<int?>("OccupationSalary")
.HasColumnType("int")
b.Property<double?>("OccupationSalary")
.HasColumnType("double")
.HasComment("ตำแหน่งปัจจุบัน เงินเดือน");
b.Property<string>("OccupationTelephone")
@ -2284,6 +2288,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnType("float")
.HasComment("ค่าธรรมเนียม");
b.Property<int?>("GraduationYearLock")
.HasColumnType("int")
.HasComment("ล็อกวันที่สำเร็จการศึกษา (ปี)");
b.Property<Guid?>("ImportFileId")
.HasColumnType("char(36)");
@ -2673,6 +2681,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("EducationLevel")
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasComment("ขีดจำกัดวุฒิการศึกษา");
b.Property<bool>("HighDegree")
.HasColumnType("tinyint(1)")
.HasComment("ปริญญาบัตรขึ้นไป");

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,42 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recurit.Exam.Service.Migrations
{
/// <inheritdoc />
public partial class update_tables_periodExam_and_positionExam : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "EducationLevel",
table: "PositionExams",
type: "varchar(50)",
maxLength: 50,
nullable: true,
comment: "ขีดจำกัดวุฒิการศึกษา")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<int>(
name: "GraduationYearLock",
table: "PeriodExams",
type: "int",
nullable: true,
comment: "ล็อกวันที่สำเร็จการศึกษา (ปี)");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "EducationLevel",
table: "PositionExams");
migrationBuilder.DropColumn(
name: "GraduationYearLock",
table: "PeriodExams");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,40 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recurit.Exam.Service.Migrations
{
/// <inheritdoc />
public partial class update_tables_candidates_change_datatype : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<double>(
name: "OccupationSalary",
table: "Candidates",
type: "double",
nullable: true,
comment: "ตำแหน่งปัจจุบัน เงินเดือน",
oldClrType: typeof(int),
oldType: "int",
oldNullable: true,
oldComment: "ตำแหน่งปัจจุบัน เงินเดือน");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<int>(
name: "OccupationSalary",
table: "Candidates",
type: "int",
nullable: true,
comment: "ตำแหน่งปัจจุบัน เงินเดือน",
oldClrType: typeof(double),
oldType: "double",
oldNullable: true,
oldComment: "ตำแหน่งปัจจุบัน เงินเดือน");
}
}
}

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 update_table_candidate_add_field_IsShowExamInfo : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsShowExamInfo",
table: "Candidates",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "สถานะ เปิดให้ดาวน์โหลดใบสมัคร แสดงสถานที่สอบ และเลขประจำตัวสอบ");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsShowExamInfo",
table: "Candidates");
}
}
}

View file

@ -266,7 +266,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[Comment("ตำแหน่งปัจจุบัน กลุ่ม/ฝ่าย")]
public string? OccupationGroup { get; set; }
[Comment("ตำแหน่งปัจจุบัน เงินเดือน")]
public int? OccupationSalary { get; set; }
public double? OccupationSalary { get; set; }
[Comment("ตำแหน่งปัจจุบัน สังกัด")]
public string? OccupationPosition { get; set; }
[Comment("ตำแหน่งปัจจุบัน ประเภทราชการ")]
@ -315,6 +315,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[Comment("โทรศัพท์ บุคคลที่สามารถติดต่อได้")]
public string? ContactTel { get; set; }
[Comment("สถานะ เปิดให้ดาวน์โหลดใบสมัคร แสดงสถานที่สอบ และเลขประจำตัวสอบ")]
public bool IsShowExamInfo { get; set; } = false;
public virtual List<Education> Educations { get; set; } = new List<Education>();
public virtual List<Career> Careers { get; set; } = new List<Career>();

View file

@ -103,6 +103,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
public string? AuthName { get; set; }
public string? AuthPosition { get; set; }
[Comment("ล็อกวันที่สำเร็จการศึกษา (ปี)")]
public int? GraduationYearLock { get; set; } = 3;
[Comment("รายชื่อคนสม้ครในรอบ")]
public List<Candidate> Candidate { get; set; } = new List<Candidate>();

View file

@ -175,7 +175,7 @@ namespace BMA.EHR.Domain.Models.Placement
[Comment("ตำแหน่งปัจจุบัน กลุ่ม/ฝ่าย")]
public string? OccupationGroup { get; set; }
[Comment("ตำแหน่งปัจจุบัน เงินเดือน")]
public int? OccupationSalary { get; set; }
public double? OccupationSalary { get; set; }
[Comment("ตำแหน่งปัจจุบัน สังกัด")]
public string? OccupationPosition { get; set; }
[Comment("ตำแหน่งปัจจุบัน ประเภทราชการ")]

View file

@ -34,5 +34,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[Comment("รหัสประจำตำแหน่งที่สอบ")]
public string? Code { get; set; }
[Comment("ขีดจำกัดวุฒิการศึกษา"), MaxLength(50)]
public string? EducationLevel { get; set; }
}
}

View file

@ -0,0 +1,11 @@
using System.Net;
namespace BMA.EHR.Recurit.Exam.Service.Request
{
public class RequestApproveShowExamInfo
{
public string? ExamId { get; set; }
public bool? Status { get; set; }
}
}

View file

@ -39,5 +39,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Request
public string? HighDegree { get; set; }
public DateTime? AnnouncementDate { get; set; }
public Guid? Id { get; set; }
public bool? IsShowExamInfo { get; set; }
}
}

View file

@ -33,7 +33,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Request
public string? CompanyCode { get; set; }
public string? Reason { get; set; }
public string? RefNo1 { get; set; }
public int? GraduationYearLock { get; set; }
public List<FormFile>? Doc { get; set; }
public List<FormFile>? Image { get; set; }
public List<RequestBankExam> BankExam { get; set; } = new();

View file

@ -13,5 +13,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Request
public string? Code { get; set; }
public string? TypeId { get; set; }
public string? TypeName { get; set; }
public string? EducationLevel { get; set; }
}
}

View file

@ -10,5 +10,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Request
public int? Year { get; set; }
public string? Position { get; set; }
public string? PositionLevel { get; set; }
public string? EducationLevel { get; set; }
}
}

View file

@ -10,5 +10,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Request
public int? Year { get; set; }
public bool Status { get; set; }
public bool SetSeat { get; set; }
public float? Fee { get; set;}
}
}

View file

@ -16,5 +16,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Request
public PositionExam? PositionExam { get; set; }
public DateTime? RegisterEndDate { get; set; }
public DateTime? RegisterStartDate { get; set; }
public int? graduationYearLock { get; set; }
}
}

View file

@ -4,6 +4,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
public class CandidateContactResponseItem
{
public Guid? ContactPrefixId { get; set; }
public string? ContactPrefix { get; set; }
public string? ContactFirstname { get; set; }
public string? ContactLastname { get; set; }
public string? ContactRelations { get; set; }

View file

@ -6,7 +6,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
public string? OccupationOrg { get; set; }
public string? OccupationPile { get; set; }
public string? OccupationGroup { get; set; }
public int? OccupationSalary { get; set; }
public double? OccupationSalary { get; set; }
public string? OccupationPosition { get; set; }
public string? OccupationPositionType { get; set; }
public string? OccupationTelephone { get; set; }

View file

@ -5,14 +5,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
{
// public Models.Prefix? Prefix { get; set; }
public string? PrefixId { get; set; }
public string? Prefix { get; set; }
public string? PrefixName { get; set; } = string.Empty;
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? ReligionId { get; set; }
// public string? Religion { get; set; }
public string? ReligionName { get; set; } = string.Empty;
public string? Email { get; set; } = string.Empty;
public string? CitizenId { get; set; } = string.Empty;
// public Models.Province? CitizenProvince { get; set; }
@ -73,7 +73,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
public string? OccupationOrg { get; set; }
public string? OccupationPile { get; set; }
public string? OccupationGroup { get; set; }
public int? OccupationSalary { get; set; }
public double? OccupationSalary { get; set; }
public string? OccupationPosition { get; set; }
public string? OccupationPositionType { get; set; }
public string? OccupationTelephone { get; set; }
@ -88,6 +88,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
public Guid? EducationLevelHighId { get; set; }
public Guid? ContactPrefixId { get; set; }
public string? ContactPrefixName { get; set; } = string.Empty;
public string? ContactFirstname { get; set; }
public string? ContactLastname { get; set; }
public string? ContactRelations { get; set; }

View file

@ -7,5 +7,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
public string? Status { get; set; }
public string? RejectDetail { get; set; }
public bool? IsShowExamInfo { get; set; }
}
}

View file

@ -38,6 +38,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
public string? CompanyCode { get; set; }
public string? Reason { get; set; }
public string? RefNo1 { get; set; }
public int? GraduationYearLock { get; set; }
public List<Models.Candidate> Candidate { get; set; } = new List<Models.Candidate>();
public List<Models.PositionExam> PositionExam { get; set; } = new List<Models.PositionExam>();
public List<Models.BankExam> BankExam { get; set; } = new List<Models.BankExam>();

View file

@ -7,6 +7,7 @@ using BMA.EHR.Recurit.Exam.Service.Request;
using BMA.EHR.Recurit.Exam.Service.Response;
using BMA.EHR.Recurit.Exam.Service.Responses.Document;
using Microsoft.EntityFrameworkCore;
using System.Linq;
namespace BMA.EHR.Recurit.Exam.Service.Services
{
@ -52,6 +53,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
public async Task<Candidate> GetsAsync(string candidateId)
{
var candidate = await _context.Candidates.AsQueryable()
.Include(x => x.PositionExam)
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
if (candidate == null)
@ -344,6 +346,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Select(x => new CandidateContactResponseItem
{
ContactPrefixId = x.ContactPrefixId,
ContactPrefix = x.ContactPrefixName,
ContactFirstname = x.ContactFirstname,
ContactLastname = x.ContactLastname,
ContactRelations = x.ContactRelations,
@ -358,6 +361,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Select(x => new CandidateContactResponseItem
{
ContactPrefixId = x.ContactPrefixId,
ContactPrefix = x.ContactPrefixName,
ContactFirstname = x.ContactFirstname,
ContactLastname = x.ContactLastname,
ContactRelations = x.ContactRelations,
@ -662,9 +666,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
EditorCondition = exam.EditorCondition,
EditorConfirm = exam.EditorConfirm,
Position = candidatePosition == null ? false : true,
CanRegister = exam.RegisterStartDate == null || exam.RegisterEndDate == null ? true : DateOnly.FromDateTime(exam.RegisterStartDate.Value) <= DateOnly.FromDateTime(DateTime.Now) && DateOnly.FromDateTime(exam.RegisterEndDate.Value) >= DateOnly.FromDateTime(DateTime.Now),
//CanRegister = exam.RegisterStartDate == null || exam.RegisterEndDate == null ? true : DateOnly.FromDateTime(exam.RegisterStartDate.Value) <= DateOnly.FromDateTime(DateTime.Now) && DateOnly.FromDateTime(exam.RegisterEndDate.Value) >= DateOnly.FromDateTime(DateTime.Now),
CanRegister = exam.RegisterStartDate == null || exam.RegisterEndDate == null
? true
: exam.RegisterStartDate.Value <= DateTime.Now && exam.RegisterEndDate.Value >= DateTime.Now,
RegisterEndDate = exam.RegisterEndDate,
RegisterStartDate = exam.RegisterStartDate,
graduationYearLock = exam.GraduationYearLock,
};
}
@ -677,10 +685,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (exam == null)
throw new Exception(GlobalMessages.ExamNotFound);
if (exam.RegisterStartDate != null && exam.RegisterStartDate.Value.Date > DateTime.Now.Date)
if (exam.RegisterStartDate != null && exam.RegisterStartDate.Value > DateTime.Now)
throw new Exception("ยังไม่ถึงช่วงเวลาสมัครสอบ");
if (exam.RegisterEndDate != null && exam.RegisterEndDate.Value.Date < DateTime.Now.Date)
if (exam.RegisterEndDate != null && exam.RegisterEndDate.Value < DateTime.Now)
throw new Exception("หมดเวลาช่วงสมัครสอบ");
var _candidate = await _context.Candidates.AsQueryable()
@ -738,40 +746,52 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (candidate == null)
throw new Exception(GlobalMessages.ExamNotFound);
if (updated.PrefixId != null)
//if (updated.PrefixId != null)
//{
// var prefix = await _contextOrg.prefixe.AsQueryable()
// .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.PrefixId));
// if (prefix == null)
// throw new Exception(GlobalMessages.PrefixNotFound);
// candidate.PrefixId = prefix.Id;
// candidate.PrefixName = prefix.name;
//}
if (!string.IsNullOrEmpty(updated.PrefixName))
{
var prefix = await _contextOrg.prefixe.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.PrefixId));
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.PrefixId = prefix.Id;
candidate.PrefixName = prefix.name;
candidate.PrefixName = updated.PrefixName;
}
if (updated.ContactPrefixId != null)
//if (updated.ContactPrefixId != null)
//{
// var prefix = await _contextOrg.prefixe.AsQueryable()
// .FirstOrDefaultAsync(x => x.Id == updated.ContactPrefixId);
// if (prefix == null)
// throw new Exception(GlobalMessages.PrefixNotFound);
// candidate.ContactPrefixId = prefix.Id;
// candidate.ContactPrefixName = prefix.name;
//}
if (!string.IsNullOrEmpty(updated.ContactPrefixName))
{
var prefix = await _contextOrg.prefixe.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.ContactPrefixId);
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.ContactPrefixId = prefix.Id;
candidate.ContactPrefixName = prefix.name;
candidate.ContactPrefixName = updated.ContactPrefixName;
}
if (updated.ReligionId != null)
//if (updated.ReligionId != null)
//{
// var religion = await _contextOrg.religion.AsQueryable()
// .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.ReligionId));
// if (religion == null)
// throw new Exception(GlobalMessages.ReligionNotFound);
// candidate.ReligionId = religion.Id;
// candidate.ReligionName = religion.name;
//}
if (!string.IsNullOrEmpty(updated.ReligionName))
{
var religion = await _contextOrg.religion.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.ReligionId));
if (religion == null)
throw new Exception(GlobalMessages.ReligionNotFound);
candidate.ReligionId = religion.Id;
candidate.ReligionName = religion.name;
candidate.ReligionName = updated.ReligionName;
}
if (updated.RegistProvinceId != null)
@ -962,40 +982,52 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (candidate == null)
throw new Exception(GlobalMessages.ExamNotFound);
if (updated.PrefixId != null)
//if (updated.PrefixId != null)
//{
// var prefix = await _contextOrg.prefixe.AsQueryable()
// .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.PrefixId));
// if (prefix == null)
// throw new Exception(GlobalMessages.PrefixNotFound);
// candidate.PrefixId = prefix.Id;
// candidate.PrefixName = prefix.name;
//}
if (!string.IsNullOrEmpty(updated.PrefixName))
{
var prefix = await _contextOrg.prefixe.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.PrefixId));
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.PrefixId = prefix.Id;
candidate.PrefixName = prefix.name;
candidate.PrefixName = updated.PrefixName;
}
if (updated.ContactPrefixId != null)
//if (updated.ContactPrefixId != null)
//{
// var prefix = await _contextOrg.prefixe.AsQueryable()
// .FirstOrDefaultAsync(x => x.Id == updated.ContactPrefixId);
// if (prefix == null)
// throw new Exception(GlobalMessages.PrefixNotFound);
// candidate.ContactPrefixId = prefix.Id;
// candidate.ContactPrefixName = prefix.name;
//}
if (!string.IsNullOrEmpty(updated.ContactPrefixName))
{
var prefix = await _contextOrg.prefixe.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.ContactPrefixId);
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.ContactPrefixId = prefix.Id;
candidate.ContactPrefixName = prefix.name;
candidate.ContactPrefixName = updated.ContactPrefixName;
}
if (updated.ReligionId != null)
//if (updated.ReligionId != null)
//{
// var religion = await _contextOrg.religion.AsQueryable()
// .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.ReligionId));
// if (religion == null)
// throw new Exception(GlobalMessages.ReligionNotFound);
// candidate.ReligionId = religion.Id;
// candidate.ReligionName = religion.name;
//}
if (!string.IsNullOrEmpty(updated.ReligionName))
{
var religion = await _contextOrg.religion.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.ReligionId));
if (religion == null)
throw new Exception(GlobalMessages.ReligionNotFound);
candidate.ReligionId = religion.Id;
candidate.ReligionName = religion.name;
candidate.ReligionName = updated.ReligionName;
}
if (updated.RegistProvinceId != null)
@ -1197,6 +1229,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
candidate.PrefixId = prefix.Id;
candidate.PrefixName = prefix.name;
}
if (!string.IsNullOrEmpty(updated.Prefix))
{
candidate.PrefixName = updated.Prefix;
}
if (updated.RelationshipId != null)
{
@ -1936,7 +1972,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
return new CandidateStatusResponse { Status = candidate.Status, RejectDetail = candidate.RejectDetail };
return new CandidateStatusResponse { Status = candidate.Status, RejectDetail = candidate.RejectDetail, IsShowExamInfo = candidate.IsShowExamInfo };
}
public async Task UserCheckCandidateService(string examId, string positionId, string status)
@ -1949,10 +1985,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (exam == null)
throw new Exception(GlobalMessages.ExamNotFound);
if (exam.RegisterStartDate != null && exam.RegisterStartDate.Value.Date > DateTime.Now.Date)
if (exam.RegisterStartDate != null && exam.RegisterStartDate.Value > DateTime.Now)
throw new Exception("ยังไม่ถึงช่วงเวลาสมัครสอบ");
if (exam.RegisterEndDate != null && exam.RegisterEndDate.Value.Date < DateTime.Now.Date)
if (exam.RegisterEndDate != null && exam.RegisterEndDate.Value < DateTime.Now)
throw new Exception("หมดเวลาช่วงสมัครสอบ");
var candidate = await _context.Candidates.AsQueryable()
@ -1984,7 +2020,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (status == "checkRegister")
{
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + exam.Name;
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: รอยืนยันสถานะการสมัคร";
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: ได้รับใบสมัครแล้ว";
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
if (candidate.RegisterDate == null)
candidate.RegisterDate = DateTime.Now;
@ -2017,6 +2053,99 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
await _context.SaveChangesAsync();
}
public async Task UserConfirmCheckSeatService(string examId, string positionId)
{
var examGuid = Guid.Parse(examId);
var positionGuid = Guid.Parse(positionId);
// 1) โหลดข้อมูลรอบสอบ
var exam = await _context.PeriodExams
.Where(p => !p.CheckDisability && p.Id == examGuid)
.Include(x => x.PositionExam)
.FirstOrDefaultAsync();
if (exam == null)
throw new Exception(GlobalMessages.ExamNotFound);
// 2) โหลด Candidate เดิม (ดึงครั้งเดียวพอ)
var candidate = await _context.Candidates
.Include(x => x.PositionExam)
.Include(x => x.PeriodExam)
.FirstOrDefaultAsync(x => x.PeriodExam.Id == exam.Id && x.UserId == UserId);
if (positionGuid != Guid.Empty)
{
// 3) ตรวจสอบตำแหน่ง
var position = await _context.PositionExams
.FirstOrDefaultAsync(x => x.Id == positionGuid && x.PeriodExam.Id == exam.Id);
if (position == null)
throw new Exception(GlobalMessages.PositionExamNotFound);
// 4) ลบข้อมูลตำแหน่งอื่นในรอบนี้
var deleteOther = await _context.Candidates
.Where(x => x.PeriodExam.Id == exam.Id
&& x.UserId == UserId
&& x.PositionExam.Id != position.Id)
.ToListAsync();
_context.Candidates.RemoveRange(deleteOther);
// 5) โหลด candidate ใหม่เฉพาะตำแหน่งที่เลือก
candidate = await _context.Candidates
.FirstOrDefaultAsync(x => x.PeriodExam.Id == exam.Id
&& x.UserId == UserId
&& x.PositionExam.Id == position.Id);
}
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
// ต้องอยู่ในสถานะ CHECKREGISTER เท่านั้น
if (candidate.Status.Trim().ToUpper() != "CHECKREGISTER")
throw new Exception(GlobalMessages.CannotInsertToDatabase);
// 6) ไม่เสียค่าสมัคร → ต้องออกเลขประจำตัวสอบด้วย
if (candidate.PeriodExam.Fee == 0)
{
candidate.Status = "checkSeat";
// ❗ออกเลขประจำตัวสอบ (กันซ้ำ 100%)
if (string.IsNullOrEmpty(candidate.ExamIdenNumber))
{
using var transaction = await _context.Database.BeginTransactionAsync();
// อ่านเลขล่าสุด (Lock ภายใน Transaction)
var lastNumber = await _context.Candidates
.Where(x => x.PeriodExam.Id == exam.Id)
.OrderByDescending(x => x.ExamIdenNumber)
.Select(x => x.ExamIdenNumber)
.FirstOrDefaultAsync();
// Convert → หาเลขลำดับต่อไป
int next = 1;
if (!string.IsNullOrEmpty(lastNumber))
{
// ถ้าเลขมี prefix เช่น P01xxxx → ต้องเอาเฉพาะตัวเลข
string numeric = new string(lastNumber.Where(char.IsDigit).ToArray());
next = int.Parse(numeric) + 1;
}
// สร้างเลขตามตำแหน่งสอบ
candidate.ExamIdenNumber =
candidate.PositionExam == null
? next.ToString("D5")
: candidate.PositionExam.Code + next.ToString("D5");
await _context.SaveChangesAsync();
await transaction.CommitAsync();
}
}
await _context.SaveChangesAsync();
}
public async Task AdminCheckCandidateService(string candidateId, string status, RequestApprove item)
{
var candidate = await _context.Candidates.AsQueryable()
@ -2147,6 +2276,30 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
await _context.SaveChangesAsync();
}
public async Task AdminCheckShowExamInfoService(string examId, bool status)
{
var examGuid = Guid.Parse(examId);
var periodExam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == examGuid);
if (periodExam == null)
throw new Exception(GlobalMessages.ExamNotFound);
var candidates = await _context.Candidates.AsQueryable()
.Include(x => x.PeriodExam)
.Where(x => x.PeriodExam.Id == examGuid /*&& x.IsShowExamInfo == false*/)
.ToListAsync();
foreach (var candidate in candidates)
{
if (candidate.Status.Trim().ToUpper() == "REGISTER" && candidate.Status.Trim().ToUpper() == "CHECKREGISTER" && candidate.Status.Trim().ToUpper() == "PAYMENT")
continue;
candidate.IsShowExamInfo = status;
}
await _context.SaveChangesAsync();
}
public async Task AdminRejectToCheckCandidateService(Guid candidateId, string? reason)
{
var candidate = await _context.Candidates.AsQueryable()
@ -2299,6 +2452,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Position = positionName,
PositionLevel = positionLevelName,
HighDegree = highDegree,
IsShowExamInfo = candidate.IsShowExamInfo,
};
}
@ -2440,34 +2594,63 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
public async Task CheckCitizen(string examId, string positionId, string citizenId)
{
var exam = await _context.PeriodExams.AsQueryable()
.Where(p => p.CheckDisability == false)
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
// var exam = await _context.PeriodExams.AsQueryable()
// .Where(p => p.CheckDisability == false)
// .FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
if (exam == null)
throw new Exception(GlobalMessages.ExamNotFound);
// if (exam == null)
// throw new Exception(GlobalMessages.ExamNotFound);
if (positionId != "00000000-0000-0000-0000-000000000000")
{
var position = await _context.PositionExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId) && x.PeriodExam == exam);
// if (citizenId.Length != 13)
// throw new Exception(GlobalMessages.CitizenIncomplete);
if (position == null)
throw new Exception(GlobalMessages.PositionExamNotFound);
// int[] citizenIdDigits = citizenId.Select(c => int.Parse(c.ToString())).ToArray();
// int cal =
// citizenIdDigits[0] * 13 +
// citizenIdDigits[1] * 12 +
// citizenIdDigits[2] * 11 +
// citizenIdDigits[3] * 10 +
// citizenIdDigits[4] * 9 +
// citizenIdDigits[5] * 8 +
// citizenIdDigits[6] * 7 +
// citizenIdDigits[7] * 6 +
// citizenIdDigits[8] * 5 +
// citizenIdDigits[9] * 4 +
// citizenIdDigits[10] * 3 +
// citizenIdDigits[11] * 2;
var candidate1 = await _context.Candidates.AsQueryable()
.Where(x => x.PeriodExam == exam && x.UserId != UserId && x.PositionExam == position && x.CitizenId == citizenId)
.FirstOrDefaultAsync();
if (candidate1 != null)
throw new Exception(GlobalMessages.CitizanDupicate);
// int calStp2 = cal % 11;
// int chkDigit = 11 - calStp2;
// if (chkDigit >= 10)
// {
// chkDigit = 0;
// }
// if (citizenIdDigits[12] != chkDigit)
// throw new Exception(GlobalMessages.CitizenIncorrect);
// if (positionId != "00000000-0000-0000-0000-000000000000")
// {
// var position = await _context.PositionExams.AsQueryable()
// .FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId) && x.PeriodExam == exam);
// if (position == null)
// throw new Exception(GlobalMessages.PositionExamNotFound);
// var candidate1 = await _context.Candidates.AsQueryable()
// .Where(x => x.PeriodExam == exam && x.UserId != UserId /*&& x.PositionExam == position*/ && x.CitizenId == citizenId)
// .FirstOrDefaultAsync();
// if (candidate1 != null)
// throw new Exception(GlobalMessages.CitizanDupicate);
return;
}
// }
var candidate2 = await _context.Candidates.AsQueryable()
.Where(x => x.PeriodExam == exam && x.UserId != UserId && x.CitizenId == citizenId)
.FirstOrDefaultAsync();
if (candidate2 != null)
throw new Exception(GlobalMessages.CitizanDupicate);
//var candidate2 = await _context.Candidates.AsQueryable()
// .Where(x => x.PeriodExam == exam && x.UserId != UserId && x.CitizenId == citizenId)
// .FirstOrDefaultAsync();
//if (candidate2 != null)
// throw new Exception(GlobalMessages.CitizanDupicate);
}
public async Task GetExamCandidateAsync(Guid id)

View file

@ -185,6 +185,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Round = x.Round,
SetSeat = x.SetSeat,
Year = x.Year,
GraduationYearLock = x.GraduationYearLock,
BankExam = x.BankExam.OrderBy(o => o.CreatedAt).Select(b => new BankExam
{
Id = b.Id,
@ -203,6 +204,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
PositionLevelName = b.PositionLevelName,
HighDegree = b.HighDegree,
Code = b.Code,
EducationLevel = b.EducationLevel,
}).ToList(),
Documents = x.PeriodExamDocuments.OrderBy(o => o.CreatedAt).Select(b => new FileListResponse
{
@ -289,6 +291,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Year = periodExam.Year,
Status = periodExam.PaymentEndDate == null ? true : DateTime.Now > periodExam.PaymentEndDate,
SetSeat = periodExam.SetSeat,
Fee = periodExam.Fee,
};
}
@ -317,6 +320,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Year = periodExam.Year,
Position = positionExam.PositionName,
PositionLevel = positionExam.PositionLevelName,
EducationLevel = positionExam.EducationLevel,
};
}
else
@ -328,6 +332,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Year = periodExam.Year,
Position = null,
PositionLevel = null,
EducationLevel = positionExam.EducationLevel,
};
}
}
@ -364,6 +369,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
CompanyCode = inserted.CompanyCode,
Reason = inserted.Reason,
RefNo1 = inserted.RefNo1,
GraduationYearLock = inserted.GraduationYearLock ?? 3,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
@ -406,6 +412,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Code = position.Code,
TypeId = position.TypeId,
TypeName = position.TypeName,
EducationLevel = position.EducationLevel,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
@ -464,6 +471,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
periodExam.CompanyCode = updated.CompanyCode;
periodExam.Reason = updated.Reason;
periodExam.RefNo1 = updated.RefNo1;
periodExam.GraduationYearLock = updated.GraduationYearLock;
periodExam.LastUpdatedAt = DateTime.Now;
periodExam.LastUpdateUserId = UserId ?? "";
periodExam.LastUpdateFullName = FullName ?? "";
@ -539,6 +547,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
position.Code = positionData.Code;
position.TypeId = positionData.TypeId;
position.TypeName = positionData.TypeName;
position.EducationLevel = positionData.EducationLevel;
position.LastUpdatedAt = DateTime.Now;
position.LastUpdateUserId = UserId ?? "";
position.LastUpdateFullName = FullName ?? "";
@ -573,6 +582,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Code = position.Code,
TypeId = position.TypeId,
TypeName = position.TypeName,
EducationLevel = position.EducationLevel,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
@ -799,6 +809,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Status = x.Status,
PositionLevelName = x.PositionExam == null ? null : x.PositionExam.PositionLevelName,
PositionName = x.PositionExam == null ? null : x.PositionExam.PositionName,
IsShowExamInfo = x.IsShowExamInfo,
})
.Skip((page - 1) * pageSize)
.Take(pageSize)
@ -880,6 +891,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Status = x.Status,
PositionLevelName = x.PositionExam == null ? null : x.PositionExam.PositionLevelName,
PositionName = x.PositionExam == null ? null : x.PositionExam.PositionName,
IsShowExamInfo = x.IsShowExamInfo,
})
.ToListAsync();
var _candidate = await _context.Candidates.AsQueryable()
@ -992,6 +1004,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Select(x => new CandidateContactResponseItem
{
ContactPrefixId = x.ContactPrefixId,
ContactPrefix = x.ContactPrefixName,
ContactFirstname = x.ContactFirstname,
ContactLastname = x.ContactLastname,
ContactRelations = x.ContactRelations,
@ -2181,72 +2194,72 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
_data.Add(new
{
Num = num.ToString().ToThaiNumber(),
PositionName = item.PositionName != null && item.PositionLevelName != null ? $"{item.PositionName} {item.PositionLevelName}".ToThaiNumber() : "-",
FullName = item.FullName != null ? item.FullName.ToThaiNumber() : "-",
Nationality = item.Nationality != null ? item.Nationality.ToThaiNumber() : "-",
ReligionName = item.ReligionName != null ? item.ReligionName.ToThaiNumber() : "-",
DateOfBirth = item.DateOfBirth != null ? item.DateOfBirth.ToThaiNumber() : "-",
Age = item.Age != null ? item.Age.ToThaiNumber() : "-",
Telephone = item.Telephone != null ? item.Telephone.ToThaiNumber() : "-",
Num = num.ToString(),
PositionName = item.PositionName != null && item.PositionLevelName != null ? $"{item.PositionName} {item.PositionLevelName}" : "-",
FullName = item.FullName != null ? item.FullName: "-",
Nationality = item.Nationality != null ? item.Nationality : "-",
ReligionName = item.ReligionName != null ? item.ReligionName : "-",
DateOfBirth = item.DateOfBirth != null ? item.DateOfBirth : "-",
Age = item.Age != null ? item.Age : "-",
Telephone = item.Telephone != null ? item.Telephone : "-",
Email = item.Email != null ? item.Email : "-",
CitizenId = item.CitizenId != null ? item.CitizenId.ToThaiNumber() : "-",
CitizenId = item.CitizenId != null ? item.CitizenId : "-",
EducationLevelExamName = education.EducationLevelExamName == null ? "-" : education.EducationLevelExamName.ToThaiNumber(),
EducationName = education.EducationName == null ? "-" : education.EducationName.ToThaiNumber(),
EducationMajor = education.EducationMajor == null ? "-" : education.EducationMajor.ToThaiNumber(),
EducationLocation = education.EducationLocation == null ? "-" : education.EducationLocation.ToThaiNumber(),
EducationEndDate = education.EducationEndDate == null ? "-" : (education.EducationEndDate == null ? "-" : education.EducationEndDate.Value.Date.ToThaiShortDate().ToThaiNumber()),
EducationScores = education.EducationScores == null ? "-" : education.EducationScores.ToThaiNumber(),
EducationType = education.EducationType == null ? "-" : education.EducationType.ToThaiNumber(),
EducationLevelHighName = education.EducationLevelHighName == null ? "-" : education.EducationLevelHighName.ToThaiNumber(),
EducationLevelExamName = education.EducationLevelExamName == null ? "-" : education.EducationLevelExamName,
EducationName = education.EducationName == null ? "-" : education.EducationName,
EducationMajor = education.EducationMajor == null ? "-" : education.EducationMajor,
EducationLocation = education.EducationLocation == null ? "-" : education.EducationLocation,
EducationEndDate = education.EducationEndDate == null ? "-" : (education.EducationEndDate == null ? "-" : education.EducationEndDate.Value.Date.ToThaiShortDate()),
EducationScores = education.EducationScores == null ? "-" : education.EducationScores,
EducationType = education.EducationType == null ? "-" : education.EducationType,
EducationLevelHighName = education.EducationLevelHighName == null ? "-" : education.EducationLevelHighName,
OccupationPositionType = item.OccupationPositionType == null ? "-" : GenerateStatusOccupation(item.OccupationPositionType),
OccupationPosition = item.OccupationPosition == null ? "-" : item.OccupationPosition.ToThaiNumber(),
OccupationSalary = item.OccupationSalary == null ? "-" : item.OccupationSalary.ToString().ToThaiNumber(),
OccupationGroup = item.OccupationGroup == null ? "-" : item.OccupationGroup.ToThaiNumber(),
OccupationPile = item.OccupationPile == null ? "-" : item.OccupationPile.ToThaiNumber(),
OccupationOrg = item.OccupationOrg == null ? "-" : item.OccupationOrg.ToThaiNumber(),
OccupationTelephone = item.OccupationTelephone == null ? "-" : item.OccupationTelephone.ToThaiNumber(),
OccupationPosition = item.OccupationPosition == null ? "-" : item.OccupationPosition,
OccupationSalary = item.OccupationSalary == null ? "-" : item.OccupationSalary.ToString(),
OccupationGroup = item.OccupationGroup == null ? "-" : item.OccupationGroup,
OccupationPile = item.OccupationPile == null ? "-" : item.OccupationPile,
OccupationOrg = item.OccupationOrg == null ? "-" : item.OccupationOrg,
OccupationTelephone = item.OccupationTelephone == null ? "-" : item.OccupationTelephone,
Position = firstCareer.Position == null ? "-" : firstCareer.Position.ToThaiNumber(),
Position = firstCareer.Position == null ? "-" : firstCareer.Position,
Type = firstCareer.Type == null ? "-" : firstCareer.Type,
DurationStart = firstCareer.DurationStart == null ? "-" : firstCareer.DurationStart.Date.ToThaiShortDate().ToThaiNumber(),
DurationEnd = firstCareer.DurationEnd == null ? "-" : firstCareer.DurationEnd.Date.ToThaiShortDate().ToThaiNumber(),
RangeDate = firstCareer.RangeDate == null ? "-" : firstCareer.RangeDate.ToThaiNumber(),
DurationStart = firstCareer.DurationStart == null ? "-" : firstCareer.DurationStart.Date.ToThaiShortDate(),
DurationEnd = firstCareer.DurationEnd == null ? "-" : firstCareer.DurationEnd.Date.ToThaiShortDate(),
RangeDate = firstCareer.RangeDate == null ? "-" : firstCareer.RangeDate,
CurrentAddress = item.CurrentAddress == null ? "-" : item.CurrentAddress.ToThaiNumber(),
CurrentProvinceName = item.CurrentProvinceName == null ? "-" : item.CurrentProvinceName.ToThaiNumber(),
CurrentDistrictName = item.CurrentDistrictName == null ? "-" : item.CurrentDistrictName.ToThaiNumber(),
CurrentSubDistrictName = item.CurrentSubDistrictName == null ? "-" : item.CurrentSubDistrictName.ToThaiNumber(),
CurrentZipCode = item.CurrentZipCode == null ? "-" : item.CurrentZipCode.ToThaiNumber(),
CurrentAddress = item.CurrentAddress == null ? "-" : item.CurrentAddress,
CurrentProvinceName = item.CurrentProvinceName == null ? "-" : item.CurrentProvinceName,
CurrentDistrictName = item.CurrentDistrictName == null ? "-" : item.CurrentDistrictName,
CurrentSubDistrictName = item.CurrentSubDistrictName == null ? "-" : item.CurrentSubDistrictName,
CurrentZipCode = item.CurrentZipCode == null ? "-" : item.CurrentZipCode,
RegistAddress = item.RegistAddress == null ? "-" : item.RegistAddress.ToThaiNumber(),
RegistProvinceName = item.RegistProvinceName == null ? "-" : item.RegistProvinceName.ToThaiNumber(),
RegistDistrictName = item.RegistDistrictName == null ? "-" : item.RegistDistrictName.ToThaiNumber(),
RegistSubDistrictName = item.RegistSubDistrictName == null ? "-" : item.RegistSubDistrictName.ToThaiNumber(),
RegistZipCode = item.RegistZipCode == null ? "-" : item.RegistZipCode.ToThaiNumber(),
RegistAddress = item.RegistAddress == null ? "-" : item.RegistAddress,
RegistProvinceName = item.RegistProvinceName == null ? "-" : item.RegistProvinceName,
RegistDistrictName = item.RegistDistrictName == null ? "-" : item.RegistDistrictName,
RegistSubDistrictName = item.RegistSubDistrictName == null ? "-" : item.RegistSubDistrictName,
RegistZipCode = item.RegistZipCode == null ? "-" : item.RegistZipCode,
ContactFullName = item.ContactFullName == null ? "-" : item.ContactFullName.ToThaiNumber(),
ContactRelations = item.ContactRelations == null ? "-" : item.ContactRelations.ToThaiNumber(),
ContactTel = item.ContactTel == null ? "-" : item.ContactTel.ToThaiNumber(),
ContactFullName = item.ContactFullName == null ? "-" : item.ContactFullName,
ContactRelations = item.ContactRelations == null ? "-" : item.ContactRelations,
ContactTel = item.ContactTel == null ? "-" : item.ContactTel,
CandidateStatus = GenerateStatusCandidate(item.Status),
Number = item.Number == null ? "-" : item.Number.ToThaiNumber(),
ExamIdenNumber = item.ExamIdenNumber == null ? "-" : item.ExamIdenNumber.ToThaiNumber(),
SeatNumber = item.SeatNumber == null ? "-" : item.SeatNumber.ToThaiNumber(),
PointTotalA = item.PointTotalA == null ? "-" : item.PointTotalA.ToThaiNumber(),
PointA = item.PointA == null ? "-" : item.PointA.ToThaiNumber(),
ResultA = item.ResultA == null ? "-" : item.ResultA.ToThaiNumber(),
PointTotalB = item.PointTotalB == null ? "-" : item.PointTotalB.ToThaiNumber(),
PointB = item.PointB == null ? "-" : item.PointB.ToThaiNumber(),
ResultB = item.ResultB == null ? "-" : item.ResultB.ToThaiNumber(),
PointTotalC = item.PointTotalC == null ? "-" : item.PointTotalC.ToThaiNumber(),
PointC = item.PointC == null ? "-" : item.PointC.ToThaiNumber(),
ResultC = item.ResultC == null ? "-" : item.ResultC.ToThaiNumber(),
Pass = item.Pass == null ? "-" : item.Pass.ToThaiNumber(),
CreatedAt = item.CreatedAt.Date == null ? "-" : item.CreatedAt.Date.ToThaiShortDate().ToThaiNumber(),
RegisterDate = item.RegisterDate.Value.Date == null ? "-" : $"{item.RegisterDate.Value.Date.ToThaiShortDate()} {item.RegisterDate.Value.ToString("HH:mm:ss.ffff")}".ToThaiNumber()
Number = item.Number == null ? "-" : item.Number,
ExamIdenNumber = item.ExamIdenNumber == null ? "-" : item.ExamIdenNumber,
SeatNumber = item.SeatNumber == null ? "-" : item.SeatNumber,
PointTotalA = item.PointTotalA == null ? "-" : item.PointTotalA,
PointA = item.PointA == null ? "-" : item.PointA,
ResultA = item.ResultA == null ? "-" : item.ResultA,
PointTotalB = item.PointTotalB == null ? "-" : item.PointTotalB,
PointB = item.PointB == null ? "-" : item.PointB,
ResultB = item.ResultB == null ? "-" : item.ResultB,
PointTotalC = item.PointTotalC == null ? "-" : item.PointTotalC,
PointC = item.PointC == null ? "-" : item.PointC,
ResultC = item.ResultC == null ? "-" : item.ResultC,
Pass = item.Pass == null ? "-" : item.Pass,
CreatedAt = item.CreatedAt.Date == null ? "-" : item.CreatedAt.Date.ToThaiShortDate(),
RegisterDate = item.RegisterDate.Value.Date == null ? "-" : $"{item.RegisterDate.Value.Date.ToThaiShortDate()} {item.RegisterDate.Value.ToString("HH:mm:ss.ffff")}"
});
if (careers.Count > 1)
@ -2283,11 +2296,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
OccupationOrg = "",
OccupationTelephone = "",
Position = career.Position != null ? career.Position.ToThaiNumber() : "-",
Position = career.Position != null ? career.Position : "-",
Type = career.Type != null ? career.Type : "-",
DurationStart = career.DurationStart != null ? career.DurationStart.Date.ToThaiShortDate().ToThaiNumber() : "-",
DurationEnd = career.DurationEnd != null ? career.DurationEnd.Date.ToThaiShortDate().ToThaiNumber() : "-",
RangeDate = career.RangeDate != null ? career.RangeDate.ToThaiNumber() : "-",
DurationStart = career.DurationStart != null ? career.DurationStart.Date.ToThaiShortDate() : "-",
DurationEnd = career.DurationEnd != null ? career.DurationEnd.Date.ToThaiShortDate() : "-",
RangeDate = career.RangeDate != null ? career.RangeDate : "-",
CurrentAddress = "",
CurrentProvinceName = "",
@ -2329,33 +2342,33 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
{
_data.Add(new
{
Num = num.ToString().ToThaiNumber(),
PositionName = item.PositionName != null && item.PositionLevelName != null ? $"{item.PositionName} {item.PositionLevelName}".ToThaiNumber() : "-",
FullName = item.FullName != null ? item.FullName.ToThaiNumber() : "-",
Nationality = item.Nationality != null ? item.Nationality.ToThaiNumber() : "-",
ReligionName = item.ReligionName != null ? item.ReligionName.ToThaiNumber() : "-",
DateOfBirth = item.DateOfBirth != null ? item.DateOfBirth.ToThaiNumber() : "-",
Age = item.Age != null ? item.Age.ToThaiNumber() : "-",
Telephone = item.Telephone != null ? item.Telephone.ToThaiNumber() : "-",
Num = num.ToString(),
PositionName = item.PositionName != null && item.PositionLevelName != null ? $"{item.PositionName} {item.PositionLevelName}" : "-",
FullName = item.FullName != null ? item.FullName : "-",
Nationality = item.Nationality != null ? item.Nationality : "-",
ReligionName = item.ReligionName != null ? item.ReligionName : "-",
DateOfBirth = item.DateOfBirth != null ? item.DateOfBirth : "-",
Age = item.Age != null ? item.Age : "-",
Telephone = item.Telephone != null ? item.Telephone : "-",
Email = item.Email != null ? item.Email : "-",
CitizenId = item.CitizenId != null ? item.CitizenId.ToThaiNumber() : "-",
CitizenId = item.CitizenId != null ? item.CitizenId : "-",
EducationLevelExamName = education.EducationLevelExamName == null ? "-" : education.EducationLevelExamName.ToThaiNumber(),
EducationName = education.EducationName == null ? "-" : education.EducationName.ToThaiNumber(),
EducationMajor = education.EducationMajor == null ? "-" : education.EducationMajor.ToThaiNumber(),
EducationLocation = education.EducationLocation == null ? "-" : education.EducationLocation.ToThaiNumber(),
EducationEndDate = education.EducationEndDate == null ? "-" : (education.EducationEndDate == null ? "-" : education.EducationEndDate.Value.Date.ToThaiShortDate().ToThaiNumber()),
EducationScores = education.EducationScores == null ? "-" : education.EducationScores.ToThaiNumber(),
EducationType = education.EducationType == null ? "-" : education.EducationType.ToThaiNumber(),
EducationLevelHighName = education.EducationLevelHighName == null ? "-" : education.EducationLevelHighName.ToThaiNumber(),
EducationLevelExamName = education.EducationLevelExamName == null ? "-" : education.EducationLevelExamName,
EducationName = education.EducationName == null ? "-" : education.EducationName,
EducationMajor = education.EducationMajor == null ? "-" : education.EducationMajor,
EducationLocation = education.EducationLocation == null ? "-" : education.EducationLocation,
EducationEndDate = education.EducationEndDate == null ? "-" : (education.EducationEndDate == null ? "-" : education.EducationEndDate.Value.Date.ToThaiShortDate()),
EducationScores = education.EducationScores == null ? "-" : education.EducationScores,
EducationType = education.EducationType == null ? "-" : education.EducationType,
EducationLevelHighName = education.EducationLevelHighName == null ? "-" : education.EducationLevelHighName,
OccupationPositionType = item.OccupationPositionType == null ? "-" : GenerateStatusOccupation(item.OccupationPositionType),
OccupationPosition = item.OccupationPosition == null ? "-" : item.OccupationPosition.ToThaiNumber(),
OccupationSalary = item.OccupationSalary == null ? "-" : item.OccupationSalary.ToString().ToThaiNumber(),
OccupationGroup = item.OccupationGroup == null ? "-" : item.OccupationGroup.ToThaiNumber(),
OccupationPile = item.OccupationPile == null ? "-" : item.OccupationPile.ToThaiNumber(),
OccupationOrg = item.OccupationOrg == null ? "-" : item.OccupationOrg.ToThaiNumber(),
OccupationTelephone = item.OccupationTelephone == null ? "-" : item.OccupationTelephone.ToThaiNumber(),
OccupationPosition = item.OccupationPosition == null ? "-" : item.OccupationPosition,
OccupationSalary = item.OccupationSalary == null ? "-" : item.OccupationSalary.ToString(),
OccupationGroup = item.OccupationGroup == null ? "-" : item.OccupationGroup,
OccupationPile = item.OccupationPile == null ? "-" : item.OccupationPile,
OccupationOrg = item.OccupationOrg == null ? "-" : item.OccupationOrg,
OccupationTelephone = item.OccupationTelephone == null ? "-" : item.OccupationTelephone,
Position = "-",
Type = "-",
@ -2363,38 +2376,38 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
DurationEnd = "-",
RangeDate = "-",
CurrentAddress = item.CurrentAddress == null ? "-" : item.CurrentAddress.ToThaiNumber(),
CurrentProvinceName = item.CurrentProvinceName == null ? "-" : item.CurrentProvinceName.ToThaiNumber(),
CurrentDistrictName = item.CurrentDistrictName == null ? "-" : item.CurrentDistrictName.ToThaiNumber(),
CurrentSubDistrictName = item.CurrentSubDistrictName == null ? "-" : item.CurrentSubDistrictName.ToThaiNumber(),
CurrentZipCode = item.CurrentZipCode == null ? "-" : item.CurrentZipCode.ToThaiNumber(),
CurrentAddress = item.CurrentAddress == null ? "-" : item.CurrentAddress,
CurrentProvinceName = item.CurrentProvinceName == null ? "-" : item.CurrentProvinceName,
CurrentDistrictName = item.CurrentDistrictName == null ? "-" : item.CurrentDistrictName,
CurrentSubDistrictName = item.CurrentSubDistrictName == null ? "-" : item.CurrentSubDistrictName,
CurrentZipCode = item.CurrentZipCode == null ? "-" : item.CurrentZipCode,
RegistAddress = item.RegistAddress == null ? "-" : item.RegistAddress.ToThaiNumber(),
RegistProvinceName = item.RegistProvinceName == null ? "-" : item.RegistProvinceName.ToThaiNumber(),
RegistDistrictName = item.RegistDistrictName == null ? "-" : item.RegistDistrictName.ToThaiNumber(),
RegistSubDistrictName = item.RegistSubDistrictName == null ? "-" : item.RegistSubDistrictName.ToThaiNumber(),
RegistZipCode = item.RegistZipCode == null ? "-" : item.RegistZipCode.ToThaiNumber(),
RegistAddress = item.RegistAddress == null ? "-" : item.RegistAddress,
RegistProvinceName = item.RegistProvinceName == null ? "-" : item.RegistProvinceName,
RegistDistrictName = item.RegistDistrictName == null ? "-" : item.RegistDistrictName,
RegistSubDistrictName = item.RegistSubDistrictName == null ? "-" : item.RegistSubDistrictName,
RegistZipCode = item.RegistZipCode == null ? "-" : item.RegistZipCode,
ContactFullName = item.ContactFullName == null ? "-" : item.ContactFullName.ToThaiNumber(),
ContactRelations = item.ContactRelations == null ? "-" : item.ContactRelations.ToThaiNumber(),
ContactTel = item.ContactTel == null ? "-" : item.ContactTel.ToThaiNumber(),
ContactFullName = item.ContactFullName == null ? "-" : item.ContactFullName,
ContactRelations = item.ContactRelations == null ? "-" : item.ContactRelations,
ContactTel = item.ContactTel == null ? "-" : item.ContactTel,
CandidateStatus = GenerateStatusCandidate(item.Status),
Number = item.Number == null ? "-" : item.Number.ToThaiNumber(),
ExamIdenNumber = item.ExamIdenNumber == null ? "-" : item.ExamIdenNumber.ToThaiNumber(),
SeatNumber = item.SeatNumber == null ? "-" : item.SeatNumber.ToThaiNumber(),
PointTotalA = item.PointTotalA == null ? "-" : item.PointTotalA.ToThaiNumber(),
PointA = item.PointA == null ? "-" : item.PointA.ToThaiNumber(),
ResultA = item.ResultA == null ? "-" : item.ResultA.ToThaiNumber(),
PointTotalB = item.PointTotalB == null ? "-" : item.PointTotalB.ToThaiNumber(),
PointB = item.PointB == null ? "-" : item.PointB.ToThaiNumber(),
ResultB = item.ResultB == null ? "-" : item.ResultB.ToThaiNumber(),
PointTotalC = item.PointTotalC == null ? "-" : item.PointTotalC.ToThaiNumber(),
PointC = item.PointC == null ? "-" : item.PointC.ToThaiNumber(),
ResultC = item.ResultC == null ? "-" : item.ResultC.ToThaiNumber(),
Pass = item.Pass == null ? "-" : item.Pass.ToThaiNumber(),
CreatedAt = item.CreatedAt.Date == null ? "-" : item.CreatedAt.Date.ToThaiShortDate().ToThaiNumber(),
RegisterDate = item.RegisterDate.Value.Date == null ? "-" : $"{item.RegisterDate.Value.Date.ToThaiShortDate()} {item.RegisterDate.Value.ToString("HH:mm:ss.ffff")}".ToThaiNumber()
Number = item.Number == null ? "-" : item.Number,
ExamIdenNumber = item.ExamIdenNumber == null ? "-" : item.ExamIdenNumber,
SeatNumber = item.SeatNumber == null ? "-" : item.SeatNumber,
PointTotalA = item.PointTotalA == null ? "-" : item.PointTotalA,
PointA = item.PointA == null ? "-" : item.PointA,
ResultA = item.ResultA == null ? "-" : item.ResultA,
PointTotalB = item.PointTotalB == null ? "-" : item.PointTotalB,
PointB = item.PointB == null ? "-" : item.PointB,
ResultB = item.ResultB == null ? "-" : item.ResultB,
PointTotalC = item.PointTotalC == null ? "-" : item.PointTotalC,
PointC = item.PointC == null ? "-" : item.PointC,
ResultC = item.ResultC == null ? "-" : item.ResultC,
Pass = item.Pass == null ? "-" : item.Pass,
CreatedAt = item.CreatedAt.Date == null ? "-" : item.CreatedAt.Date.ToThaiShortDate(),
RegisterDate = item.RegisterDate.Value.Date == null ? "-" : $"{item.RegisterDate.Value.Date.ToThaiShortDate()} {item.RegisterDate.Value.ToString("HH:mm:ss.ffff")}"
});
}