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