ปรับ ui สรรหาสอบคัดเลือก

This commit is contained in:
Kittapath 2023-10-02 00:22:28 +07:00
parent c79bc39c86
commit fbef67f33a
29 changed files with 7384 additions and 666 deletions

View file

@ -264,7 +264,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)] [ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)] [ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsAsyncRegisterExam(string examId, string positionId) public async Task<ActionResult<ResponseObject>> GetsAsyncRegisterExam(Guid examId, Guid positionId)
{ {
try try
{ {
@ -555,32 +555,32 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
} }
} }
/// <summary> // /// <summary>
/// อัพเดทข้อมูล ประวัติการศีกษา ผู้สมัคร // /// อัพเดทข้อมูล ประวัติการศีกษา ผู้สมัคร
/// </summary> // /// </summary>
/// <param name="educationId">รหัสประวัติการศีกษา</param> // /// <param name="educationId">รหัสประวัติการศีกษา</param>
/// <param name="candidateEducation">ข้อมูลประวัติการศีกษา</param> // /// <param name="candidateEducation">ข้อมูลประวัติการศีกษา</param>
/// <returns></returns> // /// <returns></returns>
/// <response code="200">เมื่อทำการอัพเดทข้อมูล ประวัติการศีกษา ผู้สมัคร สำเร็จ</response> // /// <response code="200">เมื่อทำการอัพเดทข้อมูล ประวัติการศีกษา ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response> // /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response> // /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("education/{educationId:length(36)}")] // [HttpPut("education/{educationId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)] // [ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)] // [ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)] // [ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> UpdateAsyncEducation(string educationId, CandidateEducationResponseItem candidateEducation) // public async Task<ActionResult<ResponseObject>> UpdateAsyncEducation(string educationId, CandidateEducationResponseItem candidateEducation)
{ // {
try // try
{ // {
await _candidateService.UpdateAsyncEducation(educationId, candidateEducation); // await _candidateService.UpdateAsyncEducation(educationId, candidateEducation);
return Success(); // return Success();
} // }
catch (Exception ex) // catch (Exception ex)
{ // {
return Error(ex); // return Error(ex);
} // }
} // }
/// <summary> /// <summary>
/// ลบข้อมูล ประวัติการศีกษา ผู้สมัคร /// ลบข้อมูล ประวัติการศีกษา ผู้สมัคร

View file

@ -605,31 +605,34 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnType("longtext") .HasColumnType("longtext")
.HasComment("ลำดับที่สอบได้"); .HasComment("ลำดับที่สอบได้");
b.Property<string>("OccupationCompany") b.Property<string>("OccupationGroup")
.HasColumnType("longtext") .HasColumnType("longtext")
.HasComment("สำนัก/บริษัท บริษัท"); .HasComment("ตำแหน่งปัจจุบัน กลุ่ม/ฝ่าย");
b.Property<string>("OccupationDepartment") b.Property<string>("OccupationOrg")
.HasColumnType("longtext") .HasColumnType("longtext")
.HasComment("กอง/ฝ่าย บริษัท"); .HasComment("ตำแหน่งปัจจุบัน ชื่อตำแหน่ง");
b.Property<string>("OccupationEmail") b.Property<string>("OccupationPile")
.HasMaxLength(200) .HasColumnType("longtext")
.HasColumnType("varchar(200)") .HasComment("ตำแหน่งปัจจุบัน กอง");
.HasComment("อีเมล บริษัท");
b.Property<string>("OccupationPosition") b.Property<string>("OccupationPosition")
.HasColumnType("longtext") .HasColumnType("longtext")
.HasComment("ตำแหน่งอาชีพ"); .HasComment("ตำแหน่งปัจจุบัน สังกัด");
b.Property<string>("OccupationPositionType")
.HasColumnType("longtext")
.HasComment("ตำแหน่งปัจจุบัน ประเภทราชการ");
b.Property<int?>("OccupationSalary")
.HasColumnType("int")
.HasComment("ตำแหน่งปัจจุบัน เงินเดือน");
b.Property<string>("OccupationTelephone") b.Property<string>("OccupationTelephone")
.HasMaxLength(20) .HasMaxLength(20)
.HasColumnType("varchar(20)") .HasColumnType("varchar(20)")
.HasComment("โทรศัพท์ บริษัท"); .HasComment("ตำแหน่งปัจจุบัน เบอร์โทรที่ทำงาน");
b.Property<string>("OccupationType")
.HasColumnType("longtext")
.HasComment("ประเภทอาชีพที่ทำงานมาก่อน");
b.Property<string>("Pass") b.Property<string>("Pass")
.HasColumnType("longtext") .HasColumnType("longtext")
@ -769,6 +772,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnType("longtext") .HasColumnType("longtext")
.HasComment("สถานภาพ"); .HasComment("สถานภาพ");
b.Property<Guid?>("ReligionId")
.HasColumnType("char(36)")
.HasComment("Id ศาสนา");
b.Property<string>("ReligionName")
.HasColumnType("longtext")
.HasComment("ศาสนา");
b.Property<string>("ResultA") b.Property<string>("ResultA")
.HasColumnType("longtext") .HasColumnType("longtext")
.HasComment("ผลสอบภาค ก"); .HasComment("ผลสอบภาค ก");
@ -931,6 +942,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnOrder(1) .HasColumnOrder(1)
.HasComment("ระยะเวลาเริ่ม"); .HasComment("ระยะเวลาเริ่ม");
b.Property<string>("Group")
.IsRequired()
.HasColumnType("longtext")
.HasColumnOrder(4)
.HasComment("กลุ่ม/ฝ่าย");
b.Property<bool>("IsActive") b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)") .HasColumnType("tinyint(1)")
.HasColumnOrder(106) .HasColumnOrder(106)
@ -955,29 +972,29 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnOrder(102) .HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("Name") b.Property<string>("Org")
.IsRequired() .IsRequired()
.HasColumnType("longtext") .HasColumnType("longtext")
.HasColumnOrder(3) .HasColumnOrder(6)
.HasComment("สถานที่ทำงาน/ฝึกงาน"); .HasComment("สังกัด");
b.Property<string>("Pile")
.IsRequired()
.HasColumnType("longtext")
.HasColumnOrder(5)
.HasComment("กอง");
b.Property<string>("Position") b.Property<string>("Position")
.IsRequired() .IsRequired()
.HasColumnType("longtext") .HasColumnType("longtext")
.HasColumnOrder(4) .HasColumnOrder(3)
.HasComment("ตำแหน่ง/ลักษณะงาน"); .HasComment("ชื่อตำแหน่ง");
b.Property<string>("Reason") b.Property<string>("RangeDate")
.IsRequired() .IsRequired()
.HasColumnType("longtext") .HasColumnType("longtext")
.HasColumnOrder(6) .HasColumnOrder(7)
.HasComment("เหตุผลที่ออก"); .HasComment("ระยะเวลา");
b.Property<int>("Salary")
.HasMaxLength(20)
.HasColumnType("int")
.HasColumnOrder(5)
.HasComment("เงินเดือนสุดท้ายก่อนออก");
b.HasKey("Id"); b.HasKey("Id");
@ -2109,23 +2126,45 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnOrder(101) .HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล"); .HasComment("User Id ที่สร้างข้อมูล");
b.Property<DateTime>("DurationEnd") b.Property<DateTime?>("EducationEndDate")
.HasColumnType("datetime(6)") .HasColumnType("datetime(6)")
.HasColumnOrder(2) .HasComment("วันที่สำเร็จการศึกษา");
.HasComment("ระยะเวลาสิ้นสุด");
b.Property<DateTime>("DurationStart") b.Property<Guid?>("EducationLevelExamId")
.HasColumnType("datetime(6)")
.HasColumnOrder(1)
.HasComment("ระยะเวลาเริ่ม");
b.Property<Guid?>("EducationLevelId")
.HasColumnType("char(36)") .HasColumnType("char(36)")
.HasComment("Idวุฒิที่ได้รับ"); .HasComment("Id วุฒิที่ใช้สมัครสอบ");
b.Property<string>("EducationLevelName") b.Property<string>("EducationLevelExamName")
.HasColumnType("longtext") .HasColumnType("longtext")
.HasComment("วุฒิที่ได้รับ"); .HasComment("วุฒิที่ใช้สมัครสอบ");
b.Property<Guid?>("EducationLevelHighId")
.HasColumnType("char(36)")
.HasComment("Id วุฒิการศึกษาสูงสุด");
b.Property<string>("EducationLevelHighName")
.HasColumnType("longtext")
.HasComment("วุฒิการศึกษาสูงสุด");
b.Property<string>("EducationLocation")
.HasColumnType("longtext")
.HasComment("ชื่อสถานศึกษา");
b.Property<string>("EducationMajor")
.HasColumnType("longtext")
.HasComment("สาขาวิชา/วิชาเอก");
b.Property<string>("EducationName")
.HasColumnType("longtext")
.HasComment("ชื่อปริญญา");
b.Property<string>("EducationScores")
.HasColumnType("longtext")
.HasComment("คะแนนเฉลี่ยสะสม");
b.Property<string>("EducationType")
.HasColumnType("longtext")
.HasComment("ประเภทสถานศึกษา");
b.Property<bool>("IsActive") b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)") .HasColumnType("tinyint(1)")
@ -2151,24 +2190,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnOrder(102) .HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("Major")
.IsRequired()
.HasColumnType("longtext")
.HasColumnOrder(4)
.HasComment("สาขาวิชา/วิชาเอก");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext")
.HasColumnOrder(3)
.HasComment("ชื่อสถานศึกษา");
b.Property<float>("Scores")
.HasMaxLength(10)
.HasColumnType("float")
.HasColumnOrder(6)
.HasComment("คะแนนเฉลี่ยตลอดหลักสูตร");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("CandidateId"); b.HasIndex("CandidateId");
@ -2239,6 +2260,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnType("longtext") .HasColumnType("longtext")
.HasComment("รายละเอียดสมัครสอบ"); .HasComment("รายละเอียดสมัครสอบ");
b.Property<string>("EditorCondition")
.HasColumnType("longtext")
.HasComment("รายละเอียดเงื่อนไขการสมัคร");
b.Property<string>("EditorConfirm")
.HasColumnType("longtext")
.HasComment("รายละเอียดคำรับรอง");
b.Property<DateTime?>("ExamDate") b.Property<DateTime?>("ExamDate")
.HasColumnType("datetime(6)") .HasColumnType("datetime(6)")
.HasComment("วันที่สอบ"); .HasComment("วันที่สอบ");
@ -2508,7 +2537,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.Property<bool>("HighDegree") b.Property<bool>("HighDegree")
.HasColumnType("tinyint(1)") .HasColumnType("tinyint(1)")
.HasComment("ปริญญาขึ้นไป"); .HasComment("ปริญญาบัตรขึ้นไป");
b.Property<bool>("IsActive") b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)") .HasColumnType("tinyint(1)")
@ -2541,6 +2570,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnType("char(36)") .HasColumnType("char(36)")
.HasComment("Id ตำแหน่ง"); .HasComment("Id ตำแหน่ง");
b.Property<Guid?>("PositionLevelId")
.HasColumnType("char(36)")
.HasComment("Id ระดับ");
b.Property<string>("PositionLevelName")
.HasColumnType("longtext")
.HasComment("ชื่อระดับ");
b.Property<string>("PositionName") b.Property<string>("PositionName")
.HasColumnType("longtext") .HasColumnType("longtext")
.HasComment("ชื่อตำแหน่ง"); .HasComment("ชื่อตำแหน่ง");
@ -2795,7 +2832,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Education", b => modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Education", b =>
{ {
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Candidate", "Candidate") b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Candidate", "Candidate")
.WithMany() .WithMany("Educations")
.HasForeignKey("CandidateId") .HasForeignKey("CandidateId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
@ -2868,6 +2905,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.Navigation("CMSGovernments"); b.Navigation("CMSGovernments");
}); });
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Candidate", b =>
{
b.Navigation("Educations");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Disables.Disable", b => modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Disables.Disable", b =>
{ {
b.Navigation("Addresses"); b.Navigation("Addresses");

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,111 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recurit.Exam.Service.Migrations
{
/// <inheritdoc />
public partial class UpdateTablePositionExamAddPositionLevel : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<bool>(
name: "HighDegree",
table: "PositionExams",
type: "tinyint(1)",
nullable: false,
comment: "ปริญญาบัตรขึ้นไป",
oldClrType: typeof(bool),
oldType: "tinyint(1)",
oldComment: "ปริญญาขึ้นไป");
migrationBuilder.AddColumn<Guid>(
name: "PositionLevelId",
table: "PositionExams",
type: "char(36)",
nullable: true,
comment: "Id ระดับ",
collation: "ascii_general_ci");
migrationBuilder.AddColumn<string>(
name: "PositionLevelName",
table: "PositionExams",
type: "longtext",
nullable: true,
comment: "ชื่อระดับ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "EditorCondition",
table: "PeriodExams",
type: "longtext",
nullable: true,
comment: "รายละเอียดเงื่อนไขการสมัคร")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "EditorConfirm",
table: "PeriodExams",
type: "longtext",
nullable: true,
comment: "รายละเอียดคำรับรอง")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<Guid>(
name: "ReligionId",
table: "Candidates",
type: "char(36)",
nullable: true,
comment: "Id ศาสนา",
collation: "ascii_general_ci");
migrationBuilder.AddColumn<string>(
name: "ReligionName",
table: "Candidates",
type: "longtext",
nullable: true,
comment: "ศาสนา")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "PositionLevelId",
table: "PositionExams");
migrationBuilder.DropColumn(
name: "PositionLevelName",
table: "PositionExams");
migrationBuilder.DropColumn(
name: "EditorCondition",
table: "PeriodExams");
migrationBuilder.DropColumn(
name: "EditorConfirm",
table: "PeriodExams");
migrationBuilder.DropColumn(
name: "ReligionId",
table: "Candidates");
migrationBuilder.DropColumn(
name: "ReligionName",
table: "Candidates");
migrationBuilder.AlterColumn<bool>(
name: "HighDegree",
table: "PositionExams",
type: "tinyint(1)",
nullable: false,
comment: "ปริญญาขึ้นไป",
oldClrType: typeof(bool),
oldType: "tinyint(1)",
oldComment: "ปริญญาบัตรขึ้นไป");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,504 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recurit.Exam.Service.Migrations
{
/// <inheritdoc />
public partial class UpdateTablePositionExamAddPositionLevel1 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DurationEnd",
table: "Educations");
migrationBuilder.DropColumn(
name: "DurationStart",
table: "Educations");
migrationBuilder.DropColumn(
name: "EducationLevelId",
table: "Educations");
migrationBuilder.DropColumn(
name: "EducationLevelName",
table: "Educations");
migrationBuilder.DropColumn(
name: "Major",
table: "Educations");
migrationBuilder.DropColumn(
name: "Name",
table: "Educations");
migrationBuilder.DropColumn(
name: "Scores",
table: "Educations");
migrationBuilder.DropColumn(
name: "Name",
table: "Careers");
migrationBuilder.DropColumn(
name: "Reason",
table: "Careers");
migrationBuilder.DropColumn(
name: "Salary",
table: "Careers");
migrationBuilder.DropColumn(
name: "OccupationCompany",
table: "Candidates");
migrationBuilder.DropColumn(
name: "OccupationDepartment",
table: "Candidates");
migrationBuilder.DropColumn(
name: "OccupationEmail",
table: "Candidates");
migrationBuilder.DropColumn(
name: "OccupationType",
table: "Candidates");
migrationBuilder.AddColumn<DateTime>(
name: "EducationEndDate",
table: "Educations",
type: "datetime(6)",
nullable: true,
comment: "วันที่สำเร็จการศึกษา");
migrationBuilder.AddColumn<Guid>(
name: "EducationLevelExamId",
table: "Educations",
type: "char(36)",
nullable: true,
comment: "Id วุฒิที่ใช้สมัครสอบ",
collation: "ascii_general_ci");
migrationBuilder.AddColumn<string>(
name: "EducationLevelExamName",
table: "Educations",
type: "longtext",
nullable: true,
comment: "วุฒิที่ใช้สมัครสอบ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<Guid>(
name: "EducationLevelHighId",
table: "Educations",
type: "char(36)",
nullable: true,
comment: "Id วุฒิการศึกษาสูงสุด",
collation: "ascii_general_ci");
migrationBuilder.AddColumn<string>(
name: "EducationLevelHighName",
table: "Educations",
type: "longtext",
nullable: true,
comment: "วุฒิการศึกษาสูงสุด")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "EducationLocation",
table: "Educations",
type: "longtext",
nullable: true,
comment: "ชื่อสถานศึกษา")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "EducationMajor",
table: "Educations",
type: "longtext",
nullable: true,
comment: "สาขาวิชา/วิชาเอก")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "EducationName",
table: "Educations",
type: "longtext",
nullable: true,
comment: "ชื่อปริญญา")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "EducationScores",
table: "Educations",
type: "longtext",
nullable: true,
comment: "คะแนนเฉลี่ยสะสม")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "EducationType",
table: "Educations",
type: "longtext",
nullable: true,
comment: "ประเภทสถานศึกษา")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Position",
table: "Careers",
type: "longtext",
nullable: false,
comment: "ชื่อตำแหน่ง",
oldClrType: typeof(string),
oldType: "longtext",
oldComment: "ตำแหน่ง/ลักษณะงาน")
.Annotation("MySql:CharSet", "utf8mb4")
.Annotation("Relational:ColumnOrder", 3)
.OldAnnotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:ColumnOrder", 4);
migrationBuilder.AddColumn<string>(
name: "Group",
table: "Careers",
type: "longtext",
nullable: false,
comment: "กลุ่ม/ฝ่าย")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Org",
table: "Careers",
type: "longtext",
nullable: false,
comment: "สังกัด")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Pile",
table: "Careers",
type: "longtext",
nullable: false,
comment: "กอง")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "RangeDate",
table: "Careers",
type: "longtext",
nullable: false,
comment: "ระยะเวลา")
.Annotation("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,
oldNullable: true,
oldComment: "โทรศัพท์ บริษัท")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "OccupationPosition",
table: "Candidates",
type: "longtext",
nullable: true,
comment: "ตำแหน่งปัจจุบัน สังกัด",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "ตำแหน่งอาชีพ")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "OccupationGroup",
table: "Candidates",
type: "longtext",
nullable: true,
comment: "ตำแหน่งปัจจุบัน กลุ่ม/ฝ่าย")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "OccupationOrg",
table: "Candidates",
type: "longtext",
nullable: true,
comment: "ตำแหน่งปัจจุบัน ชื่อตำแหน่ง")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "OccupationPile",
table: "Candidates",
type: "longtext",
nullable: true,
comment: "ตำแหน่งปัจจุบัน กอง")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "OccupationPositionType",
table: "Candidates",
type: "longtext",
nullable: true,
comment: "ตำแหน่งปัจจุบัน ประเภทราชการ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<int>(
name: "OccupationSalary",
table: "Candidates",
type: "int",
nullable: true,
comment: "ตำแหน่งปัจจุบัน เงินเดือน");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "EducationEndDate",
table: "Educations");
migrationBuilder.DropColumn(
name: "EducationLevelExamId",
table: "Educations");
migrationBuilder.DropColumn(
name: "EducationLevelExamName",
table: "Educations");
migrationBuilder.DropColumn(
name: "EducationLevelHighId",
table: "Educations");
migrationBuilder.DropColumn(
name: "EducationLevelHighName",
table: "Educations");
migrationBuilder.DropColumn(
name: "EducationLocation",
table: "Educations");
migrationBuilder.DropColumn(
name: "EducationMajor",
table: "Educations");
migrationBuilder.DropColumn(
name: "EducationName",
table: "Educations");
migrationBuilder.DropColumn(
name: "EducationScores",
table: "Educations");
migrationBuilder.DropColumn(
name: "EducationType",
table: "Educations");
migrationBuilder.DropColumn(
name: "Group",
table: "Careers");
migrationBuilder.DropColumn(
name: "Org",
table: "Careers");
migrationBuilder.DropColumn(
name: "Pile",
table: "Careers");
migrationBuilder.DropColumn(
name: "RangeDate",
table: "Careers");
migrationBuilder.DropColumn(
name: "OccupationGroup",
table: "Candidates");
migrationBuilder.DropColumn(
name: "OccupationOrg",
table: "Candidates");
migrationBuilder.DropColumn(
name: "OccupationPile",
table: "Candidates");
migrationBuilder.DropColumn(
name: "OccupationPositionType",
table: "Candidates");
migrationBuilder.DropColumn(
name: "OccupationSalary",
table: "Candidates");
migrationBuilder.AddColumn<DateTime>(
name: "DurationEnd",
table: "Educations",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
comment: "ระยะเวลาสิ้นสุด")
.Annotation("Relational:ColumnOrder", 2);
migrationBuilder.AddColumn<DateTime>(
name: "DurationStart",
table: "Educations",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
comment: "ระยะเวลาเริ่ม")
.Annotation("Relational:ColumnOrder", 1);
migrationBuilder.AddColumn<Guid>(
name: "EducationLevelId",
table: "Educations",
type: "char(36)",
nullable: true,
comment: "Idวุฒิที่ได้รับ",
collation: "ascii_general_ci");
migrationBuilder.AddColumn<string>(
name: "EducationLevelName",
table: "Educations",
type: "longtext",
nullable: true,
comment: "วุฒิที่ได้รับ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Major",
table: "Educations",
type: "longtext",
nullable: false,
comment: "สาขาวิชา/วิชาเอก")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Name",
table: "Educations",
type: "longtext",
nullable: false,
comment: "ชื่อสถานศึกษา")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<float>(
name: "Scores",
table: "Educations",
type: "float",
maxLength: 10,
nullable: false,
defaultValue: 0f,
comment: "คะแนนเฉลี่ยตลอดหลักสูตร")
.Annotation("Relational:ColumnOrder", 6);
migrationBuilder.AlterColumn<string>(
name: "Position",
table: "Careers",
type: "longtext",
nullable: false,
comment: "ตำแหน่ง/ลักษณะงาน",
oldClrType: typeof(string),
oldType: "longtext",
oldComment: "ชื่อตำแหน่ง")
.Annotation("MySql:CharSet", "utf8mb4")
.Annotation("Relational:ColumnOrder", 4)
.OldAnnotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:ColumnOrder", 3);
migrationBuilder.AddColumn<string>(
name: "Name",
table: "Careers",
type: "longtext",
nullable: false,
comment: "สถานที่ทำงาน/ฝึกงาน")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Reason",
table: "Careers",
type: "longtext",
nullable: false,
comment: "เหตุผลที่ออก")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<int>(
name: "Salary",
table: "Careers",
type: "int",
maxLength: 20,
nullable: false,
defaultValue: 0,
comment: "เงินเดือนสุดท้ายก่อนออก")
.Annotation("Relational:ColumnOrder", 5);
migrationBuilder.AlterColumn<string>(
name: "OccupationTelephone",
table: "Candidates",
type: "varchar(20)",
maxLength: 20,
nullable: true,
comment: "โทรศัพท์ บริษัท",
oldClrType: typeof(string),
oldType: "varchar(20)",
oldMaxLength: 20,
oldNullable: true,
oldComment: "ตำแหน่งปัจจุบัน เบอร์โทรที่ทำงาน")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "OccupationPosition",
table: "Candidates",
type: "longtext",
nullable: true,
comment: "ตำแหน่งอาชีพ",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "ตำแหน่งปัจจุบัน สังกัด")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "OccupationCompany",
table: "Candidates",
type: "longtext",
nullable: true,
comment: "สำนัก/บริษัท บริษัท")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "OccupationDepartment",
table: "Candidates",
type: "longtext",
nullable: true,
comment: "กอง/ฝ่าย บริษัท")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "OccupationEmail",
table: "Candidates",
type: "varchar(200)",
maxLength: 200,
nullable: true,
comment: "อีเมล บริษัท")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "OccupationType",
table: "Candidates",
type: "longtext",
nullable: true,
comment: "ประเภทอาชีพที่ทำงานมาก่อน")
.Annotation("MySql:CharSet", "utf8mb4");
}
}
}

View file

@ -110,6 +110,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[Comment("สถานภาพ")] [Comment("สถานภาพ")]
public string? RelationshipName { get; set; } public string? RelationshipName { get; set; }
[Comment("Id ศาสนา")]
public Guid? ReligionId { get; set; }
[Comment("ศาสนา")]
public string? ReligionName { get; set; }
[MaxLength(200), Comment("อีเมล")] [MaxLength(200), Comment("อีเมล")]
public string? Email { get; set; } public string? Email { get; set; }
@ -253,24 +259,20 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[MaxLength(100), Comment("สัญชาติมารดา")] [MaxLength(100), Comment("สัญชาติมารดา")]
public string? MotherNationality { get; set; } public string? MotherNationality { get; set; }
[Comment("ตำแหน่งปัจจุบัน ชื่อตำแหน่ง")]
public string? OccupationOrg { get; set; }
[Comment("ประเภทอาชีพที่ทำงานมาก่อน")] [Comment("ตำแหน่งปัจจุบัน กอง")]
public string? OccupationType { get; set; } public string? OccupationPile { get; set; }
[Comment("ตำแหน่งปัจจุบัน กลุ่ม/ฝ่าย")]
[Comment("ตำแหน่งอาชีพ")] public string? OccupationGroup { get; set; }
[Comment("ตำแหน่งปัจจุบัน เงินเดือน")]
public int? OccupationSalary { get; set; }
[Comment("ตำแหน่งปัจจุบัน สังกัด")]
public string? OccupationPosition { get; set; } public string? OccupationPosition { get; set; }
[Comment("ตำแหน่งปัจจุบัน ประเภทราชการ")]
public string? OccupationPositionType { get; set; }
[Comment("สำนัก/บริษัท บริษัท")] [MaxLength(20), 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; } public string? OccupationTelephone { get; set; }
[Comment("เหตุผลการไม่อนุมัติ")] [Comment("เหตุผลการไม่อนุมัติ")]

View file

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

View file

@ -8,26 +8,25 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
{ {
[Required, Column(Order = 7), Comment("Id ผู้สมัคร")] [Required, Column(Order = 7), Comment("Id ผู้สมัคร")]
public virtual Candidate? Candidate { get; set; } public virtual Candidate? Candidate { get; set; }
[Comment("Id วุฒิที่ใช้สมัครสอบ")]
[Comment("Idวุฒิที่ได้รับ")] public Guid? EducationLevelExamId { get; set; }
public Guid? EducationLevelId { get; set; } [Comment("วุฒิที่ใช้สมัครสอบ")]
public string? EducationLevelExamName { get; set; }
[Comment("วุฒิที่ได้รับ")] [Comment("ชื่อปริญญา")]
public string? EducationLevelName { get; set; } public string? EducationName { get; set; }
[Comment("สาขาวิชา/วิชาเอก")]
[Required, Column(Order = 4), Comment("สาขาวิชา/วิชาเอก")] public string? EducationMajor { get; set; }
public string Major { get; set; } = string.Empty; [Comment("ชื่อสถานศึกษา")]
public string? EducationLocation { get; set; }
[Required, MaxLength(10), Column(Order = 6), Comment("คะแนนเฉลี่ยตลอดหลักสูตร")] [Comment("ประเภทสถานศึกษา")]
public float Scores { get; set; } public string? EducationType { get; set; }
[Comment("วันที่สำเร็จการศึกษา")]
[Required, Column(Order = 3), Comment("ชื่อสถานศึกษา")] public DateTime? EducationEndDate { get; set; }
public string Name { get; set; } = string.Empty; [Comment("คะแนนเฉลี่ยสะสม")]
public string? EducationScores { get; set; }
[Required, Column(Order = 1), Comment("ระยะเวลาเริ่ม")] [Comment("Id วุฒิการศึกษาสูงสุด")]
public DateTime DurationStart { get; set; } = DateTime.Now.Date; public Guid? EducationLevelHighId { get; set; }
[Comment("วุฒิการศึกษาสูงสุด")]
[Required, Column(Order = 2), Comment("ระยะเวลาสิ้นสุด")] public string? EducationLevelHighName { get; set; }
public DateTime DurationEnd { get; set; } = DateTime.Now.Date;
} }
} }

View file

@ -68,6 +68,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[Comment("รายละเอียดสมัครสอบ")] [Comment("รายละเอียดสมัครสอบ")]
public string? Detail { get; set; } public string? Detail { get; set; }
[Comment("รายละเอียดเงื่อนไขการสมัคร")]
public string? EditorCondition { get; set; }
[Comment("รายละเอียดคำรับรอง")]
public string? EditorConfirm { get; set; }
[Comment("หมายเหตุ")] [Comment("หมายเหตุ")]
public string? Note { get; set; } public string? Note { get; set; }

View file

@ -173,23 +173,21 @@ namespace BMA.EHR.Domain.Models.Placement
[MaxLength(100), Comment("สัญชาติมารดา")] [MaxLength(100), Comment("สัญชาติมารดา")]
public string? MotherNationality { get; set; } public string? MotherNationality { get; set; }
[Comment("ประเภทอาชีพที่ทำงานมาก่อน")] [Comment("ตำแหน่งปัจจุบัน ชื่อตำแหน่ง")]
public string? OccupationType { get; set; } public string? OccupationOrg { get; set; }
[Comment("ตำแหน่งปัจจุบัน กอง")]
[Comment("สำนัก/บริษัท บริษัท")] public string? OccupationPile { get; set; }
public string? OccupationCompany { get; set; } [Comment("ตำแหน่งปัจจุบัน กลุ่ม/ฝ่าย")]
public string? OccupationGroup { get; set; }
[Comment("กอง/ฝ่าย บริษัท")] [Comment("ตำแหน่งปัจจุบัน เงินเดือน")]
public string? OccupationDepartment { get; set; } public int? OccupationSalary { get; set; }
[Comment("ตำแหน่งปัจจุบัน สังกัด")]
[MaxLength(200), Comment("อีเมล บริษัท")]
public string? OccupationEmail { get; set; }
[MaxLength(200), Comment("โทรศัพท์ บริษัท")]
public string? OccupationTelephone { get; set; }
[Comment("ตำแหน่งอาชีพ")]
public string? OccupationPosition { get; set; } public string? OccupationPosition { get; set; }
[Comment("ตำแหน่งปัจจุบัน ประเภทราชการ")]
public string? OccupationPositionType { get; set; }
[MaxLength(20), Comment("ตำแหน่งปัจจุบัน เบอร์โทรที่ทำงาน")]
public string? OccupationTelephone { get; set; }
// [Comment("Id ตำแหน่งเลขที่")] // [Comment("Id ตำแหน่งเลขที่")]
// public PositionNumberEntity? PositionNumber { get; set; } // public PositionNumberEntity? PositionNumber { get; set; }

View file

@ -0,0 +1,25 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using BMA.EHR.Recurit.Exam.Service.Models;
using System.ComponentModel.DataAnnotations.Schema;
namespace BMA.EHR.Domain.Models.Placement
{
public class PositionLevel : EntityBaseNoIsActive
{
[Column(Order = 1), Comment("ลำดับ")]
public int? Order { get; set; }
[Required, MaxLength(100), Column(Order = 2), Comment("ชื่อระดับตำแหน่ง")]
public string Name { get; set; } = string.Empty;
[Required, MaxLength(100), Column(Order = 3), Comment("ชื่อย่อระดับตำแหน่ง")]
public string ShortName { get; set; } = string.Empty;
[Column(Order = 4), Comment("ลำดับชั้นของระดับตำแหน่ง")]
public int Level { get; set; } = 0;
[Column(Order = 5), Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true;
}
}

View file

@ -2,6 +2,7 @@
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using BMA.EHR.Recurit.Exam.Service.Models.Documents; using BMA.EHR.Recurit.Exam.Service.Models.Documents;
using BMA.EHR.Domain.Models.Placement;
namespace BMA.EHR.Recurit.Exam.Service.Models namespace BMA.EHR.Recurit.Exam.Service.Models
{ {
@ -16,13 +17,19 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[Comment("ชื่อตำแหน่ง")] [Comment("ชื่อตำแหน่ง")]
public string? PositionName { get; set; } public string? PositionName { get; set; }
[Comment("Id ระดับ")]
public Guid? PositionLevelId { get; set; }
[Comment("ชื่อระดับ")]
public string? PositionLevelName { get; set; }
[Comment("Id ประเภทแบบฟอร์ม")] [Comment("Id ประเภทแบบฟอร์ม")]
public string? TypeId { get; set; } public string? TypeId { get; set; }
[Comment("ชื่อประเภทแบบฟอร์ม")] [Comment("ชื่อประเภทแบบฟอร์ม")]
public string? TypeName { get; set; } public string? TypeName { get; set; }
[Comment("ปริญญาขึ้นไป")] [Comment("ปริญญาบัตรขึ้นไป")]
public bool HighDegree { get; set; } public bool HighDegree { get; set; }
} }
} }

View file

@ -35,6 +35,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Request
public int? ReviewPoint { get; set; } public int? ReviewPoint { get; set; }
public string? Review { get; set; } public string? Review { get; set; }
public string? Position { get; set; } public string? Position { get; set; }
public string? PositionLevel { get; set; }
public string? HighDegree { get; set; } public string? HighDegree { get; set; }
public DateTime? AnnouncementDate { get; set; } public DateTime? AnnouncementDate { get; set; }
public Guid? Id { get; set; } public Guid? Id { get; set; }

View file

@ -26,6 +26,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Request
public bool AnnouncementExam { get; set; } public bool AnnouncementExam { get; set; }
public string? Category { get; set; } public string? Category { get; set; }
public string? Detail { get; set; } public string? Detail { get; set; }
public string? EditorCondition { get; set; }
public string? EditorConfirm { get; set; }
public string? Note { get; set; } public string? Note { get; set; }
public List<FormFile>? Doc { get; set; } public List<FormFile>? Doc { get; set; }
public List<FormFile>? Image { get; set; } public List<FormFile>? Image { get; set; }

View file

@ -7,6 +7,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Request
public Guid? Id { get; set; } public Guid? Id { get; set; }
public Guid? PositionId { get; set; } public Guid? PositionId { get; set; }
public string? PositionName { get; set; } public string? PositionName { get; set; }
public Guid? PositionLevelId { get; set; }
public string? PositionLevelName { get; set; }
public bool HighDegree { get; set; } public bool HighDegree { get; set; }
public string? TypeId { get; set; } public string? TypeId { get; set; }
public string? TypeName { get; set; } public string? TypeName { get; set; }

View file

@ -8,6 +8,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Request
public string? Name { get; set; } public string? Name { get; set; }
public int? Round { get; set; } public int? Round { get; set; }
public int? Year { get; set; } public int? Year { get; set; }
public PositionExam? Posiiton { get; set; } public string? Position { get; set; }
public string? PositionLevel { get; set; }
} }
} }

View file

@ -10,6 +10,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Request
public bool Bank { get; set; } public bool Bank { get; set; }
public bool Payment { get; set; } public bool Payment { get; set; }
public string? Status { get; set; } public string? Status { get; set; }
public string? EditorCondition { get; set; }
public string? EditorConfirm { get; set; }
public PositionExam? PositionExam { get; set; } public PositionExam? PositionExam { get; set; }
} }
} }

View file

@ -21,9 +21,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
public string? Payment_endDate { get; set; } public string? Payment_endDate { get; set; }
public string? Title { get; set; } public string? Title { get; set; }
public string? Detail { get; set; } public string? Detail { get; set; }
public string? EditorCondition { get; set; }
public string? EditorConfirm { get; set; }
public string? Image { get; set; } public string? Image { get; set; }
public List<HomePageLinkResponseItem>? Images { get; set; } public List<HomePageLinkResponseItem>? Images { get; set; }
public List<HomePageLinkResponseItem>? Files { get; set; } public List<HomePageLinkResponseItem>? Files { get; set; }
public List<HomePageLinkResponseItem>? Positions { get; set; } public List<HomePageLinkResponseItem>? Positions { get; set; }
public List<HomePageLinkResponseItem>? PositionsTrue { get; set; }
public List<HomePageLinkResponseItem>? PositionsFalse { get; set; }
} }
} }

View file

@ -3,11 +3,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
{ {
public class CandidateCareerResponseItem public class CandidateCareerResponseItem
{ {
public string Name { get; set; } = string.Empty;
public string Position { get; set; } = string.Empty; public string Position { get; set; } = string.Empty;
public int Salary { get; set; } public string Group { get; set; } = string.Empty;
public DateTime DurationStart { get; set; } public string Pile { get; set; } = string.Empty;
public DateTime DurationEnd { get; set; } public string Org { get; set; } = string.Empty;
public string Reason { get; set; } = string.Empty; public DateTime DurationStart { get; set; } = DateTime.Now.Date;
public DateTime DurationEnd { get; set; } = DateTime.Now.Date;
public string RangeDate { get; set; } = string.Empty;
} }
} }

View file

@ -3,11 +3,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
{ {
public class CandidateEducationResponseItem public class CandidateEducationResponseItem
{ {
public string EducationLevelId { get; set; } = string.Empty; public Guid EducationLevelExamId { get; set; }
public string Major { get; set; } = string.Empty; public string EducationName { get; set; } = string.Empty;
public float Scores { get; set; } public string EducationMajor { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty; public string EducationLocation { get; set; } = string.Empty;
public DateTime DurationStart { get; set; } public string EducationType { get; set; } = string.Empty;
public DateTime DurationEnd { get; set; } public DateTime EducationEndDate { get; set; }
public string EducationScores { get; set; } = string.Empty;
public Guid EducationLevelHighId { get; set; }
} }
} }

View file

@ -13,6 +13,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
// public Models.Relationship? Relationship { get; set; } // public Models.Relationship? Relationship { get; set; }
public string? RelationshipId { get; set; } public string? RelationshipId { get; set; }
public string? Relationship { get; set; } public string? Relationship { get; set; }
public string? ReligionId { get; set; }
public string? Religion { get; set; }
public string? Email { get; set; } = string.Empty; public string? Email { get; set; } = string.Empty;
public string? CitizenId { get; set; } = string.Empty; public string? CitizenId { get; set; } = string.Empty;
// public Models.Province? CitizenProvince { get; set; } // public Models.Province? CitizenProvince { get; set; }

View file

@ -3,16 +3,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
{ {
public class CandidateOccupationResponseItem public class CandidateOccupationResponseItem
{ {
public string? OccupationType { get; set; } public string? OccupationOrg { get; set; }
public string? OccupationPile { get; set; }
public string? OccupationCompany { get; set; } public string? OccupationGroup { get; set; }
public int? OccupationSalary { get; set; }
public string? OccupationDepartment { get; set; }
public string? OccupationEmail { get; set; }
public string? OccupationTelephone { get; set; }
public string? OccupationPosition { get; set; } public string? OccupationPosition { get; set; }
public string? OccupationPositionType { get; set; }
public string? OccupationTelephone { get; set; }
} }
} }

View file

@ -11,17 +11,17 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
public string? Nationality { get; set; } = string.Empty; public string? Nationality { get; set; } = string.Empty;
public DateTime? DateOfBirth { get; set; } public DateTime? DateOfBirth { get; set; }
// public Models.Relationship? Relationship { get; set; } // public Models.Relationship? Relationship { get; set; }
public string? RelationshipId { get; set; } public string? ReligionId { get; set; }
public string? Relationship { get; set; } // public string? Religion { get; set; }
public string? Email { get; set; } = string.Empty; public string? Email { get; set; } = string.Empty;
public string? CitizenId { get; set; } = string.Empty; public string? CitizenId { get; set; } = string.Empty;
// public Models.Province? CitizenProvince { get; set; } // public Models.Province? CitizenProvince { get; set; }
public string? CitizenProvinceId { get; set; } // public string? CitizenProvinceId { get; set; }
public string? CitizenProvince { get; set; } // public string? CitizenProvince { get; set; }
// public Models.District? CitizenDistrict { get; set; } // // public Models.District? CitizenDistrict { get; set; }
public string? CitizenDistrictId { get; set; } // public string? CitizenDistrictId { get; set; }
public string? CitizenDistrict { get; set; } // public string? CitizenDistrict { get; set; }
public DateTime? CitizenDate { get; set; } // public DateTime? CitizenDate { get; set; }
public string? Telephone { get; set; } public string? Telephone { get; set; }
public string? MobilePhone { get; set; } public string? MobilePhone { get; set; }
public string? Knowledge { get; set; } public string? Knowledge { get; set; }
@ -48,38 +48,43 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
public string? CurrentSubDistrictId { get; set; } public string? CurrentSubDistrictId { get; set; }
public string? CurrentSubDistrict { get; set; } public string? CurrentSubDistrict { get; set; }
public string? CurrentZipCode { get; set; } public string? CurrentZipCode { get; set; }
public bool? Marry { get; set; } // public bool? Marry { get; set; }
// public Models.Prefix? MarryPrefix { get; set; } // // public Models.Prefix? MarryPrefix { get; set; }
public string? MarryPrefixId { get; set; } // public string? MarryPrefixId { get; set; }
public string? MarryPrefix { get; set; } // public string? MarryPrefix { get; set; }
public string? MarryFirstName { get; set; } // public string? MarryFirstName { get; set; }
public string? MarryLastName { get; set; } // public string? MarryLastName { get; set; }
public string? MarryOccupation { get; set; } // public string? MarryOccupation { get; set; }
public string? MarryNationality { get; set; } // public string? MarryNationality { get; set; }
// public Models.Prefix? FatherPrefix { get; set; } // // public Models.Prefix? FatherPrefix { get; set; }
public string? FatherPrefixId { get; set; } // public string? FatherPrefixId { get; set; }
public string? FatherPrefix { get; set; } // public string? FatherPrefix { get; set; }
public string? FatherFirstName { get; set; } // public string? FatherFirstName { get; set; }
public string? FatherLastName { get; set; } // public string? FatherLastName { get; set; }
public string? FatherOccupation { get; set; } // public string? FatherOccupation { get; set; }
public string? FatherNationality { get; set; } // public string? FatherNationality { get; set; }
// public Models.Prefix? MotherPrefix { get; set; } // // public Models.Prefix? MotherPrefix { get; set; }
public string? MotherPrefixId { get; set; } // public string? MotherPrefixId { get; set; }
public string? MotherPrefix { get; set; } // public string? MotherPrefix { get; set; }
public string? MotherFirstName { get; set; } // public string? MotherFirstName { get; set; }
public string? MotherLastName { get; set; } // public string? MotherLastName { get; set; }
public string? MotherOccupation { get; set; } // public string? MotherOccupation { get; set; }
public string? MotherNationality { get; set; } // public string? MotherNationality { get; set; }
public string? OccupationType { get; set; } public string? OccupationOrg { get; set; }
public string? OccupationPile { get; set; }
public string? OccupationCompany { get; set; } public string? OccupationGroup { get; set; }
public int? OccupationSalary { get; set; }
public string? OccupationDepartment { get; set; } public string? OccupationPosition { get; set; }
public string? OccupationPositionType { get; set; }
public string? OccupationEmail { get; set; }
public string? OccupationTelephone { get; set; } public string? OccupationTelephone { get; set; }
public string? OccupationPosition { get; set; } public Guid EducationLevelExamId { get; set; }
public string EducationName { get; set; } = string.Empty;
public string EducationMajor { get; set; } = string.Empty;
public string EducationLocation { get; set; } = string.Empty;
public string EducationType { get; set; } = string.Empty;
public DateTime EducationEndDate { get; set; }
public string EducationScores { get; set; } = string.Empty;
public Guid EducationLevelHighId { get; set; }
} }
} }

View file

@ -17,6 +17,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
public class HomePageLinkResponseItem public class HomePageLinkResponseItem
{ {
public string? Title { get; set; } public string? Title { get; set; }
public string? Level { get; set; }
public string? Url { get; set; } public string? Url { get; set; }
public string? Id { get; set; } public string? Id { get; set; }
public string? Path { get; set; } public string? Path { get; set; }

View file

@ -30,6 +30,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
public bool AnnouncementExam { get; set; } public bool AnnouncementExam { get; set; }
public string? Category { get; set; } public string? Category { get; set; }
public string? Detail { get; set; } public string? Detail { get; set; }
public string? EditorCondition { get; set; }
public string? EditorConfirm { get; set; }
public string? Note { get; set; } public string? Note { get; set; }
public bool IsActive { get; set; } public bool IsActive { get; set; }
public bool SetSeat { get; set; } public bool SetSeat { get; set; }

View file

@ -460,11 +460,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Announcement_endDate = x.AnnouncementEndDate.ToString("yyyy-MM-dd"), Announcement_endDate = x.AnnouncementEndDate.ToString("yyyy-MM-dd"),
AnnouncementExam = x.AnnouncementExam, AnnouncementExam = x.AnnouncementExam,
Register_startDate = x.RegisterStartDate == null ? null : x.RegisterStartDate.Value.ToString("yyyy-MM-dd"), Register_startDate = x.RegisterStartDate == null ? null : x.RegisterStartDate.Value.ToString("yyyy-MM-dd"),
Register_endDate = x.RegisterEndDate == null ? null : x.RegisterEndDate.Value.ToString("yyyy-MM-dd"), Register_endDate = x.RegisterEndDate == null || x.RegisterEndDate == x.RegisterStartDate ? null : x.RegisterEndDate.Value.ToString("yyyy-MM-dd"),
Payment_startDate = x.PaymentStartDate == null ? null : x.PaymentStartDate.Value.ToString("yyyy-MM-dd"), Payment_startDate = x.PaymentStartDate == null ? null : x.PaymentStartDate.Value.ToString("yyyy-MM-dd"),
Payment_endDate = x.PaymentEndDate == null ? null : x.PaymentEndDate.Value.ToString("yyyy-MM-dd"), Payment_endDate = x.PaymentEndDate == null || x.PaymentEndDate == x.PaymentStartDate ? null : x.PaymentEndDate.Value.ToString("yyyy-MM-dd"),
Title = x.Name, Title = x.Name,
Detail = x.Detail, Detail = x.Detail,
EditorCondition = x.EditorCondition,
EditorConfirm = x.EditorConfirm,
Images = x.PeriodExamImages.OrderBy(x => x.CreatedAt).Select(s => new HomePageLinkResponseItem Images = x.PeriodExamImages.OrderBy(x => x.CreatedAt).Select(s => new HomePageLinkResponseItem
{ {
Title = s.Document.FileName, Title = s.Document.FileName,
@ -479,9 +481,29 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
{ {
Id = s.Id.ToString(), Id = s.Id.ToString(),
Title = s.PositionName == null ? x.Name : s.PositionName, Title = s.PositionName == null ? x.Name : s.PositionName,
HighDegree = s.HighDegree == true ? "ปริญญาขึ้นไป" : "ต่ำกว่าปริญญาตรี", Level = s.PositionLevelName == null ? "-" : s.PositionLevelName,
HighDegree = s.HighDegree == true ? "ปริญญาบัตรขึ้นไป" : "ต่ำกว่าปริญญาบัตร",
Path = $"{x.Id}/{s.Id}", Path = $"{x.Id}/{s.Id}",
}).ToList(), })
.ToList(),
PositionsTrue = x.PositionExam.OrderBy(x => x.CreatedAt).Where(x => x.HighDegree == true).Select(s => new HomePageLinkResponseItem
{
Id = s.Id.ToString(),
Title = s.PositionName == null ? x.Name : s.PositionName,
Level = s.PositionLevelName == null ? "-" : s.PositionLevelName,
HighDegree = s.HighDegree == true ? "ปริญญาบัตรขึ้นไป" : "ต่ำกว่าปริญญาบัตร",
Path = $"{x.Id}/{s.Id}",
})
.ToList(),
PositionsFalse = x.PositionExam.OrderBy(x => x.CreatedAt).Where(x => x.HighDegree == false).Select(s => new HomePageLinkResponseItem
{
Id = s.Id.ToString(),
Title = s.PositionName == null ? x.Name : s.PositionName,
Level = s.PositionLevelName == null ? "-" : s.PositionLevelName,
HighDegree = s.HighDegree == true ? "ปริญญาบัตรขึ้นไป" : "ต่ำกว่าปริญญาบัตร",
Path = $"{x.Id}/{s.Id}",
})
.ToList(),
}) })
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();

View file

@ -1,4 +1,5 @@
using System.Security.Claims; using System.Security.Claims;
using BMA.EHR.Domain.Models.Placement;
using BMA.EHR.Recurit.Exam.Service.Core; using BMA.EHR.Recurit.Exam.Service.Core;
using BMA.EHR.Recurit.Exam.Service.Data; using BMA.EHR.Recurit.Exam.Service.Data;
using BMA.EHR.Recurit.Exam.Service.Models; using BMA.EHR.Recurit.Exam.Service.Models;
@ -87,8 +88,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
LastName = x.LastName, LastName = x.LastName,
Nationality = x.Nationality, Nationality = x.Nationality,
DateOfBirth = x.DateOfBirth, DateOfBirth = x.DateOfBirth,
Relationship = x.RelationshipName, Religion = x.ReligionName,
RelationshipId = x.RelationshipId != null ? x.RelationshipId.ToString() : null, ReligionId = x.ReligionId != null ? x.ReligionId.ToString() : null,
CitizenProvince = x.CitizenProvinceName, CitizenProvince = x.CitizenProvinceName,
CitizenProvinceId = x.CitizenProvinceId != null ? x.CitizenProvinceId.ToString() : null, CitizenProvinceId = x.CitizenProvinceId != null ? x.CitizenProvinceId.ToString() : null,
CitizenDistrict = x.CitizenDistrictName, CitizenDistrict = x.CitizenDistrictName,
@ -114,8 +115,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
LastName = x.LastName, LastName = x.LastName,
Nationality = x.Nationality, Nationality = x.Nationality,
DateOfBirth = x.DateOfBirth, DateOfBirth = x.DateOfBirth,
Relationship = x.RelationshipName, Religion = x.ReligionName,
RelationshipId = x.RelationshipId != null ? x.RelationshipId.ToString() : null, ReligionId = x.ReligionId != null ? x.ReligionId.ToString() : null,
CitizenProvince = x.CitizenProvinceName, CitizenProvince = x.CitizenProvinceName,
CitizenProvinceId = x.CitizenProvinceId != null ? x.CitizenProvinceId.ToString() : null, CitizenProvinceId = x.CitizenProvinceId != null ? x.CitizenProvinceId.ToString() : null,
CitizenDistrict = x.CitizenDistrictName, CitizenDistrict = x.CitizenDistrictName,
@ -294,12 +295,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Where(x => x.PeriodExam == exam && x.UserId == UserId && x.PositionExam == position) .Where(x => x.PeriodExam == exam && x.UserId == UserId && x.PositionExam == position)
.Select(x => new CandidateOccupationResponseItem .Select(x => new CandidateOccupationResponseItem
{ {
OccupationType = x.OccupationType, OccupationOrg = x.OccupationOrg,
OccupationCompany = x.OccupationCompany, OccupationPile = x.OccupationPile,
OccupationDepartment = x.OccupationDepartment, OccupationGroup = x.OccupationGroup,
OccupationEmail = x.OccupationEmail, OccupationSalary = x.OccupationSalary,
OccupationTelephone = x.OccupationTelephone,
OccupationPosition = x.OccupationPosition, OccupationPosition = x.OccupationPosition,
OccupationPositionType = x.OccupationPositionType,
OccupationTelephone = x.OccupationTelephone,
}) })
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
} }
@ -309,12 +311,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Where(x => x.PeriodExam == exam && x.UserId == UserId) .Where(x => x.PeriodExam == exam && x.UserId == UserId)
.Select(x => new CandidateOccupationResponseItem .Select(x => new CandidateOccupationResponseItem
{ {
OccupationType = x.OccupationType, OccupationOrg = x.OccupationOrg,
OccupationCompany = x.OccupationCompany, OccupationPile = x.OccupationPile,
OccupationDepartment = x.OccupationDepartment, OccupationGroup = x.OccupationGroup,
OccupationEmail = x.OccupationEmail, OccupationSalary = x.OccupationSalary,
OccupationTelephone = x.OccupationTelephone,
OccupationPosition = x.OccupationPosition, OccupationPosition = x.OccupationPosition,
OccupationPositionType = x.OccupationPositionType,
OccupationTelephone = x.OccupationTelephone,
}) })
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
} }
@ -353,7 +356,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.ToListAsync(); .ToListAsync();
} }
public async Task<IEnumerable<Education?>> GetsAsyncEducation(string examId, string positionId) public async Task<Education?> GetsAsyncEducation(string examId, string positionId)
{ {
var exam = await _context.PeriodExams.AsQueryable() var exam = await _context.PeriodExams.AsQueryable()
.Where(p => p.CheckDisability == false) .Where(p => p.CheckDisability == false)
@ -382,8 +385,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
return await _context.Educations.AsQueryable() return await _context.Educations.AsQueryable()
.Where(x => x.Candidate == candidate) .Where(x => x.Candidate == candidate)
.OrderBy(d => d.DurationStart) .FirstOrDefaultAsync();
.ToListAsync();
} }
public async Task<IEnumerable<FileListResponse?>> GetsAsyncFileUpload(string examId, string positionId) public async Task<IEnumerable<FileListResponse?>> GetsAsyncFileUpload(string examId, string positionId)
@ -574,12 +576,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
return candidate.PaymentImg == null ? "" : candidate.PaymentImg.Detail.ToString(); return candidate.PaymentImg == null ? "" : candidate.PaymentImg.Detail.ToString();
} }
public async Task<RequestStatusRegistry> GetsAsyncRegisterExam(string examId, string positionId) public async Task<RequestStatusRegistry> GetsAsyncRegisterExam(Guid examId, Guid positionId)
{ {
var exam = await _context.PeriodExams.AsQueryable() var exam = await _context.PeriodExams.AsQueryable()
.Where(p => p.CheckDisability == false) .Where(p => p.CheckDisability == false)
.Include(x => x.BankExam) .Include(x => x.BankExam)
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId)); .FirstOrDefaultAsync(x => x.Id == examId);
if (exam == null) if (exam == null)
throw new Exception(GlobalMessages.ExamNotFound); throw new Exception(GlobalMessages.ExamNotFound);
@ -588,9 +590,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId); .FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId);
var position = await _context.PositionExams.AsQueryable() var position = await _context.PositionExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId) && x.PeriodExam == exam); .FirstOrDefaultAsync(x => x.Id == positionId);
if (positionId != "00000000-0000-0000-0000-000000000000") if (positionId != Guid.Parse("00000000-0000-0000-0000-000000000000"))
{ {
// var position = await _context.PositionExams.AsQueryable() // var position = await _context.PositionExams.AsQueryable()
// .FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId) && x.PeriodExam == exam); // .FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId) && x.PeriodExam == exam);
@ -613,6 +615,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
PositionExam = candidatePosition?.PositionExam, PositionExam = candidatePosition?.PositionExam,
Bank = exam.BankExam.Count() > 0, Bank = exam.BankExam.Count() > 0,
Payment = exam.Fee > 0, Payment = exam.Fee > 0,
EditorCondition = exam.EditorCondition,
EditorConfirm = exam.EditorConfirm,
Position = candidatePosition == null ? false : true Position = candidatePosition == null ? false : true
}; };
} }
@ -673,7 +677,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
{ {
var candidateId = await CreateAsyncCandidate(examId, positionId); var candidateId = await CreateAsyncCandidate(examId, positionId);
var candidate = await _context.Candidates.AsQueryable() var candidate = await _context.Candidates
.AsQueryable()
.Include(x => x.Educations)
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
if (candidate == null) if (candidate == null)
@ -691,40 +697,16 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
candidate.PrefixName = prefix.Name; candidate.PrefixName = prefix.Name;
} }
if (updated.RelationshipId != null) if (updated.ReligionId != null)
{ {
var relationship = await _contextMetadata.Relationships.AsQueryable() var religion = await _contextMetadata.Religions.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RelationshipId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.ReligionId));
if (relationship == null) if (religion == null)
throw new Exception(GlobalMessages.RelationshipNotFound); throw new Exception(GlobalMessages.ReligionNotFound);
candidate.RelationshipId = relationship.Id; candidate.ReligionId = religion.Id;
candidate.RelationshipName = relationship.Name; candidate.ReligionName = religion.Name;
}
if (updated.CitizenProvinceId != null)
{
var citizenProvince = await _contextMetadata.Provinces.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CitizenProvinceId));
if (citizenProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.CitizenProvinceId = citizenProvince.Id;
candidate.CitizenProvinceName = citizenProvince.Name;
}
if (updated.CitizenDistrictId != null)
{
var citizenDistrict = await _contextMetadata.Districts.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CitizenDistrictId));
if (citizenDistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound);
candidate.CitizenDistrictId = citizenDistrict.Id;
candidate.CitizenDistrictName = citizenDistrict.Name;
} }
if (updated.RegistProvinceId != null) if (updated.RegistProvinceId != null)
@ -801,49 +783,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
candidate.CurrentZipCode = currentSubDistrict.ZipCode; candidate.CurrentZipCode = currentSubDistrict.ZipCode;
} }
if (updated.MarryPrefixId != null)
{
var prefix = await _contextMetadata.Prefixes.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.MarryPrefixId));
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.MarryPrefixId = prefix.Id;
candidate.MarryPrefixName = prefix.Name;
}
if (updated.FatherPrefixId != null)
{
var prefix = await _contextMetadata.Prefixes.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.FatherPrefixId));
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.FatherPrefixId = prefix.Id;
candidate.FatherPrefixName = prefix.Name;
}
if (updated.MotherPrefixId != null)
{
var prefix = await _contextMetadata.Prefixes.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.MotherPrefixId));
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.MotherPrefixId = prefix.Id;
candidate.MotherPrefixName = prefix.Name;
}
candidate.FirstName = updated.FirstName; candidate.FirstName = updated.FirstName;
candidate.LastName = updated.LastName; candidate.LastName = updated.LastName;
candidate.Nationality = updated.Nationality; candidate.Nationality = updated.Nationality;
candidate.DateOfBirth = updated.DateOfBirth; candidate.DateOfBirth = updated.DateOfBirth;
candidate.Email = updated.Email; candidate.Email = updated.Email;
candidate.CitizenId = updated.CitizenId; candidate.CitizenId = updated.CitizenId;
candidate.CitizenDate = updated.CitizenDate;
candidate.Telephone = updated.Telephone; candidate.Telephone = updated.Telephone;
candidate.MobilePhone = updated.MobilePhone; candidate.MobilePhone = updated.MobilePhone;
candidate.Knowledge = updated.Knowledge; candidate.Knowledge = updated.Knowledge;
@ -852,33 +797,74 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
candidate.RegistSame = updated.RegistSame == null ? null : updated.RegistSame; candidate.RegistSame = updated.RegistSame == null ? null : updated.RegistSame;
candidate.CurrentAddress = updated.CurrentAddress; candidate.CurrentAddress = updated.CurrentAddress;
candidate.Marry = updated.Marry == null ? null : updated.Marry; candidate.OccupationOrg = updated.OccupationOrg;
candidate.MarryFirstName = updated.MarryFirstName; candidate.OccupationPile = updated.OccupationPile;
candidate.MarryLastName = updated.MarryLastName; candidate.OccupationGroup = updated.OccupationGroup;
candidate.MarryOccupation = updated.MarryOccupation; candidate.OccupationSalary = updated.OccupationSalary;
candidate.MarryNationality = updated.MarryNationality;
candidate.FatherFirstName = updated.FatherFirstName;
candidate.FatherLastName = updated.FatherLastName;
candidate.FatherOccupation = updated.FatherOccupation;
candidate.FatherNationality = updated.FatherNationality;
candidate.MotherFirstName = updated.MotherFirstName;
candidate.MotherLastName = updated.MotherLastName;
candidate.MotherOccupation = updated.MotherOccupation;
candidate.MotherNationality = updated.MotherNationality;
candidate.OccupationType = updated.OccupationType;
candidate.OccupationCompany = updated.OccupationCompany;
candidate.OccupationDepartment = updated.OccupationDepartment;
candidate.OccupationEmail = updated.OccupationEmail;
candidate.OccupationTelephone = updated.OccupationTelephone;
candidate.OccupationPosition = updated.OccupationPosition; candidate.OccupationPosition = updated.OccupationPosition;
candidate.OccupationPositionType = updated.OccupationPositionType;
candidate.OccupationTelephone = updated.OccupationTelephone;
var educationLevelExam = await _contextMetadata.EducationLevels.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId);
if (educationLevelExam == null)
throw new Exception(GlobalMessages.EducationLevelNotFound);
var educationLevelHigh = await _contextMetadata.EducationLevels.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId);
if (educationLevelHigh == null)
throw new Exception(GlobalMessages.EducationLevelNotFound);
if (candidate.Educations.FirstOrDefault() == null)
{
var education = new Education
{
Candidate = candidate,
EducationLevelExamId = educationLevelExam.Id,
EducationLevelExamName = educationLevelExam.Name,
EducationName = updated.EducationName,
EducationMajor = updated.EducationMajor,
EducationLocation = updated.EducationLocation,
EducationType = updated.EducationType,
EducationEndDate = updated.EducationEndDate,
EducationScores = updated.EducationScores,
EducationLevelHighId = educationLevelHigh.Id,
EducationLevelHighName = educationLevelHigh.Name,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
CreatedFullName = FullName ?? "",
LastUpdatedAt = DateTime.Now,
LastUpdateUserId = UserId ?? "",
LastUpdateFullName = FullName ?? "",
};
await _context.Educations.AddAsync(education);
}
else
{
candidate.Educations.FirstOrDefault().EducationLevelExamId = educationLevelExam.Id;
candidate.Educations.FirstOrDefault().EducationLevelExamName = educationLevelExam.Name;
candidate.Educations.FirstOrDefault().EducationName = updated.EducationName;
candidate.Educations.FirstOrDefault().EducationMajor = updated.EducationMajor;
candidate.Educations.FirstOrDefault().EducationLocation = updated.EducationLocation;
candidate.Educations.FirstOrDefault().EducationType = updated.EducationType;
candidate.Educations.FirstOrDefault().EducationEndDate = updated.EducationEndDate;
candidate.Educations.FirstOrDefault().EducationScores = updated.EducationScores;
candidate.Educations.FirstOrDefault().EducationLevelHighId = educationLevelHigh.Id;
candidate.Educations.FirstOrDefault().EducationLevelHighName = educationLevelHigh.Name;
candidate.Educations.FirstOrDefault().LastUpdatedAt = DateTime.Now;
candidate.Educations.FirstOrDefault().LastUpdateUserId = UserId ?? "";
candidate.Educations.FirstOrDefault().LastUpdateFullName = FullName ?? "";
}
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
} }
public async Task UpdateAdminAsync(string candidateId, CandidateResponseItem updated) public async Task UpdateAdminAsync(string candidateId, CandidateResponseItem updated)
{ {
var candidate = await _context.Candidates.AsQueryable() var candidate = await _context.Candidates
.AsQueryable()
.Include(x => x.Educations)
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
if (candidate == null) if (candidate == null)
@ -896,40 +882,16 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
candidate.PrefixName = prefix.Name; candidate.PrefixName = prefix.Name;
} }
if (updated.RelationshipId != null) if (updated.ReligionId != null)
{ {
var relationship = await _contextMetadata.Relationships.AsQueryable() var religion = await _contextMetadata.Religions.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RelationshipId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.ReligionId));
if (relationship == null) if (religion == null)
throw new Exception(GlobalMessages.RelationshipNotFound); throw new Exception(GlobalMessages.ReligionNotFound);
candidate.RelationshipId = relationship.Id; candidate.ReligionId = religion.Id;
candidate.RelationshipName = relationship.Name; candidate.ReligionName = religion.Name;
}
if (updated.CitizenProvinceId != null)
{
var citizenProvince = await _contextMetadata.Provinces.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CitizenProvinceId));
if (citizenProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.CitizenProvinceId = citizenProvince.Id;
candidate.CitizenProvinceName = citizenProvince.Name;
}
if (updated.CitizenDistrictId != null)
{
var citizenDistrict = await _contextMetadata.Districts.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CitizenDistrictId));
if (citizenDistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound);
candidate.CitizenDistrictId = citizenDistrict.Id;
candidate.CitizenDistrictName = citizenDistrict.Name;
} }
if (updated.RegistProvinceId != null) if (updated.RegistProvinceId != null)
@ -1006,49 +968,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
candidate.CurrentZipCode = currentSubDistrict.ZipCode; candidate.CurrentZipCode = currentSubDistrict.ZipCode;
} }
if (updated.MarryPrefixId != null)
{
var prefix = await _contextMetadata.Prefixes.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.MarryPrefixId));
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.MarryPrefixId = prefix.Id;
candidate.MarryPrefixName = prefix.Name;
}
if (updated.FatherPrefixId != null)
{
var prefix = await _contextMetadata.Prefixes.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.FatherPrefixId));
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.FatherPrefixId = prefix.Id;
candidate.FatherPrefixName = prefix.Name;
}
if (updated.MotherPrefixId != null)
{
var prefix = await _contextMetadata.Prefixes.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.MotherPrefixId));
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.MotherPrefixId = prefix.Id;
candidate.MotherPrefixName = prefix.Name;
}
candidate.FirstName = updated.FirstName; candidate.FirstName = updated.FirstName;
candidate.LastName = updated.LastName; candidate.LastName = updated.LastName;
candidate.Nationality = updated.Nationality; candidate.Nationality = updated.Nationality;
candidate.DateOfBirth = updated.DateOfBirth; candidate.DateOfBirth = updated.DateOfBirth;
candidate.Email = updated.Email; candidate.Email = updated.Email;
candidate.CitizenId = updated.CitizenId; candidate.CitizenId = updated.CitizenId;
candidate.CitizenDate = updated.CitizenDate;
candidate.Telephone = updated.Telephone; candidate.Telephone = updated.Telephone;
candidate.MobilePhone = updated.MobilePhone; candidate.MobilePhone = updated.MobilePhone;
candidate.Knowledge = updated.Knowledge; candidate.Knowledge = updated.Knowledge;
@ -1057,27 +982,65 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
candidate.RegistSame = updated.RegistSame == null ? null : updated.RegistSame; candidate.RegistSame = updated.RegistSame == null ? null : updated.RegistSame;
candidate.CurrentAddress = updated.CurrentAddress; candidate.CurrentAddress = updated.CurrentAddress;
candidate.Marry = updated.Marry == null ? null : updated.Marry; candidate.OccupationOrg = updated.OccupationOrg;
candidate.MarryFirstName = updated.MarryFirstName; candidate.OccupationPile = updated.OccupationPile;
candidate.MarryLastName = updated.MarryLastName; candidate.OccupationGroup = updated.OccupationGroup;
candidate.MarryOccupation = updated.MarryOccupation; candidate.OccupationSalary = updated.OccupationSalary;
candidate.MarryNationality = updated.MarryNationality;
candidate.FatherFirstName = updated.FatherFirstName;
candidate.FatherLastName = updated.FatherLastName;
candidate.FatherOccupation = updated.FatherOccupation;
candidate.FatherNationality = updated.FatherNationality;
candidate.MotherFirstName = updated.MotherFirstName;
candidate.MotherLastName = updated.MotherLastName;
candidate.MotherOccupation = updated.MotherOccupation;
candidate.MotherNationality = updated.MotherNationality;
candidate.OccupationType = updated.OccupationType;
candidate.OccupationCompany = updated.OccupationCompany;
candidate.OccupationDepartment = updated.OccupationDepartment;
candidate.OccupationEmail = updated.OccupationEmail;
candidate.OccupationTelephone = updated.OccupationTelephone;
candidate.OccupationPosition = updated.OccupationPosition; candidate.OccupationPosition = updated.OccupationPosition;
candidate.OccupationPositionType = updated.OccupationPositionType;
candidate.OccupationTelephone = updated.OccupationTelephone;
var educationLevelExam = await _contextMetadata.EducationLevels.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId);
if (educationLevelExam == null)
throw new Exception(GlobalMessages.EducationLevelNotFound);
var educationLevelHigh = await _contextMetadata.EducationLevels.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId);
if (educationLevelHigh == null)
throw new Exception(GlobalMessages.EducationLevelNotFound);
if (candidate.Educations.FirstOrDefault() == null)
{
var education = new Education
{
Candidate = candidate,
EducationLevelExamId = educationLevelExam.Id,
EducationLevelExamName = educationLevelExam.Name,
EducationName = updated.EducationName,
EducationMajor = updated.EducationMajor,
EducationLocation = updated.EducationLocation,
EducationType = updated.EducationType,
EducationEndDate = updated.EducationEndDate,
EducationScores = updated.EducationScores,
EducationLevelHighId = educationLevelHigh.Id,
EducationLevelHighName = educationLevelHigh.Name,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
CreatedFullName = FullName ?? "",
LastUpdatedAt = DateTime.Now,
LastUpdateUserId = UserId ?? "",
LastUpdateFullName = FullName ?? "",
};
await _context.Educations.AddAsync(education);
}
else
{
candidate.Educations.FirstOrDefault().EducationLevelExamId = educationLevelExam.Id;
candidate.Educations.FirstOrDefault().EducationLevelExamName = educationLevelExam.Name;
candidate.Educations.FirstOrDefault().EducationName = updated.EducationName;
candidate.Educations.FirstOrDefault().EducationMajor = updated.EducationMajor;
candidate.Educations.FirstOrDefault().EducationLocation = updated.EducationLocation;
candidate.Educations.FirstOrDefault().EducationType = updated.EducationType;
candidate.Educations.FirstOrDefault().EducationEndDate = updated.EducationEndDate;
candidate.Educations.FirstOrDefault().EducationScores = updated.EducationScores;
candidate.Educations.FirstOrDefault().EducationLevelHighId = educationLevelHigh.Id;
candidate.Educations.FirstOrDefault().EducationLevelHighName = educationLevelHigh.Name;
candidate.Educations.FirstOrDefault().LastUpdatedAt = DateTime.Now;
candidate.Educations.FirstOrDefault().LastUpdateUserId = UserId ?? "";
candidate.Educations.FirstOrDefault().LastUpdateFullName = FullName ?? "";
}
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
} }
@ -1365,12 +1328,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (candidate == null) if (candidate == null)
throw new Exception(GlobalMessages.ExamNotFound); throw new Exception(GlobalMessages.ExamNotFound);
candidate.OccupationType = updated.OccupationType; candidate.OccupationOrg = updated.OccupationOrg;
candidate.OccupationCompany = updated.OccupationCompany; candidate.OccupationPile = updated.OccupationPile;
candidate.OccupationDepartment = updated.OccupationDepartment; candidate.OccupationGroup = updated.OccupationGroup;
candidate.OccupationEmail = updated.OccupationEmail; candidate.OccupationSalary = updated.OccupationSalary;
candidate.OccupationTelephone = updated.OccupationTelephone;
candidate.OccupationPosition = updated.OccupationPosition; candidate.OccupationPosition = updated.OccupationPosition;
candidate.OccupationPositionType = updated.OccupationPositionType;
candidate.OccupationTelephone = updated.OccupationTelephone;
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
} }
@ -1475,12 +1439,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var career = new Career var career = new Career
{ {
Candidate = candidate, Candidate = candidate,
Name = updated.Name,
Position = updated.Position, Position = updated.Position,
Salary = updated.Salary, Group = updated.Group,
Pile = updated.Pile,
Org = updated.Org,
DurationStart = updated.DurationStart, DurationStart = updated.DurationStart,
DurationEnd = updated.DurationEnd, DurationEnd = updated.DurationEnd,
Reason = updated.Reason, RangeDate = updated.RangeDate,
CreatedAt = DateTime.Now, CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "", CreatedUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now, LastUpdatedAt = DateTime.Now,
@ -1501,12 +1466,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var career = new Career var career = new Career
{ {
Candidate = candidate, Candidate = candidate,
Name = updated.Name,
Position = updated.Position, Position = updated.Position,
Salary = updated.Salary, Group = updated.Group,
Pile = updated.Pile,
Org = updated.Org,
DurationStart = updated.DurationStart, DurationStart = updated.DurationStart,
DurationEnd = updated.DurationEnd, DurationEnd = updated.DurationEnd,
Reason = updated.Reason, RangeDate = updated.RangeDate,
CreatedAt = DateTime.Now, CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "", CreatedUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now, LastUpdatedAt = DateTime.Now,
@ -1524,33 +1490,64 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var candidateId = await CreateAsyncCandidate(examId, positionId); var candidateId = await CreateAsyncCandidate(examId, positionId);
var candidate = await _context.Candidates.AsQueryable() var candidate = await _context.Candidates.AsQueryable()
.Include(x => x.Educations)
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
var educationLevel = await _contextMetadata.EducationLevels.AsQueryable() if (candidate == null)
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.EducationLevelId)); throw new Exception(GlobalMessages.CandidateNotFound);
if (educationLevel == null) var educationLevelExam = await _contextMetadata.EducationLevels.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId);
if (educationLevelExam == null)
throw new Exception(GlobalMessages.EducationLevelNotFound); throw new Exception(GlobalMessages.EducationLevelNotFound);
var education = new Education var educationLevelHigh = await _contextMetadata.EducationLevels.AsQueryable()
{ .FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId);
Candidate = candidate,
EducationLevelId = educationLevel.Id, if (educationLevelHigh == null)
EducationLevelName = educationLevel.Name, throw new Exception(GlobalMessages.EducationLevelNotFound);
Major = updated.Major, if (candidate.Educations.FirstOrDefault() == null)
Scores = updated.Scores, {
Name = updated.Name, var education = new Education
DurationStart = updated.DurationStart, {
DurationEnd = updated.DurationEnd, Candidate = candidate,
CreatedAt = DateTime.Now, EducationLevelExamId = educationLevelExam.Id,
CreatedUserId = UserId ?? "", EducationLevelExamName = educationLevelExam.Name,
LastUpdatedAt = DateTime.Now, EducationName = updated.EducationName,
LastUpdateUserId = UserId ?? "", EducationMajor = updated.EducationMajor,
CreatedFullName = FullName ?? "", EducationLocation = updated.EducationLocation,
LastUpdateFullName = FullName ?? "", EducationType = updated.EducationType,
}; EducationEndDate = updated.EducationEndDate,
EducationScores = updated.EducationScores,
EducationLevelHighId = educationLevelHigh.Id,
EducationLevelHighName = educationLevelHigh.Name,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
CreatedFullName = FullName ?? "",
LastUpdatedAt = DateTime.Now,
LastUpdateUserId = UserId ?? "",
LastUpdateFullName = FullName ?? "",
};
await _context.Educations.AddAsync(education);
}
else
{
candidate.Educations.FirstOrDefault().EducationLevelExamId = educationLevelExam.Id;
candidate.Educations.FirstOrDefault().EducationLevelExamName = educationLevelExam.Name;
candidate.Educations.FirstOrDefault().EducationName = updated.EducationName;
candidate.Educations.FirstOrDefault().EducationMajor = updated.EducationMajor;
candidate.Educations.FirstOrDefault().EducationLocation = updated.EducationLocation;
candidate.Educations.FirstOrDefault().EducationType = updated.EducationType;
candidate.Educations.FirstOrDefault().EducationEndDate = updated.EducationEndDate;
candidate.Educations.FirstOrDefault().EducationScores = updated.EducationScores;
candidate.Educations.FirstOrDefault().EducationLevelHighId = educationLevelHigh.Id;
candidate.Educations.FirstOrDefault().EducationLevelHighName = educationLevelHigh.Name;
candidate.Educations.FirstOrDefault().LastUpdatedAt = DateTime.Now;
candidate.Educations.FirstOrDefault().LastUpdateUserId = UserId ?? "";
candidate.Educations.FirstOrDefault().LastUpdateFullName = FullName ?? "";
}
await _context.Educations.AddAsync(education);
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
} }
@ -1559,31 +1556,60 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var candidate = await _context.Candidates.AsQueryable() var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId)); .FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
var educationLevel = await _contextMetadata.EducationLevels.AsQueryable() if (candidate == null)
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.EducationLevelId)); throw new Exception(GlobalMessages.CandidateNotFound);
if (educationLevel == null) var educationLevelExam = await _contextMetadata.EducationLevels.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId);
if (educationLevelExam == null)
throw new Exception(GlobalMessages.EducationLevelNotFound); throw new Exception(GlobalMessages.EducationLevelNotFound);
var education = new Education var educationLevelHigh = await _contextMetadata.EducationLevels.AsQueryable()
{ .FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId);
Candidate = candidate,
EducationLevelId = educationLevel.Id,
EducationLevelName = educationLevel.Name,
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); if (educationLevelHigh == null)
throw new Exception(GlobalMessages.EducationLevelNotFound);
if (candidate.Educations.FirstOrDefault() == null)
{
var education = new Education
{
Candidate = candidate,
EducationLevelExamId = educationLevelExam.Id,
EducationLevelExamName = educationLevelExam.Name,
EducationName = updated.EducationName,
EducationMajor = updated.EducationMajor,
EducationLocation = updated.EducationLocation,
EducationType = updated.EducationType,
EducationEndDate = updated.EducationEndDate,
EducationScores = updated.EducationScores,
EducationLevelHighId = educationLevelHigh.Id,
EducationLevelHighName = educationLevelHigh.Name,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
CreatedFullName = FullName ?? "",
LastUpdatedAt = DateTime.Now,
LastUpdateUserId = UserId ?? "",
LastUpdateFullName = FullName ?? "",
};
await _context.Educations.AddAsync(education);
}
else
{
candidate.Educations.FirstOrDefault().EducationLevelExamId = educationLevelExam.Id;
candidate.Educations.FirstOrDefault().EducationLevelExamName = educationLevelExam.Name;
candidate.Educations.FirstOrDefault().EducationName = updated.EducationName;
candidate.Educations.FirstOrDefault().EducationMajor = updated.EducationMajor;
candidate.Educations.FirstOrDefault().EducationLocation = updated.EducationLocation;
candidate.Educations.FirstOrDefault().EducationType = updated.EducationType;
candidate.Educations.FirstOrDefault().EducationEndDate = updated.EducationEndDate;
candidate.Educations.FirstOrDefault().EducationScores = updated.EducationScores;
candidate.Educations.FirstOrDefault().EducationLevelHighId = educationLevelHigh.Id;
candidate.Educations.FirstOrDefault().EducationLevelHighName = educationLevelHigh.Name;
candidate.Educations.FirstOrDefault().LastUpdatedAt = DateTime.Now;
candidate.Educations.FirstOrDefault().LastUpdateUserId = UserId ?? "";
candidate.Educations.FirstOrDefault().LastUpdateFullName = FullName ?? "";
}
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
} }
@ -1595,12 +1621,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (career == null) if (career == null)
throw new Exception(GlobalMessages.CareerNotFound); throw new Exception(GlobalMessages.CareerNotFound);
career.Name = updated.Name;
career.Position = updated.Position; career.Position = updated.Position;
career.Salary = updated.Salary; career.Group = updated.Group;
career.Pile = updated.Pile;
career.Org = updated.Org;
career.DurationStart = updated.DurationStart; career.DurationStart = updated.DurationStart;
career.DurationEnd = updated.DurationEnd; career.DurationEnd = updated.DurationEnd;
career.Reason = updated.Reason; career.RangeDate = updated.RangeDate;
career.LastUpdatedAt = DateTime.Now; career.LastUpdatedAt = DateTime.Now;
career.LastUpdateUserId = UserId ?? ""; career.LastUpdateUserId = UserId ?? "";
career.LastUpdateFullName = FullName ?? ""; career.LastUpdateFullName = FullName ?? "";
@ -1621,33 +1648,33 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
} }
public async Task UpdateAsyncEducation(string educationId, CandidateEducationResponseItem updated) // public async Task UpdateAsyncEducation(string educationId, CandidateEducationResponseItem updated)
{ // {
var education = await _context.Educations.AsQueryable() // var education = await _context.Educations.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(educationId)); // .FirstOrDefaultAsync(x => x.Id == Guid.Parse(educationId));
if (education == null) // if (education == null)
throw new Exception(GlobalMessages.EducationNotFound); // throw new Exception(GlobalMessages.EducationNotFound);
var educationLevel = await _contextMetadata.EducationLevels.AsQueryable() // var educationLevel = await _contextMetadata.EducationLevels.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.EducationLevelId)); // .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.EducationLevelId));
if (educationLevel == null) // if (educationLevel == null)
throw new Exception(GlobalMessages.EducationLevelNotFound); // throw new Exception(GlobalMessages.EducationLevelNotFound);
education.EducationLevelId = educationLevel.Id; // education.EducationLevelId = educationLevel.Id;
education.EducationLevelName = educationLevel.Name; // education.EducationLevelName = educationLevel.Name;
education.Major = updated.Major; // education.Major = updated.Major;
education.Scores = updated.Scores; // education.Scores = updated.Scores;
education.Name = updated.Name; // education.Name = updated.Name;
education.DurationStart = updated.DurationStart; // education.DurationStart = updated.DurationStart;
education.DurationEnd = updated.DurationEnd; // education.DurationEnd = updated.DurationEnd;
education.LastUpdatedAt = DateTime.Now; // education.LastUpdatedAt = DateTime.Now;
education.LastUpdateUserId = UserId ?? ""; // education.LastUpdateUserId = UserId ?? "";
education.LastUpdateFullName = FullName ?? ""; // education.LastUpdateFullName = FullName ?? "";
await _context.SaveChangesAsync(); // await _context.SaveChangesAsync();
} // }
public async Task DeleteAsyncEducation(string educationId) public async Task DeleteAsyncEducation(string educationId)
{ {
@ -1702,6 +1729,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (exam == null) if (exam == null)
throw new Exception(GlobalMessages.ExamNotFound); throw new Exception(GlobalMessages.ExamNotFound);
if (exam.RegisterStartDate != null && exam.RegisterStartDate.Value.Date < DateTime.Now.Date)
throw new Exception("ยังไม่ถึงช่วงเวลาสมัครสอบ");
if (exam.RegisterEndDate != null && exam.RegisterEndDate.Value.Date > DateTime.Now.Date)
throw new Exception("หมดเวลาช่วงสมัครสอบ");
var candidate = await _context.Candidates.AsQueryable() var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId); .FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId);
@ -1887,6 +1920,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
var positionName = ""; var positionName = "";
var positionLevelName = "";
var highDegree = ""; var highDegree = "";
if (positionId != "00000000-0000-0000-0000-000000000000") if (positionId != "00000000-0000-0000-0000-000000000000")
{ {
@ -1900,7 +1934,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Where(x => x.PeriodExam == exam && x.UserId == UserId && x.PositionExam == position) .Where(x => x.PeriodExam == exam && x.UserId == UserId && x.PositionExam == position)
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
positionName = position.PositionName; positionName = position.PositionName;
highDegree = position.HighDegree == true ? "ปริญญาขึ้นไป" : "ต่ำกว่าปริญญาตรี"; positionLevelName = position.PositionLevelName;
highDegree = position.HighDegree == true ? "ปริญญาบัตรขึ้นไป" : "ต่ำกว่าปริญญาบัตร";
} }
if (candidate == null) if (candidate == null)
@ -1940,6 +1975,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
AnnouncementDate = exam.AnnouncementDate?.AddYears(2), AnnouncementDate = exam.AnnouncementDate?.AddYears(2),
Id = candidate.Id, Id = candidate.Id,
Position = positionName, Position = positionName,
PositionLevel = positionLevelName,
HighDegree = highDegree, HighDegree = highDegree,
}; };
} }
@ -1955,11 +1991,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
throw new Exception(GlobalMessages.CandidateNotFound); throw new Exception(GlobalMessages.CandidateNotFound);
var positionName = ""; var positionName = "";
var positionLevelName = "";
var highDegree = ""; var highDegree = "";
if (candidate.PositionExam != null) if (candidate.PositionExam != null)
{ {
positionName = candidate.PositionExam.PositionName; positionName = candidate.PositionExam.PositionName;
highDegree = candidate.PositionExam.HighDegree == true ? "ปริญญาขึ้นไป" : "ต่ำกว่าปริญญาตรี"; positionLevelName = candidate.PositionExam.PositionLevelName;
highDegree = candidate.PositionExam.HighDegree == true ? "ปริญญาบัตรขึ้นไป" : "ต่ำกว่าปริญญาบัตร";
} }
return new RequestCardCandidate return new RequestCardCandidate
@ -1996,6 +2034,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
AnnouncementDate = candidate.PeriodExam?.AnnouncementDate?.AddYears(2), AnnouncementDate = candidate.PeriodExam?.AnnouncementDate?.AddYears(2),
Id = candidate.Id, Id = candidate.Id,
Position = positionName, Position = positionName,
PositionLevel = positionLevelName,
HighDegree = highDegree, HighDegree = highDegree,
}; };
} }

View file

@ -78,11 +78,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
{ {
switch (status.Trim().ToUpper()) switch (status.Trim().ToUpper())
{ {
case "OFFICIAL": return "ข้าราชการกรุงเทพมหานคร"; case "prem": return "ลูกจ้างประจำ";
case "PERSONNEL": return "บุคลากรกรุงเทพมหานคร"; case "temp": return "ลูกจ้างชั่วคราว";
case "OFFICIALSOTHER": return "ข้าราชการประเภทอื่น"; case "other": return "ผู้ปฏิบัติงานอื่นในกรุงเทพมหานคร";
case "EMPLOYEE": return "ลูกจ้าง/พนักงานราชการของส่วนราชการอื่น";
case "OTHER": return "อื่นๆ";
default: return status; default: return status;
} }
} }
@ -135,6 +133,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
CheckDisability = x.CheckDisability, CheckDisability = x.CheckDisability,
CheckDocument = x.CheckDocument, CheckDocument = x.CheckDocument,
Detail = x.Detail, Detail = x.Detail,
EditorCondition = x.EditorCondition,
EditorConfirm = x.EditorConfirm,
Fee = x.Fee, Fee = x.Fee,
Id = x.Id, Id = x.Id,
IsActive = x.IsActive, IsActive = x.IsActive,
@ -197,6 +197,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
CheckDisability = x.CheckDisability, CheckDisability = x.CheckDisability,
CheckDocument = x.CheckDocument, CheckDocument = x.CheckDocument,
Detail = x.Detail, Detail = x.Detail,
EditorCondition = x.EditorCondition,
EditorConfirm = x.EditorConfirm,
Fee = x.Fee, Fee = x.Fee,
Id = x.Id, Id = x.Id,
IsActive = x.IsActive, IsActive = x.IsActive,
@ -230,6 +232,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
TypeName = b.TypeName, TypeName = b.TypeName,
PositionId = b.PositionId, PositionId = b.PositionId,
PositionName = b.PositionName, PositionName = b.PositionName,
PositionLevelId = b.PositionLevelId,
PositionLevelName = b.PositionLevelName,
HighDegree = b.HighDegree, HighDegree = b.HighDegree,
}).ToList(), }).ToList(),
Documents = x.PeriodExamDocuments.OrderBy(o => o.CreatedAt).Select(b => new FileListResponse Documents = x.PeriodExamDocuments.OrderBy(o => o.CreatedAt).Select(b => new FileListResponse
@ -300,6 +304,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (periodExam == null) if (periodExam == null)
throw new Exception(GlobalMessages.ExamNotFound); throw new Exception(GlobalMessages.ExamNotFound);
var positionExam = await _context.PositionExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId));
if (positionExam == null)
throw new Exception(GlobalMessages.ExamNotFound);
if (positionId != "00000000-0000-0000-0000-000000000000") if (positionId != "00000000-0000-0000-0000-000000000000")
{ {
return new RequestPositionName return new RequestPositionName
@ -307,7 +317,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Name = periodExam.Name, Name = periodExam.Name,
Round = periodExam.Round, Round = periodExam.Round,
Year = periodExam.Year, Year = periodExam.Year,
Posiiton = periodExam.PositionExam.FirstOrDefault(x => x.Id == Guid.Parse(positionId) && x.PeriodExam == periodExam), Position = positionExam.PositionName,
PositionLevel = positionExam.PositionLevelName,
}; };
} }
else else
@ -317,7 +328,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Name = periodExam.Name, Name = periodExam.Name,
Round = periodExam.Round, Round = periodExam.Round,
Year = periodExam.Year, Year = periodExam.Year,
Posiiton = null, Position = null,
PositionLevel = null,
}; };
} }
} }
@ -347,6 +359,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
AnnouncementExam = inserted.AnnouncementExam, AnnouncementExam = inserted.AnnouncementExam,
Category = inserted.Category, Category = inserted.Category,
Detail = inserted.Detail, Detail = inserted.Detail,
EditorCondition = inserted.EditorCondition,
EditorConfirm = inserted.EditorConfirm,
Note = inserted.Note, Note = inserted.Note,
CreatedAt = DateTime.Now, CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "", CreatedUserId = UserId ?? "",
@ -384,6 +398,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
PeriodExam = periodExam, PeriodExam = periodExam,
PositionId = position.PositionId, PositionId = position.PositionId,
PositionName = position.PositionName, PositionName = position.PositionName,
PositionLevelId = position.PositionLevelId,
PositionLevelName = position.PositionLevelName,
HighDegree = position.HighDegree, HighDegree = position.HighDegree,
TypeId = position.TypeId, TypeId = position.TypeId,
TypeName = position.TypeName, TypeName = position.TypeName,
@ -438,6 +454,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
// periodExam.AnnouncementExam = updated.AnnouncementExam; // periodExam.AnnouncementExam = updated.AnnouncementExam;
periodExam.Category = updated.Category; periodExam.Category = updated.Category;
periodExam.Detail = updated.Detail; periodExam.Detail = updated.Detail;
periodExam.EditorCondition = updated.EditorCondition;
periodExam.EditorConfirm = updated.EditorConfirm;
periodExam.Note = updated.Note; periodExam.Note = updated.Note;
periodExam.LastUpdatedAt = DateTime.Now; periodExam.LastUpdatedAt = DateTime.Now;
periodExam.LastUpdateUserId = UserId ?? ""; periodExam.LastUpdateUserId = UserId ?? "";
@ -508,6 +526,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
{ {
position.PositionId = positionData.PositionId; position.PositionId = positionData.PositionId;
position.PositionName = positionData.PositionName; position.PositionName = positionData.PositionName;
position.PositionLevelId = positionData.PositionLevelId;
position.PositionLevelName = positionData.PositionLevelName;
position.HighDegree = positionData.HighDegree; position.HighDegree = positionData.HighDegree;
position.TypeId = positionData.TypeId; position.TypeId = positionData.TypeId;
position.TypeName = positionData.TypeName; position.TypeName = positionData.TypeName;
@ -539,6 +559,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
PeriodExam = periodExam, PeriodExam = periodExam,
PositionId = position.PositionId, PositionId = position.PositionId,
PositionName = position.PositionName, PositionName = position.PositionName,
PositionLevelId = position.PositionLevelId,
PositionLevelName = position.PositionLevelName,
HighDegree = position.HighDegree, HighDegree = position.HighDegree,
TypeId = position.TypeId, TypeId = position.TypeId,
TypeName = position.TypeName, TypeName = position.TypeName,
@ -660,6 +682,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (status == "all") if (status == "all")
{ {
var candidate = await _context.Candidates.AsQueryable() var candidate = await _context.Candidates.AsQueryable()
.Include(x => x.PositionExam)
.Include(x => x.ProfileImg) .Include(x => x.ProfileImg)
.OrderByDescending(d => d.CreatedAt) .OrderByDescending(d => d.CreatedAt)
.Where(x => x.PeriodExam == periodExam && x.RegisterDate != null && x.Status != "register" && x.Status != "rejectRegister") .Where(x => x.PeriodExam == periodExam && x.RegisterDate != null && x.Status != "register" && x.Status != "rejectRegister")
@ -678,6 +701,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
else else
{ {
var candidate = await _context.Candidates.AsQueryable() var candidate = await _context.Candidates.AsQueryable()
.Include(x => x.PositionExam)
.Include(x => x.ProfileImg) .Include(x => x.ProfileImg)
.OrderByDescending(d => d.CreatedAt) .OrderByDescending(d => d.CreatedAt)
.Where(x => x.PeriodExam == periodExam && x.Status == status) .Where(x => x.PeriodExam == periodExam && x.Status == status)
@ -707,8 +731,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
LastName = x.LastName, LastName = x.LastName,
Nationality = x.Nationality, Nationality = x.Nationality,
DateOfBirth = x.DateOfBirth, DateOfBirth = x.DateOfBirth,
Relationship = x.RelationshipName, Religion = x.ReligionName,
RelationshipId = x.RelationshipId != null ? x.RelationshipId.ToString() : null, ReligionId = x.ReligionId != null ? x.ReligionId.ToString() : null,
CitizenProvince = x.CitizenProvinceName, CitizenProvince = x.CitizenProvinceName,
CitizenProvinceId = x.CitizenProvinceId != null ? x.CitizenProvinceId.ToString() : null, CitizenProvinceId = x.CitizenProvinceId != null ? x.CitizenProvinceId.ToString() : null,
CitizenDistrict = x.CitizenDistrictName, CitizenDistrict = x.CitizenDistrictName,
@ -754,12 +778,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Where(x => x.Id == Guid.Parse(candidateId)) .Where(x => x.Id == Guid.Parse(candidateId))
.Select(x => new CandidateOccupationResponseItem .Select(x => new CandidateOccupationResponseItem
{ {
OccupationType = x.OccupationType, OccupationOrg = x.OccupationOrg,
OccupationCompany = x.OccupationCompany, OccupationPile = x.OccupationPile,
OccupationDepartment = x.OccupationDepartment, OccupationGroup = x.OccupationGroup,
OccupationEmail = x.OccupationEmail, OccupationSalary = x.OccupationSalary,
OccupationTelephone = x.OccupationTelephone,
OccupationPosition = x.OccupationPosition, OccupationPosition = x.OccupationPosition,
OccupationPositionType = x.OccupationPositionType,
OccupationTelephone = x.OccupationTelephone,
}) })
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
} }
@ -820,12 +845,17 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
} }
public async Task<IEnumerable<Education?>> GetsAsyncEducation(string candidateId) public async Task<Education?> GetsAsyncEducation(string candidateId)
{ {
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
if (candidate == null)
throw new Exception(GlobalMessages.ExamNotFound);
return await _context.Educations.AsQueryable() return await _context.Educations.AsQueryable()
.Where(x => x.Candidate.Id == Guid.Parse(candidateId)) .Where(x => x.Candidate == candidate)
.OrderBy(d => d.DurationStart) .FirstOrDefaultAsync();
.ToListAsync();
} }
public async Task<IEnumerable<Career?>> GetsAsyncCareer(string candidateId) public async Task<IEnumerable<Career?>> GetsAsyncCareer(string candidateId)
@ -1319,7 +1349,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Nationality = c.Nationality, Nationality = c.Nationality,
DateOfBirth = c.DateOfBirth == null ? "" : c.DateOfBirth.Value.Date.ToThaiShortDate(), DateOfBirth = c.DateOfBirth == null ? "" : c.DateOfBirth.Value.Date.ToThaiShortDate(),
Age = c.DateOfBirth == null ? "" : c.DateOfBirth.Value.Date.CalculateAgeStrV2(0, 0), Age = c.DateOfBirth == null ? "" : c.DateOfBirth.Value.Date.CalculateAgeStrV2(0, 0),
RelationshipName = c.RelationshipName, ReligionName = c.ReligionName,
Telephone = c.Telephone, Telephone = c.Telephone,
MobilePhone = c.MobilePhone, MobilePhone = c.MobilePhone,
Email = c.Email, Email = c.Email,
@ -1334,14 +1364,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
CurrentDistrictName = c.CurrentDistrictName, CurrentDistrictName = c.CurrentDistrictName,
CurrentSubDistrictName = c.CurrentSubDistrictName, CurrentSubDistrictName = c.CurrentSubDistrictName,
CurrentZipCode = c.CurrentZipCode, CurrentZipCode = c.CurrentZipCode,
MarryFullName = $"{c.MarryPrefixName}{c.MarryFirstName} {c.MarryLastName}", OccupationOrg = c.OccupationOrg,
FatherFullName = $"{c.FatherPrefixName}{c.FatherFirstName} {c.FatherLastName}", OccupationPile = c.OccupationPile,
MotherFullName = $"{c.MotherPrefixName}{c.MotherFirstName} {c.MotherLastName}", OccupationGroup = c.OccupationGroup,
OccupationType = c.OccupationType, OccupationSalary = c.OccupationSalary,
OccupationPosition = c.OccupationPosition, OccupationPosition = c.OccupationPosition,
OccupationCompany = c.OccupationCompany, OccupationPositionType = c.OccupationPositionType,
OccupationDepartment = c.OccupationDepartment,
OccupationEmail = c.OccupationEmail,
OccupationTelephone = c.OccupationTelephone, OccupationTelephone = c.OccupationTelephone,
RegisterDate = c.RegisterDate, RegisterDate = c.RegisterDate,
@ -1384,7 +1412,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.Cells[1, 4].Value = "สัญชาติ"; summarySheet.Cells[1, 4].Value = "สัญชาติ";
summarySheet.Cells[1, 5].Value = "วันเกิด"; summarySheet.Cells[1, 5].Value = "วันเกิด";
summarySheet.Cells[1, 6].Value = "อายุ"; summarySheet.Cells[1, 6].Value = "อายุ";
summarySheet.Cells[1, 7].Value = "สถานภาพ"; summarySheet.Cells[1, 7].Value = "ศาสนา";
summarySheet.Cells[1, 8].Value = "โทรศัพท์"; summarySheet.Cells[1, 8].Value = "โทรศัพท์";
summarySheet.Cells[1, 9].Value = "โทรศัพท์มือถือ"; summarySheet.Cells[1, 9].Value = "โทรศัพท์มือถือ";
summarySheet.Cells[1, 10].Value = "อีเมล"; summarySheet.Cells[1, 10].Value = "อีเมล";
@ -1399,46 +1427,54 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.Cells[1, 19].Value = "เขต/อำเภอที่อยู่ปัจจุบัน"; summarySheet.Cells[1, 19].Value = "เขต/อำเภอที่อยู่ปัจจุบัน";
summarySheet.Cells[1, 20].Value = "ตำบล/แขวงที่อยู่ปัจจุบัน"; summarySheet.Cells[1, 20].Value = "ตำบล/แขวงที่อยู่ปัจจุบัน";
summarySheet.Cells[1, 21].Value = "รหัสไปรษณีย์ที่อยู่ปัจจุบัน"; summarySheet.Cells[1, 21].Value = "รหัสไปรษณีย์ที่อยู่ปัจจุบัน";
summarySheet.Cells[1, 22].Value = "คู่สมรส";
summarySheet.Cells[1, 23].Value = "บิดา"; summarySheet.Cells[1, 22].Value = "ประเภทตำแหน่งปัจจุบัน";
summarySheet.Cells[1, 24].Value = "มารดา"; summarySheet.Cells[1, 23].Value = "ชื่อตำแหน่งปัจจุบัน";
summarySheet.Cells[1, 25].Value = "อาชีพ"; summarySheet.Cells[1, 24].Value = "เงินเดือน ตำแหน่งปัจจุบัน";
summarySheet.Cells[1, 26].Value = "ตำแหน่ง"; summarySheet.Cells[1, 25].Value = "กลุ่ม/ฝ่าย ตำแหน่งปัจจุบัน";
summarySheet.Cells[1, 27].Value = "สำนัก/บริษัท"; summarySheet.Cells[1, 26].Value = "กอง ตำแหน่งปัจจุบัน";
summarySheet.Cells[1, 28].Value = "กอง/ฝ่าย"; summarySheet.Cells[1, 27].Value = "สังกัด ตำแหน่งปัจจุบัน";
summarySheet.Cells[1, 29].Value = "อีเมลบริษัท"; summarySheet.Cells[1, 28].Value = "เบอร์ที่ทำงาน ตำแหน่งปัจจุบัน";
summarySheet.Cells[1, 30].Value = "โทรศัพท์บริษัท";
summarySheet.Cells[1, 31].Value = "วุฒิที่ได้รับ"; summarySheet.Cells[1, 29].Value = "วุฒิที่ใช้สมัครสอบ";
summarySheet.Cells[1, 32].Value = "สาขา/วิชาเอก"; summarySheet.Cells[1, 30].Value = "ชื่อปริญญา";
summarySheet.Cells[1, 33].Value = "คะแนนเฉลี่ยตลอดหลักสูตร"; summarySheet.Cells[1, 31].Value = "สาขาวิชา/วิชาเอก";
summarySheet.Cells[1, 34].Value = "ชื่อสถานศีกษา"; summarySheet.Cells[1, 32].Value = "ชื่อสถานศึกษา";
summarySheet.Cells[1, 35].Value = "ระยะเวลาเริ่มศึกษา"; summarySheet.Cells[1, 33].Value = "ประเภทสถานศึกษา";
summarySheet.Cells[1, 36].Value = "ระยะเวลาสิ้นสุดศึกษา"; summarySheet.Cells[1, 34].Value = "วันที่สำเร็จการศึกษา";
summarySheet.Cells[1, 37].Value = "สถานที่ทำงาน/ฝึกงาน"; summarySheet.Cells[1, 35].Value = "คะแนนเฉลี่ยสะสม";
summarySheet.Cells[1, 38].Value = "ตำแหน่ง/ลักษณะงาน"; summarySheet.Cells[1, 36].Value = "วุฒิการศึกษาสูงสุด";
summarySheet.Cells[1, 39].Value = "เงินเดือนสุดท้านก่อนออก";
summarySheet.Cells[1, 40].Value = "ระยะเวลาเริ่มทำงาน/ฝึกงาน"; summarySheet.Cells[1, 37].Value = "ตำแหน่งปัจจุบัน ชื่อตำแหน่ง";
summarySheet.Cells[1, 41].Value = "ระยะเวลาสิ้นสุดทำงาน/ฝึกงาน"; summarySheet.Cells[1, 38].Value = "ตำแหน่งปัจจุบัน กอง";
summarySheet.Cells[1, 42].Value = "เหตุผลที่ออก"; summarySheet.Cells[1, 39].Value = "ตำแหน่งปัจจุบัน กลุ่ม/ฝ่าย";
summarySheet.Cells[1, 43].Value = "ลำดับที่สอบได้"; summarySheet.Cells[1, 40].Value = "ตำแหน่งปัจจุบัน เงินเดือน";
summarySheet.Cells[1, 44].Value = "เลขประจำตัวสอบ"; summarySheet.Cells[1, 41].Value = "ตำแหน่งปัจจุบัน สังกัด";
summarySheet.Cells[1, 45].Value = "เลขที่นั่งสอบ"; summarySheet.Cells[1, 42].Value = "ตำแหน่งปัจจุบัน ประเภทราชการ";
summarySheet.Cells[1, 46].Value = "คะแนนเต็มภาค ข"; summarySheet.Cells[1, 43].Value = "เบอร์โทรที่ทำงาน";
summarySheet.Cells[1, 47].Value = "คะแนนภาค ข";
summarySheet.Cells[1, 48].Value = "ผลสอบภาค ข"; summarySheet.Cells[1, 44].Value = "ลำดับที่สอบได้";
summarySheet.Cells[1, 49].Value = "คะแนนเต็มภาค ค"; summarySheet.Cells[1, 45].Value = "เลขประจำตัวสอบ";
summarySheet.Cells[1, 50].Value = "คะแนนภาค ค"; summarySheet.Cells[1, 46].Value = "เลขที่นั่งสอบ";
summarySheet.Cells[1, 51].Value = "ผลสอบภาค ค"; summarySheet.Cells[1, 47].Value = "คะแนนเต็มภาค ก";
summarySheet.Cells[1, 52].Value = "ผลการสอบ"; summarySheet.Cells[1, 48].Value = "คะแนนภาค ก";
summarySheet.Cells[1, 53].Value = "วันที่สมัคร"; summarySheet.Cells[1, 49].Value = "ผลสอบภาค ก";
summarySheet.Cells[1, 54].Value = "วันเและเวลาที่สมัคร"; summarySheet.Cells[1, 50].Value = "คะแนนเต็มภาค ข";
summarySheet.Cells[1, 51].Value = "คะแนนภาค ข";
summarySheet.Cells[1, 52].Value = "ผลสอบภาค ข";
summarySheet.Cells[1, 53].Value = "คะแนนเต็มภาค ค";
summarySheet.Cells[1, 54].Value = "คะแนนภาค ค";
summarySheet.Cells[1, 55].Value = "ผลสอบภาค ค";
summarySheet.Cells[1, 56].Value = "ผลการสอบ";
summarySheet.Cells[1, 57].Value = "วันที่สมัคร";
summarySheet.Cells[1, 58].Value = "วันเและเวลาที่สมัคร";
int row = 2; int row = 2;
foreach (var item in candidates) foreach (var item in candidates)
{ {
var educations = await _context.Educations var educations = await _context.Educations
.AsQueryable() .AsQueryable()
.OrderBy(x => x.DurationStart) .OrderBy(x => x.EducationEndDate)
.Where(x => x.Candidate.Id == item.Id) .Where(x => x.Candidate.Id == item.Id)
.ToListAsync(); .ToListAsync();
@ -1450,7 +1486,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.Cells[row, 4].Value = item.Nationality; summarySheet.Cells[row, 4].Value = item.Nationality;
summarySheet.Cells[row, 5].Value = item.DateOfBirth; summarySheet.Cells[row, 5].Value = item.DateOfBirth;
summarySheet.Cells[row, 6].Value = item.Age; summarySheet.Cells[row, 6].Value = item.Age;
summarySheet.Cells[row, 7].Value = item.RelationshipName; summarySheet.Cells[row, 7].Value = item.ReligionName;
summarySheet.Cells[row, 8].Value = item.Telephone; summarySheet.Cells[row, 8].Value = item.Telephone;
summarySheet.Cells[row, 9].Value = item.MobilePhone; summarySheet.Cells[row, 9].Value = item.MobilePhone;
summarySheet.Cells[row, 10].Value = item.Email; summarySheet.Cells[row, 10].Value = item.Email;
@ -1465,36 +1501,39 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.Cells[row, 19].Value = item.CurrentDistrictName; summarySheet.Cells[row, 19].Value = item.CurrentDistrictName;
summarySheet.Cells[row, 20].Value = item.CurrentSubDistrictName; summarySheet.Cells[row, 20].Value = item.CurrentSubDistrictName;
summarySheet.Cells[row, 21].Value = item.CurrentZipCode; summarySheet.Cells[row, 21].Value = item.CurrentZipCode;
summarySheet.Cells[row, 22].Value = item.MarryFullName;
summarySheet.Cells[row, 23].Value = item.FatherFullName; summarySheet.Cells[row, 22].Value = item.OccupationPosition;
summarySheet.Cells[row, 24].Value = item.MotherFullName; summarySheet.Cells[row, 23].Value = item.OccupationSalary;
summarySheet.Cells[row, 25].Value = item.OccupationType == null ? null : GenerateStatusOccupation(item.OccupationType); summarySheet.Cells[row, 24].Value = item.OccupationGroup;
summarySheet.Cells[row, 26].Value = item.OccupationPosition; summarySheet.Cells[row, 25].Value = item.OccupationPile;
summarySheet.Cells[row, 27].Value = item.OccupationCompany; summarySheet.Cells[row, 26].Value = item.OccupationOrg;
summarySheet.Cells[row, 28].Value = item.OccupationDepartment; summarySheet.Cells[row, 27].Value = item.OccupationPositionType == null ? null : GenerateStatusOccupation(item.OccupationPositionType);
summarySheet.Cells[row, 29].Value = item.OccupationEmail; summarySheet.Cells[row, 28].Value = item.OccupationTelephone;
summarySheet.Cells[row, 30].Value = item.OccupationTelephone;
summarySheet.Cells[row, 31].Value = education.EducationLevelName; summarySheet.Cells[row, 29].Value = education.EducationLevelExamName;
summarySheet.Cells[row, 32].Value = education.Major; summarySheet.Cells[row, 30].Value = education.EducationName;
summarySheet.Cells[row, 33].Value = education.Scores; summarySheet.Cells[row, 31].Value = education.EducationMajor;
summarySheet.Cells[row, 34].Value = education.Name; summarySheet.Cells[row, 32].Value = education.EducationLocation;
summarySheet.Cells[row, 35].Value = education.DurationStart == null ? "" : education.DurationStart.Date.ToThaiShortDate(); summarySheet.Cells[row, 33].Value = education.EducationType;
summarySheet.Cells[row, 36].Value = education.DurationEnd == null ? "" : education.DurationEnd.Date.ToThaiShortDate(); summarySheet.Cells[row, 34].Value = education.EducationEndDate == null ? "-" : education.EducationEndDate.Value.Date.ToThaiShortDate();
summarySheet.Cells[row, 43].Value = item.Number; summarySheet.Cells[row, 35].Value = education.EducationScores;
summarySheet.Cells[row, 44].Value = item.ExamIdenNumber; summarySheet.Cells[row, 36].Value = education.EducationLevelHighName;
summarySheet.Cells[row, 45].Value = item.SeatNumber;
summarySheet.Cells[row, 46].Value = item.PointTotalA; summarySheet.Cells[row, 44].Value = item.Number;
summarySheet.Cells[row, 47].Value = item.PointA; summarySheet.Cells[row, 45].Value = item.ExamIdenNumber;
summarySheet.Cells[row, 48].Value = item.ResultA; summarySheet.Cells[row, 46].Value = item.SeatNumber;
summarySheet.Cells[row, 49].Value = item.PointTotalB; summarySheet.Cells[row, 47].Value = item.PointTotalA;
summarySheet.Cells[row, 50].Value = item.PointB; summarySheet.Cells[row, 48].Value = item.PointA;
summarySheet.Cells[row, 51].Value = item.ResultB; summarySheet.Cells[row, 49].Value = item.ResultA;
summarySheet.Cells[row, 52].Value = item.PointTotalC; summarySheet.Cells[row, 50].Value = item.PointTotalB;
summarySheet.Cells[row, 53].Value = item.PointC; summarySheet.Cells[row, 51].Value = item.PointB;
summarySheet.Cells[row, 54].Value = item.ResultC; summarySheet.Cells[row, 52].Value = item.ResultB;
summarySheet.Cells[row, 55].Value = item.Pass; summarySheet.Cells[row, 53].Value = item.PointTotalC;
summarySheet.Cells[row, 56].Value = item.CreatedAt.Date.ToThaiShortDate(); summarySheet.Cells[row, 54].Value = item.PointC;
summarySheet.Cells[row, 57].Value = item.RegisterDate; summarySheet.Cells[row, 55].Value = item.ResultC;
summarySheet.Cells[row, 56].Value = item.Pass;
summarySheet.Cells[row, 57].Value = item.CreatedAt.Date.ToThaiShortDate();
summarySheet.Cells[row, 58].Value = item.RegisterDate;
row++; row++;
} }
var careers = await _context.Careers var careers = await _context.Careers
@ -1511,7 +1550,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.Cells[row, 4].Value = item.Nationality; summarySheet.Cells[row, 4].Value = item.Nationality;
summarySheet.Cells[row, 5].Value = item.DateOfBirth; summarySheet.Cells[row, 5].Value = item.DateOfBirth;
summarySheet.Cells[row, 6].Value = item.Age; summarySheet.Cells[row, 6].Value = item.Age;
summarySheet.Cells[row, 7].Value = item.RelationshipName; summarySheet.Cells[row, 7].Value = item.ReligionName;
summarySheet.Cells[row, 8].Value = item.Telephone; summarySheet.Cells[row, 8].Value = item.Telephone;
summarySheet.Cells[row, 9].Value = item.MobilePhone; summarySheet.Cells[row, 9].Value = item.MobilePhone;
summarySheet.Cells[row, 10].Value = item.Email; summarySheet.Cells[row, 10].Value = item.Email;
@ -1526,36 +1565,38 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.Cells[row, 19].Value = item.CurrentDistrictName; summarySheet.Cells[row, 19].Value = item.CurrentDistrictName;
summarySheet.Cells[row, 20].Value = item.CurrentSubDistrictName; summarySheet.Cells[row, 20].Value = item.CurrentSubDistrictName;
summarySheet.Cells[row, 21].Value = item.CurrentZipCode; summarySheet.Cells[row, 21].Value = item.CurrentZipCode;
summarySheet.Cells[row, 22].Value = item.MarryFullName;
summarySheet.Cells[row, 23].Value = item.FatherFullName; summarySheet.Cells[row, 22].Value = item.OccupationPosition;
summarySheet.Cells[row, 24].Value = item.MotherFullName; summarySheet.Cells[row, 23].Value = item.OccupationSalary;
summarySheet.Cells[row, 25].Value = item.OccupationType == null ? null : GenerateStatusOccupation(item.OccupationType); summarySheet.Cells[row, 24].Value = item.OccupationGroup;
summarySheet.Cells[row, 26].Value = item.OccupationPosition; summarySheet.Cells[row, 25].Value = item.OccupationPile;
summarySheet.Cells[row, 27].Value = item.OccupationCompany; summarySheet.Cells[row, 26].Value = item.OccupationOrg;
summarySheet.Cells[row, 28].Value = item.OccupationDepartment; summarySheet.Cells[row, 27].Value = item.OccupationPositionType == null ? null : GenerateStatusOccupation(item.OccupationPositionType);
summarySheet.Cells[row, 29].Value = item.OccupationEmail; summarySheet.Cells[row, 28].Value = item.OccupationTelephone;
summarySheet.Cells[row, 30].Value = item.OccupationTelephone;
summarySheet.Cells[row, 37].Value = career.Name; summarySheet.Cells[row, 37].Value = career.Position;
summarySheet.Cells[row, 38].Value = career.Position; summarySheet.Cells[row, 38].Value = career.Group;
summarySheet.Cells[row, 39].Value = career.Salary; summarySheet.Cells[row, 39].Value = career.Pile;
summarySheet.Cells[row, 40].Value = career.DurationStart == null ? "" : career.DurationStart.Date.ToThaiShortDate(); summarySheet.Cells[row, 40].Value = career.Org;
summarySheet.Cells[row, 41].Value = career.DurationEnd == null ? "" : career.DurationEnd.Date.ToThaiShortDate(); summarySheet.Cells[row, 41].Value = career.DurationStart == null ? "-" : career.DurationStart.Date.ToThaiShortDate();
summarySheet.Cells[row, 42].Value = career.Reason; summarySheet.Cells[row, 42].Value = career.DurationEnd == null ? "-" : career.DurationEnd.Date.ToThaiShortDate();
summarySheet.Cells[row, 43].Value = item.Number; summarySheet.Cells[row, 43].Value = career.RangeDate;
summarySheet.Cells[row, 44].Value = item.ExamIdenNumber;
summarySheet.Cells[row, 45].Value = item.SeatNumber; summarySheet.Cells[row, 44].Value = item.Number;
summarySheet.Cells[row, 46].Value = item.PointTotalA; summarySheet.Cells[row, 45].Value = item.ExamIdenNumber;
summarySheet.Cells[row, 47].Value = item.PointA; summarySheet.Cells[row, 46].Value = item.SeatNumber;
summarySheet.Cells[row, 48].Value = item.ResultA; summarySheet.Cells[row, 47].Value = item.PointTotalA;
summarySheet.Cells[row, 49].Value = item.PointTotalB; summarySheet.Cells[row, 48].Value = item.PointA;
summarySheet.Cells[row, 50].Value = item.PointB; summarySheet.Cells[row, 49].Value = item.ResultA;
summarySheet.Cells[row, 51].Value = item.ResultB; summarySheet.Cells[row, 50].Value = item.PointTotalB;
summarySheet.Cells[row, 52].Value = item.PointTotalC; summarySheet.Cells[row, 51].Value = item.PointB;
summarySheet.Cells[row, 53].Value = item.PointC; summarySheet.Cells[row, 52].Value = item.ResultB;
summarySheet.Cells[row, 54].Value = item.ResultC; summarySheet.Cells[row, 53].Value = item.PointTotalC;
summarySheet.Cells[row, 55].Value = item.Pass; summarySheet.Cells[row, 54].Value = item.PointC;
summarySheet.Cells[row, 56].Value = item.CreatedAt.Date.ToThaiShortDate(); summarySheet.Cells[row, 55].Value = item.ResultC;
summarySheet.Cells[row, 57].Value = item.RegisterDate; summarySheet.Cells[row, 56].Value = item.Pass;
summarySheet.Cells[row, 57].Value = item.CreatedAt.Date.ToThaiShortDate();
summarySheet.Cells[row, 58].Value = item.RegisterDate;
row++; row++;
} }
if (educations.Count() == 0 && careers.Count() == 0) if (educations.Count() == 0 && careers.Count() == 0)
@ -1566,7 +1607,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.Cells[row, 4].Value = item.Nationality; summarySheet.Cells[row, 4].Value = item.Nationality;
summarySheet.Cells[row, 5].Value = item.DateOfBirth; summarySheet.Cells[row, 5].Value = item.DateOfBirth;
summarySheet.Cells[row, 6].Value = item.Age; summarySheet.Cells[row, 6].Value = item.Age;
summarySheet.Cells[row, 7].Value = item.RelationshipName; summarySheet.Cells[row, 7].Value = item.ReligionName;
summarySheet.Cells[row, 8].Value = item.Telephone; summarySheet.Cells[row, 8].Value = item.Telephone;
summarySheet.Cells[row, 9].Value = item.MobilePhone; summarySheet.Cells[row, 9].Value = item.MobilePhone;
summarySheet.Cells[row, 10].Value = item.Email; summarySheet.Cells[row, 10].Value = item.Email;
@ -1581,31 +1622,30 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.Cells[row, 19].Value = item.CurrentDistrictName; summarySheet.Cells[row, 19].Value = item.CurrentDistrictName;
summarySheet.Cells[row, 20].Value = item.CurrentSubDistrictName; summarySheet.Cells[row, 20].Value = item.CurrentSubDistrictName;
summarySheet.Cells[row, 21].Value = item.CurrentZipCode; summarySheet.Cells[row, 21].Value = item.CurrentZipCode;
summarySheet.Cells[row, 22].Value = item.MarryFullName;
summarySheet.Cells[row, 23].Value = item.FatherFullName;
summarySheet.Cells[row, 24].Value = item.MotherFullName;
summarySheet.Cells[row, 25].Value = item.OccupationType == null ? null : GenerateStatusOccupation(item.OccupationType);
summarySheet.Cells[row, 26].Value = item.OccupationPosition;
summarySheet.Cells[row, 27].Value = item.OccupationCompany;
summarySheet.Cells[row, 28].Value = item.OccupationDepartment;
summarySheet.Cells[row, 29].Value = item.OccupationEmail;
summarySheet.Cells[row, 30].Value = item.OccupationTelephone;
summarySheet.Cells[row, 43].Value = item.Number; summarySheet.Cells[row, 22].Value = item.OccupationPosition;
summarySheet.Cells[row, 44].Value = item.ExamIdenNumber; summarySheet.Cells[row, 23].Value = item.OccupationSalary;
summarySheet.Cells[row, 45].Value = item.SeatNumber; summarySheet.Cells[row, 24].Value = item.OccupationGroup;
summarySheet.Cells[row, 46].Value = item.PointTotalA; summarySheet.Cells[row, 25].Value = item.OccupationPile;
summarySheet.Cells[row, 47].Value = item.PointA; summarySheet.Cells[row, 26].Value = item.OccupationOrg;
summarySheet.Cells[row, 48].Value = item.ResultA; summarySheet.Cells[row, 27].Value = item.OccupationPositionType == null ? null : GenerateStatusOccupation(item.OccupationPositionType);
summarySheet.Cells[row, 49].Value = item.PointTotalB; summarySheet.Cells[row, 28].Value = item.OccupationTelephone;
summarySheet.Cells[row, 50].Value = item.PointB;
summarySheet.Cells[row, 51].Value = item.ResultB; summarySheet.Cells[row, 44].Value = item.Number;
summarySheet.Cells[row, 52].Value = item.PointTotalC; summarySheet.Cells[row, 45].Value = item.ExamIdenNumber;
summarySheet.Cells[row, 53].Value = item.PointC; summarySheet.Cells[row, 46].Value = item.SeatNumber;
summarySheet.Cells[row, 54].Value = item.ResultC; summarySheet.Cells[row, 47].Value = item.PointTotalA;
summarySheet.Cells[row, 55].Value = item.Pass; summarySheet.Cells[row, 48].Value = item.PointA;
summarySheet.Cells[row, 56].Value = item.CreatedAt.Date.ToThaiShortDate(); summarySheet.Cells[row, 49].Value = item.ResultA;
summarySheet.Cells[row, 57].Value = item.RegisterDate; summarySheet.Cells[row, 50].Value = item.PointTotalB;
summarySheet.Cells[row, 51].Value = item.PointB;
summarySheet.Cells[row, 52].Value = item.ResultB;
summarySheet.Cells[row, 53].Value = item.PointTotalC;
summarySheet.Cells[row, 54].Value = item.PointC;
summarySheet.Cells[row, 55].Value = item.ResultC;
summarySheet.Cells[row, 56].Value = item.Pass;
summarySheet.Cells[row, 57].Value = item.CreatedAt.Date.ToThaiShortDate();
summarySheet.Cells[row, 58].Value = item.RegisterDate;
row++; row++;
} }
} }
@ -1641,7 +1681,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Nationality = c.Nationality, Nationality = c.Nationality,
DateOfBirth = c.DateOfBirth == null ? "" : c.DateOfBirth.Value.Date.ToThaiShortDate(), DateOfBirth = c.DateOfBirth == null ? "" : c.DateOfBirth.Value.Date.ToThaiShortDate(),
Age = c.DateOfBirth == null ? 0 : DateTime.Now.Date.Year - c.DateOfBirth.Value.Date.Year, Age = c.DateOfBirth == null ? 0 : DateTime.Now.Date.Year - c.DateOfBirth.Value.Date.Year,
RelationshipName = c.RelationshipName, ReligionName = c.ReligionName,
Telephone = c.Telephone, Telephone = c.Telephone,
MobilePhone = c.MobilePhone, MobilePhone = c.MobilePhone,
Email = c.Email, Email = c.Email,
@ -1656,14 +1696,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
CurrentDistrictName = c.CurrentDistrictName, CurrentDistrictName = c.CurrentDistrictName,
CurrentSubDistrictName = c.CurrentSubDistrictName, CurrentSubDistrictName = c.CurrentSubDistrictName,
CurrentZipCode = c.CurrentZipCode, CurrentZipCode = c.CurrentZipCode,
MarryFullName = $"{c.MarryPrefixName}{c.MarryFirstName} {c.MarryLastName}", OccupationOrg = c.OccupationOrg,
FatherFullName = $"{c.FatherPrefixName}{c.FatherFirstName} {c.FatherLastName}", OccupationPile = c.OccupationPile,
MotherFullName = $"{c.MotherPrefixName}{c.MotherFirstName} {c.MotherLastName}", OccupationGroup = c.OccupationGroup,
OccupationType = c.OccupationType, OccupationSalary = c.OccupationSalary,
OccupationPosition = c.OccupationPosition, OccupationPosition = c.OccupationPosition,
OccupationCompany = c.OccupationCompany, OccupationPositionType = c.OccupationPositionType,
OccupationDepartment = c.OccupationDepartment,
OccupationEmail = c.OccupationEmail,
OccupationTelephone = c.OccupationTelephone, OccupationTelephone = c.OccupationTelephone,
Number = c.Number, Number = c.Number,
ExamIdenNumber = c.ExamIdenNumber, ExamIdenNumber = c.ExamIdenNumber,
@ -1729,7 +1767,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Where(x => x.Candidate.PeriodExam == periodExam) .Where(x => x.Candidate.PeriodExam == periodExam)
.Where(x => x.Candidate.CreatedAt.Date <= item.DateEnd.Date) .Where(x => x.Candidate.CreatedAt.Date <= item.DateEnd.Date)
.Where(x => x.Candidate.CreatedAt.Date >= item.DateStart.Date) .Where(x => x.Candidate.CreatedAt.Date >= item.DateStart.Date)
.GroupBy(x => x.EducationLevelName) .GroupBy(x => x.EducationLevelExamName)
.Select(x => new .Select(x => new
{ {
Name = x.Key, Name = x.Key,
@ -1746,7 +1784,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
} }
if (educations.Count() != 0) if (educations.Count() != 0)
{ {
summarySheet.Cells[5, fixMerge, 5, rowName - 1].Value = "วุฒิการศึกษา"; summarySheet.Cells[5, fixMerge, 5, rowName - 1].Value = "วุฒิที่ใช้สมัครสอบ";
summarySheet.Cells[5, fixMerge, 5, rowName - 1].Merge = true; summarySheet.Cells[5, fixMerge, 5, rowName - 1].Merge = true;
fixMerge = rowCount; fixMerge = rowCount;
} }
@ -1755,7 +1793,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Where(x => x.Candidate.PeriodExam == periodExam) .Where(x => x.Candidate.PeriodExam == periodExam)
.Where(x => x.Candidate.CreatedAt.Date <= item.DateEnd.Date) .Where(x => x.Candidate.CreatedAt.Date <= item.DateEnd.Date)
.Where(x => x.Candidate.CreatedAt.Date >= item.DateStart.Date) .Where(x => x.Candidate.CreatedAt.Date >= item.DateStart.Date)
.GroupBy(x => x.Name) .GroupBy(x => x.Position)
.Select(x => new .Select(x => new
{ {
Name = x.Key, Name = x.Key,
@ -1866,8 +1904,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
public async Task UpdateAsyncCandidateToPlacement(Guid examId) public async Task UpdateAsyncCandidateToPlacement(Guid examId)
{ {
var periodExam = await _context.PeriodExams.AsQueryable() var periodExam = await _context.PeriodExams.AsQueryable()
.Include(x => x.Candidate)
.ThenInclude(x => x.Educations)
.Include(x => x.Candidate) .Include(x => x.Candidate)
.ThenInclude(x => x.PositionExam) .ThenInclude(x => x.PositionExam)
.Include(x => x.Candidate) .Include(x => x.Candidate)
@ -1911,7 +1947,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Lastname = candidate.LastName, Lastname = candidate.LastName,
Nationality = candidate.Nationality, Nationality = candidate.Nationality,
DateOfBirth = candidate.DateOfBirth, DateOfBirth = candidate.DateOfBirth,
Relationship = await _contextMetadata.Relationships.FirstOrDefaultAsync(x => x.Id == candidate.RelationshipId), Religion = await _contextMetadata.Religions.FirstOrDefaultAsync(x => x.Id == candidate.ReligionId),
Email = candidate.Email, Email = candidate.Email,
CitizenId = candidate.CitizenId, CitizenId = candidate.CitizenId,
CitizenDistrict = await _contextMetadata.Districts.FirstOrDefaultAsync(x => x.Id == candidate.CitizenDistrictId), CitizenDistrict = await _contextMetadata.Districts.FirstOrDefaultAsync(x => x.Id == candidate.CitizenDistrictId),
@ -1947,12 +1983,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
MotherLastName = candidate.MotherLastName, MotherLastName = candidate.MotherLastName,
MotherOccupation = candidate.MotherOccupation, MotherOccupation = candidate.MotherOccupation,
MotherNationality = candidate.MotherNationality, MotherNationality = candidate.MotherNationality,
OccupationType = candidate.OccupationType, OccupationOrg = candidate.OccupationOrg,
OccupationCompany = candidate.OccupationCompany, OccupationPile = candidate.OccupationPile,
OccupationDepartment = candidate.OccupationDepartment, OccupationGroup = candidate.OccupationGroup,
OccupationEmail = candidate.OccupationEmail, OccupationSalary = candidate.OccupationSalary,
OccupationTelephone = candidate.OccupationTelephone,
OccupationPosition = candidate.OccupationPosition, OccupationPosition = candidate.OccupationPosition,
OccupationPositionType = candidate.OccupationPositionType,
OccupationTelephone = candidate.OccupationTelephone,
PointTotalA = candidate.PointTotalA == null ? null : Convert.ToDouble(candidate.PointTotalA), PointTotalA = candidate.PointTotalA == null ? null : Convert.ToDouble(candidate.PointTotalA),
PointA = candidate.PointA == null ? null : Convert.ToDouble(candidate.PointA), PointA = candidate.PointA == null ? null : Convert.ToDouble(candidate.PointA),
PointTotalB = candidate.PointTotalB == null ? null : Convert.ToDouble(candidate.PointTotalB), PointTotalB = candidate.PointTotalB == null ? null : Convert.ToDouble(candidate.PointTotalB),
@ -1978,13 +2015,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var placementEducation = new PlacementEducation var placementEducation = new PlacementEducation
{ {
PlacementProfile = placementProfile, PlacementProfile = placementProfile,
EducationLevel = await _contextMetadata.EducationLevels.FirstOrDefaultAsync(x => x.Id == education.EducationLevelId), EducationLevel = await _contextMetadata.EducationLevels.FirstOrDefaultAsync(x => x.Id == education.EducationLevelExamId),
Field = education.Major, Field = education.EducationMajor,
Gpa = education.Scores.ToString(), Gpa = education.EducationScores,
Institute = education.Name, Institute = education.EducationLocation,
IsDate = true, IsDate = true,
StartDate = education.DurationStart, FinishDate = education.EducationEndDate,
EndDate = education.DurationEnd,
CreatedAt = DateTime.Now, CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "", CreatedUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now, LastUpdatedAt = DateTime.Now,
@ -2103,12 +2139,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
// MotherLastName = candidate.MotherLastName, // MotherLastName = candidate.MotherLastName,
// MotherOccupation = candidate.MotherOccupation, // MotherOccupation = candidate.MotherOccupation,
// MotherNationality = candidate.MotherNationality, // MotherNationality = candidate.MotherNationality,
OccupationType = "other",
OccupationPositionType = "other",
// OccupationCompany = candidate.OccupationCompany, // OccupationCompany = candidate.OccupationCompany,
OccupationDepartment = candidate.Occupations.FirstOrDefault() == null ? null : candidate.Occupations.FirstOrDefault().Workplace, // OccupationDepartment = candidate.Occupations.FirstOrDefault() == null ? null : candidate.Occupations.FirstOrDefault().Workplace,
// OccupationEmail = candidate.OccupationEmail, // OccupationEmail = candidate.OccupationEmail,
OccupationTelephone = candidate.Occupations.FirstOrDefault() == null ? null : candidate.Occupations.FirstOrDefault().Telephone, OccupationTelephone = candidate.Occupations.FirstOrDefault() == null ? null : candidate.Occupations.FirstOrDefault().Telephone,
OccupationPosition = candidate.Occupations.FirstOrDefault() == null ? null : candidate.Occupations.FirstOrDefault().Position, OccupationPosition = candidate.Occupations.FirstOrDefault() == null ? null : candidate.Occupations.FirstOrDefault().Position,
PointTotalA = disableScore == null ? null : Convert.ToDouble(disableScore.FullA), PointTotalA = disableScore == null ? null : Convert.ToDouble(disableScore.FullA),
PointA = disableScore == null ? null : Convert.ToDouble(disableScore.SumA), PointA = disableScore == null ? null : Convert.ToDouble(disableScore.SumA),
PointTotalB = disableScore == null ? null : Convert.ToDouble(disableScore.FullB), PointTotalB = disableScore == null ? null : Convert.ToDouble(disableScore.FullB),