โอนคนสรรหาไปบรรจุ
This commit is contained in:
parent
9a53f34107
commit
7fbdf971fa
13 changed files with 530 additions and 312 deletions
|
|
@ -42,6 +42,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
||||||
private readonly MinIOService _minioService;
|
private readonly MinIOService _minioService;
|
||||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||||
private readonly DisableService _disableService;
|
private readonly DisableService _disableService;
|
||||||
|
private readonly PeriodExamService _periodExamService;
|
||||||
|
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
private readonly ILogger<DisableController> _logger;
|
private readonly ILogger<DisableController> _logger;
|
||||||
|
|
@ -55,6 +56,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
||||||
MinIOService minioService,
|
MinIOService minioService,
|
||||||
IWebHostEnvironment webHostEnvironment,
|
IWebHostEnvironment webHostEnvironment,
|
||||||
DisableService disableService,
|
DisableService disableService,
|
||||||
|
PeriodExamService periodExamService,
|
||||||
IHttpContextAccessor httpContextAccessor,
|
IHttpContextAccessor httpContextAccessor,
|
||||||
ILogger<DisableController> logger)
|
ILogger<DisableController> logger)
|
||||||
{
|
{
|
||||||
|
|
@ -63,6 +65,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
||||||
_minioService = minioService;
|
_minioService = minioService;
|
||||||
_webHostEnvironment = webHostEnvironment;
|
_webHostEnvironment = webHostEnvironment;
|
||||||
_disableService = disableService;
|
_disableService = disableService;
|
||||||
|
_periodExamService = periodExamService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
@ -2048,6 +2051,31 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// โอนคนสรรหาไปบรรจุ
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="examId">รหัสรอบสมัคร</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200">เมื่อโอนคนสรรหาไปบรรจุสำเร็จ</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpGet("placement/{examId:length(36)}")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
public async Task<ActionResult<ResponseObject>> UpdateAsyncDisableToPlacement(Guid examId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await _periodExamService.UpdateAsyncDisableToPlacement(examId);
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return Error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
|
|
@ -62,5 +62,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Data
|
||||||
public DbSet<PlacementProfile> PlacementProfiles { get; set; }
|
public DbSet<PlacementProfile> PlacementProfiles { get; set; }
|
||||||
public DbSet<PlacementType> PlacementTypes { get; set; }
|
public DbSet<PlacementType> PlacementTypes { get; set; }
|
||||||
public DbSet<PositionPath> PositionPaths { get; set; }
|
public DbSet<PositionPath> PositionPaths { get; set; }
|
||||||
|
public DbSet<Gender> Genders { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,37 +8,37 @@ namespace BMA.EHR.Recurit.Exam.Service.Models.Disables
|
||||||
{
|
{
|
||||||
|
|
||||||
[Required, MaxLength(13), Comment("เลขประจำตัวประชาชน")]
|
[Required, MaxLength(13), Comment("เลขประจำตัวประชาชน")]
|
||||||
public string CitizenId { get; set; } = string.Empty;
|
public string CitizenId { get; set; } = string.Empty;//
|
||||||
|
|
||||||
[Required, MaxLength(50)]
|
[Required, MaxLength(50)]
|
||||||
public string ExamId { get; set; } = string.Empty;
|
public string ExamId { get; set; } = string.Empty;//
|
||||||
|
|
||||||
[Required, MaxLength(50)]
|
[Required, MaxLength(50)]
|
||||||
public string Prefix { get; set; } = string.Empty;
|
public string Prefix { get; set; } = string.Empty;//
|
||||||
|
|
||||||
[Required, MaxLength(150)]
|
[Required, MaxLength(150)]
|
||||||
public string FirstName { get; set; } = string.Empty;
|
public string FirstName { get; set; } = string.Empty;//
|
||||||
|
|
||||||
[Required, MaxLength(150)]
|
[Required, MaxLength(150)]
|
||||||
public string LastName { get; set; } = string.Empty;
|
public string LastName { get; set; } = string.Empty;//
|
||||||
|
|
||||||
[MaxLength(20)]
|
[MaxLength(20)]
|
||||||
public string Gendor { get; set; } = string.Empty;
|
public string Gendor { get; set; } = string.Empty;//
|
||||||
|
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string National { get; set; } = string.Empty;
|
public string National { get; set; } = string.Empty;//
|
||||||
|
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string Race { get; set; } = string.Empty;
|
public string Race { get; set; } = string.Empty;//
|
||||||
|
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string Religion { get; set; } = string.Empty;
|
public string Religion { get; set; } = string.Empty;//
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public DateTime DateOfBirth { get; set; }
|
public DateTime DateOfBirth { get; set; }//
|
||||||
|
|
||||||
[MaxLength(20)]
|
[MaxLength(20)]
|
||||||
public string Marry { get; set; } = string.Empty;
|
public string Marry { get; set; } = string.Empty;//
|
||||||
|
|
||||||
[MaxLength(1)]
|
[MaxLength(1)]
|
||||||
public string Isspecial { get; set; } = "N";
|
public string Isspecial { get; set; } = "N";
|
||||||
|
|
@ -47,9 +47,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Models.Disables
|
||||||
public string RefNo { get; set; } = string.Empty;
|
public string RefNo { get; set; } = string.Empty;
|
||||||
|
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string CitizenCardIssuer { get; set; } = string.Empty;
|
public string CitizenCardIssuer { get; set; } = string.Empty;//
|
||||||
|
|
||||||
public DateTime CitizenCardExpireDate { get; set; }
|
public DateTime CitizenCardExpireDate { get; set; }//
|
||||||
|
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string Remark { get; set; } = string.Empty;
|
public string Remark { get; set; } = string.Empty;
|
||||||
|
|
@ -77,6 +77,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Models.Disables
|
||||||
|
|
||||||
public DateTime ApplyDate { get; set; }
|
public DateTime ApplyDate { get; set; }
|
||||||
|
|
||||||
public string? PositionName { get; set; }
|
public string? PositionName { get; set; }//
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,58 +5,58 @@ namespace BMA.EHR.Recurit.Exam.Service.Models.Disables
|
||||||
public class DisableAddress : EntityBase
|
public class DisableAddress : EntityBase
|
||||||
{
|
{
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string Address { get; set; }
|
public string Address { get; set; }//
|
||||||
|
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string Moo { get; set; }
|
public string Moo { get; set; }//
|
||||||
|
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string Soi { get; set; }
|
public string Soi { get; set; }//
|
||||||
|
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string Road { get; set; }
|
public string Road { get; set; }//
|
||||||
|
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string District { get; set; }
|
public string District { get; set; }//
|
||||||
|
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string Amphur { get; set; }
|
public string Amphur { get; set; }//
|
||||||
|
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string Province { get; set; }
|
public string Province { get; set; }//
|
||||||
|
|
||||||
[MaxLength(5)]
|
[MaxLength(5)]
|
||||||
public string ZipCode { get; set; }
|
public string ZipCode { get; set; }//
|
||||||
|
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string Telephone { get; set; }
|
public string Telephone { get; set; }//
|
||||||
|
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string Mobile { get; set; }
|
public string Mobile { get; set; }//
|
||||||
|
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string Address1 { get; set; }
|
public string Address1 { get; set; }//
|
||||||
|
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string Moo1 { get; set; }
|
public string Moo1 { get; set; }//
|
||||||
|
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string Soi1 { get; set; }
|
public string Soi1 { get; set; }//
|
||||||
|
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string Road1 { get; set; }
|
public string Road1 { get; set; }//
|
||||||
|
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string District1 { get; set; }
|
public string District1 { get; set; }//
|
||||||
|
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string Amphur1 { get; set; }
|
public string Amphur1 { get; set; }//
|
||||||
|
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string Province1 { get; set; }
|
public string Province1 { get; set; }//
|
||||||
|
|
||||||
[MaxLength(5)]
|
[MaxLength(5)]
|
||||||
public string ZipCode1 { get; set; }
|
public string ZipCode1 { get; set; }//
|
||||||
|
|
||||||
public Disable Disable { get; set; }
|
public Disable Disable { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Models.Disables
|
||||||
public class DisableEducation : EntityBase
|
public class DisableEducation : EntityBase
|
||||||
{
|
{
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string Degree { get; set; }
|
public string Degree { get; set; }//
|
||||||
|
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string Major { get; set; }
|
public string Major { get; set; }//
|
||||||
|
|
||||||
[MaxLength(20)]
|
[MaxLength(20)]
|
||||||
public string MajorGroupId { get; set; }
|
public string MajorGroupId { get; set; }
|
||||||
|
|
@ -17,16 +17,16 @@ namespace BMA.EHR.Recurit.Exam.Service.Models.Disables
|
||||||
public string MajorGroupName { get; set; }
|
public string MajorGroupName { get; set; }
|
||||||
|
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string University { get; set; }
|
public string University { get; set; }//
|
||||||
public double GPA { get; set; } = 0.0;
|
public double GPA { get; set; } = 0.0;//
|
||||||
|
|
||||||
[MaxLength(1000)]
|
[MaxLength(1000)]
|
||||||
public string Specialist { get; set; }
|
public string Specialist { get; set; }
|
||||||
|
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string HighDegree { get; set; }
|
public string HighDegree { get; set; }//
|
||||||
|
|
||||||
public DateTime BachelorDate { get; set; }
|
public DateTime BachelorDate { get; set; }//
|
||||||
|
|
||||||
public Disable Disable { get; set; }
|
public Disable Disable { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Models.Disables
|
||||||
public string WorkAge { get; set; }
|
public string WorkAge { get; set; }
|
||||||
|
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string Position { get; set; }
|
public string Position { get; set; }//
|
||||||
|
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string Workplace { get; set; }
|
public string Workplace { get; set; }//
|
||||||
|
|
||||||
[MaxLength(200)]
|
[MaxLength(200)]
|
||||||
public string Telephone { get; set; }
|
public string Telephone { get; set; }//
|
||||||
|
|
||||||
public Disable Disable { get; set; }
|
public Disable Disable { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
Models/Gendor.cs
Normal file
12
Models/Gendor.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Recurit.Exam.Service.Models
|
||||||
|
{
|
||||||
|
public class Gender : EntityBase
|
||||||
|
{
|
||||||
|
[Required, MaxLength(20), Column(Order = 1), Comment("เพศ")]
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -27,7 +27,7 @@ namespace BMA.EHR.Domain.Models.Placement
|
||||||
[MaxLength(1000), Comment("ทุน")]
|
[MaxLength(1000), Comment("ทุน")]
|
||||||
public string? FundName { get; set; }
|
public string? FundName { get; set; }
|
||||||
[Comment("ระยะเวลาหลักสูตร")]
|
[Comment("ระยะเวลาหลักสูตร")]
|
||||||
public int DurationYear { get; set; }
|
public int? DurationYear { get; set; }
|
||||||
[Comment("วันที่สำเร็จการศึกษา")]
|
[Comment("วันที่สำเร็จการศึกษา")]
|
||||||
public DateTime? FinishDate { get; set; }
|
public DateTime? FinishDate { get; set; }
|
||||||
[Comment("ประเภทช่วงเวลาการศึกษา")]
|
[Comment("ประเภทช่วงเวลาการศึกษา")]
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ namespace BMA.EHR.Domain.Models.Placement
|
||||||
public string? Firstname { get; set; }
|
public string? Firstname { get; set; }
|
||||||
[Comment("นามสกุล")]
|
[Comment("นามสกุล")]
|
||||||
public string? Lastname { get; set; }
|
public string? Lastname { get; set; }
|
||||||
// [Comment("Id เพศ")]
|
[Comment("Id เพศ")]
|
||||||
// public Gender? Gender { get; set; }
|
public Gender? Gender { get; set; }
|
||||||
|
|
||||||
[Comment("Id ตำแหน่งที่สอบได้")]
|
[Comment("Id ตำแหน่งที่สอบได้")]
|
||||||
public PositionPath? PositionCandidate { get; set; }
|
public PositionPath? PositionCandidate { get; set; }
|
||||||
|
|
@ -82,10 +82,10 @@ namespace BMA.EHR.Domain.Models.Placement
|
||||||
[Comment("วันที่ออกบัตร")]
|
[Comment("วันที่ออกบัตร")]
|
||||||
public DateTime? CitizenDate { get; set; }
|
public DateTime? CitizenDate { get; set; }
|
||||||
|
|
||||||
[MaxLength(20), Comment("โทรศัพท์")]
|
[MaxLength(200), Comment("โทรศัพท์")]
|
||||||
public string? Telephone { get; set; }
|
public string? Telephone { get; set; }
|
||||||
|
|
||||||
[MaxLength(20), Comment("โทรศัพท์มือถือ")]
|
[MaxLength(200), Comment("โทรศัพท์มือถือ")]
|
||||||
public string? MobilePhone { get; set; }
|
public string? MobilePhone { get; set; }
|
||||||
|
|
||||||
[Comment("ความสามารถพิเศษ")]
|
[Comment("ความสามารถพิเศษ")]
|
||||||
|
|
@ -184,7 +184,7 @@ namespace BMA.EHR.Domain.Models.Placement
|
||||||
[MaxLength(200), Comment("อีเมล บริษัท")]
|
[MaxLength(200), Comment("อีเมล บริษัท")]
|
||||||
public string? OccupationEmail { get; set; }
|
public string? OccupationEmail { get; set; }
|
||||||
|
|
||||||
[MaxLength(20), Comment("โทรศัพท์ บริษัท")]
|
[MaxLength(200), Comment("โทรศัพท์ บริษัท")]
|
||||||
public string? OccupationTelephone { get; set; }
|
public string? OccupationTelephone { get; set; }
|
||||||
|
|
||||||
[Comment("ตำแหน่งอาชีพ")]
|
[Comment("ตำแหน่งอาชีพ")]
|
||||||
|
|
@ -227,10 +227,10 @@ namespace BMA.EHR.Domain.Models.Placement
|
||||||
public double? PointC { get; set; }
|
public double? PointC { get; set; }
|
||||||
|
|
||||||
[Comment("ลำดับที่สอบได้")]
|
[Comment("ลำดับที่สอบได้")]
|
||||||
public int ExamNumber { get; set; }
|
public int? ExamNumber { get; set; }
|
||||||
|
|
||||||
[Comment("จำนวนครั้งที่สมัครสอบ")]
|
[Comment("จำนวนครั้งที่สมัครสอบ")]
|
||||||
public int ExamRound { get; set; }
|
public int? ExamRound { get; set; }
|
||||||
|
|
||||||
[Comment("ผลสมัครสอบ")]
|
[Comment("ผลสมัครสอบ")]
|
||||||
public string? Pass { get; set; }
|
public string? Pass { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -1919,13 +1919,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
||||||
OccupationEmail = candidate.OccupationEmail,
|
OccupationEmail = candidate.OccupationEmail,
|
||||||
OccupationTelephone = candidate.OccupationTelephone,
|
OccupationTelephone = candidate.OccupationTelephone,
|
||||||
OccupationPosition = candidate.OccupationPosition,
|
OccupationPosition = candidate.OccupationPosition,
|
||||||
PointTotalA = Convert.ToDouble(candidate.PointTotalA),
|
PointTotalA = candidate.PointTotalA == null ? null : Convert.ToDouble(candidate.PointTotalA),
|
||||||
PointA = Convert.ToDouble(candidate.PointA),
|
PointA = candidate.PointA == null ? null : Convert.ToDouble(candidate.PointA),
|
||||||
PointTotalB = Convert.ToDouble(candidate.PointTotalB),
|
PointTotalB = candidate.PointTotalB == null ? null : Convert.ToDouble(candidate.PointTotalB),
|
||||||
PointB = Convert.ToDouble(candidate.PointB),
|
PointB = candidate.PointB == null ? null : Convert.ToDouble(candidate.PointB),
|
||||||
PointTotalC = Convert.ToDouble(candidate.PointTotalC),
|
PointTotalC = candidate.PointTotalC == null ? null : Convert.ToDouble(candidate.PointTotalC),
|
||||||
PointC = Convert.ToDouble(candidate.PointC),
|
PointC = candidate.PointC == null ? null : Convert.ToDouble(candidate.PointC),
|
||||||
ExamNumber = Convert.ToInt32(candidate.Number),
|
ExamNumber = candidate.Number == null ? null : Convert.ToInt32(candidate.Number),
|
||||||
ExamRound = 1,
|
ExamRound = 1,
|
||||||
IsRelief = false,
|
IsRelief = false,
|
||||||
PlacementStatus = "UN-CONTAIN",
|
PlacementStatus = "UN-CONTAIN",
|
||||||
|
|
@ -1963,6 +1963,181 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
||||||
}
|
}
|
||||||
await _contextMetadata.SaveChangesAsync();
|
await _contextMetadata.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task UpdateAsyncDisableToPlacement(Guid examId)
|
||||||
|
{
|
||||||
|
var periodExam = await _context.PeriodExams.AsQueryable()
|
||||||
|
.Where(x => x.CheckDisability == true)
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == examId);
|
||||||
|
|
||||||
|
if (periodExam == null)
|
||||||
|
throw new Exception(GlobalMessages.ExamNotFound);
|
||||||
|
|
||||||
|
var _placement = await _contextMetadata.Placements.AsQueryable()
|
||||||
|
.FirstOrDefaultAsync(x => x.Name == periodExam.Name && x.Year == ((int)(periodExam.Year == null ? 0 : periodExam.Year)));
|
||||||
|
if (_placement != null)
|
||||||
|
throw new Exception("รอบการสอบนี้ได้ทำการบรรจุไปแล้ว");
|
||||||
|
|
||||||
|
var placement = new Placement
|
||||||
|
{
|
||||||
|
Name = periodExam.Name,
|
||||||
|
Round = periodExam.Round == null ? "" : periodExam.Round.ToString(),
|
||||||
|
Year = (int)(periodExam.Year == null ? 0 : periodExam.Year),
|
||||||
|
Number = await _context.Disables.AsQueryable().Where(x => x.PeriodExam == periodExam).CountAsync(),
|
||||||
|
PlacementType = await _contextMetadata.PlacementTypes.FirstOrDefaultAsync(x => x.Name.Trim().ToUpper().Contains("ผู้พิการ")) == null ? await _contextMetadata.PlacementTypes.FirstOrDefaultAsync() : await _contextMetadata.PlacementTypes.FirstOrDefaultAsync(x => x.Name.Trim().ToUpper().Contains("ผู้พิการ")),
|
||||||
|
StartDate = DateTime.Now,
|
||||||
|
EndDate = DateTime.Now.AddYears(2).AddDays(-1),
|
||||||
|
CreatedAt = DateTime.Now,
|
||||||
|
CreatedUserId = UserId ?? "",
|
||||||
|
CreatedFullName = FullName ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
LastUpdateFullName = FullName ?? "",
|
||||||
|
};
|
||||||
|
await _contextMetadata.Placements.AddAsync(placement);
|
||||||
|
var candidates = await _context.Disables.AsQueryable()
|
||||||
|
.Include(x => x.Addresses)
|
||||||
|
.Include(x => x.Certificates)
|
||||||
|
.Include(x => x.Educations)
|
||||||
|
.Include(x => x.Occupations)
|
||||||
|
.Where(x => x.PeriodExam == periodExam)
|
||||||
|
.ToListAsync();
|
||||||
|
foreach (var candidate in candidates)
|
||||||
|
{
|
||||||
|
var Address = candidate.Addresses.FirstOrDefault() == null ? null : $"{candidate.Addresses.FirstOrDefault().Address}";
|
||||||
|
var Moo = candidate.Addresses.FirstOrDefault() == null ? null : $" หมู่ {candidate.Addresses.FirstOrDefault().Moo}";
|
||||||
|
var Soi = candidate.Addresses.FirstOrDefault() == null ? null : $" ซอย {candidate.Addresses.FirstOrDefault().Soi}";
|
||||||
|
var Road = candidate.Addresses.FirstOrDefault() == null ? null : $" ถนน {candidate.Addresses.FirstOrDefault().Road}";
|
||||||
|
var Address1 = candidate.Addresses.FirstOrDefault() == null ? null : $"{candidate.Addresses.FirstOrDefault().Address1}";
|
||||||
|
var Moo1 = candidate.Addresses.FirstOrDefault() == null ? null : $" หมู่ {candidate.Addresses.FirstOrDefault().Moo1}";
|
||||||
|
var Soi1 = candidate.Addresses.FirstOrDefault() == null ? null : $" ซอย {candidate.Addresses.FirstOrDefault().Soi1}";
|
||||||
|
var Road1 = candidate.Addresses.FirstOrDefault() == null ? null : $" ถนน {candidate.Addresses.FirstOrDefault().Road1}";
|
||||||
|
var scoreImport = await _context.ScoreImports.AsQueryable()
|
||||||
|
.FirstOrDefaultAsync(x => x.PeriodExam == periodExam);
|
||||||
|
var disableScore = await _context.DisableScores.AsQueryable()
|
||||||
|
.Where(x => x.ScoreImport == scoreImport)
|
||||||
|
.Where(x => x.ExamId == candidate.ExamId)
|
||||||
|
.FirstOrDefaultAsync(x => x.ExamId == candidate.ExamId && x.ScoreImport == scoreImport);
|
||||||
|
var placementProfile = new PlacementProfile
|
||||||
|
{
|
||||||
|
Placement = placement,
|
||||||
|
PositionCandidate = await _contextMetadata.PositionPaths.FirstOrDefaultAsync(x => x.Name == candidate.PositionName),
|
||||||
|
Prefix = await _contextMetadata.Prefixes.FirstOrDefaultAsync(x => x.Name == candidate.Prefix),
|
||||||
|
Firstname = candidate.FirstName,
|
||||||
|
Lastname = candidate.LastName,
|
||||||
|
Gender = await _contextMetadata.Genders.FirstOrDefaultAsync(x => x.Name == candidate.Gendor),
|
||||||
|
Nationality = candidate.National,
|
||||||
|
Race = candidate.Race,
|
||||||
|
Religion = await _contextMetadata.Religions.FirstOrDefaultAsync(x => x.Name == candidate.Religion),
|
||||||
|
DateOfBirth = candidate.DateOfBirth,
|
||||||
|
Relationship = await _contextMetadata.Relationships.FirstOrDefaultAsync(x => x.Name == candidate.Marry),
|
||||||
|
// Email = candidate.Email,
|
||||||
|
CitizenId = candidate.CitizenId,
|
||||||
|
// CitizenDistrict = await _contextMetadata.Districts.FirstOrDefaultAsync(x => x.Id == candidate.CitizenDistrictId),
|
||||||
|
CitizenProvince = await _contextMetadata.Provinces.FirstOrDefaultAsync(x => x.Name == candidate.CitizenCardIssuer),
|
||||||
|
CitizenDate = candidate.CitizenCardExpireDate,
|
||||||
|
Telephone = candidate.Addresses.FirstOrDefault() == null ? null : candidate.Addresses.FirstOrDefault().Telephone,
|
||||||
|
MobilePhone = candidate.Addresses.FirstOrDefault() == null ? null : candidate.Addresses.FirstOrDefault().Mobile,
|
||||||
|
// Knowledge = candidate.Knowledge,
|
||||||
|
RegistAddress = $"{Address}{Moo}{Soi}{Road}",
|
||||||
|
RegistProvince = candidate.Addresses.FirstOrDefault() == null ? null : await _contextMetadata.Provinces.FirstOrDefaultAsync(x => x.Name == candidate.Addresses.FirstOrDefault().Province),
|
||||||
|
RegistDistrict = candidate.Addresses.FirstOrDefault() == null ? null : await _contextMetadata.Districts.FirstOrDefaultAsync(x => x.Name == candidate.Addresses.FirstOrDefault().District),
|
||||||
|
RegistSubDistrict = candidate.Addresses.FirstOrDefault() == null ? null : await _contextMetadata.SubDistricts.FirstOrDefaultAsync(x => x.Name == candidate.Addresses.FirstOrDefault().Amphur),
|
||||||
|
RegistZipCode = candidate.Addresses.FirstOrDefault() == null ? null : candidate.Addresses.FirstOrDefault().ZipCode,
|
||||||
|
RegistSame = false,
|
||||||
|
CurrentAddress = $"{Address1}{Moo1}{Soi1}{Road1}",
|
||||||
|
CurrentProvince = candidate.Addresses.FirstOrDefault() == null ? null : await _contextMetadata.Provinces.FirstOrDefaultAsync(x => x.Name == candidate.Addresses.FirstOrDefault().Province1),
|
||||||
|
CurrentDistrict = candidate.Addresses.FirstOrDefault() == null ? null : await _contextMetadata.Districts.FirstOrDefaultAsync(x => x.Name == candidate.Addresses.FirstOrDefault().District1),
|
||||||
|
CurrentSubDistrict = candidate.Addresses.FirstOrDefault() == null ? null : await _contextMetadata.SubDistricts.FirstOrDefaultAsync(x => x.Name == candidate.Addresses.FirstOrDefault().Amphur1),
|
||||||
|
CurrentZipCode = candidate.Addresses.FirstOrDefault() == null ? null : candidate.Addresses.FirstOrDefault().ZipCode1,
|
||||||
|
Marry = candidate.Marry.Contains("สมรส"),
|
||||||
|
// MarryPrefix = await _contextMetadata.Prefixes.FirstOrDefaultAsync(x => x.Id == candidate.MarryPrefixId),
|
||||||
|
// MarryFirstName = candidate.MarryFirstName,
|
||||||
|
// MarryLastName = candidate.MarryLastName,
|
||||||
|
// MarryOccupation = candidate.MarryOccupation,
|
||||||
|
// MarryNationality = candidate.MarryNationality,
|
||||||
|
// FatherPrefix = await _contextMetadata.Prefixes.FirstOrDefaultAsync(x => x.Id == candidate.FatherPrefixId),
|
||||||
|
// FatherFirstName = candidate.FatherFirstName,
|
||||||
|
// FatherLastName = candidate.FatherLastName,
|
||||||
|
// FatherOccupation = candidate.FatherOccupation,
|
||||||
|
// FatherNationality = candidate.FatherNationality,
|
||||||
|
// MotherPrefix = await _contextMetadata.Prefixes.FirstOrDefaultAsync(x => x.Id == candidate.MotherPrefixId),
|
||||||
|
// MotherFirstName = candidate.MotherFirstName,
|
||||||
|
// MotherLastName = candidate.MotherLastName,
|
||||||
|
// MotherOccupation = candidate.MotherOccupation,
|
||||||
|
// MotherNationality = candidate.MotherNationality,
|
||||||
|
OccupationType = "other",
|
||||||
|
// OccupationCompany = candidate.OccupationCompany,
|
||||||
|
OccupationDepartment = candidate.Occupations.FirstOrDefault() == null ? null : candidate.Occupations.FirstOrDefault().Workplace,
|
||||||
|
// OccupationEmail = candidate.OccupationEmail,
|
||||||
|
OccupationTelephone = candidate.Occupations.FirstOrDefault() == null ? null : candidate.Occupations.FirstOrDefault().Telephone,
|
||||||
|
OccupationPosition = candidate.Occupations.FirstOrDefault() == null ? null : candidate.Occupations.FirstOrDefault().Position,
|
||||||
|
PointTotalA = disableScore == null ? null : Convert.ToDouble(disableScore.FullA),
|
||||||
|
PointA = disableScore == null ? null : Convert.ToDouble(disableScore.SumA),
|
||||||
|
PointTotalB = disableScore == null ? null : Convert.ToDouble(disableScore.FullB),
|
||||||
|
PointB = disableScore == null ? null : Convert.ToDouble(disableScore.SumB),
|
||||||
|
PointTotalC = disableScore == null ? null : Convert.ToDouble(disableScore.FullC),
|
||||||
|
PointC = disableScore == null ? null : Convert.ToDouble(disableScore.SumC),
|
||||||
|
ExamNumber = disableScore == null || int.TryParse(disableScore.Number, out int n) == false ? null : Convert.ToInt32(disableScore.Number),
|
||||||
|
ExamRound = null,
|
||||||
|
IsRelief = false,
|
||||||
|
PlacementStatus = "UN-CONTAIN",
|
||||||
|
Pass = disableScore == null ? null : disableScore.ExamStatus,
|
||||||
|
ReportingDate = DateTime.Now,
|
||||||
|
CreatedAt = DateTime.Now,
|
||||||
|
CreatedUserId = UserId ?? "",
|
||||||
|
CreatedFullName = FullName ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
LastUpdateFullName = FullName ?? "",
|
||||||
|
};
|
||||||
|
await _contextMetadata.PlacementProfiles.AddAsync(placementProfile);
|
||||||
|
|
||||||
|
var placementEducation = new PlacementEducation
|
||||||
|
{
|
||||||
|
PlacementProfile = placementProfile,
|
||||||
|
EducationLevel = await _contextMetadata.EducationLevels.FirstOrDefaultAsync(x => x.Name == (candidate.Educations.FirstOrDefault() == null ? null : candidate.Educations.FirstOrDefault().HighDegree)),
|
||||||
|
Field = candidate.Educations.FirstOrDefault() == null ? null : candidate.Educations.FirstOrDefault().Major,
|
||||||
|
Gpa = candidate.Educations.FirstOrDefault() == null ? null : candidate.Educations.FirstOrDefault().GPA.ToString(),
|
||||||
|
Institute = candidate.Educations.FirstOrDefault() == null ? null : candidate.Educations.FirstOrDefault().University,
|
||||||
|
Degree = candidate.Educations.FirstOrDefault() == null ? null : candidate.Educations.FirstOrDefault().Degree,
|
||||||
|
// Country = education.Name,
|
||||||
|
// Duration = education.Name,
|
||||||
|
// Other = education.Name,
|
||||||
|
// FundName = education.Name,
|
||||||
|
// DurationYear = education.Name,
|
||||||
|
FinishDate = candidate.Educations.FirstOrDefault() == null ? null : candidate.Educations.FirstOrDefault().BachelorDate,
|
||||||
|
IsDate = true,
|
||||||
|
// StartDate = education.DurationStart,
|
||||||
|
// EndDate = education.DurationEnd,
|
||||||
|
CreatedAt = DateTime.Now,
|
||||||
|
CreatedUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
CreatedFullName = FullName ?? "",
|
||||||
|
LastUpdateFullName = FullName ?? "",
|
||||||
|
};
|
||||||
|
await _contextMetadata.PlacementEducations.AddAsync(placementEducation);
|
||||||
|
|
||||||
|
var placementCertificate = new PlacementCertificate
|
||||||
|
{
|
||||||
|
PlacementProfile = placementProfile,
|
||||||
|
CertificateNo = candidate.Certificates.FirstOrDefault() == null ? null : candidate.Certificates.FirstOrDefault().CertificateNo,
|
||||||
|
// Issuer = candidate.Certificates.FirstOrDefault() == null ? null : candidate.Certificates.FirstOrDefault().Issuer,
|
||||||
|
IssueDate = candidate.Certificates.FirstOrDefault() == null ? null : candidate.Certificates.FirstOrDefault().IssueDate,
|
||||||
|
ExpireDate = candidate.Certificates.FirstOrDefault() == null ? null : candidate.Certificates.FirstOrDefault().ExpiredDate,
|
||||||
|
CertificateType = candidate.Certificates.FirstOrDefault() == null ? null : candidate.Certificates.FirstOrDefault().Description,
|
||||||
|
CreatedAt = DateTime.Now,
|
||||||
|
CreatedUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
CreatedFullName = FullName ?? "",
|
||||||
|
LastUpdateFullName = FullName ?? "",
|
||||||
|
};
|
||||||
|
await _contextMetadata.PlacementCertificates.AddAsync(placementCertificate);
|
||||||
|
}
|
||||||
|
await _contextMetadata.SaveChangesAsync();
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,10 @@
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"MongoConnection": "mongodb://admin:adminVM123@127.0.0.1:27017",
|
"MongoConnection": "mongodb://admin:adminVM123@127.0.0.1:27017",
|
||||||
"DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
// "DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||||
|
"DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_exam_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||||
// "MetadataConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
// "MetadataConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||||
"MetadataConnection": "server=192.168.1.9;user=root;password=adminVM123;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
"MetadataConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||||
},
|
},
|
||||||
"Jwt": {
|
"Jwt": {
|
||||||
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,10 @@
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"MongoConnection": "mongodb://admin:adminVM123@127.0.0.1:27017",
|
"MongoConnection": "mongodb://admin:adminVM123@127.0.0.1:27017",
|
||||||
"DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
// "DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||||
|
"DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_exam_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||||
// "MetadataConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
// "MetadataConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||||
"MetadataConnection": "server=192.168.1.9;user=root;password=adminVM123;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
"MetadataConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||||
},
|
},
|
||||||
"Jwt": {
|
"Jwt": {
|
||||||
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue