migrate + ปรับระบบสรรหาสอบคัดเลือก
This commit is contained in:
parent
577c7b289e
commit
f20abe032d
19 changed files with 6470 additions and 15 deletions
|
|
@ -344,6 +344,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
.Select(x => new CandidateContactResponseItem
|
||||
{
|
||||
ContactPrefixId = x.ContactPrefixId,
|
||||
ContactPrefix = x.ContactPrefixName,
|
||||
ContactFirstname = x.ContactFirstname,
|
||||
ContactLastname = x.ContactLastname,
|
||||
ContactRelations = x.ContactRelations,
|
||||
|
|
@ -358,6 +359,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
.Select(x => new CandidateContactResponseItem
|
||||
{
|
||||
ContactPrefixId = x.ContactPrefixId,
|
||||
ContactPrefix = x.ContactPrefixName,
|
||||
ContactFirstname = x.ContactFirstname,
|
||||
ContactLastname = x.ContactLastname,
|
||||
ContactRelations = x.ContactRelations,
|
||||
|
|
@ -749,6 +751,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
candidate.PrefixId = prefix.Id;
|
||||
candidate.PrefixName = prefix.name;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(updated.Prefix))
|
||||
{
|
||||
candidate.PrefixName = updated.Prefix;
|
||||
}
|
||||
|
||||
if (updated.ContactPrefixId != null)
|
||||
{
|
||||
|
|
@ -761,6 +767,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
candidate.ContactPrefixId = prefix.Id;
|
||||
candidate.ContactPrefixName = prefix.name;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(updated.ContactPrefixName))
|
||||
{
|
||||
candidate.ContactPrefixName = updated.ContactPrefixName;
|
||||
}
|
||||
|
||||
if (updated.ReligionId != null)
|
||||
{
|
||||
|
|
@ -773,6 +783,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
candidate.ReligionId = religion.Id;
|
||||
candidate.ReligionName = religion.name;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(updated.ReligionName))
|
||||
{
|
||||
candidate.ReligionName = updated.ReligionName;
|
||||
}
|
||||
|
||||
if (updated.RegistProvinceId != null)
|
||||
{
|
||||
|
|
@ -973,6 +987,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
candidate.PrefixId = prefix.Id;
|
||||
candidate.PrefixName = prefix.name;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(updated.Prefix))
|
||||
{
|
||||
candidate.PrefixName = updated.Prefix;
|
||||
}
|
||||
|
||||
if (updated.ContactPrefixId != null)
|
||||
{
|
||||
|
|
@ -985,6 +1003,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
candidate.ContactPrefixId = prefix.Id;
|
||||
candidate.ContactPrefixName = prefix.name;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(updated.ContactPrefixName))
|
||||
{
|
||||
candidate.ContactPrefixName = updated.ContactPrefixName;
|
||||
}
|
||||
|
||||
if (updated.ReligionId != null)
|
||||
{
|
||||
|
|
@ -997,6 +1019,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
candidate.ReligionId = religion.Id;
|
||||
candidate.ReligionName = religion.name;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(updated.ReligionName))
|
||||
{
|
||||
candidate.ReligionName = updated.ReligionName;
|
||||
}
|
||||
|
||||
if (updated.RegistProvinceId != null)
|
||||
{
|
||||
|
|
@ -1197,6 +1223,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
candidate.PrefixId = prefix.Id;
|
||||
candidate.PrefixName = prefix.name;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(updated.Prefix))
|
||||
{
|
||||
candidate.PrefixName = updated.Prefix;
|
||||
}
|
||||
|
||||
if (updated.RelationshipId != null)
|
||||
{
|
||||
|
|
@ -2447,6 +2477,35 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
if (exam == null)
|
||||
throw new Exception(GlobalMessages.ExamNotFound);
|
||||
|
||||
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 calStp2 = cal % 11;
|
||||
int chkDigit = 11 - calStp2;
|
||||
|
||||
if (chkDigit == 10)
|
||||
chkDigit = 1;
|
||||
else if (chkDigit == 11)
|
||||
chkDigit = chkDigit % 10;
|
||||
|
||||
if (citizenIdDigits[12] != chkDigit)
|
||||
throw new Exception(GlobalMessages.CitizenIncorrect);
|
||||
|
||||
if (positionId != "00000000-0000-0000-0000-000000000000")
|
||||
{
|
||||
var position = await _context.PositionExams.AsQueryable()
|
||||
|
|
@ -2456,18 +2515,18 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
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)
|
||||
.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)
|
||||
.FirstOrDefaultAsync();
|
||||
if (candidate2 != null)
|
||||
throw new Exception(GlobalMessages.CitizanDupicate);
|
||||
//var candidate2 = await _context.Candidates.AsQueryable()
|
||||
// .Where(x => x.PeriodExam == exam && x.UserId != UserId && x.CitizenId == citizenId)
|
||||
// .FirstOrDefaultAsync();
|
||||
//if (candidate2 != null)
|
||||
// throw new Exception(GlobalMessages.CitizanDupicate);
|
||||
}
|
||||
|
||||
public async Task GetExamCandidateAsync(Guid id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue