From fde95f3b862eb0a46423d46267dc0144a276b4f6 Mon Sep 17 00:00:00 2001 From: Kittapath Date: Mon, 9 Oct 2023 15:57:03 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84=E0=B8=9F?= =?UTF-8?q?=E0=B8=A5=E0=B9=8C=20import=20=E0=B8=AA=E0=B8=A1=E0=B8=B1?= =?UTF-8?q?=E0=B8=84=E0=B8=A3=E0=B8=AA=E0=B8=AD=E0=B8=9A=E0=B8=84=E0=B8=B1?= =?UTF-8?q?=E0=B8=94=E0=B9=80=E0=B8=A5=E0=B8=B7=E0=B8=AD=E0=B8=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Services/CandidateService.cs | 28 +++++++++++++++++--------- Services/PeriodExamService.cs | 38 +++++++++++++++++------------------ 2 files changed, 37 insertions(+), 29 deletions(-) diff --git a/Services/CandidateService.cs b/Services/CandidateService.cs index 7db67d7..a213d3f 100644 --- a/Services/CandidateService.cs +++ b/Services/CandidateService.cs @@ -1985,15 +1985,17 @@ namespace BMA.EHR.Recurit.Exam.Service.Services .Where(x => x.PeriodExam == candidate.PeriodExam) .Where(x => x.PositionExam == candidate.PositionExam) .Where(x => x.ExamIdenNumber != null) - .Where(x => x.Status == "checkRegister") + .Where(x => x.Status != "register") .OrderByDescending(d => d.CreatedAt) .ToListAsync(); if (periodExam == null) throw new Exception(GlobalMessages.ExamNotFound); - - var num = periodExam.Count() + 1; - candidate.ExamIdenNumber = candidate.PositionExam == null ? num.ToString() : candidate.PositionExam.Code + num.ToString("D5"); + if (candidate.ExamIdenNumber == null) + { + var num = periodExam.Count() + 1; + candidate.ExamIdenNumber = candidate.PositionExam == null ? num.ToString() : candidate.PositionExam.Code + num.ToString("D5"); + } } if (status == "checkPayment") { @@ -2047,7 +2049,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services else if (status == "payment" && candidate.PeriodExam.Fee == 0) { var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name; - var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: ได้รับใบสมัครแล้ว"; + var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: รอเจ้าหน้าที่จัดที่นั่งสอบ"; if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email); candidate.Status = "checkSeat"; // var num = periodExam.Count() + 1; @@ -2062,7 +2064,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services if (candidate.Status == "checkSeat") { var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name; - var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: ได้รับใบสมัครแล้ว"; + var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: รอเจ้าหน้าที่จัดที่นั่งสอบ"; if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email); // var num = periodExam.Count() + 1; // candidate.ExamIdenNumber = candidate.PositionExam == null ? num.ToString() : candidate.PositionExam.Code + num; @@ -2098,7 +2100,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services throw new Exception(GlobalMessages.ExamNotFound); var periodExam = await _context.Candidates.AsQueryable() - .Where(x => x.PeriodExam == candidate.PeriodExam && x.ExamIdenNumber != null) + .Where(x => x.PeriodExam == candidate.PeriodExam) + .Where(x => x.PositionExam == candidate.PositionExam) + .Where(x => x.ExamIdenNumber != null) + .Where(x => x.Status != "register") .OrderByDescending(d => d.CreatedAt) .ToListAsync(); @@ -2109,11 +2114,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Services if (candidate.PeriodExam.Fee == 0) { var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name; - var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: ได้รับใบสมัครแล้ว"; + var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: รอเจ้าหน้าที่จัดที่นั่งสอบ"; if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email); candidate.Status = "checkSeat"; - var num = periodExam.Count() + 1 + _num; - candidate.ExamIdenNumber = candidate.PositionExam == null ? num.ToString() : candidate.PositionExam.Code + num; + if (candidate.ExamIdenNumber == null) + { + var num = periodExam.Count() + 1; + candidate.ExamIdenNumber = candidate.PositionExam == null ? num.ToString() : candidate.PositionExam.Code + num.ToString("D5"); + } } else if (candidate.PeriodExam.Fee != 0) { diff --git a/Services/PeriodExamService.cs b/Services/PeriodExamService.cs index f4fb3a5..bb4033a 100644 --- a/Services/PeriodExamService.cs +++ b/Services/PeriodExamService.cs @@ -941,28 +941,28 @@ namespace BMA.EHR.Recurit.Exam.Service.Services CitizenId = worksheet.Cells[row, 3].Value != null ? worksheet.Cells[row, 3].Value.ToString() : null, SeatNumber = worksheet.Cells[row, 4].Value != null ? worksheet.Cells[row, 4].Value.ToString() : null, - PointPath1A = worksheet.Cells[row, 6].Value != null ? worksheet.Cells[row, 6].Value.ToString() : null, - PointPath2A = worksheet.Cells[row, 7].Value != null ? worksheet.Cells[row, 7].Value.ToString() : null, - PointPath3A = worksheet.Cells[row, 8].Value != null ? worksheet.Cells[row, 8].Value.ToString() : null, - PointTotalA = worksheet.Cells[3, 9].Value != null ? worksheet.Cells[3, 9].Value.ToString()?.Split(" ")[0] : null, - PointA = worksheet.Cells[row, 9].Value != null ? worksheet.Cells[row, 9].Value.ToString() : null, - PointPerA = worksheet.Cells[row, 10].Value != null ? worksheet.Cells[row, 10].Value.ToString() : null, - ResultA = worksheet.Cells[row, 11].Value != null ? worksheet.Cells[row, 11].Value.ToString() : null, + PointPath1A = worksheet.Cells[row, 9].Value != null ? worksheet.Cells[row, 9].Value.ToString() : null, + PointPath2A = worksheet.Cells[row, 10].Value != null ? worksheet.Cells[row, 10].Value.ToString() : null, + PointPath3A = worksheet.Cells[row, 11].Value != null ? worksheet.Cells[row, 11].Value.ToString() : null, + PointTotalA = worksheet.Cells[3, 12].Value != null ? worksheet.Cells[3, 12].Value.ToString()?.Split(" ")[0] : null, + PointA = worksheet.Cells[row, 12].Value != null ? worksheet.Cells[row, 12].Value.ToString() : null, + PointPerA = worksheet.Cells[row, 13].Value != null ? worksheet.Cells[row, 13].Value.ToString() : null, + ResultA = worksheet.Cells[row, 14].Value != null ? worksheet.Cells[row, 14].Value.ToString() : null, - PointTotalB = worksheet.Cells[3, 12].Value != null ? worksheet.Cells[3, 12].Value.ToString()?.Split(" ")[0] : null, - PointB = worksheet.Cells[row, 12].Value != null ? worksheet.Cells[row, 12].Value.ToString() : null, - PointPerB = worksheet.Cells[row, 13].Value != null ? worksheet.Cells[row, 13].Value.ToString() : null, - ResultB = worksheet.Cells[row, 14].Value != null ? worksheet.Cells[row, 14].Value.ToString() : null, + PointTotalB = worksheet.Cells[3, 15].Value != null ? worksheet.Cells[3, 15].Value.ToString()?.Split(" ")[0] : null, + PointB = worksheet.Cells[row, 15].Value != null ? worksheet.Cells[row, 15].Value.ToString() : null, + PointPerB = worksheet.Cells[row, 16].Value != null ? worksheet.Cells[row, 16].Value.ToString() : null, + ResultB = worksheet.Cells[row, 17].Value != null ? worksheet.Cells[row, 17].Value.ToString() : null, - PointPath1C = worksheet.Cells[row, 15].Value != null ? worksheet.Cells[row, 15].Value.ToString() : null, - PointPath2C = worksheet.Cells[row, 16].Value != null ? worksheet.Cells[row, 16].Value.ToString() : null, - PointTotalC = worksheet.Cells[3, 17].Value != null ? worksheet.Cells[3, 17].Value.ToString()?.Split(" ")[0] : null, - PointC = worksheet.Cells[row, 17].Value != null ? worksheet.Cells[row, 17].Value.ToString() : null, - PointPerC = worksheet.Cells[row, 18].Value != null ? worksheet.Cells[row, 18].Value.ToString() : null, - ResultC = worksheet.Cells[row, 19].Value != null ? worksheet.Cells[row, 19].Value.ToString() : null, + PointPath1C = worksheet.Cells[row, 18].Value != null ? worksheet.Cells[row, 18].Value.ToString() : null, + PointPath2C = worksheet.Cells[row, 19].Value != null ? worksheet.Cells[row, 19].Value.ToString() : null, + PointTotalC = worksheet.Cells[3, 20].Value != null ? worksheet.Cells[3, 20].Value.ToString()?.Split(" ")[0] : null, + PointC = worksheet.Cells[row, 20].Value != null ? worksheet.Cells[row, 20].Value.ToString() : null, + PointPerC = worksheet.Cells[row, 21].Value != null ? worksheet.Cells[row, 21].Value.ToString() : null, + ResultC = worksheet.Cells[row, 22].Value != null ? worksheet.Cells[row, 22].Value.ToString() : null, - Pass = worksheet.Cells[row, 20].Value != null ? (worksheet.Cells[row, 20].Value.ToString()) : null, - ExamReason = worksheet.Cells[row, 24].Value != null ? (worksheet.Cells[row, 24].Value.ToString()) : null, + Pass = worksheet.Cells[row, 23].Value != null ? (worksheet.Cells[row, 23].Value.ToString()) : null, + ExamReason = worksheet.Cells[row, 27].Value != null ? (worksheet.Cells[row, 27].Value.ToString()) : null, }); // } }