แก้คิวรี่ผู้สมัครสอบ
This commit is contained in:
parent
e1b5abe91f
commit
d1ca7e9ab1
1 changed files with 61 additions and 19 deletions
|
|
@ -675,7 +675,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<Candidate?>> GetsCandidateByStatusAsync(string examId, string status)
|
public async Task<IEnumerable<dynamic>> GetsCandidateByStatusAsync(string examId, string status)
|
||||||
{
|
{
|
||||||
var periodExam = await _context.PeriodExams.AsQueryable()
|
var periodExam = await _context.PeriodExams.AsQueryable()
|
||||||
.Where(x => x.CheckDisability == false)
|
.Where(x => x.CheckDisability == false)
|
||||||
|
|
@ -687,39 +687,81 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
||||||
if (status == "all")
|
if (status == "all")
|
||||||
{
|
{
|
||||||
var candidate = await _context.Candidates.AsQueryable()
|
var candidate = await _context.Candidates.AsQueryable()
|
||||||
.Include(x => x.PositionExam)
|
// .Include(x => x.PositionExam)
|
||||||
.Include(x => x.ProfileImg)
|
// .Include(x => x.ProfileImg)
|
||||||
.OrderByDescending(d => d.CreatedAt)
|
.OrderByDescending(d => d.CreatedAt)
|
||||||
.Where(x => x.PeriodExam == periodExam && x.RegisterDate != null && x.Status != "register" && x.Status != "rejectRegister")
|
.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();
|
.ToListAsync();
|
||||||
if (candidate.Where(x => x.Status == "done").FirstOrDefault() != null)
|
if (candidate.Where(x => x.Status == "done").FirstOrDefault() != null)
|
||||||
candidate = candidate.OrderBy(x => Convert.ToInt32(x.Number)).ToList();
|
candidate = candidate.OrderBy(x => Convert.ToInt32(x.Number)).ToList();
|
||||||
var i = 0;
|
// var i = 0;
|
||||||
foreach (var item in candidate)
|
// foreach (var item in candidate)
|
||||||
{
|
// {
|
||||||
if (candidate[i].ProfileImg != null)
|
// if (candidate[i].ProfileImg != null)
|
||||||
candidate[i].ProfileImg.Detail = _minioService.ImagesPath(candidate[i].ProfileImg.Id).Result;
|
// candidate[i].ProfileImg.Detail = _minioService.ImagesPath(candidate[i].ProfileImg.Id).Result;
|
||||||
i++;
|
// i++;
|
||||||
}
|
// }
|
||||||
return candidate;
|
return candidate;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var candidate = await _context.Candidates.AsQueryable()
|
var candidate = await _context.Candidates.AsQueryable()
|
||||||
.Include(x => x.PositionExam)
|
// .Include(x => x.PositionExam)
|
||||||
.Include(x => x.ProfileImg)
|
// .Include(x => x.ProfileImg)
|
||||||
.OrderByDescending(d => d.CreatedAt)
|
.OrderByDescending(d => d.CreatedAt)
|
||||||
.Where(x => x.PeriodExam == periodExam && x.Status == status)
|
.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();
|
.ToListAsync();
|
||||||
if (candidate.Where(x => x.Status == "done").FirstOrDefault() != null)
|
if (candidate.Where(x => x.Status == "done").FirstOrDefault() != null)
|
||||||
candidate = candidate.OrderBy(x => Convert.ToInt32(x.Number)).ToList();
|
candidate = candidate.OrderBy(x => Convert.ToInt32(x.Number)).ToList();
|
||||||
var i = 0;
|
// var i = 0;
|
||||||
foreach (var item in candidate)
|
// foreach (var item in candidate)
|
||||||
{
|
// {
|
||||||
if (candidate[i].ProfileImg != null)
|
// if (candidate[i].ProfileImg != null)
|
||||||
candidate[i].ProfileImg.Detail = _minioService.ImagesPath(candidate[i].ProfileImg.Id).Result;
|
// candidate[i].ProfileImg.Detail = _minioService.ImagesPath(candidate[i].ProfileImg.Id).Result;
|
||||||
i++;
|
// i++;
|
||||||
}
|
// }
|
||||||
return candidate;
|
return candidate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue