From 0a42e68b2801df34e2e5d8f518b3602dfca11422 Mon Sep 17 00:00:00 2001 From: Harid Promsri <52228846+Harid-999@users.noreply.github.com> Date: Fri, 17 Oct 2025 10:03:49 +0700 Subject: [PATCH] =?UTF-8?q?fix=20bug=20=E0=B9=82=E0=B8=AD=E0=B8=99?= =?UTF-8?q?=E0=B8=84=E0=B8=99=E0=B9=84=E0=B8=9B=E0=B8=9A=E0=B8=A3=E0=B8=A3?= =?UTF-8?q?=E0=B8=88=E0=B8=B8=20(#4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: harid --- Controllers/DisableController.cs | 6 ++++- Services/PeriodExamService.cs | 38 +++++++++++++++++--------------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/Controllers/DisableController.cs b/Controllers/DisableController.cs index 346c459..883f395 100644 --- a/Controllers/DisableController.cs +++ b/Controllers/DisableController.cs @@ -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, diff --git a/Services/PeriodExamService.cs b/Services/PeriodExamService.cs index d206a1f..e0794e2 100644 --- a/Services/PeriodExamService.cs +++ b/Services/PeriodExamService.cs @@ -3098,7 +3098,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services // 🚀 Prepare batch inserts var placementProfiles = new List(); var placementEducations = new List(); - var placementCertificates = new List(); + /*Comment ข้อมูลใบประกอบวิชาชีพ เพราะในไฟล์นำเข้ายังไม่มีคอลัมน์ที่ระบุข้อมูลส่วนนี้*/ + //var placementCertificates = new List(); 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();