ย้ายคนจากสรรหาไปบรรจุ

This commit is contained in:
Kittapath 2023-07-25 23:45:35 +07:00
parent afd9994783
commit 9a53f34107
15 changed files with 846 additions and 260 deletions

View file

@ -832,6 +832,31 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
return Error(ex); return Error(ex);
} }
} }
/// <summary>
/// โอนคนสรรหาไปบรรจุ
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <returns></returns>
/// <response code="200">เมื่อโอนคนสรรหาไปบรรจุสำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("placement/{examId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> UpdateAsyncCandidateToPlacement(Guid examId)
{
try
{
await _periodExamService.UpdateAsyncCandidateToPlacement(examId);
return Success();
}
catch (Exception ex)
{
return Error(ex);
}
}
#endregion #endregion
} }
} }

View file

@ -1,6 +1,7 @@
using BMA.EHR.Recurit.Exam.Service.Models; using BMA.EHR.Recurit.Exam.Service.Models;
using BMA.EHR.Recurit.Exam.Service.Models.Documents; using BMA.EHR.Recurit.Exam.Service.Models.Documents;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using BMA.EHR.Domain.Models.Placement;
namespace BMA.EHR.Recurit.Exam.Service.Data namespace BMA.EHR.Recurit.Exam.Service.Data
{ {
@ -54,5 +55,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Data
public DbSet<OrganizationOrganization> OrganizationOrganizations { get; set; } public DbSet<OrganizationOrganization> OrganizationOrganizations { get; set; }
public DbSet<OrganizationShortName> OrganizationShortNames { get; set; } public DbSet<OrganizationShortName> OrganizationShortNames { get; set; }
public DbSet<Placement> Placements { get; set; }
public DbSet<PlacementCertificate> PlacementCertificates { get; set; }
public DbSet<PlacementEducation> PlacementEducations { get; set; }
public DbSet<PlacementIsProperty> PlacementIsProperties { get; set; }
public DbSet<PlacementProfile> PlacementProfiles { get; set; }
public DbSet<PlacementType> PlacementTypes { get; set; }
public DbSet<PositionPath> PositionPaths { get; set; }
} }
} }

View file

@ -293,6 +293,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[Comment("วันที่ชำระเงิน")] [Comment("วันที่ชำระเงิน")]
public DateTime? PaymentDate { get; set; } public DateTime? PaymentDate { get; set; }
public virtual List<Education> Educations { get; set; } = new List<Education>();
} }
} }

View file

@ -0,0 +1,32 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace BMA.EHR.Recurit.Exam.Service.Models
{
public class EntityBaseNoIsActive
{
[Key, Column(Order = 0), Comment("PrimaryKey")]
[JsonPropertyName("id")]
public Guid Id { get; set; }
[Required, Column(Order = 100), Comment("สร้างข้อมูลเมื่อ")]
public DateTime CreatedAt { get; set; } = DateTime.Now;
[Column(Order = 101), Comment("User Id ที่สร้างข้อมูล"), MaxLength(40)]
public string CreatedUserId { get; set; } = string.Empty;
[Column(Order = 102), Comment("แก้ไขข้อมูลล่าสุดเมื่อ")]
public DateTime? LastUpdatedAt { get; set; }
[Column(Order = 103), Comment("User Id ที่แก้ไขข้อมูลล่าสุด"), MaxLength(40)]
public string LastUpdateUserId { get; set; } = string.Empty;
[Column(Order = 104), Comment("ชื่อ User ที่สร้างข้อมูล"), MaxLength(200)]
public string CreatedFullName { get; set; } = string.Empty;
[Column(Order = 105), Comment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"), MaxLength(200)]
public string LastUpdateFullName { get; set; } = string.Empty;
}
}

View file

@ -0,0 +1,28 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using BMA.EHR.Recurit.Exam.Service.Models;
namespace BMA.EHR.Domain.Models.Placement
{
public class Placement : EntityBaseNoIsActive
{
[Required, Comment("รอบการสอบ")]
public string Name { get; set; } = string.Empty;
[Comment("ครั้งที่")]
public string Round { get; set; } = string.Empty;
[Required, Comment("ปีงบประมาณ"), MaxLength(5)]
public int Year { get; set; }
[Required, Comment("จำนวนผู้สอบได้"), MaxLength(10)]
public int Number { get; set; } = 0;
[Required, Comment("ประเภทการสอบ")]
public required PlacementType PlacementType { get; set; }
[Required, Comment("วันที่เริ่มบัญชีบัญชี")]
public DateTime StartDate { get; set; }
[Required, Comment("วันที่สิ้นสุดบัญชี")]
public DateTime EndDate { get; set; }
[Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true;
public virtual List<PlacementProfile> PlacementProfiles { get; set; } = new List<PlacementProfile>();
}
}

View file

@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using BMA.EHR.Recurit.Exam.Service.Models;
namespace BMA.EHR.Domain.Models.Placement
{
public class PlacementCertificate : EntityBaseNoIsActive
{
[Required, Comment("Id ผู้สมัคร")]
public virtual PlacementProfile? PlacementProfile { get; set; }
[MaxLength(20), Comment("เลขที่ใบอนุญาต")]
public string? CertificateNo { get; set; }
[MaxLength(200), Comment("หน่วยงานผู้ออกใบอนุญาต")]
public string? Issuer { get; set; }
[Comment("วันที่ออกใบอนุญาต")]
public DateTime? IssueDate { get; set; }
[Comment("วันที่หมดอายุ")]
public DateTime? ExpireDate { get; set; }
[MaxLength(100), Comment("ชื่อใบอนุญาต")]
public string? CertificateType { get; set; }
}
}

View file

@ -0,0 +1,44 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using BMA.EHR.Recurit.Exam.Service.Models;
namespace BMA.EHR.Domain.Models.Placement
{
public class PlacementEducation : EntityBaseNoIsActive
{
[Required, Comment("Id ผู้สมัคร")]
public virtual PlacementProfile? PlacementProfile { get; set; }
[Comment("Idวุฒิที่ได้รับ")]
public virtual EducationLevel? EducationLevel { get; set; }
[MaxLength(1000), Comment("สถานศึกษา")]
public string? Institute { get; set; }
[MaxLength(200), Comment("วุฒิการศึกษา")]
public string? Degree { get; set; }
[MaxLength(200), Comment("สาขาวิชา/ทาง")]
public string? Field { get; set; }
[MaxLength(20), Comment("เกรดเฉลี่ย")]
public string? Gpa { get; set; }
[MaxLength(1000), Comment("ประเทศ")]
public string? Country { get; set; }
[MaxLength(1000), Comment("ระยะเวลา")]
public string? Duration { get; set; }
[MaxLength(1000), Comment("ข้อมูลการติดต่อ")]
public string? Other { get; set; }
[MaxLength(1000), Comment("ทุน")]
public string? FundName { get; set; }
[Comment("ระยะเวลาหลักสูตร")]
public int DurationYear { get; set; }
[Comment("วันที่สำเร็จการศึกษา")]
public DateTime? FinishDate { get; set; }
[Comment("ประเภทช่วงเวลาการศึกษา")]
public bool? IsDate { get; set; }
[Comment("ตั้งแต่")]
public DateTime? StartDate { get; set; }
[Comment("ถึง")]
public DateTime? EndDate { get; set; }
// [Comment("Id เป็นวุฒิการศึกษาในตำแหน่ง")]
// public PositionPath? PositionPath { get; set; }
[Comment("เป็นวุฒิศึกษาในตำแหน่ง")]
public bool? IsEducation { get; set; }
}
}

View file

@ -0,0 +1,15 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using BMA.EHR.Recurit.Exam.Service.Models;
namespace BMA.EHR.Domain.Models.Placement
{
public class PlacementIsProperty : EntityBaseNoIsActive
{
[Required, Comment("ชื่อคุณสมบัติ")]
public string Name { get; set; } = string.Empty;
[Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true;
}
}

View file

@ -0,0 +1,243 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using BMA.EHR.Recurit.Exam.Service.Models;
namespace BMA.EHR.Domain.Models.Placement
{
public class PlacementProfile : EntityBaseNoIsActive
{
[Comment("Id บรรจุ")]
public Placement? Placement { get; set; }
[Comment("Id คำนำหน้า")]
public Prefix? Prefix { get; set; }
[Comment("ชื่อ")]
public string? Firstname { get; set; }
[Comment("นามสกุล")]
public string? Lastname { get; set; }
// [Comment("Id เพศ")]
// public Gender? Gender { get; set; }
[Comment("Id ตำแหน่งที่สอบได้")]
public PositionPath? PositionCandidate { get; set; }
// [Comment("Id เลขที่ตำแหน่ง")]
// public OrganizationPositionEntity? OrganizationPosition { get; set; }
[Comment("วันที่บรรจุ")]
public DateTime? RecruitDate { get; set; }
[Comment("วันที่รายงานตัว")]
public DateTime? ReportingDate { get; set; }
[Comment("เงินเดือน")]
public double? Amount { get; set; }
[Comment("เงินประจำตำแหน่ง")]
public double? PositionSalaryAmount { get; set; }
[Comment("เงินค่าตอบแทนรายเดือน")]
public double? MouthSalaryAmount { get; set; }
[Comment("ตำแหน่ง (รายละเอียด)")]
public string? SalaryClass { get; set; }
[Comment("เอกสารอ้างอิง")]
public string? SalaryRef { get; set; }
[Comment("ข้าราชการฯ กทม.")]
public bool? IsOfficer { get; set; }
[Comment("สถานะการบรรจุ")]
public string PlacementStatus { get; set; } = "un-contain";
[Comment("เหตุผลสละสิทธิ์")]
public string? RejectReason { get; set; }
[Comment("ผ่อนผัน")]
public bool IsRelief { get; set; } = false;
[Comment("เหตุผลผ่อนผัน")]
public string? ReliefReason { get; set; }
// [Comment("Id เอกสารผ่อนผัน")]
// public Document? ReliefDoc { get; set; }
[Comment("การคัดกรองคุณสมบัติ")]
public string? IsProperty { get; set; }
[MaxLength(40), Comment("สัญชาติ")]
public string? Nationality { get; set; }
[MaxLength(40), Comment("เชื้อชาติ")]
public string? Race { get; set; }
[MaxLength(40), Comment("วันเกิด")]
public DateTime? DateOfBirth { get; set; }
[Comment("Id สถานภาพ")]
public Relationship? Relationship { get; set; }
// [Comment("Id กลุ่มเลือด")]
// public BloodGroup? BloodGroup { get; set; }
[Comment("Id ศาสนา")]
public Religion? Religion { get; set; }
[MaxLength(200), Comment("อีเมล")]
public string? Email { get; set; }
[MaxLength(20), Comment("เลขประจำตัวประชาชน")]
public string? CitizenId { get; set; }
[Comment("Id เขตที่ออกบัตรประชาชน")]
public District? CitizenDistrict { get; set; }
[Comment("Id จังหวัดที่ออกบัตรประชาชน")]
public Province? CitizenProvince { get; set; }
[Comment("วันที่ออกบัตร")]
public DateTime? CitizenDate { get; set; }
[MaxLength(20), Comment("โทรศัพท์")]
public string? Telephone { get; set; }
[MaxLength(20), Comment("โทรศัพท์มือถือ")]
public string? MobilePhone { get; set; }
[Comment("ความสามารถพิเศษ")]
public string? Knowledge { get; set; }
[Comment("ที่อยู่ตามทะเบียนบ้าน")]
public string? RegistAddress { get; set; }
[Comment("Id จังหวัดที่อยู่ตามทะเบียนบ้าน")]
public Province? RegistProvince { get; set; }
[Comment("Id อำเภอที่อยู่ตามทะเบียนบ้าน")]
public District? RegistDistrict { get; set; }
[Comment("Id ตำบลที่อยู่ตามทะเบียนบ้าน")]
public SubDistrict? RegistSubDistrict { get; set; }
[MaxLength(10), Comment("รหัสไปรษณีย์ที่อยู่ตามทะเบียนบ้าน")]
public string? RegistZipCode { get; set; }
[Comment("ที่อยู่ปัจจุบันเหมือนที่อยู่ตามทะเบียนบ้าน")]
public bool? RegistSame { get; set; }
[Comment("ที่อยู่ปัจจุบัน")]
public string? CurrentAddress { get; set; }
[Comment("Id จังหวัดที่อยู่ปัจจุบัน")]
public Province? CurrentProvince { get; set; }
[Comment("Id อำเภอที่อยู่ปัจจุบัน")]
public District? CurrentDistrict { get; set; }
[Comment("Id ตำบลที่อยู่ปัจจุบัน")]
public SubDistrict? CurrentSubDistrict { get; set; }
[MaxLength(10), Comment("รหัสไปรษณีย์ที่อยู่ปัจจุบัน")]
public string? CurrentZipCode { get; set; }
[Comment("คู่สมรส")]
public bool? Marry { get; set; }
[Comment("Id คำนำหน้าชื่อคู่สมรส")]
public Prefix? MarryPrefix { get; set; }
[MaxLength(100), Comment("ชื่อจริงคู่สมรส")]
public string? MarryFirstName { get; set; }
[MaxLength(100), Comment("นามสกุลคู่สมรส")]
public string? MarryLastName { get; set; }
[MaxLength(200), Comment("อาชีพคู่สมรส")]
public string? MarryOccupation { get; set; }
[MaxLength(100), Comment("สัญชาติคู่สมรส")]
public string? MarryNationality { get; set; }
[Comment("Id คำนำหน้าชื่อบิดา")]
public Prefix? FatherPrefix { get; set; }
[MaxLength(100), Comment("ชื่อจริงบิดา")]
public string? FatherFirstName { get; set; }
[MaxLength(100), Comment("นามสกุลบิดา")]
public string? FatherLastName { get; set; }
[MaxLength(200), Comment("อาชีพบิดา")]
public string? FatherOccupation { get; set; }
[MaxLength(100), Comment("สัญชาติบิดา")]
public string? FatherNationality { get; set; }
[Comment("Id คำนำหน้าชื่อมารดา")]
public Prefix? MotherPrefix { get; set; }
[MaxLength(100), Comment("ชื่อจริงมารดา")]
public string? MotherFirstName { get; set; }
[MaxLength(100), Comment("นามสกุลมารดา")]
public string? MotherLastName { get; set; }
[MaxLength(200), Comment("อาชีพมารดา")]
public string? MotherOccupation { get; set; }
[MaxLength(100), Comment("สัญชาติมารดา")]
public string? MotherNationality { get; set; }
[Comment("ประเภทอาชีพที่ทำงานมาก่อน")]
public string? OccupationType { get; set; }
[Comment("สำนัก/บริษัท บริษัท")]
public string? OccupationCompany { get; set; }
[Comment("กอง/ฝ่าย บริษัท")]
public string? OccupationDepartment { get; set; }
[MaxLength(200), Comment("อีเมล บริษัท")]
public string? OccupationEmail { get; set; }
[MaxLength(20), Comment("โทรศัพท์ บริษัท")]
public string? OccupationTelephone { get; set; }
[Comment("ตำแหน่งอาชีพ")]
public string? OccupationPosition { get; set; }
// [Comment("Id ตำแหน่งเลขที่")]
// public PositionNumberEntity? PositionNumber { get; set; }
// [Comment("Id ตำแหน่ง")]
// public PositionPath? PositionPath { get; set; }
// [Comment("Id ด้าน/สาขา")]
// public PositionPathSide? PositionPathSide { get; set; }
// [Comment("Id ประเภทตำแหน่ง")]
// public PositionType? PositionType { get; set; }
// [Comment("Id สายงาน")]
// public PositionLine? PositionLine { get; set; }
// [Comment("Id ระดับ")]
// public PositionLevel? PositionLevel { get; set; }
[Comment("คะแนนเต็มภาค ก")]
public double? PointTotalA { get; set; }
[Comment("คะแนนภาค ก")]
public double? PointA { get; set; }
[Comment("คะแนนเต็มภาค ข")]
public double? PointTotalB { get; set; }
[Comment("คะแนนภาค ข")]
public double? PointB { get; set; }
[Comment("คะแนนเต็มภาค ค")]
public double? PointTotalC { get; set; }
[Comment("คะแนนภาค ค")]
public double? PointC { get; set; }
[Comment("ลำดับที่สอบได้")]
public int ExamNumber { get; set; }
[Comment("จำนวนครั้งที่สมัครสอบ")]
public int ExamRound { get; set; }
[Comment("ผลสมัครสอบ")]
public string? Pass { get; set; }
[Comment("ข้อมูลตำแหน่ง Draft")]
public bool? Draft { get; set; }
public virtual List<PlacementCertificate> PlacementCertificates { get; set; } = new List<PlacementCertificate>();
public virtual List<PlacementEducation> PlacementEducations { get; set; } = new List<PlacementEducation>();
}
}

View file

@ -0,0 +1,15 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using BMA.EHR.Recurit.Exam.Service.Models;
namespace BMA.EHR.Domain.Models.Placement
{
public class PlacementType : EntityBaseNoIsActive
{
[Required, Comment("ชื่อประเภทบรรจุ")]
public string Name { get; set; } = string.Empty;
[Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true;
}
}

View file

@ -0,0 +1,19 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using BMA.EHR.Recurit.Exam.Service.Models;
using System.ComponentModel.DataAnnotations.Schema;
namespace BMA.EHR.Domain.Models.Placement
{
public class PositionPath : EntityBaseNoIsActive
{
[Required, MaxLength(100), Column(Order = 1), Comment("ชื่อสายงาน")]
public string Name { get; set; } = string.Empty;
[Column(Order = 2), Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true;
[Column(Order = 3), Comment("หมายเหตุ")]
public string Note { get; set; } = string.Empty;
}
}

View file

@ -1,5 +1,6 @@
using System.Security.Claims; using System.Security.Claims;
using System.Text.Json; using System.Text.Json;
using BMA.EHR.Domain.Models.Placement;
using BMA.EHR.Extensions; using BMA.EHR.Extensions;
using BMA.EHR.Recurit.Exam.Service.Core; using BMA.EHR.Recurit.Exam.Service.Core;
using BMA.EHR.Recurit.Exam.Service.Data; using BMA.EHR.Recurit.Exam.Service.Data;
@ -11,6 +12,7 @@ using BMA.EHR.Recurit.Exam.Service.Responses.Document;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using OfficeOpenXml; using OfficeOpenXml;
using BMA.EHR.Domain.Models.Placement;
namespace BMA.EHR.Recurit.Exam.Service.Services namespace BMA.EHR.Recurit.Exam.Service.Services
{ {
@ -1829,6 +1831,138 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
stream.Position = 0; stream.Position = 0;
return stream; return stream;
} }
public async Task UpdateAsyncCandidateToPlacement(Guid examId)
{
var periodExam = await _context.PeriodExams.AsQueryable()
.Include(x => x.Candidate)
.ThenInclude(x => x.Educations)
.Include(x => x.Candidate)
.ThenInclude(x => x.PositionExam)
.FirstOrDefaultAsync(x => x.Id == examId);
if (periodExam == null)
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)));
if (_placement != null)
throw new Exception("รอบการสอบนี้ได้ทำการบรรจุไปแล้ว");
var placement = new Placement
{
Name = periodExam.Name,
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(),
PlacementType = await _contextMetadata.PlacementTypes.FirstOrDefaultAsync(x => x.Name.Trim().ToUpper().Contains("คัดเลือก")) == null ? await _contextMetadata.PlacementTypes.FirstOrDefaultAsync() : await _contextMetadata.PlacementTypes.FirstOrDefaultAsync(x => x.Name.Trim().ToUpper().Contains("คัดเลือก")),
StartDate = DateTime.Now,
EndDate = DateTime.Now.AddYears(2).AddDays(-1),
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
CreatedFullName = FullName ?? "",
LastUpdatedAt = DateTime.Now,
LastUpdateUserId = UserId ?? "",
LastUpdateFullName = FullName ?? "",
};
await _contextMetadata.Placements.AddAsync(placement);
foreach (var candidate in periodExam.Candidate)
{
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)),
Prefix = await _contextMetadata.Prefixes.FirstOrDefaultAsync(x => x.Id == candidate.PrefixId),
Firstname = candidate.FirstName,
Lastname = candidate.LastName,
Nationality = candidate.Nationality,
DateOfBirth = candidate.DateOfBirth,
Relationship = await _contextMetadata.Relationships.FirstOrDefaultAsync(x => x.Id == candidate.RelationshipId),
Email = candidate.Email,
CitizenId = candidate.CitizenId,
CitizenDistrict = await _contextMetadata.Districts.FirstOrDefaultAsync(x => x.Id == candidate.CitizenDistrictId),
CitizenProvince = await _contextMetadata.Provinces.FirstOrDefaultAsync(x => x.Id == candidate.CitizenProvinceId),
CitizenDate = candidate.CitizenDate,
Telephone = candidate.Telephone,
MobilePhone = candidate.MobilePhone,
Knowledge = candidate.Knowledge,
RegistAddress = candidate.RegistAddress,
RegistProvince = await _contextMetadata.Provinces.FirstOrDefaultAsync(x => x.Id == candidate.RegistProvinceId),
RegistDistrict = await _contextMetadata.Districts.FirstOrDefaultAsync(x => x.Id == candidate.RegistDistrictId),
RegistSubDistrict = await _contextMetadata.SubDistricts.FirstOrDefaultAsync(x => x.Id == candidate.RegistSubDistrictId),
RegistZipCode = candidate.RegistZipCode,
RegistSame = candidate.RegistSame,
CurrentAddress = candidate.CurrentAddress,
CurrentProvince = await _contextMetadata.Provinces.FirstOrDefaultAsync(x => x.Id == candidate.CurrentProvinceId),
CurrentDistrict = await _contextMetadata.Districts.FirstOrDefaultAsync(x => x.Id == candidate.CurrentDistrictId),
CurrentSubDistrict = await _contextMetadata.SubDistricts.FirstOrDefaultAsync(x => x.Id == candidate.CurrentSubDistrictId),
CurrentZipCode = candidate.CurrentZipCode,
Marry = candidate.Marry,
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,
OccupationType = candidate.OccupationType,
OccupationCompany = candidate.OccupationCompany,
OccupationDepartment = candidate.OccupationDepartment,
OccupationEmail = candidate.OccupationEmail,
OccupationTelephone = candidate.OccupationTelephone,
OccupationPosition = candidate.OccupationPosition,
PointTotalA = Convert.ToDouble(candidate.PointTotalA),
PointA = Convert.ToDouble(candidate.PointA),
PointTotalB = Convert.ToDouble(candidate.PointTotalB),
PointB = Convert.ToDouble(candidate.PointB),
PointTotalC = Convert.ToDouble(candidate.PointTotalC),
PointC = Convert.ToDouble(candidate.PointC),
ExamNumber = Convert.ToInt32(candidate.Number),
ExamRound = 1,
IsRelief = false,
PlacementStatus = "UN-CONTAIN",
Pass = candidate.Pass,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
CreatedFullName = FullName ?? "",
LastUpdatedAt = DateTime.Now,
LastUpdateUserId = UserId ?? "",
LastUpdateFullName = FullName ?? "",
};
await _contextMetadata.PlacementProfiles.AddAsync(placementProfile);
foreach (var education in candidate.Educations)
{
var placementEducation = new PlacementEducation
{
PlacementProfile = placementProfile,
EducationLevel = await _contextMetadata.EducationLevels.FirstOrDefaultAsync(x => x.Id == education.EducationLevelId),
Field = education.Major,
Gpa = education.Scores.ToString(),
Institute = education.Name,
IsDate = true,
StartDate = education.DurationStart,
EndDate = education.DurationEnd,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
LastUpdateUserId = UserId ?? "",
CreatedFullName = FullName ?? "",
LastUpdateFullName = FullName ?? "",
};
await _contextMetadata.PlacementEducations.AddAsync(placementEducation);
}
}
await _contextMetadata.SaveChangesAsync();
}
#endregion #endregion
} }
} }

View file

@ -14,10 +14,10 @@
"AllowedHosts": "*", "AllowedHosts": "*",
"ConnectionStrings": { "ConnectionStrings": {
"MongoConnection": "mongodb://127.0.0.1:27017", "MongoConnection": "mongodb://127.0.0.1:27017",
"DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", // "DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
// "DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3308;database=bma_ehr_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_exam_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"MetadataConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" // "MetadataConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
// "MetadataConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3308;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" "MetadataConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
}, },
"Jwt": { "Jwt": {
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI", "Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",

View file

@ -14,10 +14,10 @@
"AllowedHosts": "*", "AllowedHosts": "*",
"ConnectionStrings": { "ConnectionStrings": {
"MongoConnection": "mongodb://127.0.0.1:27017", "MongoConnection": "mongodb://127.0.0.1:27017",
"DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", // "DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
// "DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3308;database=bma_ehr_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", "DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_exam_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"MetadataConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" // "MetadataConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
// "MetadataConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3308;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" "MetadataConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
}, },
"Jwt": { "Jwt": {
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI", "Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",

File diff suppressed because it is too large Load diff