From d1ca7e9ab180775ef219ed396beb746082473ee2 Mon Sep 17 00:00:00 2001 From: Kittapath Date: Wed, 18 Oct 2023 01:46:45 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B8=84=E0=B8=B4?= =?UTF-8?q?=E0=B8=A7=E0=B8=A3=E0=B8=B5=E0=B9=88=E0=B8=9C=E0=B8=B9=E0=B9=89?= =?UTF-8?q?=E0=B8=AA=E0=B8=A1=E0=B8=B1=E0=B8=84=E0=B8=A3=E0=B8=AA=E0=B8=AD?= =?UTF-8?q?=E0=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Services/PeriodExamService.cs | 80 ++++++++++++++++++++++++++--------- 1 file changed, 61 insertions(+), 19 deletions(-) diff --git a/Services/PeriodExamService.cs b/Services/PeriodExamService.cs index af2b18c..22675ad 100644 --- a/Services/PeriodExamService.cs +++ b/Services/PeriodExamService.cs @@ -675,7 +675,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services await _context.SaveChangesAsync(); } - public async Task> GetsCandidateByStatusAsync(string examId, string status) + public async Task> GetsCandidateByStatusAsync(string examId, string status) { var periodExam = await _context.PeriodExams.AsQueryable() .Where(x => x.CheckDisability == false) @@ -687,39 +687,81 @@ namespace BMA.EHR.Recurit.Exam.Service.Services if (status == "all") { var candidate = await _context.Candidates.AsQueryable() - .Include(x => x.PositionExam) - .Include(x => x.ProfileImg) + // .Include(x => x.PositionExam) + // .Include(x => x.ProfileImg) .OrderByDescending(d => d.CreatedAt) .Where(x => x.PeriodExam == periodExam && x.RegisterDate != null && x.Status != "register" && x.Status != "rejectRegister") + .Select(x => new + { + Id = x.Id, + PrefixName = x.PrefixName, + FirstName = x.FirstName, + LastName = x.LastName, + // ProfileImg = x.ProfileImg, + CitizenId = x.CitizenId, + Number = x.Number, + RegisterDate = x.RegisterDate, + ExamIdenNumber = x.ExamIdenNumber, + SeatNumber = x.SeatNumber, + ResultA = x.ResultA, + ResultB = x.ResultB, + ResultC = x.ResultC, + Pass = x.Pass, + Email = x.Email, + Status = x.Status, + PositionLevelName = x.PositionExam == null ? null : x.PositionExam.PositionLevelName, + PositionName = x.PositionExam == null ? null : x.PositionExam.PositionName, + }) .ToListAsync(); if (candidate.Where(x => x.Status == "done").FirstOrDefault() != null) candidate = candidate.OrderBy(x => Convert.ToInt32(x.Number)).ToList(); - var i = 0; - foreach (var item in candidate) - { - if (candidate[i].ProfileImg != null) - candidate[i].ProfileImg.Detail = _minioService.ImagesPath(candidate[i].ProfileImg.Id).Result; - i++; - } + // var i = 0; + // foreach (var item in candidate) + // { + // if (candidate[i].ProfileImg != null) + // candidate[i].ProfileImg.Detail = _minioService.ImagesPath(candidate[i].ProfileImg.Id).Result; + // i++; + // } return candidate; } else { var candidate = await _context.Candidates.AsQueryable() - .Include(x => x.PositionExam) - .Include(x => x.ProfileImg) + // .Include(x => x.PositionExam) + // .Include(x => x.ProfileImg) .OrderByDescending(d => d.CreatedAt) .Where(x => x.PeriodExam == periodExam && x.Status == status) + .Select(x => new + { + Id = x.Id, + PrefixName = x.PrefixName, + FirstName = x.FirstName, + LastName = x.LastName, + // ProfileImg = x.ProfileImg, + CitizenId = x.CitizenId, + Number = x.Number, + RegisterDate = x.RegisterDate, + ExamIdenNumber = x.ExamIdenNumber, + SeatNumber = x.SeatNumber, + ResultA = x.ResultA, + ResultB = x.ResultB, + ResultC = x.ResultC, + Pass = x.Pass, + Email = x.Email, + Status = x.Status, + PositionLevelName = x.PositionExam == null ? null : x.PositionExam.PositionLevelName, + PositionName = x.PositionExam == null ? null : x.PositionExam.PositionName, + }) .ToListAsync(); if (candidate.Where(x => x.Status == "done").FirstOrDefault() != null) candidate = candidate.OrderBy(x => Convert.ToInt32(x.Number)).ToList(); - var i = 0; - foreach (var item in candidate) - { - if (candidate[i].ProfileImg != null) - candidate[i].ProfileImg.Detail = _minioService.ImagesPath(candidate[i].ProfileImg.Id).Result; - i++; - } + // var i = 0; + // foreach (var item in candidate) + // { + // if (candidate[i].ProfileImg != null) + // candidate[i].ProfileImg.Detail = _minioService.ImagesPath(candidate[i].ProfileImg.Id).Result; + // i++; + // } return candidate; } }