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, 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, IsSpecial = p.Isspecial,
Remark = p.Remark, Remark = p.Remark,
University = p.Educations.First().University, University = p.Educations.First().University,

View file

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