migrate + ปรับระบบสรรหาสอบคัดเลือก (2)

This commit is contained in:
harid 2025-11-18 13:21:57 +07:00
parent f20abe032d
commit 876b085dd2
11 changed files with 3261 additions and 2 deletions

View file

@ -667,6 +667,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
CanRegister = exam.RegisterStartDate == null || exam.RegisterEndDate == null ? true : DateOnly.FromDateTime(exam.RegisterStartDate.Value) <= DateOnly.FromDateTime(DateTime.Now) && DateOnly.FromDateTime(exam.RegisterEndDate.Value) >= DateOnly.FromDateTime(DateTime.Now),
RegisterEndDate = exam.RegisterEndDate,
RegisterStartDate = exam.RegisterStartDate,
graduationYearLock = exam.GraduationYearLock,
};
}
@ -1966,7 +1967,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
return new CandidateStatusResponse { Status = candidate.Status, RejectDetail = candidate.RejectDetail };
return new CandidateStatusResponse { Status = candidate.Status, RejectDetail = candidate.RejectDetail, IsShowExamInfo = candidate.IsShowExamInfo };
}
public async Task UserCheckCandidateService(string examId, string positionId, string status)
@ -2177,6 +2178,41 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
await _context.SaveChangesAsync();
}
public async Task AdminCheckShowExamInfoService(string[] candidateId)
{
//var _num = 0;
foreach (var _candidateId in candidateId)
{
var candidate = await _context.Candidates.AsQueryable()
.Include(x => x.PeriodExam)
.Include(x => x.PositionExam)
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(_candidateId));
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
if (candidate.Status.Trim().ToUpper() != "CHECKREGISTER")
continue;
if (candidate.PeriodExam == null)
throw new Exception(GlobalMessages.ExamNotFound);
var periodExam = await _context.Candidates.AsQueryable()
.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();
if (periodExam == null)
throw new Exception(GlobalMessages.ExamNotFound);
candidate.IsShowExamInfo = true;
//++_num;
}
await _context.SaveChangesAsync();
}
public async Task AdminRejectToCheckCandidateService(Guid candidateId, string? reason)
{
var candidate = await _context.Candidates.AsQueryable()
@ -2329,6 +2365,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Position = positionName,
PositionLevel = positionLevelName,
HighDegree = highDegree,
IsShowExamInfo = candidate.IsShowExamInfo,
};
}

View file

@ -319,6 +319,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Year = periodExam.Year,
Position = positionExam.PositionName,
PositionLevel = positionExam.PositionLevelName,
EducationLevel = positionExam.EducationLevel,
};
}
else
@ -330,6 +331,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Year = periodExam.Year,
Position = null,
PositionLevel = null,
EducationLevel = positionExam.EducationLevel,
};
}
}
@ -366,7 +368,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
CompanyCode = inserted.CompanyCode,
Reason = inserted.Reason,
RefNo1 = inserted.RefNo1,
GraduationYearLock = inserted.GraduationYearLock,
GraduationYearLock = inserted.GraduationYearLock ?? 3,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
@ -806,6 +808,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Status = x.Status,
PositionLevelName = x.PositionExam == null ? null : x.PositionExam.PositionLevelName,
PositionName = x.PositionExam == null ? null : x.PositionExam.PositionName,
IsShowExamInfo = x.IsShowExamInfo,
})
.Skip((page - 1) * pageSize)
.Take(pageSize)
@ -887,6 +890,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Status = x.Status,
PositionLevelName = x.PositionExam == null ? null : x.PositionExam.PositionLevelName,
PositionName = x.PositionExam == null ? null : x.PositionExam.PositionName,
IsShowExamInfo = x.IsShowExamInfo,
})
.ToListAsync();
var _candidate = await _context.Candidates.AsQueryable()