no message

This commit is contained in:
harid 2025-12-17 09:13:04 +07:00
parent b8c219579e
commit d3aee47315
2 changed files with 42 additions and 42 deletions

View file

@ -1575,7 +1575,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
{
try
{
await _candidateService.CheckCitizen(examId, positionId, item.CitizenId);
// await _candidateService.CheckCitizen(examId, positionId, item.CitizenId);
return Success();
}

View file

@ -2594,57 +2594,57 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
public async Task CheckCitizen(string examId, string positionId, string citizenId)
{
var exam = await _context.PeriodExams.AsQueryable()
.Where(p => p.CheckDisability == false)
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
// var exam = await _context.PeriodExams.AsQueryable()
// .Where(p => p.CheckDisability == false)
// .FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
if (exam == null)
throw new Exception(GlobalMessages.ExamNotFound);
// if (exam == null)
// throw new Exception(GlobalMessages.ExamNotFound);
if (citizenId.Length != 13)
throw new Exception(GlobalMessages.CitizenIncomplete);
// if (citizenId.Length != 13)
// throw new Exception(GlobalMessages.CitizenIncomplete);
int[] citizenIdDigits = citizenId.Select(c => int.Parse(c.ToString())).ToArray();
int cal =
citizenIdDigits[0] * 13 +
citizenIdDigits[1] * 12 +
citizenIdDigits[2] * 11 +
citizenIdDigits[3] * 10 +
citizenIdDigits[4] * 9 +
citizenIdDigits[5] * 8 +
citizenIdDigits[6] * 7 +
citizenIdDigits[7] * 6 +
citizenIdDigits[8] * 5 +
citizenIdDigits[9] * 4 +
citizenIdDigits[10] * 3 +
citizenIdDigits[11] * 2;
// int[] citizenIdDigits = citizenId.Select(c => int.Parse(c.ToString())).ToArray();
// int cal =
// citizenIdDigits[0] * 13 +
// citizenIdDigits[1] * 12 +
// citizenIdDigits[2] * 11 +
// citizenIdDigits[3] * 10 +
// citizenIdDigits[4] * 9 +
// citizenIdDigits[5] * 8 +
// citizenIdDigits[6] * 7 +
// citizenIdDigits[7] * 6 +
// citizenIdDigits[8] * 5 +
// citizenIdDigits[9] * 4 +
// citizenIdDigits[10] * 3 +
// citizenIdDigits[11] * 2;
int calStp2 = cal % 11;
int chkDigit = 11 - calStp2;
// int calStp2 = cal % 11;
// int chkDigit = 11 - calStp2;
if (chkDigit >= 10)
{
chkDigit = 0;
}
// if (chkDigit >= 10)
// {
// chkDigit = 0;
// }
if (citizenIdDigits[12] != chkDigit)
throw new Exception(GlobalMessages.CitizenIncorrect);
// if (citizenIdDigits[12] != chkDigit)
// throw new Exception(GlobalMessages.CitizenIncorrect);
if (positionId != "00000000-0000-0000-0000-000000000000")
{
var position = await _context.PositionExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId) && x.PeriodExam == exam);
// if (positionId != "00000000-0000-0000-0000-000000000000")
// {
// var position = await _context.PositionExams.AsQueryable()
// .FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId) && x.PeriodExam == exam);
if (position == null)
throw new Exception(GlobalMessages.PositionExamNotFound);
// if (position == null)
// throw new Exception(GlobalMessages.PositionExamNotFound);
var candidate1 = await _context.Candidates.AsQueryable()
.Where(x => x.PeriodExam == exam && x.UserId != UserId /*&& x.PositionExam == position*/ && x.CitizenId == citizenId)
.FirstOrDefaultAsync();
if (candidate1 != null)
throw new Exception(GlobalMessages.CitizanDupicate);
// var candidate1 = await _context.Candidates.AsQueryable()
// .Where(x => x.PeriodExam == exam && x.UserId != UserId /*&& x.PositionExam == position*/ && x.CitizenId == citizenId)
// .FirstOrDefaultAsync();
// if (candidate1 != null)
// throw new Exception(GlobalMessages.CitizanDupicate);
return;
}
// }
//var candidate2 = await _context.Candidates.AsQueryable()
// .Where(x => x.PeriodExam == exam && x.UserId != UserId && x.CitizenId == citizenId)