แก้สมัครสอบ
This commit is contained in:
parent
afc0cd830c
commit
07903d3b67
30 changed files with 3471 additions and 771 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue