แก้สมัครสอบ
This commit is contained in:
parent
afc0cd830c
commit
07903d3b67
30 changed files with 3471 additions and 771 deletions
|
|
@ -19,7 +19,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
#region " Fields "
|
||||
|
||||
private readonly ApplicationDbContext _context;
|
||||
private readonly MetadataDbContext _contextMetadata;
|
||||
private readonly OrgDbContext _contextOrg;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly MinIOService _minioService;
|
||||
|
||||
|
|
@ -28,12 +28,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
#region " Constructor and Destructor "
|
||||
|
||||
public CMSCandidateService(ApplicationDbContext context,
|
||||
MetadataDbContext contextMetadata,
|
||||
OrgDbContext contextOrg,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
MinIOService minioService)
|
||||
{
|
||||
_context = context;
|
||||
_contextMetadata = contextMetadata;
|
||||
_contextOrg = contextOrg;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_minioService = minioService;
|
||||
}
|
||||
|
|
@ -139,39 +139,39 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
|
||||
if (updated.ProvinceId != null)
|
||||
{
|
||||
var province = await _contextMetadata.Provinces.AsQueryable()
|
||||
var province = await _contextOrg.province.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.ProvinceId));
|
||||
|
||||
if (province == null)
|
||||
throw new Exception(GlobalMessages.ProvinceNotFound);
|
||||
|
||||
cms.ProvinceId = province.Id;
|
||||
cms.ProvinceName = province.Name;
|
||||
cms.ProvinceName = province.name;
|
||||
}
|
||||
|
||||
if (updated.DistrictId != null)
|
||||
{
|
||||
var pistrict = await _contextMetadata.Districts.AsQueryable()
|
||||
var pistrict = await _contextOrg.district.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.DistrictId));
|
||||
|
||||
if (pistrict == null)
|
||||
throw new Exception(GlobalMessages.DistrictNotFound);
|
||||
|
||||
cms.DistrictId = pistrict.Id;
|
||||
cms.DistrictName = pistrict.Name;
|
||||
cms.DistrictName = pistrict.name;
|
||||
}
|
||||
|
||||
if (updated.SubDistrictId != null)
|
||||
{
|
||||
var subDistrict = await _contextMetadata.SubDistricts.AsQueryable()
|
||||
var subDistrict = await _contextOrg.subDistrict.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.SubDistrictId));
|
||||
|
||||
if (subDistrict == null)
|
||||
throw new Exception(GlobalMessages.SubDistrictNotFound);
|
||||
|
||||
cms.SubDistrictId = subDistrict.Id;
|
||||
cms.SubDistrictName = subDistrict.Name;
|
||||
cms.ZipCode = subDistrict.ZipCode;
|
||||
cms.SubDistrictName = subDistrict.name;
|
||||
cms.ZipCode = subDistrict.zipCode;
|
||||
}
|
||||
|
||||
cms.About = updated.About;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System.Security.Claims;
|
||||
using BMA.EHR.Domain.Models.Placement;
|
||||
using BMA.EHR.Recurit.Exam.Service.Extensions;
|
||||
using BMA.EHR.Recurit.Exam.Service.Core;
|
||||
using BMA.EHR.Recurit.Exam.Service.Data;
|
||||
|
|
@ -7,7 +6,6 @@ using BMA.EHR.Recurit.Exam.Service.Models;
|
|||
using BMA.EHR.Recurit.Exam.Service.Request;
|
||||
using BMA.EHR.Recurit.Exam.Service.Response;
|
||||
using BMA.EHR.Recurit.Exam.Service.Responses.Document;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Recurit.Exam.Service.Services
|
||||
|
|
@ -17,7 +15,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
#region " Fields "
|
||||
|
||||
private readonly ApplicationDbContext _context;
|
||||
private readonly MetadataDbContext _contextMetadata;
|
||||
private readonly OrgDbContext _contextOrg;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly MinIOService _minioService;
|
||||
private readonly MailService _mailService;
|
||||
|
|
@ -27,13 +25,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
#region " Constructor and Destructor "
|
||||
|
||||
public CandidateService(ApplicationDbContext context,
|
||||
MetadataDbContext contextMetadata,
|
||||
OrgDbContext contextOrg,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
MinIOService minioService,
|
||||
MailService mailService)
|
||||
{
|
||||
_context = context;
|
||||
_contextMetadata = contextMetadata;
|
||||
_contextOrg = contextOrg;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_minioService = minioService;
|
||||
_mailService = mailService;
|
||||
|
|
@ -742,112 +740,112 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
|
||||
if (updated.PrefixId != null)
|
||||
{
|
||||
var prefix = await _contextMetadata.Prefixes.AsQueryable()
|
||||
var prefix = await _contextOrg.prefixe.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.PrefixId));
|
||||
|
||||
if (prefix == null)
|
||||
throw new Exception(GlobalMessages.PrefixNotFound);
|
||||
|
||||
candidate.PrefixId = prefix.Id;
|
||||
candidate.PrefixName = prefix.Name;
|
||||
candidate.PrefixName = prefix.name;
|
||||
}
|
||||
|
||||
if (updated.ContactPrefixId != null)
|
||||
{
|
||||
var prefix = await _contextMetadata.Prefixes.AsQueryable()
|
||||
var prefix = await _contextOrg.prefixe.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == updated.ContactPrefixId);
|
||||
|
||||
if (prefix == null)
|
||||
throw new Exception(GlobalMessages.PrefixNotFound);
|
||||
|
||||
candidate.ContactPrefixId = prefix.Id;
|
||||
candidate.ContactPrefixName = prefix.Name;
|
||||
candidate.ContactPrefixName = prefix.name;
|
||||
}
|
||||
|
||||
if (updated.ReligionId != null)
|
||||
{
|
||||
var religion = await _contextMetadata.Religions.AsQueryable()
|
||||
var religion = await _contextOrg.religion.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.ReligionId));
|
||||
|
||||
if (religion == null)
|
||||
throw new Exception(GlobalMessages.ReligionNotFound);
|
||||
|
||||
candidate.ReligionId = religion.Id;
|
||||
candidate.ReligionName = religion.Name;
|
||||
candidate.ReligionName = religion.name;
|
||||
}
|
||||
|
||||
if (updated.RegistProvinceId != null)
|
||||
{
|
||||
var registProvince = await _contextMetadata.Provinces.AsQueryable()
|
||||
var registProvince = await _contextOrg.province.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistProvinceId));
|
||||
|
||||
if (registProvince == null)
|
||||
throw new Exception(GlobalMessages.ProvinceNotFound);
|
||||
|
||||
candidate.RegistProvinceId = registProvince.Id;
|
||||
candidate.RegistProvinceName = registProvince.Name;
|
||||
candidate.RegistProvinceName = registProvince.name;
|
||||
}
|
||||
|
||||
if (updated.RegistDistrictId != null)
|
||||
{
|
||||
var registDistrict = await _contextMetadata.Districts.AsQueryable()
|
||||
var registDistrict = await _contextOrg.district.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistDistrictId));
|
||||
|
||||
if (registDistrict == null)
|
||||
throw new Exception(GlobalMessages.DistrictNotFound);
|
||||
|
||||
candidate.RegistDistrictId = registDistrict.Id;
|
||||
candidate.RegistDistrictName = registDistrict.Name;
|
||||
candidate.RegistDistrictName = registDistrict.name;
|
||||
}
|
||||
|
||||
if (updated.RegistSubDistrictId != null)
|
||||
{
|
||||
var registSubDistrict = await _contextMetadata.SubDistricts.AsQueryable()
|
||||
var registSubDistrict = await _contextOrg.subDistrict.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistSubDistrictId));
|
||||
|
||||
if (registSubDistrict == null)
|
||||
throw new Exception(GlobalMessages.SubDistrictNotFound);
|
||||
|
||||
candidate.RegistSubDistrictId = registSubDistrict.Id;
|
||||
candidate.RegistSubDistrictName = registSubDistrict.Name;
|
||||
candidate.RegistZipCode = registSubDistrict.ZipCode;
|
||||
candidate.RegistSubDistrictName = registSubDistrict.name;
|
||||
candidate.RegistZipCode = registSubDistrict.zipCode;
|
||||
}
|
||||
|
||||
if (updated.CurrentProvinceId != null)
|
||||
{
|
||||
var currentProvince = await _contextMetadata.Provinces.AsQueryable()
|
||||
var currentProvince = await _contextOrg.province.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentProvinceId));
|
||||
|
||||
if (currentProvince == null)
|
||||
throw new Exception(GlobalMessages.ProvinceNotFound);
|
||||
|
||||
candidate.CurrentProvinceId = currentProvince.Id;
|
||||
candidate.CurrentProvinceName = currentProvince.Name;
|
||||
candidate.CurrentProvinceName = currentProvince.name;
|
||||
}
|
||||
|
||||
if (updated.CurrentDistrictId != null)
|
||||
{
|
||||
var currentDistrict = await _contextMetadata.Districts.AsQueryable()
|
||||
var currentDistrict = await _contextOrg.district.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentDistrictId));
|
||||
|
||||
if (currentDistrict == null)
|
||||
throw new Exception(GlobalMessages.DistrictNotFound);
|
||||
|
||||
candidate.CurrentDistrictId = currentDistrict.Id;
|
||||
candidate.CurrentDistrictName = currentDistrict.Name;
|
||||
candidate.CurrentDistrictName = currentDistrict.name;
|
||||
}
|
||||
|
||||
if (updated.CurrentSubDistrictId != null)
|
||||
{
|
||||
var currentSubDistrict = await _contextMetadata.SubDistricts.AsQueryable()
|
||||
var currentSubDistrict = await _contextOrg.subDistrict.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentSubDistrictId));
|
||||
|
||||
if (currentSubDistrict == null)
|
||||
throw new Exception(GlobalMessages.SubDistrictNotFound);
|
||||
|
||||
candidate.CurrentSubDistrictId = currentSubDistrict.Id;
|
||||
candidate.CurrentSubDistrictName = currentSubDistrict.Name;
|
||||
candidate.CurrentZipCode = currentSubDistrict.ZipCode;
|
||||
candidate.CurrentSubDistrictName = currentSubDistrict.name;
|
||||
candidate.CurrentZipCode = currentSubDistrict.zipCode;
|
||||
}
|
||||
|
||||
candidate.FirstName = updated.FirstName;
|
||||
|
|
@ -896,24 +894,24 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
};
|
||||
if (updated.EducationLevelExamId != null)
|
||||
{
|
||||
var educationLevelExam = await _contextMetadata.EducationLevels.AsQueryable()
|
||||
var educationLevelExam = await _contextOrg.educationLevel.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId);
|
||||
|
||||
if (educationLevelExam == null)
|
||||
throw new Exception(GlobalMessages.EducationLevelNotFound);
|
||||
education.EducationLevelExamId = educationLevelExam.Id;
|
||||
education.EducationLevelExamName = educationLevelExam.Name;
|
||||
education.EducationLevelExamName = educationLevelExam.name;
|
||||
}
|
||||
|
||||
if (updated.EducationLevelHighId != null)
|
||||
{
|
||||
var educationLevelHigh = await _contextMetadata.EducationLevels.AsQueryable()
|
||||
var educationLevelHigh = await _contextOrg.educationLevel.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId);
|
||||
|
||||
if (educationLevelHigh == null)
|
||||
throw new Exception(GlobalMessages.EducationLevelNotFound);
|
||||
education.EducationLevelHighId = educationLevelHigh.Id;
|
||||
education.EducationLevelHighName = educationLevelHigh.Name;
|
||||
education.EducationLevelHighName = educationLevelHigh.name;
|
||||
}
|
||||
await _context.Educations.AddAsync(education);
|
||||
}
|
||||
|
|
@ -930,24 +928,24 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
candidate.Educations.FirstOrDefault().LastUpdateFullName = FullName ?? "";
|
||||
if (updated.EducationLevelExamId != null)
|
||||
{
|
||||
var educationLevelExam = await _contextMetadata.EducationLevels.AsQueryable()
|
||||
var educationLevelExam = await _contextOrg.educationLevel.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId);
|
||||
|
||||
if (educationLevelExam == null)
|
||||
throw new Exception(GlobalMessages.EducationLevelNotFound);
|
||||
candidate.Educations.FirstOrDefault().EducationLevelExamId = educationLevelExam.Id;
|
||||
candidate.Educations.FirstOrDefault().EducationLevelExamName = educationLevelExam.Name;
|
||||
candidate.Educations.FirstOrDefault().EducationLevelExamName = educationLevelExam.name;
|
||||
}
|
||||
|
||||
if (updated.EducationLevelHighId != null)
|
||||
{
|
||||
var educationLevelHigh = await _contextMetadata.EducationLevels.AsQueryable()
|
||||
var educationLevelHigh = await _contextOrg.educationLevel.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId);
|
||||
|
||||
if (educationLevelHigh == null)
|
||||
throw new Exception(GlobalMessages.EducationLevelNotFound);
|
||||
candidate.Educations.FirstOrDefault().EducationLevelHighId = educationLevelHigh.Id;
|
||||
candidate.Educations.FirstOrDefault().EducationLevelHighName = educationLevelHigh.Name;
|
||||
candidate.Educations.FirstOrDefault().EducationLevelHighName = educationLevelHigh.name;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -966,112 +964,112 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
|
||||
if (updated.PrefixId != null)
|
||||
{
|
||||
var prefix = await _contextMetadata.Prefixes.AsQueryable()
|
||||
var prefix = await _contextOrg.prefixe.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.PrefixId));
|
||||
|
||||
if (prefix == null)
|
||||
throw new Exception(GlobalMessages.PrefixNotFound);
|
||||
|
||||
candidate.PrefixId = prefix.Id;
|
||||
candidate.PrefixName = prefix.Name;
|
||||
candidate.PrefixName = prefix.name;
|
||||
}
|
||||
|
||||
if (updated.ContactPrefixId != null)
|
||||
{
|
||||
var prefix = await _contextMetadata.Prefixes.AsQueryable()
|
||||
var prefix = await _contextOrg.prefixe.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == updated.ContactPrefixId);
|
||||
|
||||
if (prefix == null)
|
||||
throw new Exception(GlobalMessages.PrefixNotFound);
|
||||
|
||||
candidate.ContactPrefixId = prefix.Id;
|
||||
candidate.ContactPrefixName = prefix.Name;
|
||||
candidate.ContactPrefixName = prefix.name;
|
||||
}
|
||||
|
||||
if (updated.ReligionId != null)
|
||||
{
|
||||
var religion = await _contextMetadata.Religions.AsQueryable()
|
||||
var religion = await _contextOrg.religion.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.ReligionId));
|
||||
|
||||
if (religion == null)
|
||||
throw new Exception(GlobalMessages.ReligionNotFound);
|
||||
|
||||
candidate.ReligionId = religion.Id;
|
||||
candidate.ReligionName = religion.Name;
|
||||
candidate.ReligionName = religion.name;
|
||||
}
|
||||
|
||||
if (updated.RegistProvinceId != null)
|
||||
{
|
||||
var registProvince = await _contextMetadata.Provinces.AsQueryable()
|
||||
var registProvince = await _contextOrg.province.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistProvinceId));
|
||||
|
||||
if (registProvince == null)
|
||||
throw new Exception(GlobalMessages.ProvinceNotFound);
|
||||
|
||||
candidate.RegistProvinceId = registProvince.Id;
|
||||
candidate.RegistProvinceName = registProvince.Name;
|
||||
candidate.RegistProvinceName = registProvince.name;
|
||||
}
|
||||
|
||||
if (updated.RegistDistrictId != null)
|
||||
{
|
||||
var registDistrict = await _contextMetadata.Districts.AsQueryable()
|
||||
var registDistrict = await _contextOrg.district.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistDistrictId));
|
||||
|
||||
if (registDistrict == null)
|
||||
throw new Exception(GlobalMessages.DistrictNotFound);
|
||||
|
||||
candidate.RegistDistrictId = registDistrict.Id;
|
||||
candidate.RegistDistrictName = registDistrict.Name;
|
||||
candidate.RegistDistrictName = registDistrict.name;
|
||||
}
|
||||
|
||||
if (updated.RegistSubDistrictId != null)
|
||||
{
|
||||
var registSubDistrict = await _contextMetadata.SubDistricts.AsQueryable()
|
||||
var registSubDistrict = await _contextOrg.subDistrict.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistSubDistrictId));
|
||||
|
||||
if (registSubDistrict == null)
|
||||
throw new Exception(GlobalMessages.SubDistrictNotFound);
|
||||
|
||||
candidate.RegistSubDistrictId = registSubDistrict.Id;
|
||||
candidate.RegistSubDistrictName = registSubDistrict.Name;
|
||||
candidate.RegistZipCode = registSubDistrict.ZipCode;
|
||||
candidate.RegistSubDistrictName = registSubDistrict.name;
|
||||
candidate.RegistZipCode = registSubDistrict.zipCode;
|
||||
}
|
||||
|
||||
if (updated.CurrentProvinceId != null)
|
||||
{
|
||||
var currentProvince = await _contextMetadata.Provinces.AsQueryable()
|
||||
var currentProvince = await _contextOrg.province.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentProvinceId));
|
||||
|
||||
if (currentProvince == null)
|
||||
throw new Exception(GlobalMessages.ProvinceNotFound);
|
||||
|
||||
candidate.CurrentProvinceId = currentProvince.Id;
|
||||
candidate.CurrentProvinceName = currentProvince.Name;
|
||||
candidate.CurrentProvinceName = currentProvince.name;
|
||||
}
|
||||
|
||||
if (updated.CurrentDistrictId != null)
|
||||
{
|
||||
var currentDistrict = await _contextMetadata.Districts.AsQueryable()
|
||||
var currentDistrict = await _contextOrg.district.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentDistrictId));
|
||||
|
||||
if (currentDistrict == null)
|
||||
throw new Exception(GlobalMessages.DistrictNotFound);
|
||||
|
||||
candidate.CurrentDistrictId = currentDistrict.Id;
|
||||
candidate.CurrentDistrictName = currentDistrict.Name;
|
||||
candidate.CurrentDistrictName = currentDistrict.name;
|
||||
}
|
||||
|
||||
if (updated.CurrentSubDistrictId != null)
|
||||
{
|
||||
var currentSubDistrict = await _contextMetadata.SubDistricts.AsQueryable()
|
||||
var currentSubDistrict = await _contextOrg.subDistrict.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentSubDistrictId));
|
||||
|
||||
if (currentSubDistrict == null)
|
||||
throw new Exception(GlobalMessages.SubDistrictNotFound);
|
||||
|
||||
candidate.CurrentSubDistrictId = currentSubDistrict.Id;
|
||||
candidate.CurrentSubDistrictName = currentSubDistrict.Name;
|
||||
candidate.CurrentZipCode = currentSubDistrict.ZipCode;
|
||||
candidate.CurrentSubDistrictName = currentSubDistrict.name;
|
||||
candidate.CurrentZipCode = currentSubDistrict.zipCode;
|
||||
}
|
||||
|
||||
candidate.FirstName = updated.FirstName;
|
||||
|
|
@ -1121,24 +1119,24 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
};
|
||||
if (updated.EducationLevelExamId != null)
|
||||
{
|
||||
var educationLevelExam = await _contextMetadata.EducationLevels.AsQueryable()
|
||||
var educationLevelExam = await _contextOrg.educationLevel.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId);
|
||||
|
||||
if (educationLevelExam == null)
|
||||
throw new Exception(GlobalMessages.EducationLevelNotFound);
|
||||
education.EducationLevelExamId = educationLevelExam.Id;
|
||||
education.EducationLevelExamName = educationLevelExam.Name;
|
||||
education.EducationLevelExamName = educationLevelExam.name;
|
||||
}
|
||||
|
||||
if (updated.EducationLevelHighId != null)
|
||||
{
|
||||
var educationLevelHigh = await _contextMetadata.EducationLevels.AsQueryable()
|
||||
var educationLevelHigh = await _contextOrg.educationLevel.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId);
|
||||
|
||||
if (educationLevelHigh == null)
|
||||
throw new Exception(GlobalMessages.EducationLevelNotFound);
|
||||
education.EducationLevelHighId = educationLevelHigh.Id;
|
||||
education.EducationLevelHighName = educationLevelHigh.Name;
|
||||
education.EducationLevelHighName = educationLevelHigh.name;
|
||||
}
|
||||
await _context.Educations.AddAsync(education);
|
||||
}
|
||||
|
|
@ -1155,24 +1153,24 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
candidate.Educations.FirstOrDefault().LastUpdateFullName = FullName ?? "";
|
||||
if (updated.EducationLevelExamId != null)
|
||||
{
|
||||
var educationLevelExam = await _contextMetadata.EducationLevels.AsQueryable()
|
||||
var educationLevelExam = await _contextOrg.educationLevel.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId);
|
||||
|
||||
if (educationLevelExam == null)
|
||||
throw new Exception(GlobalMessages.EducationLevelNotFound);
|
||||
candidate.Educations.FirstOrDefault().EducationLevelExamId = educationLevelExam.Id;
|
||||
candidate.Educations.FirstOrDefault().EducationLevelExamName = educationLevelExam.Name;
|
||||
candidate.Educations.FirstOrDefault().EducationLevelExamName = educationLevelExam.name;
|
||||
}
|
||||
|
||||
if (updated.EducationLevelHighId != null)
|
||||
{
|
||||
var educationLevelHigh = await _contextMetadata.EducationLevels.AsQueryable()
|
||||
var educationLevelHigh = await _contextOrg.educationLevel.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId);
|
||||
|
||||
if (educationLevelHigh == null)
|
||||
throw new Exception(GlobalMessages.EducationLevelNotFound);
|
||||
candidate.Educations.FirstOrDefault().EducationLevelHighId = educationLevelHigh.Id;
|
||||
candidate.Educations.FirstOrDefault().EducationLevelHighName = educationLevelHigh.Name;
|
||||
candidate.Educations.FirstOrDefault().EducationLevelHighName = educationLevelHigh.name;
|
||||
}
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
|
|
@ -1190,50 +1188,50 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
|
||||
if (updated.PrefixId != null)
|
||||
{
|
||||
var prefix = await _contextMetadata.Prefixes.AsQueryable()
|
||||
var prefix = await _contextOrg.prefixe.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.PrefixId));
|
||||
|
||||
if (prefix == null)
|
||||
throw new Exception(GlobalMessages.PrefixNotFound);
|
||||
|
||||
candidate.PrefixId = prefix.Id;
|
||||
candidate.PrefixName = prefix.Name;
|
||||
candidate.PrefixName = prefix.name;
|
||||
}
|
||||
|
||||
if (updated.RelationshipId != null)
|
||||
{
|
||||
var relationship = await _contextMetadata.Relationships.AsQueryable()
|
||||
var relationship = await _contextOrg.relationship.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RelationshipId));
|
||||
|
||||
if (relationship == null)
|
||||
throw new Exception(GlobalMessages.RelationshipNotFound);
|
||||
|
||||
candidate.RelationshipId = relationship.Id;
|
||||
candidate.RelationshipName = relationship.Name;
|
||||
candidate.RelationshipName = relationship.name;
|
||||
}
|
||||
|
||||
if (updated.CitizenProvinceId != null)
|
||||
{
|
||||
var citizenProvince = await _contextMetadata.Provinces.AsQueryable()
|
||||
var citizenProvince = await _contextOrg.province.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;
|
||||
candidate.CitizenProvinceName = citizenProvince.name;
|
||||
}
|
||||
|
||||
if (updated.CitizenDistrictId != null)
|
||||
{
|
||||
var citizenDistrict = await _contextMetadata.Districts.AsQueryable()
|
||||
var citizenDistrict = await _contextOrg.district.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.CitizenDistrictName = citizenDistrict.name;
|
||||
}
|
||||
|
||||
candidate.FirstName = updated.FirstName;
|
||||
|
|
@ -1310,76 +1308,76 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
|
||||
if (updated.RegistProvinceId != null)
|
||||
{
|
||||
var registProvince = await _contextMetadata.Provinces.AsQueryable()
|
||||
var registProvince = await _contextOrg.province.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistProvinceId));
|
||||
|
||||
if (registProvince == null)
|
||||
throw new Exception(GlobalMessages.ProvinceNotFound);
|
||||
|
||||
candidate.RegistProvinceId = registProvince.Id;
|
||||
candidate.RegistProvinceName = registProvince.Name;
|
||||
candidate.RegistProvinceName = registProvince.name;
|
||||
}
|
||||
|
||||
if (updated.RegistDistrictId != null)
|
||||
{
|
||||
var registDistrict = await _contextMetadata.Districts.AsQueryable()
|
||||
var registDistrict = await _contextOrg.district.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistDistrictId));
|
||||
|
||||
if (registDistrict == null)
|
||||
throw new Exception(GlobalMessages.DistrictNotFound);
|
||||
|
||||
candidate.RegistDistrictId = registDistrict.Id;
|
||||
candidate.RegistDistrictName = registDistrict.Name;
|
||||
candidate.RegistDistrictName = registDistrict.name;
|
||||
}
|
||||
|
||||
if (updated.RegistSubDistrictId != null)
|
||||
{
|
||||
var registSubDistrict = await _contextMetadata.SubDistricts.AsQueryable()
|
||||
var registSubDistrict = await _contextOrg.subDistrict.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.RegistSubDistrictId));
|
||||
|
||||
if (registSubDistrict == null)
|
||||
throw new Exception(GlobalMessages.SubDistrictNotFound);
|
||||
|
||||
candidate.RegistSubDistrictId = registSubDistrict.Id;
|
||||
candidate.RegistSubDistrictName = registSubDistrict.Name;
|
||||
candidate.RegistZipCode = registSubDistrict.ZipCode;
|
||||
candidate.RegistSubDistrictName = registSubDistrict.name;
|
||||
candidate.RegistZipCode = registSubDistrict.zipCode;
|
||||
}
|
||||
|
||||
if (updated.CurrentProvinceId != null)
|
||||
{
|
||||
var currentProvince = await _contextMetadata.Provinces.AsQueryable()
|
||||
var currentProvince = await _contextOrg.province.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentProvinceId));
|
||||
|
||||
if (currentProvince == null)
|
||||
throw new Exception(GlobalMessages.ProvinceNotFound);
|
||||
|
||||
candidate.CurrentProvinceId = currentProvince.Id;
|
||||
candidate.CurrentProvinceName = currentProvince.Name;
|
||||
candidate.CurrentProvinceName = currentProvince.name;
|
||||
}
|
||||
|
||||
if (updated.CurrentDistrictId != null)
|
||||
{
|
||||
var currentDistrict = await _contextMetadata.Districts.AsQueryable()
|
||||
var currentDistrict = await _contextOrg.district.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentDistrictId));
|
||||
|
||||
if (currentDistrict == null)
|
||||
throw new Exception(GlobalMessages.DistrictNotFound);
|
||||
|
||||
candidate.CurrentDistrictId = currentDistrict.Id;
|
||||
candidate.CurrentDistrictName = currentDistrict.Name;
|
||||
candidate.CurrentDistrictName = currentDistrict.name;
|
||||
}
|
||||
|
||||
if (updated.CurrentSubDistrictId != null)
|
||||
{
|
||||
var currentSubDistrict = await _contextMetadata.SubDistricts.AsQueryable()
|
||||
var currentSubDistrict = await _contextOrg.subDistrict.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.CurrentSubDistrictId));
|
||||
|
||||
if (currentSubDistrict == null)
|
||||
throw new Exception(GlobalMessages.SubDistrictNotFound);
|
||||
|
||||
candidate.CurrentSubDistrictId = currentSubDistrict.Id;
|
||||
candidate.CurrentSubDistrictName = currentSubDistrict.Name;
|
||||
candidate.CurrentZipCode = currentSubDistrict.ZipCode;
|
||||
candidate.CurrentSubDistrictName = currentSubDistrict.name;
|
||||
candidate.CurrentZipCode = currentSubDistrict.zipCode;
|
||||
}
|
||||
|
||||
candidate.RegistAddress = updated.RegistAddress;
|
||||
|
|
@ -1401,38 +1399,38 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
|
||||
if (updated.MarryPrefixId != null)
|
||||
{
|
||||
var prefix = await _contextMetadata.Prefixes.AsQueryable()
|
||||
var prefix = await _contextOrg.prefixe.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;
|
||||
candidate.MarryPrefixName = prefix.name;
|
||||
}
|
||||
|
||||
if (updated.FatherPrefixId != null)
|
||||
{
|
||||
var prefix = await _contextMetadata.Prefixes.AsQueryable()
|
||||
var prefix = await _contextOrg.prefixe.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;
|
||||
candidate.FatherPrefixName = prefix.name;
|
||||
}
|
||||
|
||||
if (updated.MotherPrefixId != null)
|
||||
{
|
||||
var prefix = await _contextMetadata.Prefixes.AsQueryable()
|
||||
var prefix = await _contextOrg.prefixe.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.MotherPrefixName = prefix.name;
|
||||
}
|
||||
|
||||
candidate.Marry = updated.Marry == null ? null : updated.Marry;
|
||||
|
|
@ -1485,14 +1483,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
|
||||
if (updated.ContactPrefixId != null)
|
||||
{
|
||||
var prefix = await _contextMetadata.Prefixes.AsQueryable()
|
||||
var prefix = await _contextOrg.prefixe.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == updated.ContactPrefixId);
|
||||
|
||||
if (prefix == null)
|
||||
throw new Exception(GlobalMessages.PrefixNotFound);
|
||||
|
||||
candidate.ContactPrefixId = prefix.Id;
|
||||
candidate.ContactPrefixName = prefix.Name;
|
||||
candidate.ContactPrefixName = prefix.name;
|
||||
}
|
||||
candidate.ContactFirstname = updated.ContactFirstname;
|
||||
candidate.ContactLastname = updated.ContactLastname;
|
||||
|
|
@ -1681,24 +1679,24 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
};
|
||||
if (updated.EducationLevelExamId != null)
|
||||
{
|
||||
var educationLevelExam = await _contextMetadata.EducationLevels.AsQueryable()
|
||||
var educationLevelExam = await _contextOrg.educationLevel.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId);
|
||||
|
||||
if (educationLevelExam == null)
|
||||
throw new Exception(GlobalMessages.EducationLevelNotFound);
|
||||
education.EducationLevelExamId = educationLevelExam.Id;
|
||||
education.EducationLevelExamName = educationLevelExam.Name;
|
||||
education.EducationLevelExamName = educationLevelExam.name;
|
||||
}
|
||||
|
||||
if (updated.EducationLevelHighId != null)
|
||||
{
|
||||
var educationLevelHigh = await _contextMetadata.EducationLevels.AsQueryable()
|
||||
var educationLevelHigh = await _contextOrg.educationLevel.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId);
|
||||
|
||||
if (educationLevelHigh == null)
|
||||
throw new Exception(GlobalMessages.EducationLevelNotFound);
|
||||
education.EducationLevelHighId = educationLevelHigh.Id;
|
||||
education.EducationLevelHighName = educationLevelHigh.Name;
|
||||
education.EducationLevelHighName = educationLevelHigh.name;
|
||||
}
|
||||
await _context.Educations.AddAsync(education);
|
||||
}
|
||||
|
|
@ -1715,24 +1713,24 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
candidate.Educations.FirstOrDefault().LastUpdateFullName = FullName ?? "";
|
||||
if (updated.EducationLevelExamId != null)
|
||||
{
|
||||
var educationLevelExam = await _contextMetadata.EducationLevels.AsQueryable()
|
||||
var educationLevelExam = await _contextOrg.educationLevel.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId);
|
||||
|
||||
if (educationLevelExam == null)
|
||||
throw new Exception(GlobalMessages.EducationLevelNotFound);
|
||||
candidate.Educations.FirstOrDefault().EducationLevelExamId = educationLevelExam.Id;
|
||||
candidate.Educations.FirstOrDefault().EducationLevelExamName = educationLevelExam.Name;
|
||||
candidate.Educations.FirstOrDefault().EducationLevelExamName = educationLevelExam.name;
|
||||
}
|
||||
|
||||
if (updated.EducationLevelHighId != null)
|
||||
{
|
||||
var educationLevelHigh = await _contextMetadata.EducationLevels.AsQueryable()
|
||||
var educationLevelHigh = await _contextOrg.educationLevel.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId);
|
||||
|
||||
if (educationLevelHigh == null)
|
||||
throw new Exception(GlobalMessages.EducationLevelNotFound);
|
||||
candidate.Educations.FirstOrDefault().EducationLevelHighId = educationLevelHigh.Id;
|
||||
candidate.Educations.FirstOrDefault().EducationLevelHighName = educationLevelHigh.Name;
|
||||
candidate.Educations.FirstOrDefault().EducationLevelHighName = educationLevelHigh.name;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1767,24 +1765,24 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
};
|
||||
if (updated.EducationLevelExamId != null)
|
||||
{
|
||||
var educationLevelExam = await _contextMetadata.EducationLevels.AsQueryable()
|
||||
var educationLevelExam = await _contextOrg.educationLevel.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId);
|
||||
|
||||
if (educationLevelExam == null)
|
||||
throw new Exception(GlobalMessages.EducationLevelNotFound);
|
||||
education.EducationLevelExamId = educationLevelExam.Id;
|
||||
education.EducationLevelExamName = educationLevelExam.Name;
|
||||
education.EducationLevelExamName = educationLevelExam.name;
|
||||
}
|
||||
|
||||
if (updated.EducationLevelHighId != null)
|
||||
{
|
||||
var educationLevelHigh = await _contextMetadata.EducationLevels.AsQueryable()
|
||||
var educationLevelHigh = await _contextOrg.educationLevel.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId);
|
||||
|
||||
if (educationLevelHigh == null)
|
||||
throw new Exception(GlobalMessages.EducationLevelNotFound);
|
||||
education.EducationLevelHighId = educationLevelHigh.Id;
|
||||
education.EducationLevelHighName = educationLevelHigh.Name;
|
||||
education.EducationLevelHighName = educationLevelHigh.name;
|
||||
}
|
||||
await _context.Educations.AddAsync(education);
|
||||
}
|
||||
|
|
@ -1801,24 +1799,24 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
candidate.Educations.FirstOrDefault().LastUpdateFullName = FullName ?? "";
|
||||
if (updated.EducationLevelExamId != null)
|
||||
{
|
||||
var educationLevelExam = await _contextMetadata.EducationLevels.AsQueryable()
|
||||
var educationLevelExam = await _contextOrg.educationLevel.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelExamId);
|
||||
|
||||
if (educationLevelExam == null)
|
||||
throw new Exception(GlobalMessages.EducationLevelNotFound);
|
||||
candidate.Educations.FirstOrDefault().EducationLevelExamId = educationLevelExam.Id;
|
||||
candidate.Educations.FirstOrDefault().EducationLevelExamName = educationLevelExam.Name;
|
||||
candidate.Educations.FirstOrDefault().EducationLevelExamName = educationLevelExam.name;
|
||||
}
|
||||
|
||||
if (updated.EducationLevelHighId != null)
|
||||
{
|
||||
var educationLevelHigh = await _contextMetadata.EducationLevels.AsQueryable()
|
||||
var educationLevelHigh = await _contextOrg.educationLevel.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == updated.EducationLevelHighId);
|
||||
|
||||
if (educationLevelHigh == null)
|
||||
throw new Exception(GlobalMessages.EducationLevelNotFound);
|
||||
candidate.Educations.FirstOrDefault().EducationLevelHighId = educationLevelHigh.Id;
|
||||
candidate.Educations.FirstOrDefault().EducationLevelHighName = educationLevelHigh.Name;
|
||||
candidate.Educations.FirstOrDefault().EducationLevelHighName = educationLevelHigh.name;
|
||||
}
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
|
|
@ -1868,7 +1866,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
// if (education == null)
|
||||
// throw new Exception(GlobalMessages.EducationNotFound);
|
||||
|
||||
// var educationLevel = await _contextMetadata.EducationLevels.AsQueryable()
|
||||
// var educationLevel = await _contextOrg.educationLevel.AsQueryable()
|
||||
// .FirstOrDefaultAsync(x => x.Id == Guid.Parse(updated.EducationLevelId));
|
||||
|
||||
// if (educationLevel == null)
|
||||
|
|
|
|||
|
|
@ -1,18 +1,14 @@
|
|||
using System.Security.Claims;
|
||||
using System.Text.Json;
|
||||
using BMA.EHR.Domain.Models.Placement;
|
||||
using BMA.EHR.Recurit.Exam.Service.Extensions;
|
||||
using BMA.EHR.Recurit.Exam.Service.Core;
|
||||
using BMA.EHR.Recurit.Exam.Service.Data;
|
||||
using BMA.EHR.Recurit.Exam.Service.Models;
|
||||
using BMA.EHR.Recurit.Exam.Service.Models.Documents;
|
||||
using BMA.EHR.Recurit.Exam.Service.Request;
|
||||
using BMA.EHR.Recurit.Exam.Service.Response;
|
||||
using BMA.EHR.Recurit.Exam.Service.Responses.Document;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OfficeOpenXml;
|
||||
using BMA.EHR.Domain.Models.Placement;
|
||||
using OfficeOpenXml.Style;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
|
|
@ -26,6 +22,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
|
||||
private readonly ApplicationDbContext _context;
|
||||
private readonly MetadataDbContext _contextMetadata;
|
||||
private readonly OrgDbContext _contextOrg;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly MinIOService _minioService;
|
||||
private readonly MailService _mailService;
|
||||
|
|
@ -37,6 +34,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
|
||||
public PeriodExamService(ApplicationDbContext context,
|
||||
MetadataDbContext contextMetadata,
|
||||
OrgDbContext contextOrg,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
MinIOService minioService,
|
||||
MailService mailService,
|
||||
|
|
@ -44,6 +42,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
{
|
||||
_context = context;
|
||||
_contextMetadata = contextMetadata;
|
||||
_contextOrg = contextOrg;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_minioService = minioService;
|
||||
_mailService = mailService;
|
||||
|
|
@ -92,33 +91,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
}
|
||||
}
|
||||
|
||||
private List<Guid?> GetAllIdByRoot(Guid id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var ret = new List<Guid?>();
|
||||
|
||||
var oc = _contextMetadata.Organizations.FirstOrDefault(x => x.Id == id && x.IsActive);
|
||||
if (oc != null)
|
||||
ret.Add(oc.Id);
|
||||
|
||||
var child = _contextMetadata.Organizations.AsQueryable().Where(x => x.ParentId == id && x.IsActive).ToList();
|
||||
if (child.Any())
|
||||
{
|
||||
foreach (var item in child)
|
||||
{
|
||||
ret.AddRange(GetAllIdByRoot(item.Id));
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<PeriodExamCandidateResponseItem>> GetsAsync(string type, bool showAll = true)
|
||||
{
|
||||
var periodExams = await _context.PeriodExams.AsQueryable()
|
||||
|
|
@ -126,11 +98,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
.Where(p => p.CheckDisability == false)
|
||||
.Where(p => type.ToUpper() == "ALL" ? (p.AnnouncementExam == true || p.AnnouncementExam == false) : (type.ToUpper() == "EXAM" ? p.AnnouncementExam == true : p.AnnouncementExam == false))
|
||||
.OrderByDescending(d => d.CreatedAt).ToListAsync();
|
||||
var profileOrganizations = await _contextMetadata.ProfileOrganizations.AsQueryable()
|
||||
.ToListAsync();
|
||||
var _periodExams = (from x in periodExams
|
||||
join po in profileOrganizations on Guid.Parse(x.CreatedUserId) equals po?.UserId into poGroup
|
||||
from po in poGroup.DefaultIfEmpty()
|
||||
select new PeriodExamCandidateResponseItem
|
||||
{
|
||||
ExamDate = x.ExamDate,
|
||||
|
|
@ -161,30 +129,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
Round = x.Round,
|
||||
SetSeat = x.SetSeat,
|
||||
Year = x.Year,
|
||||
OcId = po == null ? null : po.OrganizationId,
|
||||
CreatedUserId = x.CreatedUserId,
|
||||
}).AsQueryable()
|
||||
.ToList();
|
||||
|
||||
var roles = _httpContextAccessor?.HttpContext?.User?.FindAll(ClaimTypes.Role)?.Select(c => c.Value).ToList();
|
||||
// if (!roles.Contains("head"))
|
||||
// {
|
||||
// var criteria = new List<Guid?>();
|
||||
// var profileOrganization = await _contextMetadata.ProfileOrganizations.AsQueryable()
|
||||
// .FirstOrDefaultAsync(x => x.UserId == Guid.Parse(UserId));
|
||||
|
||||
// if (profileOrganization == null)
|
||||
// return new List<PeriodExamCandidateResponseItem>();
|
||||
|
||||
// var ocId = _contextMetadata.Organizations.AsQueryable()
|
||||
// .FirstOrDefault(x => x.Id == profileOrganization.OrganizationId);
|
||||
// if (ocId == null)
|
||||
// return new List<PeriodExamCandidateResponseItem>();
|
||||
// criteria = GetAllIdByRoot(ocId.Id);
|
||||
|
||||
// if (criteria.Any())
|
||||
// _periodExams = _periodExams.Where(x => x.CreatedUserId == UserId || criteria.Contains(x.OcId == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OcId)).ToList();
|
||||
// }
|
||||
return _periodExams;
|
||||
}
|
||||
|
||||
|
|
@ -1810,7 +1759,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
}
|
||||
if (careers.Count == 0)
|
||||
row++;
|
||||
Console.WriteLine(num);
|
||||
num = num + 1;
|
||||
}
|
||||
summarySheet.Cells[summarySheet.Dimension.Address].AutoFitColumns();
|
||||
|
|
@ -2080,13 +2028,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
throw new Exception(GlobalMessages.ExamNotFound);
|
||||
|
||||
var _placement = await _contextMetadata.Placements.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Name == periodExam.Name && x.Year == ((int)(periodExam.Year == null ? 0 : periodExam.Year)));
|
||||
.FirstOrDefaultAsync(x => x.PlacementType.Name == "สอบคัดเลือก" && x.RefId == periodExam.Id);
|
||||
if (_placement != null)
|
||||
throw new Exception("รอบการสอบนี้ได้ทำการบรรจุไปแล้ว");
|
||||
|
||||
var placement = new Placement
|
||||
{
|
||||
Name = periodExam.Name,
|
||||
RefId = periodExam.Id,
|
||||
Round = periodExam.Round == null ? "" : periodExam.Round.ToString(),
|
||||
Year = (int)(periodExam.Year == null ? 0 : periodExam.Year),
|
||||
Number = periodExam.Candidate.Where(x => x.Status.Contains("done")).Count(),
|
||||
|
|
@ -2126,65 +2075,50 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
}
|
||||
}
|
||||
|
||||
var profile = await _contextMetadata.Profiles
|
||||
.Include(x => x.Salaries)
|
||||
.FirstOrDefaultAsync(p => p.CitizenId == candidate.CitizenId);
|
||||
var Prefix = await _contextMetadata.Prefixes.Where(x => x.Id == candidate.PrefixId).FirstOrDefaultAsync() == null ? null : await _contextMetadata.Prefixes.Where(x => x.Id == candidate.PrefixId).FirstOrDefaultAsync();
|
||||
var Religion = await _contextMetadata.Religions.Where(x => x.Id == candidate.ReligionId).FirstOrDefaultAsync() == null ? null : await _contextMetadata.Prefixes.Where(x => x.Id == candidate.ReligionId).FirstOrDefaultAsync();
|
||||
var CitizenDistrict = await _contextMetadata.Districts.Where(x => x.Id == candidate.CitizenDistrictId).FirstOrDefaultAsync() == null ? null : await _contextMetadata.Prefixes.Where(x => x.Id == candidate.CitizenDistrictId).FirstOrDefaultAsync();
|
||||
var CitizenProvince = await _contextMetadata.Provinces.Where(x => x.Id == candidate.CitizenProvinceId).FirstOrDefaultAsync() == null ? null : await _contextMetadata.Prefixes.Where(x => x.Id == candidate.CitizenProvinceId).FirstOrDefaultAsync();
|
||||
var RegistProvince = await _contextMetadata.Provinces.Where(x => x.Id == candidate.RegistProvinceId).FirstOrDefaultAsync() == null ? null : await _contextMetadata.Prefixes.Where(x => x.Id == candidate.RegistProvinceId).FirstOrDefaultAsync();
|
||||
var RegistDistrict = await _contextMetadata.Districts.Where(x => x.Id == candidate.RegistDistrictId).FirstOrDefaultAsync() == null ? null : await _contextMetadata.Prefixes.Where(x => x.Id == candidate.RegistDistrictId).FirstOrDefaultAsync();
|
||||
var RegistSubDistrict = await _contextMetadata.SubDistricts.Where(x => x.Id == candidate.RegistSubDistrictId).FirstOrDefaultAsync() == null ? null : await _contextMetadata.Prefixes.Where(x => x.Id == candidate.RegistSubDistrictId).FirstOrDefaultAsync();
|
||||
var CurrentProvince = await _contextMetadata.Provinces.Where(x => x.Id == candidate.CurrentProvinceId).FirstOrDefaultAsync() == null ? null : await _contextMetadata.Prefixes.Where(x => x.Id == candidate.CurrentProvinceId).FirstOrDefaultAsync();
|
||||
var CurrentDistrict = await _contextMetadata.Districts.Where(x => x.Id == candidate.CurrentDistrictId).FirstOrDefaultAsync() == null ? null : await _contextMetadata.Prefixes.Where(x => x.Id == candidate.CurrentDistrictId).FirstOrDefaultAsync();
|
||||
var CurrentSubDistrict = await _contextMetadata.SubDistricts.Where(x => x.Id == candidate.CurrentSubDistrictId).FirstOrDefaultAsync() == null ? null : await _contextMetadata.Prefixes.Where(x => x.Id == candidate.CurrentSubDistrictId).FirstOrDefaultAsync();
|
||||
var MarryPrefix = await _contextMetadata.Prefixes.Where(x => x.Id == candidate.MarryPrefixId).FirstOrDefaultAsync() == null ? null : await _contextMetadata.Prefixes.Where(x => x.Id == candidate.MarryPrefixId).FirstOrDefaultAsync();
|
||||
var FatherPrefix = await _contextMetadata.Prefixes.Where(x => x.Id == candidate.FatherPrefixId).FirstOrDefaultAsync() == null ? null : await _contextMetadata.Prefixes.Where(x => x.Id == candidate.FatherPrefixId).FirstOrDefaultAsync();
|
||||
var MotherPrefix = await _contextMetadata.Prefixes.Where(x => x.Id == candidate.MotherPrefixId).FirstOrDefaultAsync() == null ? null : await _contextMetadata.Prefixes.Where(x => x.Id == candidate.MotherPrefixId).FirstOrDefaultAsync();
|
||||
var placementProfile = new PlacementProfile
|
||||
{
|
||||
Placement = placement,
|
||||
PositionCandidate = await _contextMetadata.PositionPaths.FirstOrDefaultAsync(x => x.Id == (candidate.PositionExam == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : candidate.PositionExam.PositionId)),
|
||||
positionName = candidate.PositionExam.PositionName,
|
||||
Prefix = Prefix == null ? null : Prefix.Name,
|
||||
ProfileImg = candidate.ProfileImg,
|
||||
PositionCandidate = candidate?.PositionExam?.PositionName ?? null,
|
||||
PositionLevel = candidate?.PositionExam?.PositionLevelName ?? null,
|
||||
PositionType = candidate.PositionExam == null ? null : (candidate.PositionExam.HighDegree == null ? null : (candidate.PositionExam.HighDegree == true ? "วิชาการ" : "ทั่วไป")),
|
||||
Prefix = candidate.PrefixName,
|
||||
// ProfileImg = candidate.ProfileImg,
|
||||
Firstname = candidate.FirstName,
|
||||
Lastname = candidate.LastName,
|
||||
Nationality = candidate.Nationality,
|
||||
DateOfBirth = candidate.DateOfBirth,
|
||||
Religion = Religion == null ? null : Religion.Name,
|
||||
Religion = candidate.ReligionName,
|
||||
Email = candidate.Email,
|
||||
CitizenId = candidate.CitizenId,
|
||||
CitizenDistrictId = CitizenDistrict == null ? null : CitizenDistrict.Id.ToString(),
|
||||
CitizenProvinceId = CitizenProvince == null ? null : CitizenProvince.Id.ToString(),
|
||||
CitizenDistrictId = candidate.CitizenDistrictId,
|
||||
CitizenProvinceId = candidate.CitizenProvinceId,
|
||||
CitizenDate = candidate.CitizenDate,
|
||||
Telephone = candidate.Telephone,
|
||||
MobilePhone = candidate.MobilePhone,
|
||||
Knowledge = candidate.Knowledge,
|
||||
RegistAddress = candidate.RegistAddress,
|
||||
RegistProvinceId = RegistProvince == null ? null : RegistProvince.Id.ToString(),
|
||||
RegistDistrictId = RegistDistrict == null ? null : RegistDistrict.Id.ToString(),
|
||||
RegistSubDistrictId = RegistSubDistrict == null ? null : RegistSubDistrict.Id.ToString(),
|
||||
RegistProvinceId = candidate.RegistProvinceId,
|
||||
RegistDistrictId = candidate.RegistDistrictId,
|
||||
RegistSubDistrictId = candidate.RegistSubDistrictId,
|
||||
RegistZipCode = candidate.RegistZipCode,
|
||||
RegistSame = candidate.RegistSame,
|
||||
CurrentAddress = candidate.CurrentAddress,
|
||||
CurrentProvinceId = CurrentProvince == null ? null : CurrentProvince.Id.ToString(),
|
||||
CurrentDistrictId = CurrentDistrict == null ? null : CurrentDistrict.Id.ToString(),
|
||||
CurrentSubDistrictId = CurrentSubDistrict == null ? null : CurrentSubDistrict.Id.ToString(),
|
||||
CurrentProvinceId = candidate.CurrentProvinceId,
|
||||
CurrentDistrictId = candidate.CurrentDistrictId,
|
||||
CurrentSubDistrictId = candidate.CurrentSubDistrictId,
|
||||
CurrentZipCode = candidate.CurrentZipCode,
|
||||
Marry = candidate.Marry,
|
||||
MarryPrefix = MarryPrefix == null ? null : MarryPrefix.Name,
|
||||
MarryPrefix = candidate.MarryPrefixName,
|
||||
MarryFirstName = candidate.MarryFirstName,
|
||||
MarryLastName = candidate.MarryLastName,
|
||||
MarryOccupation = candidate.MarryOccupation,
|
||||
MarryNationality = candidate.MarryNationality,
|
||||
FatherPrefix = FatherPrefix == null ? null : FatherPrefix.Name,
|
||||
FatherPrefix = candidate.FatherPrefixName,
|
||||
FatherFirstName = candidate.FatherFirstName,
|
||||
FatherLastName = candidate.FatherLastName,
|
||||
FatherOccupation = candidate.FatherOccupation,
|
||||
FatherNationality = candidate.FatherNationality,
|
||||
MotherPrefix = MotherPrefix == null ? null : MotherPrefix.Name,
|
||||
MotherPrefix = candidate.MotherPrefixName,
|
||||
MotherFirstName = candidate.MotherFirstName,
|
||||
MotherLastName = candidate.MotherLastName,
|
||||
MotherOccupation = candidate.MotherOccupation,
|
||||
|
|
@ -2195,8 +2129,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
OccupationSalary = candidate.OccupationSalary,
|
||||
OccupationPosition = candidate.OccupationPosition,
|
||||
OccupationPositionType = candidate.OccupationPositionType,
|
||||
PositionLevel = candidate.PositionExam.PositionLevelName,
|
||||
PositionType = candidate.PositionExam == null ? null : (candidate.PositionExam.HighDegree == null ? null : (candidate.PositionExam.HighDegree == true ? "วิชาการ":"ทั่วไป")),
|
||||
OccupationTelephone = candidate.OccupationTelephone,
|
||||
PointTotalA = candidate.PointTotalA == null ? null : Convert.ToDouble(candidate.PointTotalA),
|
||||
PointA = candidate.PointA == null ? null : Convert.ToDouble(candidate.PointA),
|
||||
|
|
@ -2210,9 +2142,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
PlacementStatus = "UN-CONTAIN",
|
||||
Pass = candidate.Pass,
|
||||
RemarkHorizontal = "โดยมีเงื่อนไขว่าต้องปฏิบัติงานให้กรุงเทพมหานครเป็นระยะเวลาไม่น้อยกว่า ๕ ปี นับแต่วันที่ได้รับการบรรจุและแต่งตั้ง โดยห้ามโอนไปหน่วยงานหรือส่วนราชการอื่น เว้นเเต่ลาออกจากราชการ",
|
||||
Amount = org == null || org.result == null ? null : org.result.amount,
|
||||
PositionSalaryAmount = org == null || org.result == null ? null : org.result.positionSalaryAmount,
|
||||
MouthSalaryAmount = org == null || org.result == null ? null : org.result.mouthSalaryAmount,
|
||||
Amount = org?.result?.amount ?? null,
|
||||
PositionSalaryAmount = org?.result?.positionSalaryAmount ?? null,
|
||||
MouthSalaryAmount = org?.result?.mouthSalaryAmount ?? null,
|
||||
CreatedAt = DateTime.Now,
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedFullName = FullName ?? "",
|
||||
|
|
@ -2220,36 +2152,34 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdateFullName = FullName ?? "",
|
||||
IsOfficer = IsOfficer,
|
||||
profileId = org == null || org.result == null ? null : org.result.profileId,
|
||||
profileId = org?.result?.profileId ?? null,
|
||||
IsOld = org == null || org.result == null ? false : true,
|
||||
AmountOld = org == null || org.result == null ? null : org.result.AmountOld,
|
||||
nodeOld = org == null || org.result == null ? null : org.result.node,
|
||||
nodeIdOld = org == null || org.result == null ? null : org.result.nodeId,
|
||||
posmasterIdOld = org == null || org.result == null ? null : org.result.posmasterId,
|
||||
rootOld = org == null || org.result == null ? null : org.result.root,
|
||||
rootIdOld = org == null || org.result == null ? null : org.result.rootId,
|
||||
rootShortNameOld = org == null || org.result == null ? null : org.result.rootShortName,
|
||||
child1Old = org == null || org.result == null ? null : org.result.child1,
|
||||
child1IdOld = org == null || org.result == null ? null : org.result.child1Id,
|
||||
child1ShortNameOld = org == null || org.result == null ? null : org.result.child1ShortName,
|
||||
child2Old = org == null || org.result == null ? null : org.result.child2,
|
||||
child2IdOld = org == null || org.result == null ? null : org.result.child2Id,
|
||||
child2ShortNameOld = org == null || org.result == null ? null : org.result.child2ShortName,
|
||||
child3Old = org == null || org.result == null ? null : org.result.child3,
|
||||
child3IdOld = org == null || org.result == null ? null : org.result.child3Id,
|
||||
child3ShortNameOld = org == null || org.result == null ? null : org.result.child3ShortName,
|
||||
child4Old = org == null || org.result == null ? null : org.result.child4,
|
||||
child4IdOld = org == null || org.result == null ? null : org.result.child4Id,
|
||||
child4ShortNameOld = org == null || org.result == null ? null : org.result.child4ShortName,
|
||||
orgRevisionIdOld = org == null || org.result == null ? null : org.result.orgRevisionId,
|
||||
// positionIdOld = org == null || org.result == null ? null : org.result.positionIdOld,
|
||||
posMasterNoOld = org == null || org.result == null ? null : org.result.posMasterNo,
|
||||
positionNameOld = org == null || org.result == null ? null : org.result.position,
|
||||
// positionFieldOld = org == null || org.result == null ? null : org.result.positionFieldOld,
|
||||
posTypeIdOld = org == null || org.result == null ? null : org.result.posTypeId,
|
||||
posTypeNameOld = org == null || org.result == null ? null : org.result.posTypeName,
|
||||
posLevelIdOld = org == null || org.result == null ? null : org.result.posLevelId,
|
||||
posLevelNameOld = org == null || org.result == null ? null : org.result.posLevelName,
|
||||
AmountOld = org?.result?.AmountOld ?? null,
|
||||
nodeOld = org?.result?.node ?? null,
|
||||
nodeIdOld = org?.result?.nodeId ?? null,
|
||||
posmasterIdOld = org?.result?.posmasterId ?? null,
|
||||
rootOld = org?.result?.root ?? null,
|
||||
rootIdOld = org?.result?.rootId ?? null,
|
||||
rootShortNameOld = org?.result?.rootShortName ?? null,
|
||||
child1Old = org?.result?.child1 ?? null,
|
||||
child1IdOld = org?.result?.child1Id ?? null,
|
||||
child1ShortNameOld = org?.result?.child1ShortName ?? null,
|
||||
child2Old = org?.result?.child2 ?? null,
|
||||
child2IdOld = org?.result?.child2Id ?? null,
|
||||
child2ShortNameOld = org?.result?.child2ShortName ?? null,
|
||||
child3Old = org?.result?.child3 ?? null,
|
||||
child3IdOld = org?.result?.child3Id ?? null,
|
||||
child3ShortNameOld = org?.result?.child3ShortName ?? null,
|
||||
child4Old = org?.result?.child4 ?? null,
|
||||
child4IdOld = org?.result?.child4Id ?? null,
|
||||
child4ShortNameOld = org?.result?.child4ShortName ?? null,
|
||||
orgRevisionIdOld = org?.result?.orgRevisionId ?? null,
|
||||
posMasterNoOld = org?.result?.posMasterNo ?? null,
|
||||
positionNameOld = org?.result?.position ?? null,
|
||||
posTypeIdOld = org?.result?.posTypeId ?? null,
|
||||
posTypeNameOld = org?.result?.posTypeName ?? null,
|
||||
posLevelIdOld = org?.result?.posLevelId ?? null,
|
||||
posLevelNameOld = org?.result?.posLevelName ?? null,
|
||||
};
|
||||
await _contextMetadata.PlacementProfiles.AddAsync(placementProfile);
|
||||
|
||||
|
|
@ -2258,7 +2188,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
var placementEducation = new PlacementEducation
|
||||
{
|
||||
PlacementProfile = placementProfile,
|
||||
EducationLevel = await _contextMetadata.EducationLevels.FirstOrDefaultAsync(x => x.Id == education.EducationLevelExamId),
|
||||
EducationLevelId = education.EducationLevelExamId,
|
||||
EducationLevelName = education.EducationLevelExamName,
|
||||
Field = education.EducationMajor,
|
||||
Gpa = education.EducationScores,
|
||||
Institute = education.EducationLocation,
|
||||
|
|
@ -2287,13 +2218,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
throw new Exception(GlobalMessages.ExamNotFound);
|
||||
|
||||
var _placement = await _contextMetadata.Placements.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Name == periodExam.Name && x.Year == ((int)(periodExam.Year == null ? 0 : periodExam.Year)));
|
||||
.FirstOrDefaultAsync(x => x.PlacementType.Name == "คัดเลือกคนพิการ" && x.RefId == periodExam.Id);
|
||||
if (_placement != null)
|
||||
throw new Exception("รอบการสอบนี้ได้ทำการบรรจุไปแล้ว");
|
||||
|
||||
var placement = new Placement
|
||||
{
|
||||
Name = periodExam.Name,
|
||||
RefId = periodExam.Id,
|
||||
Round = periodExam.Round == null ? "" : periodExam.Round.ToString(),
|
||||
Year = (int)(periodExam.Year == null ? 0 : periodExam.Year),
|
||||
Number = await _context.Disables.AsQueryable().Where(x => x.PeriodExam == periodExam).CountAsync(),
|
||||
|
|
@ -2356,21 +2288,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
.FirstOrDefaultAsync(x => x.ExamId == candidate.ExamId && x.ScoreImport == scoreImport);
|
||||
if (disableScore == null)
|
||||
continue;
|
||||
var profile = await _contextMetadata.Profiles
|
||||
.Include(x => x.Salaries)
|
||||
.FirstOrDefaultAsync(p => p.CitizenId == candidate.CitizenId);
|
||||
var CitizenProvince = await _contextMetadata.Provinces.Where(x => x.Name == candidate.CitizenCardIssuer).FirstOrDefaultAsync();
|
||||
var RegistProvince = candidate.Addresses.FirstOrDefault() == null ? null : await _contextMetadata.Provinces.Where(x => x.Name == candidate.Addresses.FirstOrDefault().Province).FirstOrDefaultAsync();
|
||||
var RegistDistrict = candidate.Addresses.FirstOrDefault() == null ? null : await _contextMetadata.Districts.Where(x => x.Name == candidate.Addresses.FirstOrDefault().District).FirstOrDefaultAsync();
|
||||
var RegistSubDistrict = candidate.Addresses.FirstOrDefault() == null ? null : await _contextMetadata.SubDistricts.Where(x => x.Name == candidate.Addresses.FirstOrDefault().Amphur).FirstOrDefaultAsync();
|
||||
var CurrentProvince = candidate.Addresses.FirstOrDefault() == null ? null : await _contextMetadata.Provinces.Where(x => x.Name == candidate.Addresses.FirstOrDefault().Province1).FirstOrDefaultAsync();
|
||||
var CurrentDistrict = candidate.Addresses.FirstOrDefault() == null ? null : await _contextMetadata.Districts.Where(x => x.Name == candidate.Addresses.FirstOrDefault().District1).FirstOrDefaultAsync();
|
||||
var CurrentSubDistrict = candidate.Addresses.FirstOrDefault() == null ? null : await _contextMetadata.SubDistricts.Where(x => x.Name == candidate.Addresses.FirstOrDefault().Amphur1).FirstOrDefaultAsync();
|
||||
var placementProfile = new PlacementProfile
|
||||
{
|
||||
Placement = placement,
|
||||
PositionCandidate = await _contextMetadata.PositionPaths.FirstOrDefaultAsync(x => x.Name == candidate.PositionName),
|
||||
positionName = candidate.PositionName,
|
||||
PositionCandidate = candidate.PositionName,
|
||||
PositionType = candidate.PositionType,
|
||||
PositionLevel = candidate.PositionLevel,
|
||||
Prefix = candidate.Prefix,
|
||||
Firstname = candidate.FirstName,
|
||||
Lastname = candidate.LastName,
|
||||
|
|
@ -2380,48 +2303,27 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
Religion = candidate.Religion,
|
||||
DateOfBirth = candidate.DateOfBirth,
|
||||
Relationship = candidate.Marry,
|
||||
// Email = candidate.Email,
|
||||
CitizenId = candidate.CitizenId,
|
||||
// CitizenDistrict = await _contextMetadata.Districts.FirstOrDefaultAsync(x => x.Id == candidate.CitizenDistrictId),
|
||||
CitizenProvinceId = CitizenProvince == null ? null : CitizenProvince.Id.ToString(),
|
||||
CitizenProvinceId = _contextOrg.province.FirstOrDefault(x => x.name == candidate.CitizenCardIssuer)?.Id ?? null,
|
||||
CitizenDate = candidate.CitizenCardExpireDate,
|
||||
Telephone = candidate.Addresses.FirstOrDefault() == null ? null : candidate.Addresses.FirstOrDefault().Telephone,
|
||||
MobilePhone = candidate.Addresses.FirstOrDefault() == null ? null : candidate.Addresses.FirstOrDefault().Mobile,
|
||||
// Knowledge = candidate.Knowledge,
|
||||
Telephone = candidate?.Addresses?.FirstOrDefault()?.Telephone ?? null,
|
||||
MobilePhone = candidate?.Addresses?.FirstOrDefault()?.Mobile ?? null,
|
||||
RegistAddress = $"{Address}{Moo}{Soi}{Road}",
|
||||
RegistProvinceId = RegistProvince == null ? null : RegistProvince.Id.ToString(),
|
||||
RegistDistrictId = RegistDistrict == null ? null : RegistDistrict.Id.ToString(),
|
||||
RegistSubDistrictId = RegistSubDistrict == null ? null : RegistSubDistrict.Id.ToString(),
|
||||
RegistZipCode = candidate.Addresses.FirstOrDefault() == null ? null : candidate.Addresses.FirstOrDefault().ZipCode,
|
||||
RegistProvinceId = _contextOrg.province.FirstOrDefault(x => x.name == (candidate!.Addresses!.FirstOrDefault()!.Province ?? ""))?.Id ?? null,
|
||||
RegistDistrictId = _contextOrg.district.FirstOrDefault(x => x.name == (candidate!.Addresses!.FirstOrDefault()!.District ?? ""))?.Id ?? null,
|
||||
RegistSubDistrictId = _contextOrg.subDistrict.FirstOrDefault(x => x.name == (candidate!.Addresses!.FirstOrDefault()!.Soi ?? ""))?.Id ?? null,
|
||||
RegistZipCode = candidate?.Addresses?.FirstOrDefault()?.ZipCode ?? null,
|
||||
RegistSame = false,
|
||||
CurrentAddress = $"{Address1}{Moo1}{Soi1}{Road1}",
|
||||
CurrentProvinceId = CurrentProvince == null ? null : CurrentProvince.Id.ToString(),
|
||||
CurrentDistrictId = CurrentDistrict == null ? null : CurrentDistrict.Id.ToString(),
|
||||
CurrentSubDistrictId = CurrentSubDistrict == null ? null : CurrentSubDistrict.Id.ToString(),
|
||||
CurrentZipCode = candidate.Addresses.FirstOrDefault() == null ? null : candidate.Addresses.FirstOrDefault().ZipCode1,
|
||||
Marry = candidate.Marry.Contains("สมรส"),
|
||||
// MarryPrefix = await _contextMetadata.Prefixes.FirstOrDefaultAsync(x => x.Id == candidate.MarryPrefixId),
|
||||
// MarryFirstName = candidate.MarryFirstName,
|
||||
// MarryLastName = candidate.MarryLastName,
|
||||
// MarryOccupation = candidate.MarryOccupation,
|
||||
// MarryNationality = candidate.MarryNationality,
|
||||
// FatherPrefix = await _contextMetadata.Prefixes.FirstOrDefaultAsync(x => x.Id == candidate.FatherPrefixId),
|
||||
// FatherFirstName = candidate.FatherFirstName,
|
||||
// FatherLastName = candidate.FatherLastName,
|
||||
// FatherOccupation = candidate.FatherOccupation,
|
||||
// FatherNationality = candidate.FatherNationality,
|
||||
// MotherPrefix = await _contextMetadata.Prefixes.FirstOrDefaultAsync(x => x.Id == candidate.MotherPrefixId),
|
||||
// MotherFirstName = candidate.MotherFirstName,
|
||||
// MotherLastName = candidate.MotherLastName,
|
||||
// MotherOccupation = candidate.MotherOccupation,
|
||||
// MotherNationality = candidate.MotherNationality,
|
||||
CurrentProvinceId = _contextOrg.province.FirstOrDefault(x => x.name == (candidate!.Addresses!.FirstOrDefault()!.Province1 ?? ""))?.Id ?? null,
|
||||
CurrentDistrictId = _contextOrg.district.FirstOrDefault(x => x.name == (candidate!.Addresses!.FirstOrDefault()!.District1 ?? ""))?.Id ?? null,
|
||||
CurrentSubDistrictId = _contextOrg.subDistrict.FirstOrDefault(x => x.name == (candidate!.Addresses!.FirstOrDefault()!.Soi1 ?? ""))?.Id ?? null,
|
||||
CurrentZipCode = candidate?.Addresses?.FirstOrDefault()?.ZipCode1 ?? null,
|
||||
Marry = candidate?.Marry?.Contains("สมรส") ?? false,
|
||||
|
||||
OccupationPositionType = "other",
|
||||
// OccupationCompany = candidate.OccupationCompany,
|
||||
// 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,
|
||||
OccupationTelephone = candidate?.Occupations?.FirstOrDefault()?.Telephone ?? null,
|
||||
OccupationPosition = candidate?.Occupations?.FirstOrDefault()?.Position ?? null,
|
||||
|
||||
PointTotalA = disableScore == null ? null : Convert.ToDouble(disableScore.FullA),
|
||||
PointA = disableScore == null ? null : Convert.ToDouble(disableScore.SumA),
|
||||
|
|
@ -2435,10 +2337,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
PlacementStatus = "UN-CONTAIN",
|
||||
Pass = disableScore == null ? null : disableScore.ExamStatus,
|
||||
RemarkHorizontal = "โดยมีเงื่อนไขว่าต้องปฏิบัติงานให้กรุงเทพมหานครเป็นระยะเวลาไม่น้อยกว่า ๕ ปี นับแต่วันที่ได้รับการบรรจุและแต่งตั้ง โดยห้ามโอนไปหน่วยงานหรือส่วนราชการอื่น เว้นเเต่ลาออกจากราชการ",
|
||||
// ReportingDate = DateTime.Now,
|
||||
Amount = org == null || org.result == null ? null : org.result.amount,
|
||||
PositionSalaryAmount = org == null || org.result == null ? null : org.result.positionSalaryAmount,
|
||||
MouthSalaryAmount = org == null || org.result == null ? null : org.result.mouthSalaryAmount,
|
||||
Amount = org?.result?.amount ?? null,
|
||||
PositionSalaryAmount = org?.result?.positionSalaryAmount ?? null,
|
||||
MouthSalaryAmount = org?.result?.mouthSalaryAmount ?? null,
|
||||
CreatedAt = DateTime.Now,
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedFullName = FullName ?? "",
|
||||
|
|
@ -2446,56 +2347,48 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdateFullName = FullName ?? "",
|
||||
IsOfficer = IsOfficer,
|
||||
profileId = org == null || org.result == null ? null : org.result.profileId,
|
||||
profileId = org?.result?.profileId ?? null,
|
||||
IsOld = org == null || org.result == null ? false : true,
|
||||
AmountOld = org == null || org.result == null ? null : org.result.AmountOld,
|
||||
nodeOld = org == null || org.result == null ? null : org.result.node,
|
||||
nodeIdOld = org == null || org.result == null ? null : org.result.nodeId,
|
||||
posmasterIdOld = org == null || org.result == null ? null : org.result.posmasterId,
|
||||
rootOld = org == null || org.result == null ? null : org.result.root,
|
||||
rootIdOld = org == null || org.result == null ? null : org.result.rootId,
|
||||
rootShortNameOld = org == null || org.result == null ? null : org.result.rootShortName,
|
||||
child1Old = org == null || org.result == null ? null : org.result.child1,
|
||||
child1IdOld = org == null || org.result == null ? null : org.result.child1Id,
|
||||
child1ShortNameOld = org == null || org.result == null ? null : org.result.child1ShortName,
|
||||
child2Old = org == null || org.result == null ? null : org.result.child2,
|
||||
child2IdOld = org == null || org.result == null ? null : org.result.child2Id,
|
||||
child2ShortNameOld = org == null || org.result == null ? null : org.result.child2ShortName,
|
||||
child3Old = org == null || org.result == null ? null : org.result.child3,
|
||||
child3IdOld = org == null || org.result == null ? null : org.result.child3Id,
|
||||
child3ShortNameOld = org == null || org.result == null ? null : org.result.child3ShortName,
|
||||
child4Old = org == null || org.result == null ? null : org.result.child4,
|
||||
child4IdOld = org == null || org.result == null ? null : org.result.child4Id,
|
||||
child4ShortNameOld = org == null || org.result == null ? null : org.result.child4ShortName,
|
||||
orgRevisionIdOld = org == null || org.result == null ? null : org.result.orgRevisionId,
|
||||
// positionIdOld = org == null || org.result == null ? null : org.result.positionIdOld,
|
||||
posMasterNoOld = org == null || org.result == null ? null : org.result.posMasterNo,
|
||||
positionNameOld = org == null || org.result == null ? null : org.result.position,
|
||||
// positionFieldOld = org == null || org.result == null ? null : org.result.positionFieldOld,
|
||||
posTypeIdOld = org == null || org.result == null ? null : org.result.posTypeId,
|
||||
posTypeNameOld = org == null || org.result == null ? null : org.result.posTypeName,
|
||||
posLevelIdOld = org == null || org.result == null ? null : org.result.posLevelId,
|
||||
posLevelNameOld = org == null || org.result == null ? null : org.result.posLevelName,
|
||||
AmountOld = org?.result?.AmountOld ?? null,
|
||||
nodeOld = org?.result?.node ?? null,
|
||||
nodeIdOld = org?.result?.nodeId ?? null,
|
||||
posmasterIdOld = org?.result?.posmasterId ?? null,
|
||||
rootOld = org?.result?.root ?? null,
|
||||
rootIdOld = org?.result?.rootId ?? null,
|
||||
rootShortNameOld = org?.result?.rootShortName ?? null,
|
||||
child1Old = org?.result?.child1 ?? null,
|
||||
child1IdOld = org?.result?.child1Id ?? null,
|
||||
child1ShortNameOld = org?.result?.child1ShortName ?? null,
|
||||
child2Old = org?.result?.child2 ?? null,
|
||||
child2IdOld = org?.result?.child2Id ?? null,
|
||||
child2ShortNameOld = org?.result?.child2ShortName ?? null,
|
||||
child3Old = org?.result?.child3 ?? null,
|
||||
child3IdOld = org?.result?.child3Id ?? null,
|
||||
child3ShortNameOld = org?.result?.child3ShortName ?? null,
|
||||
child4Old = org?.result?.child4 ?? null,
|
||||
child4IdOld = org?.result?.child4Id ?? null,
|
||||
child4ShortNameOld = org?.result?.child4ShortName ?? null,
|
||||
orgRevisionIdOld = org?.result?.orgRevisionId ?? null,
|
||||
posMasterNoOld = org?.result?.posMasterNo ?? null,
|
||||
positionNameOld = org?.result?.position ?? null,
|
||||
posTypeIdOld = org?.result?.posTypeId ?? null,
|
||||
posTypeNameOld = org?.result?.posTypeName ?? null,
|
||||
posLevelIdOld = org?.result?.posLevelId ?? null,
|
||||
posLevelNameOld = org?.result?.posLevelName ?? null,
|
||||
};
|
||||
await _contextMetadata.PlacementProfiles.AddAsync(placementProfile);
|
||||
|
||||
var placementEducation = new PlacementEducation
|
||||
{
|
||||
PlacementProfile = placementProfile,
|
||||
EducationLevel = await _contextMetadata.EducationLevels.FirstOrDefaultAsync(x => x.Name == (candidate.Educations.FirstOrDefault() == null ? null : candidate.Educations.FirstOrDefault().HighDegree)),
|
||||
Field = candidate.Educations.FirstOrDefault() == null ? null : candidate.Educations.FirstOrDefault().Major,
|
||||
Gpa = candidate.Educations.FirstOrDefault() == null ? null : candidate.Educations.FirstOrDefault().GPA.ToString(),
|
||||
Institute = candidate.Educations.FirstOrDefault() == null ? null : candidate.Educations.FirstOrDefault().University,
|
||||
Degree = candidate.Educations.FirstOrDefault() == null ? null : candidate.Educations.FirstOrDefault().Degree,
|
||||
// Country = education.Name,
|
||||
// Duration = education.Name,
|
||||
// Other = education.Name,
|
||||
// FundName = education.Name,
|
||||
// DurationYear = education.Name,
|
||||
FinishDate = candidate.Educations.FirstOrDefault() == null ? null : candidate.Educations.FirstOrDefault().BachelorDate,
|
||||
EducationLevelId = _contextOrg.educationLevel.FirstOrDefault(x => x.name == (candidate!.Educations!.FirstOrDefault()!.HighDegree ?? ""))?.Id ?? null,
|
||||
EducationLevelName = _contextOrg.educationLevel.FirstOrDefault(x => x.name == (candidate!.Educations!.FirstOrDefault()!.HighDegree ?? ""))?.name ?? null,
|
||||
Field = candidate?.Educations?.FirstOrDefault()?.Major ?? null,
|
||||
Gpa = candidate?.Educations?.FirstOrDefault()?.GPA!.ToString() ?? null,
|
||||
Institute = candidate?.Educations?.FirstOrDefault()?.University ?? null,
|
||||
Degree = candidate?.Educations?.FirstOrDefault()?.Degree ?? null,
|
||||
FinishDate = candidate?.Educations?.FirstOrDefault()?.BachelorDate ?? null,
|
||||
IsDate = true,
|
||||
// StartDate = education.DurationStart,
|
||||
// EndDate = education.DurationEnd,
|
||||
CreatedAt = DateTime.Now,
|
||||
CreatedUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
|
|
@ -2508,11 +2401,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
var placementCertificate = new PlacementCertificate
|
||||
{
|
||||
PlacementProfile = placementProfile,
|
||||
CertificateNo = candidate.Certificates.FirstOrDefault() == null ? null : candidate.Certificates.FirstOrDefault().CertificateNo,
|
||||
// Issuer = candidate.Certificates.FirstOrDefault() == null ? null : candidate.Certificates.FirstOrDefault().Issuer,
|
||||
IssueDate = candidate.Certificates.FirstOrDefault() == null ? null : candidate.Certificates.FirstOrDefault().IssueDate,
|
||||
ExpireDate = candidate.Certificates.FirstOrDefault() == null ? null : candidate.Certificates.FirstOrDefault().ExpiredDate,
|
||||
CertificateType = candidate.Certificates.FirstOrDefault() == null ? null : candidate.Certificates.FirstOrDefault().Description,
|
||||
CertificateNo = candidate?.Certificates?.FirstOrDefault()?.CertificateNo ?? null,
|
||||
IssueDate = candidate?.Certificates?.FirstOrDefault()?.IssueDate ?? null,
|
||||
ExpireDate = candidate?.Certificates?.FirstOrDefault()?.ExpiredDate ?? null,
|
||||
CertificateType = candidate?.Certificates?.FirstOrDefault()?.Description ?? null,
|
||||
CreatedAt = DateTime.Now,
|
||||
CreatedUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue