fix bug โอนคนไปบรรจุ (#4)

Co-authored-by: harid <harid_pr61@live.rmutl.com>
This commit is contained in:
Harid Promsri 2025-10-17 10:03:49 +07:00 committed by GitHub
parent ecd794a070
commit 0a42e68b28
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 25 additions and 19 deletions

View file

@ -2216,7 +2216,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
: ""
: "",
ExamResult = sr == null ? "" : sr.ExamStatus,
ExamAttribute = _disableService.CheckValidCertificate(p.Certificates.First().IssueDate, 5) ? "มีคุณสมบัติ" : "ไม่มีคุณสมบัติ",
ExamAttribute = p.Certificates.Count > 0 ?
_disableService.CheckValidCertificate(p.Certificates.First().IssueDate, 5)
? "มีคุณสมบัติ"
: "ไม่มีคุณสมบัติ"
: "ไม่มีคุณสมบัติ",
IsSpecial = p.Isspecial,
Remark = p.Remark,
University = p.Educations.First().University,

View file

@ -3098,7 +3098,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
// 🚀 Prepare batch inserts
var placementProfiles = new List<PlacementProfile>();
var placementEducations = new List<PlacementEducation>();
var placementCertificates = new List<PlacementCertificate>();
/*Comment ข้อมูลใบประกอบวิชาชีพ เพราะในไฟล์นำเข้ายังไม่มีคอลัมน์ที่ระบุข้อมูลส่วนนี้*/
//var placementCertificates = new List<PlacementCertificate>();
foreach (var candidate in candidates)
{
@ -3252,28 +3253,29 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
LastUpdateFullName = FullName ?? "",
};
placementEducations.Add(placementEducation);
var placementCertificate = new PlacementCertificate
{
PlacementProfile = placementProfile,
CertificateNo = firstCertificate?.CertificateNo ?? "",
IssueDate = firstCertificate?.IssueDate,
ExpireDate = firstCertificate?.ExpiredDate,
CertificateType = firstCertificate?.Description ?? "",
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
LastUpdateUserId = UserId ?? "",
CreatedFullName = FullName ?? "",
LastUpdateFullName = FullName ?? "",
};
placementCertificates.Add(placementCertificate);
/*Comment ข้อมูลใบประกอบวิชาชีพ เพราะในไฟล์นำเข้ายังไม่มีคอลัมน์ที่ระบุข้อมูลส่วนนี้*/
//var placementCertificate = new PlacementCertificate
//{
// PlacementProfile = placementProfile,
// CertificateNo = firstCertificate?.CertificateNo ?? "",
// IssueDate = firstCertificate?.IssueDate,
// ExpireDate = firstCertificate?.ExpiredDate,
// CertificateType = firstCertificate?.Description ?? "",
// CreatedAt = DateTime.Now,
// CreatedUserId = UserId ?? "",
// LastUpdatedAt = DateTime.Now,
// LastUpdateUserId = UserId ?? "",
// CreatedFullName = FullName ?? "",
// LastUpdateFullName = FullName ?? "",
//};
//placementCertificates.Add(placementCertificate);
}
// 🚀 Batch insert all records
await _contextMetadata.PlacementProfiles.AddRangeAsync(placementProfiles);
await _contextMetadata.PlacementEducations.AddRangeAsync(placementEducations);
await _contextMetadata.PlacementCertificates.AddRangeAsync(placementCertificates);
/*Comment ข้อมูลใบประกอบวิชาชีพ เพราะในไฟล์นำเข้ายังไม่มีคอลัมน์ที่ระบุข้อมูลส่วนนี้*/
//await _contextMetadata.PlacementCertificates.AddRangeAsync(placementCertificates);
// 🚀 Single SaveChanges at the end
await _contextMetadata.SaveChangesAsync();