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)
|
||||
|
|
|
|||
|
|
@ -185,6 +185,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
Round = x.Round,
|
||||
SetSeat = x.SetSeat,
|
||||
Year = x.Year,
|
||||
GraduationYearLock = x.GraduationYearLock,
|
||||
BankExam = x.BankExam.OrderBy(o => o.CreatedAt).Select(b => new BankExam
|
||||
{
|
||||
Id = b.Id,
|
||||
|
|
@ -203,6 +204,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
PositionLevelName = b.PositionLevelName,
|
||||
HighDegree = b.HighDegree,
|
||||
Code = b.Code,
|
||||
EducationLevel = b.EducationLevel,
|
||||
}).ToList(),
|
||||
Documents = x.PeriodExamDocuments.OrderBy(o => o.CreatedAt).Select(b => new FileListResponse
|
||||
{
|
||||
|
|
@ -364,6 +366,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
CompanyCode = inserted.CompanyCode,
|
||||
Reason = inserted.Reason,
|
||||
RefNo1 = inserted.RefNo1,
|
||||
GraduationYearLock = inserted.GraduationYearLock,
|
||||
CreatedAt = DateTime.Now,
|
||||
CreatedUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
|
|
@ -406,6 +409,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
Code = position.Code,
|
||||
TypeId = position.TypeId,
|
||||
TypeName = position.TypeName,
|
||||
EducationLevel = position.EducationLevel,
|
||||
CreatedAt = DateTime.Now,
|
||||
CreatedUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
|
|
@ -464,6 +468,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
periodExam.CompanyCode = updated.CompanyCode;
|
||||
periodExam.Reason = updated.Reason;
|
||||
periodExam.RefNo1 = updated.RefNo1;
|
||||
periodExam.GraduationYearLock = updated.GraduationYearLock;
|
||||
periodExam.LastUpdatedAt = DateTime.Now;
|
||||
periodExam.LastUpdateUserId = UserId ?? "";
|
||||
periodExam.LastUpdateFullName = FullName ?? "";
|
||||
|
|
@ -539,6 +544,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
position.Code = positionData.Code;
|
||||
position.TypeId = positionData.TypeId;
|
||||
position.TypeName = positionData.TypeName;
|
||||
position.EducationLevel = positionData.EducationLevel;
|
||||
position.LastUpdatedAt = DateTime.Now;
|
||||
position.LastUpdateUserId = UserId ?? "";
|
||||
position.LastUpdateFullName = FullName ?? "";
|
||||
|
|
@ -573,6 +579,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
Code = position.Code,
|
||||
TypeId = position.TypeId,
|
||||
TypeName = position.TypeName,
|
||||
EducationLevel = position.EducationLevel,
|
||||
CreatedAt = DateTime.Now,
|
||||
CreatedUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue