ปรับ ui สรรหาสอบคัดเลือก

This commit is contained in:
Kittapath 2023-10-02 00:22:28 +07:00
parent c79bc39c86
commit fbef67f33a
29 changed files with 7384 additions and 666 deletions

View file

@ -460,11 +460,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Announcement_endDate = x.AnnouncementEndDate.ToString("yyyy-MM-dd"),
AnnouncementExam = x.AnnouncementExam,
Register_startDate = x.RegisterStartDate == null ? null : x.RegisterStartDate.Value.ToString("yyyy-MM-dd"),
Register_endDate = x.RegisterEndDate == null ? null : x.RegisterEndDate.Value.ToString("yyyy-MM-dd"),
Register_endDate = x.RegisterEndDate == null || x.RegisterEndDate == x.RegisterStartDate ? null : x.RegisterEndDate.Value.ToString("yyyy-MM-dd"),
Payment_startDate = x.PaymentStartDate == null ? null : x.PaymentStartDate.Value.ToString("yyyy-MM-dd"),
Payment_endDate = x.PaymentEndDate == null ? null : x.PaymentEndDate.Value.ToString("yyyy-MM-dd"),
Payment_endDate = x.PaymentEndDate == null || x.PaymentEndDate == x.PaymentStartDate ? null : x.PaymentEndDate.Value.ToString("yyyy-MM-dd"),
Title = x.Name,
Detail = x.Detail,
EditorCondition = x.EditorCondition,
EditorConfirm = x.EditorConfirm,
Images = x.PeriodExamImages.OrderBy(x => x.CreatedAt).Select(s => new HomePageLinkResponseItem
{
Title = s.Document.FileName,
@ -479,9 +481,29 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
{
Id = s.Id.ToString(),
Title = s.PositionName == null ? x.Name : s.PositionName,
HighDegree = s.HighDegree == true ? "ปริญญาขึ้นไป" : "ต่ำกว่าปริญญาตรี",
Level = s.PositionLevelName == null ? "-" : s.PositionLevelName,
HighDegree = s.HighDegree == true ? "ปริญญาบัตรขึ้นไป" : "ต่ำกว่าปริญญาบัตร",
Path = $"{x.Id}/{s.Id}",
}).ToList(),
})
.ToList(),
PositionsTrue = x.PositionExam.OrderBy(x => x.CreatedAt).Where(x => x.HighDegree == true).Select(s => new HomePageLinkResponseItem
{
Id = s.Id.ToString(),
Title = s.PositionName == null ? x.Name : s.PositionName,
Level = s.PositionLevelName == null ? "-" : s.PositionLevelName,
HighDegree = s.HighDegree == true ? "ปริญญาบัตรขึ้นไป" : "ต่ำกว่าปริญญาบัตร",
Path = $"{x.Id}/{s.Id}",
})
.ToList(),
PositionsFalse = x.PositionExam.OrderBy(x => x.CreatedAt).Where(x => x.HighDegree == false).Select(s => new HomePageLinkResponseItem
{
Id = s.Id.ToString(),
Title = s.PositionName == null ? x.Name : s.PositionName,
Level = s.PositionLevelName == null ? "-" : s.PositionLevelName,
HighDegree = s.HighDegree == true ? "ปริญญาบัตรขึ้นไป" : "ต่ำกว่าปริญญาบัตร",
Path = $"{x.Id}/{s.Id}",
})
.ToList(),
})
.FirstOrDefaultAsync();

View file

@ -1,4 +1,5 @@
using System.Security.Claims;
using BMA.EHR.Domain.Models.Placement;
using BMA.EHR.Recurit.Exam.Service.Core;
using BMA.EHR.Recurit.Exam.Service.Data;
using BMA.EHR.Recurit.Exam.Service.Models;
@ -87,8 +88,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
LastName = x.LastName,
Nationality = x.Nationality,
DateOfBirth = x.DateOfBirth,
Relationship = x.RelationshipName,
RelationshipId = x.RelationshipId != null ? x.RelationshipId.ToString() : null,
Religion = x.ReligionName,
ReligionId = x.ReligionId != null ? x.ReligionId.ToString() : null,
CitizenProvince = x.CitizenProvinceName,
CitizenProvinceId = x.CitizenProvinceId != null ? x.CitizenProvinceId.ToString() : null,
CitizenDistrict = x.CitizenDistrictName,
@ -114,8 +115,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
LastName = x.LastName,
Nationality = x.Nationality,
DateOfBirth = x.DateOfBirth,
Relationship = x.RelationshipName,
RelationshipId = x.RelationshipId != null ? x.RelationshipId.ToString() : null,
Religion = x.ReligionName,
ReligionId = x.ReligionId != null ? x.ReligionId.ToString() : null,
CitizenProvince = x.CitizenProvinceName,
CitizenProvinceId = x.CitizenProvinceId != null ? x.CitizenProvinceId.ToString() : null,
CitizenDistrict = x.CitizenDistrictName,
@ -294,12 +295,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Where(x => x.PeriodExam == exam && x.UserId == UserId && x.PositionExam == position)
.Select(x => new CandidateOccupationResponseItem
{
OccupationType = x.OccupationType,
OccupationCompany = x.OccupationCompany,
OccupationDepartment = x.OccupationDepartment,
OccupationEmail = x.OccupationEmail,
OccupationTelephone = x.OccupationTelephone,
OccupationOrg = x.OccupationOrg,
OccupationPile = x.OccupationPile,
OccupationGroup = x.OccupationGroup,
OccupationSalary = x.OccupationSalary,
OccupationPosition = x.OccupationPosition,
OccupationPositionType = x.OccupationPositionType,
OccupationTelephone = x.OccupationTelephone,
})
.FirstOrDefaultAsync();
}
@ -309,12 +311,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Where(x => x.PeriodExam == exam && x.UserId == UserId)
.Select(x => new CandidateOccupationResponseItem
{
OccupationType = x.OccupationType,
OccupationCompany = x.OccupationCompany,
OccupationDepartment = x.OccupationDepartment,
OccupationEmail = x.OccupationEmail,
OccupationTelephone = x.OccupationTelephone,
OccupationOrg = x.OccupationOrg,
OccupationPile = x.OccupationPile,
OccupationGroup = x.OccupationGroup,
OccupationSalary = x.OccupationSalary,
OccupationPosition = x.OccupationPosition,
OccupationPositionType = x.OccupationPositionType,
OccupationTelephone = x.OccupationTelephone,
})
.FirstOrDefaultAsync();
}
@ -353,7 +356,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.ToListAsync();
}
public async Task<IEnumerable<Education?>> GetsAsyncEducation(string examId, string positionId)
public async Task<Education?> GetsAsyncEducation(string examId, string positionId)
{
var exam = await _context.PeriodExams.AsQueryable()
.Where(p => p.CheckDisability == false)
@ -382,8 +385,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
return await _context.Educations.AsQueryable()
.Where(x => x.Candidate == candidate)
.OrderBy(d => d.DurationStart)
.ToListAsync();
.FirstOrDefaultAsync();
}
public async Task<IEnumerable<FileListResponse?>> GetsAsyncFileUpload(string examId, string positionId)
@ -574,12 +576,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
return candidate.PaymentImg == null ? "" : candidate.PaymentImg.Detail.ToString();
}
public async Task<RequestStatusRegistry> GetsAsyncRegisterExam(string examId, string positionId)
public async Task<RequestStatusRegistry> GetsAsyncRegisterExam(Guid examId, Guid positionId)
{
var exam = await _context.PeriodExams.AsQueryable()
.Where(p => p.CheckDisability == false)
.Include(x => x.BankExam)
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
.FirstOrDefaultAsync(x => x.Id == examId);
if (exam == null)
throw new Exception(GlobalMessages.ExamNotFound);
@ -588,9 +590,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId);
var position = await _context.PositionExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId) && x.PeriodExam == exam);
.FirstOrDefaultAsync(x => x.Id == positionId);
if (positionId != "00000000-0000-0000-0000-000000000000")
if (positionId != Guid.Parse("00000000-0000-0000-0000-000000000000"))
{
// var position = await _context.PositionExams.AsQueryable()
// .FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId) && x.PeriodExam == exam);
@ -613,6 +615,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
PositionExam = candidatePosition?.PositionExam,
Bank = exam.BankExam.Count() > 0,
Payment = exam.Fee > 0,
EditorCondition = exam.EditorCondition,
EditorConfirm = exam.EditorConfirm,
Position = candidatePosition == null ? false : true
};
}
@ -673,7 +677,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
{
var candidateId = await CreateAsyncCandidate(examId, positionId);
var candidate = await _context.Candidates.AsQueryable()
var candidate = await _context.Candidates
.AsQueryable()
.Include(x => x.Educations)
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
if (candidate == null)
@ -691,40 +697,16 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
candidate.PrefixName = prefix.Name;
}
if (updated.RelationshipId != null)
if (updated.ReligionId != null)
{
var relationship = await _contextMetadata.Relationships.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RelationshipId));
var religion = await _contextMetadata.Religions.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.ReligionId));
if (relationship == null)
throw new Exception(GlobalMessages.RelationshipNotFound);
if (religion == null)
throw new Exception(GlobalMessages.ReligionNotFound);
candidate.RelationshipId = relationship.Id;
candidate.RelationshipName = relationship.Name;
}
if (updated.CitizenProvinceId != null)
{
var citizenProvince = await _contextMetadata.Provinces.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CitizenProvinceId));
if (citizenProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.CitizenProvinceId = citizenProvince.Id;
candidate.CitizenProvinceName = citizenProvince.Name;
}
if (updated.CitizenDistrictId != null)
{
var citizenDistrict = await _contextMetadata.Districts.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CitizenDistrictId));
if (citizenDistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound);
candidate.CitizenDistrictId = citizenDistrict.Id;
candidate.CitizenDistrictName = citizenDistrict.Name;
candidate.ReligionId = religion.Id;
candidate.ReligionName = religion.Name;
}
if (updated.RegistProvinceId != null)
@ -801,49 +783,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
candidate.CurrentZipCode = currentSubDistrict.ZipCode;
}
if (updated.MarryPrefixId != null)
{
var prefix = await _contextMetadata.Prefixes.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.MarryPrefixId));
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.MarryPrefixId = prefix.Id;
candidate.MarryPrefixName = prefix.Name;
}
if (updated.FatherPrefixId != null)
{
var prefix = await _contextMetadata.Prefixes.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.FatherPrefixId));
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.FatherPrefixId = prefix.Id;
candidate.FatherPrefixName = prefix.Name;
}
if (updated.MotherPrefixId != null)
{
var prefix = await _contextMetadata.Prefixes.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.MotherPrefixId));
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.MotherPrefixId = prefix.Id;
candidate.MotherPrefixName = prefix.Name;
}
candidate.FirstName = updated.FirstName;
candidate.LastName = updated.LastName;
candidate.Nationality = updated.Nationality;
candidate.DateOfBirth = updated.DateOfBirth;
candidate.Email = updated.Email;
candidate.CitizenId = updated.CitizenId;
candidate.CitizenDate = updated.CitizenDate;
candidate.Telephone = updated.Telephone;
candidate.MobilePhone = updated.MobilePhone;
candidate.Knowledge = updated.Knowledge;
@ -852,33 +797,74 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
candidate.RegistSame = updated.RegistSame == null ? null : updated.RegistSame;
candidate.CurrentAddress = updated.CurrentAddress;
candidate.Marry = updated.Marry == null ? null : updated.Marry;
candidate.MarryFirstName = updated.MarryFirstName;
candidate.MarryLastName = updated.MarryLastName;
candidate.MarryOccupation = updated.MarryOccupation;
candidate.MarryNationality = updated.MarryNationality;
candidate.FatherFirstName = updated.FatherFirstName;
candidate.FatherLastName = updated.FatherLastName;
candidate.FatherOccupation = updated.FatherOccupation;
candidate.FatherNationality = updated.FatherNationality;
candidate.MotherFirstName = updated.MotherFirstName;
candidate.MotherLastName = updated.MotherLastName;
candidate.MotherOccupation = updated.MotherOccupation;
candidate.MotherNationality = updated.MotherNationality;
candidate.OccupationType = updated.OccupationType;
candidate.OccupationCompany = updated.OccupationCompany;
candidate.OccupationDepartment = updated.OccupationDepartment;
candidate.OccupationEmail = updated.OccupationEmail;
candidate.OccupationTelephone = updated.OccupationTelephone;
candidate.OccupationOrg = updated.OccupationOrg;
candidate.OccupationPile = updated.OccupationPile;
candidate.OccupationGroup = updated.OccupationGroup;
candidate.OccupationSalary = updated.OccupationSalary;
candidate.OccupationPosition = updated.OccupationPosition;
candidate.OccupationPositionType = updated.OccupationPositionType;
candidate.OccupationTelephone = updated.OccupationTelephone;
var educationLevelExam = await _contextMetadata.EducationLevels.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId);
if (educationLevelExam == null)
throw new Exception(GlobalMessages.EducationLevelNotFound);
var educationLevelHigh = await _contextMetadata.EducationLevels.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId);
if (educationLevelHigh == null)
throw new Exception(GlobalMessages.EducationLevelNotFound);
if (candidate.Educations.FirstOrDefault() == null)
{
var education = new Education
{
Candidate = candidate,
EducationLevelExamId = educationLevelExam.Id,
EducationLevelExamName = educationLevelExam.Name,
EducationName = updated.EducationName,
EducationMajor = updated.EducationMajor,
EducationLocation = updated.EducationLocation,
EducationType = updated.EducationType,
EducationEndDate = updated.EducationEndDate,
EducationScores = updated.EducationScores,
EducationLevelHighId = educationLevelHigh.Id,
EducationLevelHighName = educationLevelHigh.Name,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
CreatedFullName = FullName ?? "",
LastUpdatedAt = DateTime.Now,
LastUpdateUserId = UserId ?? "",
LastUpdateFullName = FullName ?? "",
};
await _context.Educations.AddAsync(education);
}
else
{
candidate.Educations.FirstOrDefault().EducationLevelExamId = educationLevelExam.Id;
candidate.Educations.FirstOrDefault().EducationLevelExamName = educationLevelExam.Name;
candidate.Educations.FirstOrDefault().EducationName = updated.EducationName;
candidate.Educations.FirstOrDefault().EducationMajor = updated.EducationMajor;
candidate.Educations.FirstOrDefault().EducationLocation = updated.EducationLocation;
candidate.Educations.FirstOrDefault().EducationType = updated.EducationType;
candidate.Educations.FirstOrDefault().EducationEndDate = updated.EducationEndDate;
candidate.Educations.FirstOrDefault().EducationScores = updated.EducationScores;
candidate.Educations.FirstOrDefault().EducationLevelHighId = educationLevelHigh.Id;
candidate.Educations.FirstOrDefault().EducationLevelHighName = educationLevelHigh.Name;
candidate.Educations.FirstOrDefault().LastUpdatedAt = DateTime.Now;
candidate.Educations.FirstOrDefault().LastUpdateUserId = UserId ?? "";
candidate.Educations.FirstOrDefault().LastUpdateFullName = FullName ?? "";
}
await _context.SaveChangesAsync();
}
public async Task UpdateAdminAsync(string candidateId, CandidateResponseItem updated)
{
var candidate = await _context.Candidates.AsQueryable()
var candidate = await _context.Candidates
.AsQueryable()
.Include(x => x.Educations)
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
if (candidate == null)
@ -896,40 +882,16 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
candidate.PrefixName = prefix.Name;
}
if (updated.RelationshipId != null)
if (updated.ReligionId != null)
{
var relationship = await _contextMetadata.Relationships.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RelationshipId));
var religion = await _contextMetadata.Religions.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.ReligionId));
if (relationship == null)
throw new Exception(GlobalMessages.RelationshipNotFound);
if (religion == null)
throw new Exception(GlobalMessages.ReligionNotFound);
candidate.RelationshipId = relationship.Id;
candidate.RelationshipName = relationship.Name;
}
if (updated.CitizenProvinceId != null)
{
var citizenProvince = await _contextMetadata.Provinces.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CitizenProvinceId));
if (citizenProvince == null)
throw new Exception(GlobalMessages.ProvinceNotFound);
candidate.CitizenProvinceId = citizenProvince.Id;
candidate.CitizenProvinceName = citizenProvince.Name;
}
if (updated.CitizenDistrictId != null)
{
var citizenDistrict = await _contextMetadata.Districts.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CitizenDistrictId));
if (citizenDistrict == null)
throw new Exception(GlobalMessages.DistrictNotFound);
candidate.CitizenDistrictId = citizenDistrict.Id;
candidate.CitizenDistrictName = citizenDistrict.Name;
candidate.ReligionId = religion.Id;
candidate.ReligionName = religion.Name;
}
if (updated.RegistProvinceId != null)
@ -1006,49 +968,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
candidate.CurrentZipCode = currentSubDistrict.ZipCode;
}
if (updated.MarryPrefixId != null)
{
var prefix = await _contextMetadata.Prefixes.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.MarryPrefixId));
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.MarryPrefixId = prefix.Id;
candidate.MarryPrefixName = prefix.Name;
}
if (updated.FatherPrefixId != null)
{
var prefix = await _contextMetadata.Prefixes.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.FatherPrefixId));
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.FatherPrefixId = prefix.Id;
candidate.FatherPrefixName = prefix.Name;
}
if (updated.MotherPrefixId != null)
{
var prefix = await _contextMetadata.Prefixes.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.MotherPrefixId));
if (prefix == null)
throw new Exception(GlobalMessages.PrefixNotFound);
candidate.MotherPrefixId = prefix.Id;
candidate.MotherPrefixName = prefix.Name;
}
candidate.FirstName = updated.FirstName;
candidate.LastName = updated.LastName;
candidate.Nationality = updated.Nationality;
candidate.DateOfBirth = updated.DateOfBirth;
candidate.Email = updated.Email;
candidate.CitizenId = updated.CitizenId;
candidate.CitizenDate = updated.CitizenDate;
candidate.Telephone = updated.Telephone;
candidate.MobilePhone = updated.MobilePhone;
candidate.Knowledge = updated.Knowledge;
@ -1057,27 +982,65 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
candidate.RegistSame = updated.RegistSame == null ? null : updated.RegistSame;
candidate.CurrentAddress = updated.CurrentAddress;
candidate.Marry = updated.Marry == null ? null : updated.Marry;
candidate.MarryFirstName = updated.MarryFirstName;
candidate.MarryLastName = updated.MarryLastName;
candidate.MarryOccupation = updated.MarryOccupation;
candidate.MarryNationality = updated.MarryNationality;
candidate.FatherFirstName = updated.FatherFirstName;
candidate.FatherLastName = updated.FatherLastName;
candidate.FatherOccupation = updated.FatherOccupation;
candidate.FatherNationality = updated.FatherNationality;
candidate.MotherFirstName = updated.MotherFirstName;
candidate.MotherLastName = updated.MotherLastName;
candidate.MotherOccupation = updated.MotherOccupation;
candidate.MotherNationality = updated.MotherNationality;
candidate.OccupationType = updated.OccupationType;
candidate.OccupationCompany = updated.OccupationCompany;
candidate.OccupationDepartment = updated.OccupationDepartment;
candidate.OccupationEmail = updated.OccupationEmail;
candidate.OccupationTelephone = updated.OccupationTelephone;
candidate.OccupationOrg = updated.OccupationOrg;
candidate.OccupationPile = updated.OccupationPile;
candidate.OccupationGroup = updated.OccupationGroup;
candidate.OccupationSalary = updated.OccupationSalary;
candidate.OccupationPosition = updated.OccupationPosition;
candidate.OccupationPositionType = updated.OccupationPositionType;
candidate.OccupationTelephone = updated.OccupationTelephone;
var educationLevelExam = await _contextMetadata.EducationLevels.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId);
if (educationLevelExam == null)
throw new Exception(GlobalMessages.EducationLevelNotFound);
var educationLevelHigh = await _contextMetadata.EducationLevels.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId);
if (educationLevelHigh == null)
throw new Exception(GlobalMessages.EducationLevelNotFound);
if (candidate.Educations.FirstOrDefault() == null)
{
var education = new Education
{
Candidate = candidate,
EducationLevelExamId = educationLevelExam.Id,
EducationLevelExamName = educationLevelExam.Name,
EducationName = updated.EducationName,
EducationMajor = updated.EducationMajor,
EducationLocation = updated.EducationLocation,
EducationType = updated.EducationType,
EducationEndDate = updated.EducationEndDate,
EducationScores = updated.EducationScores,
EducationLevelHighId = educationLevelHigh.Id,
EducationLevelHighName = educationLevelHigh.Name,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
CreatedFullName = FullName ?? "",
LastUpdatedAt = DateTime.Now,
LastUpdateUserId = UserId ?? "",
LastUpdateFullName = FullName ?? "",
};
await _context.Educations.AddAsync(education);
}
else
{
candidate.Educations.FirstOrDefault().EducationLevelExamId = educationLevelExam.Id;
candidate.Educations.FirstOrDefault().EducationLevelExamName = educationLevelExam.Name;
candidate.Educations.FirstOrDefault().EducationName = updated.EducationName;
candidate.Educations.FirstOrDefault().EducationMajor = updated.EducationMajor;
candidate.Educations.FirstOrDefault().EducationLocation = updated.EducationLocation;
candidate.Educations.FirstOrDefault().EducationType = updated.EducationType;
candidate.Educations.FirstOrDefault().EducationEndDate = updated.EducationEndDate;
candidate.Educations.FirstOrDefault().EducationScores = updated.EducationScores;
candidate.Educations.FirstOrDefault().EducationLevelHighId = educationLevelHigh.Id;
candidate.Educations.FirstOrDefault().EducationLevelHighName = educationLevelHigh.Name;
candidate.Educations.FirstOrDefault().LastUpdatedAt = DateTime.Now;
candidate.Educations.FirstOrDefault().LastUpdateUserId = UserId ?? "";
candidate.Educations.FirstOrDefault().LastUpdateFullName = FullName ?? "";
}
await _context.SaveChangesAsync();
}
@ -1365,12 +1328,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (candidate == null)
throw new Exception(GlobalMessages.ExamNotFound);
candidate.OccupationType = updated.OccupationType;
candidate.OccupationCompany = updated.OccupationCompany;
candidate.OccupationDepartment = updated.OccupationDepartment;
candidate.OccupationEmail = updated.OccupationEmail;
candidate.OccupationTelephone = updated.OccupationTelephone;
candidate.OccupationOrg = updated.OccupationOrg;
candidate.OccupationPile = updated.OccupationPile;
candidate.OccupationGroup = updated.OccupationGroup;
candidate.OccupationSalary = updated.OccupationSalary;
candidate.OccupationPosition = updated.OccupationPosition;
candidate.OccupationPositionType = updated.OccupationPositionType;
candidate.OccupationTelephone = updated.OccupationTelephone;
await _context.SaveChangesAsync();
}
@ -1475,12 +1439,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var career = new Career
{
Candidate = candidate,
Name = updated.Name,
Position = updated.Position,
Salary = updated.Salary,
Group = updated.Group,
Pile = updated.Pile,
Org = updated.Org,
DurationStart = updated.DurationStart,
DurationEnd = updated.DurationEnd,
Reason = updated.Reason,
RangeDate = updated.RangeDate,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
@ -1501,12 +1466,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var career = new Career
{
Candidate = candidate,
Name = updated.Name,
Position = updated.Position,
Salary = updated.Salary,
Group = updated.Group,
Pile = updated.Pile,
Org = updated.Org,
DurationStart = updated.DurationStart,
DurationEnd = updated.DurationEnd,
Reason = updated.Reason,
RangeDate = updated.RangeDate,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
@ -1524,33 +1490,64 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var candidateId = await CreateAsyncCandidate(examId, positionId);
var candidate = await _context.Candidates.AsQueryable()
.Include(x => x.Educations)
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
var educationLevel = await _contextMetadata.EducationLevels.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.EducationLevelId));
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
if (educationLevel == null)
var educationLevelExam = await _contextMetadata.EducationLevels.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId);
if (educationLevelExam == null)
throw new Exception(GlobalMessages.EducationLevelNotFound);
var education = new Education
{
Candidate = candidate,
EducationLevelId = educationLevel.Id,
EducationLevelName = educationLevel.Name,
Major = updated.Major,
Scores = updated.Scores,
Name = updated.Name,
DurationStart = updated.DurationStart,
DurationEnd = updated.DurationEnd,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
LastUpdateUserId = UserId ?? "",
CreatedFullName = FullName ?? "",
LastUpdateFullName = FullName ?? "",
};
var educationLevelHigh = await _contextMetadata.EducationLevels.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId);
if (educationLevelHigh == null)
throw new Exception(GlobalMessages.EducationLevelNotFound);
if (candidate.Educations.FirstOrDefault() == null)
{
var education = new Education
{
Candidate = candidate,
EducationLevelExamId = educationLevelExam.Id,
EducationLevelExamName = educationLevelExam.Name,
EducationName = updated.EducationName,
EducationMajor = updated.EducationMajor,
EducationLocation = updated.EducationLocation,
EducationType = updated.EducationType,
EducationEndDate = updated.EducationEndDate,
EducationScores = updated.EducationScores,
EducationLevelHighId = educationLevelHigh.Id,
EducationLevelHighName = educationLevelHigh.Name,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
CreatedFullName = FullName ?? "",
LastUpdatedAt = DateTime.Now,
LastUpdateUserId = UserId ?? "",
LastUpdateFullName = FullName ?? "",
};
await _context.Educations.AddAsync(education);
}
else
{
candidate.Educations.FirstOrDefault().EducationLevelExamId = educationLevelExam.Id;
candidate.Educations.FirstOrDefault().EducationLevelExamName = educationLevelExam.Name;
candidate.Educations.FirstOrDefault().EducationName = updated.EducationName;
candidate.Educations.FirstOrDefault().EducationMajor = updated.EducationMajor;
candidate.Educations.FirstOrDefault().EducationLocation = updated.EducationLocation;
candidate.Educations.FirstOrDefault().EducationType = updated.EducationType;
candidate.Educations.FirstOrDefault().EducationEndDate = updated.EducationEndDate;
candidate.Educations.FirstOrDefault().EducationScores = updated.EducationScores;
candidate.Educations.FirstOrDefault().EducationLevelHighId = educationLevelHigh.Id;
candidate.Educations.FirstOrDefault().EducationLevelHighName = educationLevelHigh.Name;
candidate.Educations.FirstOrDefault().LastUpdatedAt = DateTime.Now;
candidate.Educations.FirstOrDefault().LastUpdateUserId = UserId ?? "";
candidate.Educations.FirstOrDefault().LastUpdateFullName = FullName ?? "";
}
await _context.Educations.AddAsync(education);
await _context.SaveChangesAsync();
}
@ -1559,31 +1556,60 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
var educationLevel = await _contextMetadata.EducationLevels.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.EducationLevelId));
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
if (educationLevel == null)
var educationLevelExam = await _contextMetadata.EducationLevels.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId);
if (educationLevelExam == null)
throw new Exception(GlobalMessages.EducationLevelNotFound);
var education = new Education
{
Candidate = candidate,
EducationLevelId = educationLevel.Id,
EducationLevelName = educationLevel.Name,
Major = updated.Major,
Scores = updated.Scores,
Name = updated.Name,
DurationStart = updated.DurationStart,
DurationEnd = updated.DurationEnd,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
LastUpdateUserId = UserId ?? "",
CreatedFullName = FullName ?? "",
LastUpdateFullName = FullName ?? "",
};
var educationLevelHigh = await _contextMetadata.EducationLevels.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId);
await _context.Educations.AddAsync(education);
if (educationLevelHigh == null)
throw new Exception(GlobalMessages.EducationLevelNotFound);
if (candidate.Educations.FirstOrDefault() == null)
{
var education = new Education
{
Candidate = candidate,
EducationLevelExamId = educationLevelExam.Id,
EducationLevelExamName = educationLevelExam.Name,
EducationName = updated.EducationName,
EducationMajor = updated.EducationMajor,
EducationLocation = updated.EducationLocation,
EducationType = updated.EducationType,
EducationEndDate = updated.EducationEndDate,
EducationScores = updated.EducationScores,
EducationLevelHighId = educationLevelHigh.Id,
EducationLevelHighName = educationLevelHigh.Name,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
CreatedFullName = FullName ?? "",
LastUpdatedAt = DateTime.Now,
LastUpdateUserId = UserId ?? "",
LastUpdateFullName = FullName ?? "",
};
await _context.Educations.AddAsync(education);
}
else
{
candidate.Educations.FirstOrDefault().EducationLevelExamId = educationLevelExam.Id;
candidate.Educations.FirstOrDefault().EducationLevelExamName = educationLevelExam.Name;
candidate.Educations.FirstOrDefault().EducationName = updated.EducationName;
candidate.Educations.FirstOrDefault().EducationMajor = updated.EducationMajor;
candidate.Educations.FirstOrDefault().EducationLocation = updated.EducationLocation;
candidate.Educations.FirstOrDefault().EducationType = updated.EducationType;
candidate.Educations.FirstOrDefault().EducationEndDate = updated.EducationEndDate;
candidate.Educations.FirstOrDefault().EducationScores = updated.EducationScores;
candidate.Educations.FirstOrDefault().EducationLevelHighId = educationLevelHigh.Id;
candidate.Educations.FirstOrDefault().EducationLevelHighName = educationLevelHigh.Name;
candidate.Educations.FirstOrDefault().LastUpdatedAt = DateTime.Now;
candidate.Educations.FirstOrDefault().LastUpdateUserId = UserId ?? "";
candidate.Educations.FirstOrDefault().LastUpdateFullName = FullName ?? "";
}
await _context.SaveChangesAsync();
}
@ -1595,12 +1621,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (career == null)
throw new Exception(GlobalMessages.CareerNotFound);
career.Name = updated.Name;
career.Position = updated.Position;
career.Salary = updated.Salary;
career.Group = updated.Group;
career.Pile = updated.Pile;
career.Org = updated.Org;
career.DurationStart = updated.DurationStart;
career.DurationEnd = updated.DurationEnd;
career.Reason = updated.Reason;
career.RangeDate = updated.RangeDate;
career.LastUpdatedAt = DateTime.Now;
career.LastUpdateUserId = UserId ?? "";
career.LastUpdateFullName = FullName ?? "";
@ -1621,33 +1648,33 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
await _context.SaveChangesAsync();
}
public async Task UpdateAsyncEducation(string educationId, CandidateEducationResponseItem updated)
{
var education = await _context.Educations.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(educationId));
// public async Task UpdateAsyncEducation(string educationId, CandidateEducationResponseItem updated)
// {
// var education = await _context.Educations.AsQueryable()
// .FirstOrDefaultAsync(x => x.Id == Guid.Parse(educationId));
if (education == null)
throw new Exception(GlobalMessages.EducationNotFound);
// if (education == null)
// throw new Exception(GlobalMessages.EducationNotFound);
var educationLevel = await _contextMetadata.EducationLevels.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.EducationLevelId));
// var educationLevel = await _contextMetadata.EducationLevels.AsQueryable()
// .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.EducationLevelId));
if (educationLevel == null)
throw new Exception(GlobalMessages.EducationLevelNotFound);
// if (educationLevel == null)
// throw new Exception(GlobalMessages.EducationLevelNotFound);
education.EducationLevelId = educationLevel.Id;
education.EducationLevelName = educationLevel.Name;
education.Major = updated.Major;
education.Scores = updated.Scores;
education.Name = updated.Name;
education.DurationStart = updated.DurationStart;
education.DurationEnd = updated.DurationEnd;
education.LastUpdatedAt = DateTime.Now;
education.LastUpdateUserId = UserId ?? "";
education.LastUpdateFullName = FullName ?? "";
// education.EducationLevelId = educationLevel.Id;
// education.EducationLevelName = educationLevel.Name;
// education.Major = updated.Major;
// education.Scores = updated.Scores;
// education.Name = updated.Name;
// education.DurationStart = updated.DurationStart;
// education.DurationEnd = updated.DurationEnd;
// education.LastUpdatedAt = DateTime.Now;
// education.LastUpdateUserId = UserId ?? "";
// education.LastUpdateFullName = FullName ?? "";
await _context.SaveChangesAsync();
}
// await _context.SaveChangesAsync();
// }
public async Task DeleteAsyncEducation(string educationId)
{
@ -1702,6 +1729,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (exam == null)
throw new Exception(GlobalMessages.ExamNotFound);
if (exam.RegisterStartDate != null && exam.RegisterStartDate.Value.Date < DateTime.Now.Date)
throw new Exception("ยังไม่ถึงช่วงเวลาสมัครสอบ");
if (exam.RegisterEndDate != null && exam.RegisterEndDate.Value.Date > DateTime.Now.Date)
throw new Exception("หมดเวลาช่วงสมัครสอบ");
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId);
@ -1887,6 +1920,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.FirstOrDefaultAsync();
var positionName = "";
var positionLevelName = "";
var highDegree = "";
if (positionId != "00000000-0000-0000-0000-000000000000")
{
@ -1900,7 +1934,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Where(x => x.PeriodExam == exam && x.UserId == UserId && x.PositionExam == position)
.FirstOrDefaultAsync();
positionName = position.PositionName;
highDegree = position.HighDegree == true ? "ปริญญาขึ้นไป" : "ต่ำกว่าปริญญาตรี";
positionLevelName = position.PositionLevelName;
highDegree = position.HighDegree == true ? "ปริญญาบัตรขึ้นไป" : "ต่ำกว่าปริญญาบัตร";
}
if (candidate == null)
@ -1940,6 +1975,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
AnnouncementDate = exam.AnnouncementDate?.AddYears(2),
Id = candidate.Id,
Position = positionName,
PositionLevel = positionLevelName,
HighDegree = highDegree,
};
}
@ -1955,11 +1991,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
throw new Exception(GlobalMessages.CandidateNotFound);
var positionName = "";
var positionLevelName = "";
var highDegree = "";
if (candidate.PositionExam != null)
{
positionName = candidate.PositionExam.PositionName;
highDegree = candidate.PositionExam.HighDegree == true ? "ปริญญาขึ้นไป" : "ต่ำกว่าปริญญาตรี";
positionLevelName = candidate.PositionExam.PositionLevelName;
highDegree = candidate.PositionExam.HighDegree == true ? "ปริญญาบัตรขึ้นไป" : "ต่ำกว่าปริญญาบัตร";
}
return new RequestCardCandidate
@ -1996,6 +2034,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
AnnouncementDate = candidate.PeriodExam?.AnnouncementDate?.AddYears(2),
Id = candidate.Id,
Position = positionName,
PositionLevel = positionLevelName,
HighDegree = highDegree,
};
}

View file

@ -78,11 +78,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
{
switch (status.Trim().ToUpper())
{
case "OFFICIAL": return "ข้าราชการกรุงเทพมหานคร";
case "PERSONNEL": return "บุคลากรกรุงเทพมหานคร";
case "OFFICIALSOTHER": return "ข้าราชการประเภทอื่น";
case "EMPLOYEE": return "ลูกจ้าง/พนักงานราชการของส่วนราชการอื่น";
case "OTHER": return "อื่นๆ";
case "prem": return "ลูกจ้างประจำ";
case "temp": return "ลูกจ้างชั่วคราว";
case "other": return "ผู้ปฏิบัติงานอื่นในกรุงเทพมหานคร";
default: return status;
}
}
@ -135,6 +133,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
CheckDisability = x.CheckDisability,
CheckDocument = x.CheckDocument,
Detail = x.Detail,
EditorCondition = x.EditorCondition,
EditorConfirm = x.EditorConfirm,
Fee = x.Fee,
Id = x.Id,
IsActive = x.IsActive,
@ -197,6 +197,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
CheckDisability = x.CheckDisability,
CheckDocument = x.CheckDocument,
Detail = x.Detail,
EditorCondition = x.EditorCondition,
EditorConfirm = x.EditorConfirm,
Fee = x.Fee,
Id = x.Id,
IsActive = x.IsActive,
@ -230,6 +232,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
TypeName = b.TypeName,
PositionId = b.PositionId,
PositionName = b.PositionName,
PositionLevelId = b.PositionLevelId,
PositionLevelName = b.PositionLevelName,
HighDegree = b.HighDegree,
}).ToList(),
Documents = x.PeriodExamDocuments.OrderBy(o => o.CreatedAt).Select(b => new FileListResponse
@ -300,6 +304,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (periodExam == null)
throw new Exception(GlobalMessages.ExamNotFound);
var positionExam = await _context.PositionExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId));
if (positionExam == null)
throw new Exception(GlobalMessages.ExamNotFound);
if (positionId != "00000000-0000-0000-0000-000000000000")
{
return new RequestPositionName
@ -307,7 +317,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Name = periodExam.Name,
Round = periodExam.Round,
Year = periodExam.Year,
Posiiton = periodExam.PositionExam.FirstOrDefault(x => x.Id == Guid.Parse(positionId) && x.PeriodExam == periodExam),
Position = positionExam.PositionName,
PositionLevel = positionExam.PositionLevelName,
};
}
else
@ -317,7 +328,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Name = periodExam.Name,
Round = periodExam.Round,
Year = periodExam.Year,
Posiiton = null,
Position = null,
PositionLevel = null,
};
}
}
@ -347,6 +359,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
AnnouncementExam = inserted.AnnouncementExam,
Category = inserted.Category,
Detail = inserted.Detail,
EditorCondition = inserted.EditorCondition,
EditorConfirm = inserted.EditorConfirm,
Note = inserted.Note,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
@ -384,6 +398,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
PeriodExam = periodExam,
PositionId = position.PositionId,
PositionName = position.PositionName,
PositionLevelId = position.PositionLevelId,
PositionLevelName = position.PositionLevelName,
HighDegree = position.HighDegree,
TypeId = position.TypeId,
TypeName = position.TypeName,
@ -438,6 +454,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
// periodExam.AnnouncementExam = updated.AnnouncementExam;
periodExam.Category = updated.Category;
periodExam.Detail = updated.Detail;
periodExam.EditorCondition = updated.EditorCondition;
periodExam.EditorConfirm = updated.EditorConfirm;
periodExam.Note = updated.Note;
periodExam.LastUpdatedAt = DateTime.Now;
periodExam.LastUpdateUserId = UserId ?? "";
@ -508,6 +526,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
{
position.PositionId = positionData.PositionId;
position.PositionName = positionData.PositionName;
position.PositionLevelId = positionData.PositionLevelId;
position.PositionLevelName = positionData.PositionLevelName;
position.HighDegree = positionData.HighDegree;
position.TypeId = positionData.TypeId;
position.TypeName = positionData.TypeName;
@ -539,6 +559,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
PeriodExam = periodExam,
PositionId = position.PositionId,
PositionName = position.PositionName,
PositionLevelId = position.PositionLevelId,
PositionLevelName = position.PositionLevelName,
HighDegree = position.HighDegree,
TypeId = position.TypeId,
TypeName = position.TypeName,
@ -660,6 +682,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (status == "all")
{
var candidate = await _context.Candidates.AsQueryable()
.Include(x => x.PositionExam)
.Include(x => x.ProfileImg)
.OrderByDescending(d => d.CreatedAt)
.Where(x => x.PeriodExam == periodExam && x.RegisterDate != null && x.Status != "register" && x.Status != "rejectRegister")
@ -678,6 +701,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
else
{
var candidate = await _context.Candidates.AsQueryable()
.Include(x => x.PositionExam)
.Include(x => x.ProfileImg)
.OrderByDescending(d => d.CreatedAt)
.Where(x => x.PeriodExam == periodExam && x.Status == status)
@ -707,8 +731,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
LastName = x.LastName,
Nationality = x.Nationality,
DateOfBirth = x.DateOfBirth,
Relationship = x.RelationshipName,
RelationshipId = x.RelationshipId != null ? x.RelationshipId.ToString() : null,
Religion = x.ReligionName,
ReligionId = x.ReligionId != null ? x.ReligionId.ToString() : null,
CitizenProvince = x.CitizenProvinceName,
CitizenProvinceId = x.CitizenProvinceId != null ? x.CitizenProvinceId.ToString() : null,
CitizenDistrict = x.CitizenDistrictName,
@ -754,12 +778,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Where(x => x.Id == Guid.Parse(candidateId))
.Select(x => new CandidateOccupationResponseItem
{
OccupationType = x.OccupationType,
OccupationCompany = x.OccupationCompany,
OccupationDepartment = x.OccupationDepartment,
OccupationEmail = x.OccupationEmail,
OccupationTelephone = x.OccupationTelephone,
OccupationOrg = x.OccupationOrg,
OccupationPile = x.OccupationPile,
OccupationGroup = x.OccupationGroup,
OccupationSalary = x.OccupationSalary,
OccupationPosition = x.OccupationPosition,
OccupationPositionType = x.OccupationPositionType,
OccupationTelephone = x.OccupationTelephone,
})
.FirstOrDefaultAsync();
}
@ -820,12 +845,17 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.FirstOrDefaultAsync();
}
public async Task<IEnumerable<Education?>> GetsAsyncEducation(string candidateId)
public async Task<Education?> GetsAsyncEducation(string candidateId)
{
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
if (candidate == null)
throw new Exception(GlobalMessages.ExamNotFound);
return await _context.Educations.AsQueryable()
.Where(x => x.Candidate.Id == Guid.Parse(candidateId))
.OrderBy(d => d.DurationStart)
.ToListAsync();
.Where(x => x.Candidate == candidate)
.FirstOrDefaultAsync();
}
public async Task<IEnumerable<Career?>> GetsAsyncCareer(string candidateId)
@ -1319,7 +1349,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Nationality = c.Nationality,
DateOfBirth = c.DateOfBirth == null ? "" : c.DateOfBirth.Value.Date.ToThaiShortDate(),
Age = c.DateOfBirth == null ? "" : c.DateOfBirth.Value.Date.CalculateAgeStrV2(0, 0),
RelationshipName = c.RelationshipName,
ReligionName = c.ReligionName,
Telephone = c.Telephone,
MobilePhone = c.MobilePhone,
Email = c.Email,
@ -1334,14 +1364,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
CurrentDistrictName = c.CurrentDistrictName,
CurrentSubDistrictName = c.CurrentSubDistrictName,
CurrentZipCode = c.CurrentZipCode,
MarryFullName = $"{c.MarryPrefixName}{c.MarryFirstName} {c.MarryLastName}",
FatherFullName = $"{c.FatherPrefixName}{c.FatherFirstName} {c.FatherLastName}",
MotherFullName = $"{c.MotherPrefixName}{c.MotherFirstName} {c.MotherLastName}",
OccupationType = c.OccupationType,
OccupationOrg = c.OccupationOrg,
OccupationPile = c.OccupationPile,
OccupationGroup = c.OccupationGroup,
OccupationSalary = c.OccupationSalary,
OccupationPosition = c.OccupationPosition,
OccupationCompany = c.OccupationCompany,
OccupationDepartment = c.OccupationDepartment,
OccupationEmail = c.OccupationEmail,
OccupationPositionType = c.OccupationPositionType,
OccupationTelephone = c.OccupationTelephone,
RegisterDate = c.RegisterDate,
@ -1384,7 +1412,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.Cells[1, 4].Value = "สัญชาติ";
summarySheet.Cells[1, 5].Value = "วันเกิด";
summarySheet.Cells[1, 6].Value = "อายุ";
summarySheet.Cells[1, 7].Value = "สถานภาพ";
summarySheet.Cells[1, 7].Value = "ศาสนา";
summarySheet.Cells[1, 8].Value = "โทรศัพท์";
summarySheet.Cells[1, 9].Value = "โทรศัพท์มือถือ";
summarySheet.Cells[1, 10].Value = "อีเมล";
@ -1399,46 +1427,54 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.Cells[1, 19].Value = "เขต/อำเภอที่อยู่ปัจจุบัน";
summarySheet.Cells[1, 20].Value = "ตำบล/แขวงที่อยู่ปัจจุบัน";
summarySheet.Cells[1, 21].Value = "รหัสไปรษณีย์ที่อยู่ปัจจุบัน";
summarySheet.Cells[1, 22].Value = "คู่สมรส";
summarySheet.Cells[1, 23].Value = "บิดา";
summarySheet.Cells[1, 24].Value = "มารดา";
summarySheet.Cells[1, 25].Value = "อาชีพ";
summarySheet.Cells[1, 26].Value = "ตำแหน่ง";
summarySheet.Cells[1, 27].Value = "สำนัก/บริษัท";
summarySheet.Cells[1, 28].Value = "กอง/ฝ่าย";
summarySheet.Cells[1, 29].Value = "อีเมลบริษัท";
summarySheet.Cells[1, 30].Value = "โทรศัพท์บริษัท";
summarySheet.Cells[1, 31].Value = "วุฒิที่ได้รับ";
summarySheet.Cells[1, 32].Value = "สาขา/วิชาเอก";
summarySheet.Cells[1, 33].Value = "คะแนนเฉลี่ยตลอดหลักสูตร";
summarySheet.Cells[1, 34].Value = "ชื่อสถานศีกษา";
summarySheet.Cells[1, 35].Value = "ระยะเวลาเริ่มศึกษา";
summarySheet.Cells[1, 36].Value = "ระยะเวลาสิ้นสุดศึกษา";
summarySheet.Cells[1, 37].Value = "สถานที่ทำงาน/ฝึกงาน";
summarySheet.Cells[1, 38].Value = "ตำแหน่ง/ลักษณะงาน";
summarySheet.Cells[1, 39].Value = "เงินเดือนสุดท้านก่อนออก";
summarySheet.Cells[1, 40].Value = "ระยะเวลาเริ่มทำงาน/ฝึกงาน";
summarySheet.Cells[1, 41].Value = "ระยะเวลาสิ้นสุดทำงาน/ฝึกงาน";
summarySheet.Cells[1, 42].Value = "เหตุผลที่ออก";
summarySheet.Cells[1, 43].Value = "ลำดับที่สอบได้";
summarySheet.Cells[1, 44].Value = "เลขประจำตัวสอบ";
summarySheet.Cells[1, 45].Value = "เลขที่นั่งสอบ";
summarySheet.Cells[1, 46].Value = "คะแนนเต็มภาค ข";
summarySheet.Cells[1, 47].Value = "คะแนนภาค ข";
summarySheet.Cells[1, 48].Value = "ผลสอบภาค ข";
summarySheet.Cells[1, 49].Value = "คะแนนเต็มภาค ค";
summarySheet.Cells[1, 50].Value = "คะแนนภาค ค";
summarySheet.Cells[1, 51].Value = "ผลสอบภาค ค";
summarySheet.Cells[1, 52].Value = "ผลการสอบ";
summarySheet.Cells[1, 53].Value = "วันที่สมัคร";
summarySheet.Cells[1, 54].Value = "วันเและเวลาที่สมัคร";
summarySheet.Cells[1, 22].Value = "ประเภทตำแหน่งปัจจุบัน";
summarySheet.Cells[1, 23].Value = "ชื่อตำแหน่งปัจจุบัน";
summarySheet.Cells[1, 24].Value = "เงินเดือน ตำแหน่งปัจจุบัน";
summarySheet.Cells[1, 25].Value = "กลุ่ม/ฝ่าย ตำแหน่งปัจจุบัน";
summarySheet.Cells[1, 26].Value = "กอง ตำแหน่งปัจจุบัน";
summarySheet.Cells[1, 27].Value = "สังกัด ตำแหน่งปัจจุบัน";
summarySheet.Cells[1, 28].Value = "เบอร์ที่ทำงาน ตำแหน่งปัจจุบัน";
summarySheet.Cells[1, 29].Value = "วุฒิที่ใช้สมัครสอบ";
summarySheet.Cells[1, 30].Value = "ชื่อปริญญา";
summarySheet.Cells[1, 31].Value = "สาขาวิชา/วิชาเอก";
summarySheet.Cells[1, 32].Value = "ชื่อสถานศึกษา";
summarySheet.Cells[1, 33].Value = "ประเภทสถานศึกษา";
summarySheet.Cells[1, 34].Value = "วันที่สำเร็จการศึกษา";
summarySheet.Cells[1, 35].Value = "คะแนนเฉลี่ยสะสม";
summarySheet.Cells[1, 36].Value = "วุฒิการศึกษาสูงสุด";
summarySheet.Cells[1, 37].Value = "ตำแหน่งปัจจุบัน ชื่อตำแหน่ง";
summarySheet.Cells[1, 38].Value = "ตำแหน่งปัจจุบัน กอง";
summarySheet.Cells[1, 39].Value = "ตำแหน่งปัจจุบัน กลุ่ม/ฝ่าย";
summarySheet.Cells[1, 40].Value = "ตำแหน่งปัจจุบัน เงินเดือน";
summarySheet.Cells[1, 41].Value = "ตำแหน่งปัจจุบัน สังกัด";
summarySheet.Cells[1, 42].Value = "ตำแหน่งปัจจุบัน ประเภทราชการ";
summarySheet.Cells[1, 43].Value = "เบอร์โทรที่ทำงาน";
summarySheet.Cells[1, 44].Value = "ลำดับที่สอบได้";
summarySheet.Cells[1, 45].Value = "เลขประจำตัวสอบ";
summarySheet.Cells[1, 46].Value = "เลขที่นั่งสอบ";
summarySheet.Cells[1, 47].Value = "คะแนนเต็มภาค ก";
summarySheet.Cells[1, 48].Value = "คะแนนภาค ก";
summarySheet.Cells[1, 49].Value = "ผลสอบภาค ก";
summarySheet.Cells[1, 50].Value = "คะแนนเต็มภาค ข";
summarySheet.Cells[1, 51].Value = "คะแนนภาค ข";
summarySheet.Cells[1, 52].Value = "ผลสอบภาค ข";
summarySheet.Cells[1, 53].Value = "คะแนนเต็มภาค ค";
summarySheet.Cells[1, 54].Value = "คะแนนภาค ค";
summarySheet.Cells[1, 55].Value = "ผลสอบภาค ค";
summarySheet.Cells[1, 56].Value = "ผลการสอบ";
summarySheet.Cells[1, 57].Value = "วันที่สมัคร";
summarySheet.Cells[1, 58].Value = "วันเและเวลาที่สมัคร";
int row = 2;
foreach (var item in candidates)
{
var educations = await _context.Educations
.AsQueryable()
.OrderBy(x => x.DurationStart)
.OrderBy(x => x.EducationEndDate)
.Where(x => x.Candidate.Id == item.Id)
.ToListAsync();
@ -1450,7 +1486,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.Cells[row, 4].Value = item.Nationality;
summarySheet.Cells[row, 5].Value = item.DateOfBirth;
summarySheet.Cells[row, 6].Value = item.Age;
summarySheet.Cells[row, 7].Value = item.RelationshipName;
summarySheet.Cells[row, 7].Value = item.ReligionName;
summarySheet.Cells[row, 8].Value = item.Telephone;
summarySheet.Cells[row, 9].Value = item.MobilePhone;
summarySheet.Cells[row, 10].Value = item.Email;
@ -1465,36 +1501,39 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.Cells[row, 19].Value = item.CurrentDistrictName;
summarySheet.Cells[row, 20].Value = item.CurrentSubDistrictName;
summarySheet.Cells[row, 21].Value = item.CurrentZipCode;
summarySheet.Cells[row, 22].Value = item.MarryFullName;
summarySheet.Cells[row, 23].Value = item.FatherFullName;
summarySheet.Cells[row, 24].Value = item.MotherFullName;
summarySheet.Cells[row, 25].Value = item.OccupationType == null ? null : GenerateStatusOccupation(item.OccupationType);
summarySheet.Cells[row, 26].Value = item.OccupationPosition;
summarySheet.Cells[row, 27].Value = item.OccupationCompany;
summarySheet.Cells[row, 28].Value = item.OccupationDepartment;
summarySheet.Cells[row, 29].Value = item.OccupationEmail;
summarySheet.Cells[row, 30].Value = item.OccupationTelephone;
summarySheet.Cells[row, 31].Value = education.EducationLevelName;
summarySheet.Cells[row, 32].Value = education.Major;
summarySheet.Cells[row, 33].Value = education.Scores;
summarySheet.Cells[row, 34].Value = education.Name;
summarySheet.Cells[row, 35].Value = education.DurationStart == null ? "" : education.DurationStart.Date.ToThaiShortDate();
summarySheet.Cells[row, 36].Value = education.DurationEnd == null ? "" : education.DurationEnd.Date.ToThaiShortDate();
summarySheet.Cells[row, 43].Value = item.Number;
summarySheet.Cells[row, 44].Value = item.ExamIdenNumber;
summarySheet.Cells[row, 45].Value = item.SeatNumber;
summarySheet.Cells[row, 46].Value = item.PointTotalA;
summarySheet.Cells[row, 47].Value = item.PointA;
summarySheet.Cells[row, 48].Value = item.ResultA;
summarySheet.Cells[row, 49].Value = item.PointTotalB;
summarySheet.Cells[row, 50].Value = item.PointB;
summarySheet.Cells[row, 51].Value = item.ResultB;
summarySheet.Cells[row, 52].Value = item.PointTotalC;
summarySheet.Cells[row, 53].Value = item.PointC;
summarySheet.Cells[row, 54].Value = item.ResultC;
summarySheet.Cells[row, 55].Value = item.Pass;
summarySheet.Cells[row, 56].Value = item.CreatedAt.Date.ToThaiShortDate();
summarySheet.Cells[row, 57].Value = item.RegisterDate;
summarySheet.Cells[row, 22].Value = item.OccupationPosition;
summarySheet.Cells[row, 23].Value = item.OccupationSalary;
summarySheet.Cells[row, 24].Value = item.OccupationGroup;
summarySheet.Cells[row, 25].Value = item.OccupationPile;
summarySheet.Cells[row, 26].Value = item.OccupationOrg;
summarySheet.Cells[row, 27].Value = item.OccupationPositionType == null ? null : GenerateStatusOccupation(item.OccupationPositionType);
summarySheet.Cells[row, 28].Value = item.OccupationTelephone;
summarySheet.Cells[row, 29].Value = education.EducationLevelExamName;
summarySheet.Cells[row, 30].Value = education.EducationName;
summarySheet.Cells[row, 31].Value = education.EducationMajor;
summarySheet.Cells[row, 32].Value = education.EducationLocation;
summarySheet.Cells[row, 33].Value = education.EducationType;
summarySheet.Cells[row, 34].Value = education.EducationEndDate == null ? "-" : education.EducationEndDate.Value.Date.ToThaiShortDate();
summarySheet.Cells[row, 35].Value = education.EducationScores;
summarySheet.Cells[row, 36].Value = education.EducationLevelHighName;
summarySheet.Cells[row, 44].Value = item.Number;
summarySheet.Cells[row, 45].Value = item.ExamIdenNumber;
summarySheet.Cells[row, 46].Value = item.SeatNumber;
summarySheet.Cells[row, 47].Value = item.PointTotalA;
summarySheet.Cells[row, 48].Value = item.PointA;
summarySheet.Cells[row, 49].Value = item.ResultA;
summarySheet.Cells[row, 50].Value = item.PointTotalB;
summarySheet.Cells[row, 51].Value = item.PointB;
summarySheet.Cells[row, 52].Value = item.ResultB;
summarySheet.Cells[row, 53].Value = item.PointTotalC;
summarySheet.Cells[row, 54].Value = item.PointC;
summarySheet.Cells[row, 55].Value = item.ResultC;
summarySheet.Cells[row, 56].Value = item.Pass;
summarySheet.Cells[row, 57].Value = item.CreatedAt.Date.ToThaiShortDate();
summarySheet.Cells[row, 58].Value = item.RegisterDate;
row++;
}
var careers = await _context.Careers
@ -1511,7 +1550,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.Cells[row, 4].Value = item.Nationality;
summarySheet.Cells[row, 5].Value = item.DateOfBirth;
summarySheet.Cells[row, 6].Value = item.Age;
summarySheet.Cells[row, 7].Value = item.RelationshipName;
summarySheet.Cells[row, 7].Value = item.ReligionName;
summarySheet.Cells[row, 8].Value = item.Telephone;
summarySheet.Cells[row, 9].Value = item.MobilePhone;
summarySheet.Cells[row, 10].Value = item.Email;
@ -1526,36 +1565,38 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.Cells[row, 19].Value = item.CurrentDistrictName;
summarySheet.Cells[row, 20].Value = item.CurrentSubDistrictName;
summarySheet.Cells[row, 21].Value = item.CurrentZipCode;
summarySheet.Cells[row, 22].Value = item.MarryFullName;
summarySheet.Cells[row, 23].Value = item.FatherFullName;
summarySheet.Cells[row, 24].Value = item.MotherFullName;
summarySheet.Cells[row, 25].Value = item.OccupationType == null ? null : GenerateStatusOccupation(item.OccupationType);
summarySheet.Cells[row, 26].Value = item.OccupationPosition;
summarySheet.Cells[row, 27].Value = item.OccupationCompany;
summarySheet.Cells[row, 28].Value = item.OccupationDepartment;
summarySheet.Cells[row, 29].Value = item.OccupationEmail;
summarySheet.Cells[row, 30].Value = item.OccupationTelephone;
summarySheet.Cells[row, 37].Value = career.Name;
summarySheet.Cells[row, 38].Value = career.Position;
summarySheet.Cells[row, 39].Value = career.Salary;
summarySheet.Cells[row, 40].Value = career.DurationStart == null ? "" : career.DurationStart.Date.ToThaiShortDate();
summarySheet.Cells[row, 41].Value = career.DurationEnd == null ? "" : career.DurationEnd.Date.ToThaiShortDate();
summarySheet.Cells[row, 42].Value = career.Reason;
summarySheet.Cells[row, 43].Value = item.Number;
summarySheet.Cells[row, 44].Value = item.ExamIdenNumber;
summarySheet.Cells[row, 45].Value = item.SeatNumber;
summarySheet.Cells[row, 46].Value = item.PointTotalA;
summarySheet.Cells[row, 47].Value = item.PointA;
summarySheet.Cells[row, 48].Value = item.ResultA;
summarySheet.Cells[row, 49].Value = item.PointTotalB;
summarySheet.Cells[row, 50].Value = item.PointB;
summarySheet.Cells[row, 51].Value = item.ResultB;
summarySheet.Cells[row, 52].Value = item.PointTotalC;
summarySheet.Cells[row, 53].Value = item.PointC;
summarySheet.Cells[row, 54].Value = item.ResultC;
summarySheet.Cells[row, 55].Value = item.Pass;
summarySheet.Cells[row, 56].Value = item.CreatedAt.Date.ToThaiShortDate();
summarySheet.Cells[row, 57].Value = item.RegisterDate;
summarySheet.Cells[row, 22].Value = item.OccupationPosition;
summarySheet.Cells[row, 23].Value = item.OccupationSalary;
summarySheet.Cells[row, 24].Value = item.OccupationGroup;
summarySheet.Cells[row, 25].Value = item.OccupationPile;
summarySheet.Cells[row, 26].Value = item.OccupationOrg;
summarySheet.Cells[row, 27].Value = item.OccupationPositionType == null ? null : GenerateStatusOccupation(item.OccupationPositionType);
summarySheet.Cells[row, 28].Value = item.OccupationTelephone;
summarySheet.Cells[row, 37].Value = career.Position;
summarySheet.Cells[row, 38].Value = career.Group;
summarySheet.Cells[row, 39].Value = career.Pile;
summarySheet.Cells[row, 40].Value = career.Org;
summarySheet.Cells[row, 41].Value = career.DurationStart == null ? "-" : career.DurationStart.Date.ToThaiShortDate();
summarySheet.Cells[row, 42].Value = career.DurationEnd == null ? "-" : career.DurationEnd.Date.ToThaiShortDate();
summarySheet.Cells[row, 43].Value = career.RangeDate;
summarySheet.Cells[row, 44].Value = item.Number;
summarySheet.Cells[row, 45].Value = item.ExamIdenNumber;
summarySheet.Cells[row, 46].Value = item.SeatNumber;
summarySheet.Cells[row, 47].Value = item.PointTotalA;
summarySheet.Cells[row, 48].Value = item.PointA;
summarySheet.Cells[row, 49].Value = item.ResultA;
summarySheet.Cells[row, 50].Value = item.PointTotalB;
summarySheet.Cells[row, 51].Value = item.PointB;
summarySheet.Cells[row, 52].Value = item.ResultB;
summarySheet.Cells[row, 53].Value = item.PointTotalC;
summarySheet.Cells[row, 54].Value = item.PointC;
summarySheet.Cells[row, 55].Value = item.ResultC;
summarySheet.Cells[row, 56].Value = item.Pass;
summarySheet.Cells[row, 57].Value = item.CreatedAt.Date.ToThaiShortDate();
summarySheet.Cells[row, 58].Value = item.RegisterDate;
row++;
}
if (educations.Count() == 0 && careers.Count() == 0)
@ -1566,7 +1607,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.Cells[row, 4].Value = item.Nationality;
summarySheet.Cells[row, 5].Value = item.DateOfBirth;
summarySheet.Cells[row, 6].Value = item.Age;
summarySheet.Cells[row, 7].Value = item.RelationshipName;
summarySheet.Cells[row, 7].Value = item.ReligionName;
summarySheet.Cells[row, 8].Value = item.Telephone;
summarySheet.Cells[row, 9].Value = item.MobilePhone;
summarySheet.Cells[row, 10].Value = item.Email;
@ -1581,31 +1622,30 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.Cells[row, 19].Value = item.CurrentDistrictName;
summarySheet.Cells[row, 20].Value = item.CurrentSubDistrictName;
summarySheet.Cells[row, 21].Value = item.CurrentZipCode;
summarySheet.Cells[row, 22].Value = item.MarryFullName;
summarySheet.Cells[row, 23].Value = item.FatherFullName;
summarySheet.Cells[row, 24].Value = item.MotherFullName;
summarySheet.Cells[row, 25].Value = item.OccupationType == null ? null : GenerateStatusOccupation(item.OccupationType);
summarySheet.Cells[row, 26].Value = item.OccupationPosition;
summarySheet.Cells[row, 27].Value = item.OccupationCompany;
summarySheet.Cells[row, 28].Value = item.OccupationDepartment;
summarySheet.Cells[row, 29].Value = item.OccupationEmail;
summarySheet.Cells[row, 30].Value = item.OccupationTelephone;
summarySheet.Cells[row, 43].Value = item.Number;
summarySheet.Cells[row, 44].Value = item.ExamIdenNumber;
summarySheet.Cells[row, 45].Value = item.SeatNumber;
summarySheet.Cells[row, 46].Value = item.PointTotalA;
summarySheet.Cells[row, 47].Value = item.PointA;
summarySheet.Cells[row, 48].Value = item.ResultA;
summarySheet.Cells[row, 49].Value = item.PointTotalB;
summarySheet.Cells[row, 50].Value = item.PointB;
summarySheet.Cells[row, 51].Value = item.ResultB;
summarySheet.Cells[row, 52].Value = item.PointTotalC;
summarySheet.Cells[row, 53].Value = item.PointC;
summarySheet.Cells[row, 54].Value = item.ResultC;
summarySheet.Cells[row, 55].Value = item.Pass;
summarySheet.Cells[row, 56].Value = item.CreatedAt.Date.ToThaiShortDate();
summarySheet.Cells[row, 57].Value = item.RegisterDate;
summarySheet.Cells[row, 22].Value = item.OccupationPosition;
summarySheet.Cells[row, 23].Value = item.OccupationSalary;
summarySheet.Cells[row, 24].Value = item.OccupationGroup;
summarySheet.Cells[row, 25].Value = item.OccupationPile;
summarySheet.Cells[row, 26].Value = item.OccupationOrg;
summarySheet.Cells[row, 27].Value = item.OccupationPositionType == null ? null : GenerateStatusOccupation(item.OccupationPositionType);
summarySheet.Cells[row, 28].Value = item.OccupationTelephone;
summarySheet.Cells[row, 44].Value = item.Number;
summarySheet.Cells[row, 45].Value = item.ExamIdenNumber;
summarySheet.Cells[row, 46].Value = item.SeatNumber;
summarySheet.Cells[row, 47].Value = item.PointTotalA;
summarySheet.Cells[row, 48].Value = item.PointA;
summarySheet.Cells[row, 49].Value = item.ResultA;
summarySheet.Cells[row, 50].Value = item.PointTotalB;
summarySheet.Cells[row, 51].Value = item.PointB;
summarySheet.Cells[row, 52].Value = item.ResultB;
summarySheet.Cells[row, 53].Value = item.PointTotalC;
summarySheet.Cells[row, 54].Value = item.PointC;
summarySheet.Cells[row, 55].Value = item.ResultC;
summarySheet.Cells[row, 56].Value = item.Pass;
summarySheet.Cells[row, 57].Value = item.CreatedAt.Date.ToThaiShortDate();
summarySheet.Cells[row, 58].Value = item.RegisterDate;
row++;
}
}
@ -1641,7 +1681,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Nationality = c.Nationality,
DateOfBirth = c.DateOfBirth == null ? "" : c.DateOfBirth.Value.Date.ToThaiShortDate(),
Age = c.DateOfBirth == null ? 0 : DateTime.Now.Date.Year - c.DateOfBirth.Value.Date.Year,
RelationshipName = c.RelationshipName,
ReligionName = c.ReligionName,
Telephone = c.Telephone,
MobilePhone = c.MobilePhone,
Email = c.Email,
@ -1656,14 +1696,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
CurrentDistrictName = c.CurrentDistrictName,
CurrentSubDistrictName = c.CurrentSubDistrictName,
CurrentZipCode = c.CurrentZipCode,
MarryFullName = $"{c.MarryPrefixName}{c.MarryFirstName} {c.MarryLastName}",
FatherFullName = $"{c.FatherPrefixName}{c.FatherFirstName} {c.FatherLastName}",
MotherFullName = $"{c.MotherPrefixName}{c.MotherFirstName} {c.MotherLastName}",
OccupationType = c.OccupationType,
OccupationOrg = c.OccupationOrg,
OccupationPile = c.OccupationPile,
OccupationGroup = c.OccupationGroup,
OccupationSalary = c.OccupationSalary,
OccupationPosition = c.OccupationPosition,
OccupationCompany = c.OccupationCompany,
OccupationDepartment = c.OccupationDepartment,
OccupationEmail = c.OccupationEmail,
OccupationPositionType = c.OccupationPositionType,
OccupationTelephone = c.OccupationTelephone,
Number = c.Number,
ExamIdenNumber = c.ExamIdenNumber,
@ -1729,7 +1767,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Where(x => x.Candidate.PeriodExam == periodExam)
.Where(x => x.Candidate.CreatedAt.Date <= item.DateEnd.Date)
.Where(x => x.Candidate.CreatedAt.Date >= item.DateStart.Date)
.GroupBy(x => x.EducationLevelName)
.GroupBy(x => x.EducationLevelExamName)
.Select(x => new
{
Name = x.Key,
@ -1746,7 +1784,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
}
if (educations.Count() != 0)
{
summarySheet.Cells[5, fixMerge, 5, rowName - 1].Value = "วุฒิการศึกษา";
summarySheet.Cells[5, fixMerge, 5, rowName - 1].Value = "วุฒิที่ใช้สมัครสอบ";
summarySheet.Cells[5, fixMerge, 5, rowName - 1].Merge = true;
fixMerge = rowCount;
}
@ -1755,7 +1793,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Where(x => x.Candidate.PeriodExam == periodExam)
.Where(x => x.Candidate.CreatedAt.Date <= item.DateEnd.Date)
.Where(x => x.Candidate.CreatedAt.Date >= item.DateStart.Date)
.GroupBy(x => x.Name)
.GroupBy(x => x.Position)
.Select(x => new
{
Name = x.Key,
@ -1866,8 +1904,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
public async Task UpdateAsyncCandidateToPlacement(Guid examId)
{
var periodExam = await _context.PeriodExams.AsQueryable()
.Include(x => x.Candidate)
.ThenInclude(x => x.Educations)
.Include(x => x.Candidate)
.ThenInclude(x => x.PositionExam)
.Include(x => x.Candidate)
@ -1911,7 +1947,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Lastname = candidate.LastName,
Nationality = candidate.Nationality,
DateOfBirth = candidate.DateOfBirth,
Relationship = await _contextMetadata.Relationships.FirstOrDefaultAsync(x => x.Id == candidate.RelationshipId),
Religion = await _contextMetadata.Religions.FirstOrDefaultAsync(x => x.Id == candidate.ReligionId),
Email = candidate.Email,
CitizenId = candidate.CitizenId,
CitizenDistrict = await _contextMetadata.Districts.FirstOrDefaultAsync(x => x.Id == candidate.CitizenDistrictId),
@ -1947,12 +1983,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
MotherLastName = candidate.MotherLastName,
MotherOccupation = candidate.MotherOccupation,
MotherNationality = candidate.MotherNationality,
OccupationType = candidate.OccupationType,
OccupationCompany = candidate.OccupationCompany,
OccupationDepartment = candidate.OccupationDepartment,
OccupationEmail = candidate.OccupationEmail,
OccupationTelephone = candidate.OccupationTelephone,
OccupationOrg = candidate.OccupationOrg,
OccupationPile = candidate.OccupationPile,
OccupationGroup = candidate.OccupationGroup,
OccupationSalary = candidate.OccupationSalary,
OccupationPosition = candidate.OccupationPosition,
OccupationPositionType = candidate.OccupationPositionType,
OccupationTelephone = candidate.OccupationTelephone,
PointTotalA = candidate.PointTotalA == null ? null : Convert.ToDouble(candidate.PointTotalA),
PointA = candidate.PointA == null ? null : Convert.ToDouble(candidate.PointA),
PointTotalB = candidate.PointTotalB == null ? null : Convert.ToDouble(candidate.PointTotalB),
@ -1978,13 +2015,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var placementEducation = new PlacementEducation
{
PlacementProfile = placementProfile,
EducationLevel = await _contextMetadata.EducationLevels.FirstOrDefaultAsync(x => x.Id == education.EducationLevelId),
Field = education.Major,
Gpa = education.Scores.ToString(),
Institute = education.Name,
EducationLevel = await _contextMetadata.EducationLevels.FirstOrDefaultAsync(x => x.Id == education.EducationLevelExamId),
Field = education.EducationMajor,
Gpa = education.EducationScores,
Institute = education.EducationLocation,
IsDate = true,
StartDate = education.DurationStart,
EndDate = education.DurationEnd,
FinishDate = education.EducationEndDate,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
@ -2103,12 +2139,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
// MotherLastName = candidate.MotherLastName,
// MotherOccupation = candidate.MotherOccupation,
// MotherNationality = candidate.MotherNationality,
OccupationType = "other",
OccupationPositionType = "other",
// OccupationCompany = candidate.OccupationCompany,
OccupationDepartment = candidate.Occupations.FirstOrDefault() == null ? null : candidate.Occupations.FirstOrDefault().Workplace,
// OccupationDepartment = candidate.Occupations.FirstOrDefault() == null ? null : candidate.Occupations.FirstOrDefault().Workplace,
// OccupationEmail = candidate.OccupationEmail,
OccupationTelephone = candidate.Occupations.FirstOrDefault() == null ? null : candidate.Occupations.FirstOrDefault().Telephone,
OccupationPosition = candidate.Occupations.FirstOrDefault() == null ? null : candidate.Occupations.FirstOrDefault().Position,
PointTotalA = disableScore == null ? null : Convert.ToDouble(disableScore.FullA),
PointA = disableScore == null ? null : Convert.ToDouble(disableScore.SumA),
PointTotalB = disableScore == null ? null : Convert.ToDouble(disableScore.FullB),