api จัดรอบการสอบ

This commit is contained in:
Kittapath 2023-03-25 01:09:03 +07:00
parent 44d18ff74c
commit bd0f02feb1
24 changed files with 8532 additions and 33 deletions

477
.gitignore vendored Normal file
View file

@ -0,0 +1,477 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET
project.lock.json
project.fragment.lock.json
artifacts/
# Tye
.tye/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp
# Visual Studio 6 technical files
*.ncb
*.aps
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
# JetBrains Rider
*.sln.iml
##
## Visual studio for Mac
##
# globs
Makefile.in
*.userprefs
*.usertasks
config.make
config.status
aclocal.m4
install-sh
autom4te.cache/
*.tar.gz
tarballs/
test-results/
# Mac bundle stuff
*.dmg
*.app
# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk

View file

@ -1,4 +1,5 @@
using BMA.EHR.Recurit.Exam.Service.Request;
using BMA.EHR.Core;
using BMA.EHR.Recurit.Exam.Service.Request;
using BMA.EHR.Recurit.Exam.Service.Response;
using BMA.EHR.Recurit.Exam.Service.Services;
using Microsoft.AspNetCore.Authorization;
@ -50,6 +51,32 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
{
var items = await _candidateService.GetStatusCandidateService(examId);
return Success(GlobalMessages.Success, items);
}
catch (Exception 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("{candidateId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsAsync(string candidateId)
{
try
{
var items = await _candidateService.GetsAsync(candidateId);
return Success(items);
}
catch (Exception ex)
@ -423,6 +450,33 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
}
}
/// <summary>
/// ลบข้อมูล ประวัติการทำงาน/ฝึกงาน ผู้สมัคร
/// </summary>
/// <param name="careerId">รหัสประวัติการทำงาน/ฝึกงาน</param>
/// <param name="candidateCareer">ข้อมูลประวัติการทำงาน/ฝึกงาน</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการลบข้อมูล ประวัติการทำงาน/ฝึกงาน ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpDelete("career/{careerId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> UpdateAsyncCareer(string careerId)
{
try
{
await _candidateService.DeleteAsyncCareer(careerId);
return Success();
}
catch (Exception ex)
{
return Error(ex);
}
}
/// <summary>
/// อัพเดทข้อมูล ประวัติการศีกษา ผู้สมัคร
/// </summary>
@ -432,7 +486,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// <response code="200">เมื่อทำการอัพเดทข้อมูล ประวัติการศีกษา ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("career/{educationId:length(36)}")]
[HttpPut("education/{educationId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
@ -450,6 +504,33 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
}
}
/// <summary>
/// ลบข้อมูล ประวัติการศีกษา ผู้สมัคร
/// </summary>
/// <param name="educationId">รหัสประวัติการศีกษา</param>
/// <param name="candidateEducation">ข้อมูลประวัติการศีกษา</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการลบข้อมูล ประวัติการศีกษา ผู้สมัคร สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpDelete("education/{educationId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> DeleteAsyncEducation(string educationId)
{
try
{
await _candidateService.DeleteAsyncEducation(educationId);
return Success();
}
catch (Exception ex)
{
return Error(ex);
}
}
/// <summary>
/// ผู้สมัครทำการสมัครสอบ
/// </summary>
@ -492,7 +573,33 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
{
try
{
await _candidateService.AdminCheckCandidateService(candidate, item.Status ? "payment" : "rejectRegister");
await _candidateService.AdminCheckCandidateService(candidate, item.Status ? "payment" : "rejectRegister", item);
return Success();
}
catch (Exception ex)
{
return Error(ex);
}
}
/// <summary>
/// เจ้าหน้าที่ตรวจคุณสมบัติผู้สมัครไม่ผ่านและให้สมัครใหม่
/// </summary>
/// <param name="candidate">รหัสใบสมัคร</param>
/// <returns></returns>
/// <response code="200">เมื่อเจ้าหน้าที่ตรวจคุณสมบัติผู้สมัครไม่ผ่านและให้สมัครใหม่สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("reject-register/{candidate:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> RejectRegisterCandidateService(string candidate, RequestApprove item)
{
try
{
await _candidateService.AdminCheckCandidateService(candidate, "rejectDelete", item);
return Success();
}
@ -544,7 +651,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
{
try
{
await _candidateService.AdminCheckCandidateService(candidate, item.Status ? "pending" : "rejectPayment");
await _candidateService.AdminCheckCandidateService(candidate, item.Status ? "checkSeat" : "rejectPayment", item);
return Success();
}
@ -570,7 +677,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
{
try
{
await _candidateService.AdminCheckCandidateService(candidate, "done");
await _candidateService.AdminPassCandidateService(candidate, "done");
return Success();
}

View file

@ -162,6 +162,84 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
}
}
/// <summary>
/// รายชื่อผู้สมัครสอบรอ ตรวจสอบคุณสมบัติ
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านรายชื่อผู้สมัครสอบรอ ตรวจสอบคุณสมบัติสำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("register/{examId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsCandidateCheckRegisterAsync(string examId)
{
try
{
var items = await _periodExamService.GetsCandidateByStatusAsync(examId, "checkRegister");
return Success(items);
}
catch (Exception 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("payment/{examId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsCandidateCheckPaymentAsync(string examId)
{
try
{
var items = await _periodExamService.GetsCandidateByStatusAsync(examId, "checkPayment");
return Success(items);
}
catch (Exception 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("seat/{examId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetsCandidateCheckSeatAsync(string examId)
{
try
{
var items = await _periodExamService.GetsCandidateByStatusAsync(examId, "checkSeat");
return Success(items);
}
catch (Exception ex)
{
return Error(ex);
}
}
#endregion
}
}

View file

@ -100,6 +100,16 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnType("varchar(100)")
.HasComment("นามสกุลบิดา");
b.Property<string>("FatherNationality")
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasComment("สัญชาติบิดา");
b.Property<string>("FatherOccupation")
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasComment("อาชีพบิดา");
b.Property<Guid?>("FatherPrefixId")
.HasColumnType("char(36)");
@ -152,6 +162,16 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnType("varchar(100)")
.HasComment("นามสกุลคู่สมรส");
b.Property<string>("MarryNationality")
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasComment("สัญชาติคู่สมรส");
b.Property<string>("MarryOccupation")
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasComment("อาชีพคู่สมรส");
b.Property<Guid?>("MarryPrefixId")
.HasColumnType("char(36)");
@ -170,6 +190,16 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnType("varchar(100)")
.HasComment("นามสกุลมารดา");
b.Property<string>("MotherNationality")
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasComment("สัญชาติมารดา");
b.Property<string>("MotherOccupation")
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasComment("อาชีพมารดา");
b.Property<Guid?>("MotherPrefixId")
.HasColumnType("char(36)");
@ -192,6 +222,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnType("varchar(200)")
.HasComment("อีเมล บริษัท");
b.Property<string>("OccupationPosition")
.HasColumnType("longtext")
.HasComment("ตำแหน่งอาชีพ");
b.Property<string>("OccupationTelephone")
.HasMaxLength(20)
.HasColumnType("varchar(20)")
@ -229,6 +263,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnType("varchar(10)")
.HasComment("รหัสไปรษณีย์ที่อยู่ตามทะเบียนบ้าน");
b.Property<string>("RejectDetail")
.HasColumnType("longtext")
.HasComment("เหตุผลการไม่อนุมัติ");
b.Property<Guid?>("RelationshipId")
.HasColumnType("char(36)");
@ -517,9 +555,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnOrder(3)
.HasComment("ชื่อสถานศึกษา");
b.Property<int>("Scores")
b.Property<float>("Scores")
.HasMaxLength(10)
.HasColumnType("int")
.HasColumnType("float")
.HasColumnOrder(6)
.HasComment("คะแนนเฉลี่ยตลอดหลักสูตร");
@ -605,6 +643,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("AnnounceDate")
.HasColumnType("datetime(6)")
.HasColumnOrder(3)
.HasComment("วันประกาศ");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
@ -625,19 +668,20 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("Detail")
.IsRequired()
.HasColumnType("longtext")
.HasColumnOrder(4)
.HasComment("รายละเอียดสมัครสอบ");
b.Property<DateTime>("EndDate")
.HasColumnType("datetime(6)")
.HasColumnOrder(3)
.HasColumnOrder(2)
.HasComment("วันสิ้นสุด");
b.Property<float?>("Fee")
.HasColumnType("float")
.HasComment("ค่าธรรมเนียม");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(5)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
@ -663,14 +707,23 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.IsRequired()
.HasMaxLength(150)
.HasColumnType("varchar(150)")
.HasColumnOrder(1)
.HasColumnOrder(4)
.HasComment("ชื่อการสอบ");
b.Property<int?>("Round")
.HasColumnType("int")
.HasColumnOrder(5)
.HasComment("รอบการสอบ");
b.Property<DateTime>("StartDate")
.HasColumnType("datetime(6)")
.HasColumnOrder(2)
.HasColumnOrder(1)
.HasComment("วันเริ่มสมัครสอบ");
b.Property<int?>("Year")
.HasColumnType("int")
.HasComment("ปีงบประมาณ");
b.HasKey("Id");
b.ToTable("PeriodExams");

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,42 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recurit.Exam.Service.Migrations
{
/// <inheritdoc />
public partial class Updatetableeducationscroetofloat : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<float>(
name: "Scores",
table: "Educations",
type: "float",
maxLength: 10,
nullable: false,
comment: "คะแนนเฉลี่ยตลอดหลักสูตร",
oldClrType: typeof(int),
oldType: "int",
oldMaxLength: 10,
oldComment: "คะแนนเฉลี่ยตลอดหลักสูตร");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<int>(
name: "Scores",
table: "Educations",
type: "int",
maxLength: 10,
nullable: false,
comment: "คะแนนเฉลี่ยตลอดหลักสูตร",
oldClrType: typeof(float),
oldType: "float",
oldMaxLength: 10,
oldComment: "คะแนนเฉลี่ยตลอดหลักสูตร");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,44 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recurit.Exam.Service.Migrations
{
/// <inheritdoc />
public partial class UpdatetableCandidateaddoccupationnationoffamily : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "MarryNationality",
table: "Candidates",
type: "varchar(100)",
maxLength: 100,
nullable: true,
comment: "สัญชาติคู่สมรส")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "MarryOccupation",
table: "Candidates",
type: "varchar(100)",
maxLength: 100,
nullable: true,
comment: "อาชีพคู่สมรส")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "MarryNationality",
table: "Candidates");
migrationBuilder.DropColumn(
name: "MarryOccupation",
table: "Candidates");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,100 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recurit.Exam.Service.Migrations
{
/// <inheritdoc />
public partial class UpdatetableCandidateaddoccupationnationoffamily2 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "MarryOccupation",
table: "Candidates",
type: "varchar(200)",
maxLength: 200,
nullable: true,
comment: "อาชีพคู่สมรส",
oldClrType: typeof(string),
oldType: "varchar(100)",
oldMaxLength: 100,
oldNullable: true,
oldComment: "อาชีพคู่สมรส")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "FatherNationality",
table: "Candidates",
type: "varchar(100)",
maxLength: 100,
nullable: true,
comment: "สัญชาติบิดา")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "FatherOccupation",
table: "Candidates",
type: "varchar(200)",
maxLength: 200,
nullable: true,
comment: "อาชีพบิดา")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "MotherNationality",
table: "Candidates",
type: "varchar(100)",
maxLength: 100,
nullable: true,
comment: "สัญชาติมารดา")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "MotherOccupation",
table: "Candidates",
type: "varchar(200)",
maxLength: 200,
nullable: true,
comment: "อาชีพมารดา")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "FatherNationality",
table: "Candidates");
migrationBuilder.DropColumn(
name: "FatherOccupation",
table: "Candidates");
migrationBuilder.DropColumn(
name: "MotherNationality",
table: "Candidates");
migrationBuilder.DropColumn(
name: "MotherOccupation",
table: "Candidates");
migrationBuilder.AlterColumn<string>(
name: "MarryOccupation",
table: "Candidates",
type: "varchar(100)",
maxLength: 100,
nullable: true,
comment: "อาชีพคู่สมรส",
oldClrType: typeof(string),
oldType: "varchar(200)",
oldMaxLength: 200,
oldNullable: true,
oldComment: "อาชีพคู่สมรส")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recurit.Exam.Service.Migrations
{
/// <inheritdoc />
public partial class UpdatetableCandidateaddocposition : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "OccupationPosition",
table: "Candidates",
type: "longtext",
nullable: true,
comment: "ตำแหน่งอาชีพ")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "OccupationPosition",
table: "Candidates");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,214 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recurit.Exam.Service.Migrations
{
/// <inheritdoc />
public partial class UpdatetablePeriodExamaddfee : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
name: "StartDate",
table: "PeriodExams",
type: "datetime(6)",
nullable: false,
comment: "วันเริ่มสมัครสอบ",
oldClrType: typeof(DateTime),
oldType: "datetime(6)",
oldComment: "วันเริ่มสมัครสอบ")
.Annotation("Relational:ColumnOrder", 1)
.OldAnnotation("Relational:ColumnOrder", 2);
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "PeriodExams",
type: "varchar(150)",
maxLength: 150,
nullable: false,
comment: "ชื่อการสอบ",
oldClrType: typeof(string),
oldType: "varchar(150)",
oldMaxLength: 150,
oldComment: "ชื่อการสอบ")
.Annotation("MySql:CharSet", "utf8mb4")
.Annotation("Relational:ColumnOrder", 4)
.OldAnnotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:ColumnOrder", 1);
migrationBuilder.AlterColumn<bool>(
name: "IsActive",
table: "PeriodExams",
type: "tinyint(1)",
nullable: false,
comment: "สถานะการใช้งาน",
oldClrType: typeof(bool),
oldType: "tinyint(1)",
oldComment: "สถานะการใช้งาน")
.OldAnnotation("Relational:ColumnOrder", 5);
migrationBuilder.AlterColumn<DateTime>(
name: "EndDate",
table: "PeriodExams",
type: "datetime(6)",
nullable: false,
comment: "วันสิ้นสุด",
oldClrType: typeof(DateTime),
oldType: "datetime(6)",
oldComment: "วันสิ้นสุด")
.Annotation("Relational:ColumnOrder", 2)
.OldAnnotation("Relational:ColumnOrder", 3);
migrationBuilder.AlterColumn<string>(
name: "Detail",
table: "PeriodExams",
type: "longtext",
nullable: true,
comment: "รายละเอียดสมัครสอบ",
oldClrType: typeof(string),
oldType: "longtext",
oldComment: "รายละเอียดสมัครสอบ")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:ColumnOrder", 4);
migrationBuilder.AddColumn<float>(
name: "Fee",
table: "PeriodExams",
type: "float",
nullable: true,
comment: "ค่าธรรมเนียม");
migrationBuilder.AddColumn<int>(
name: "Round",
table: "PeriodExams",
type: "int",
nullable: true,
comment: "รอบการสอบ")
.Annotation("Relational:ColumnOrder", 5);
migrationBuilder.AddColumn<int>(
name: "Year",
table: "PeriodExams",
type: "int",
nullable: true,
comment: "ปีงบประมาณ");
migrationBuilder.AddColumn<DateTime>(
name: "announceDate",
table: "PeriodExams",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
comment: "วันประกาศ")
.Annotation("Relational:ColumnOrder", 3);
migrationBuilder.AddColumn<string>(
name: "RejectDetail",
table: "Candidates",
type: "longtext",
nullable: true,
comment: "เหตุผลการไม่อนุมัติ")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Fee",
table: "PeriodExams");
migrationBuilder.DropColumn(
name: "Round",
table: "PeriodExams");
migrationBuilder.DropColumn(
name: "Year",
table: "PeriodExams");
migrationBuilder.DropColumn(
name: "announceDate",
table: "PeriodExams");
migrationBuilder.DropColumn(
name: "RejectDetail",
table: "Candidates");
migrationBuilder.AlterColumn<DateTime>(
name: "StartDate",
table: "PeriodExams",
type: "datetime(6)",
nullable: false,
comment: "วันเริ่มสมัครสอบ",
oldClrType: typeof(DateTime),
oldType: "datetime(6)",
oldComment: "วันเริ่มสมัครสอบ")
.Annotation("Relational:ColumnOrder", 2)
.OldAnnotation("Relational:ColumnOrder", 1);
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "PeriodExams",
type: "varchar(150)",
maxLength: 150,
nullable: false,
comment: "ชื่อการสอบ",
oldClrType: typeof(string),
oldType: "varchar(150)",
oldMaxLength: 150,
oldComment: "ชื่อการสอบ")
.Annotation("MySql:CharSet", "utf8mb4")
.Annotation("Relational:ColumnOrder", 1)
.OldAnnotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:ColumnOrder", 4);
migrationBuilder.AlterColumn<bool>(
name: "IsActive",
table: "PeriodExams",
type: "tinyint(1)",
nullable: false,
comment: "สถานะการใช้งาน",
oldClrType: typeof(bool),
oldType: "tinyint(1)",
oldComment: "สถานะการใช้งาน")
.Annotation("Relational:ColumnOrder", 5);
migrationBuilder.AlterColumn<DateTime>(
name: "EndDate",
table: "PeriodExams",
type: "datetime(6)",
nullable: false,
comment: "วันสิ้นสุด",
oldClrType: typeof(DateTime),
oldType: "datetime(6)",
oldComment: "วันสิ้นสุด")
.Annotation("Relational:ColumnOrder", 3)
.OldAnnotation("Relational:ColumnOrder", 2);
migrationBuilder.UpdateData(
table: "PeriodExams",
keyColumn: "Detail",
keyValue: null,
column: "Detail",
value: "");
migrationBuilder.AlterColumn<string>(
name: "Detail",
table: "PeriodExams",
type: "longtext",
nullable: false,
comment: "รายละเอียดสมัครสอบ",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "รายละเอียดสมัครสอบ")
.Annotation("MySql:CharSet", "utf8mb4")
.Annotation("Relational:ColumnOrder", 4)
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,28 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recurit.Exam.Service.Migrations
{
/// <inheritdoc />
public partial class UpdatetablePeriodExamaddannounceDate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "announceDate",
table: "PeriodExams",
newName: "AnnounceDate");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "AnnounceDate",
table: "PeriodExams",
newName: "announceDate");
}
}
}

View file

@ -13,7 +13,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
public string UserId { get; set; } = string.Empty;
[Required, MaxLength(20), Comment("สถานะผู้สมัคร")]
public string status { get; set; } = "register";
public string Status { get; set; } = "register";
@ -109,6 +109,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[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("คำนำหน้าชื่อบิดา")]
public virtual Prefix? FatherPrefix { get; set; }
@ -118,6 +124,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[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("คำนำหน้าชื่อมารดา")]
public virtual Prefix? MotherPrefix { get; set; }
@ -127,11 +139,20 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[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? OccupationPosition { get; set; }
[Comment("สำนัก/บริษัท บริษัท")]
public string? OccupationCompany { get; set; }
@ -143,5 +164,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[MaxLength(20), Comment("โทรศัพท์ บริษัท")]
public string? OccupationTelephone { get; set; }
[Comment("เหตุผลการไม่อนุมัติ")]
public string? RejectDetail { get; set; }
}
}

View file

@ -16,7 +16,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
public string Major { get; set; } = string.Empty;
[Required, MaxLength(10), Column(Order = 6), Comment("คะแนนเฉลี่ยตลอดหลักสูตร")]
public int Scores { get; set; }
public float Scores { get; set; }
[Required, Column(Order = 3), Comment("ชื่อสถานศึกษา")]
public string Name { get; set; } = string.Empty;

View file

@ -6,19 +6,31 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
{
public class PeriodExam : EntityBase
{
[Required, MaxLength(150), Column(Order = 1), Comment("ชื่อการสอบ")]
[Required, MaxLength(150), Column(Order = 4), Comment("ชื่อการสอบ")]
public string Name { get; set; } = string.Empty;
[Required, Column(Order = 2), Comment("วันเริ่มสมัครสอบ")]
[Required, Column(Order = 1), Comment("วันเริ่มสมัครสอบ")]
public DateTime StartDate { get; set; } = DateTime.Now.Date;
[Required, Column(Order = 3), Comment("วันสิ้นสุด")]
[Required, Column(Order = 2), Comment("วันสิ้นสุด")]
public DateTime EndDate { get; set; } = DateTime.Now.Date;
[Required, Column(Order = 4), Comment("รายละเอียดสมัครสอบ")]
public string Detail { get; set; } = string.Empty;
[Column(Order = 5), Comment("รอบการสอบ")]
public int? Round { get; set; }
[Column(Order = 5), Comment("สถานะการใช้งาน")]
[Comment("ค่าธรรมเนียม")]
public float? Fee { get; set; }
[Comment("ปีงบประมาณ")]
public int? Year { get; set; }
[Comment("รายละเอียดสมัครสอบ")]
public string? Detail { get; set; }
[Required, Column(Order = 3), Comment("วันประกาศ")]
public DateTime AnnounceDate { get; set; } = DateTime.Now.Date;
[Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true;
}
}

View file

@ -5,7 +5,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
{
public string EducationLevelId { get; set; } = string.Empty;
public string Major { get; set; } = string.Empty;
public int Scores { get; set; }
public float Scores { get; set; }
public string Name { get; set; } = string.Empty;
public DateTime DurationStart { get; set; }
public DateTime DurationEnd { get; set; }

View file

@ -8,13 +8,19 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
public string? MarryPrefixId { get; set; }
public string? MarryFirstName { get; set; }
public string? MarryLastName { get; set; }
public string? MarryOccupation { get; set; }
public string? MarryNationality { get; set; }
public Models.Prefix? FatherPrefix { get; set; }
public string? FatherPrefixId { get; set; }
public string? FatherFirstName { get; set; }
public string? FatherLastName { get; set; }
public string? FatherOccupation { get; set; }
public string? FatherNationality { get; set; }
public Models.Prefix? MotherPrefix { get; set; }
public string? MotherPrefixId { get; set; }
public string? MotherFirstName { get; set; }
public string? MotherLastName { get; set; }
public string? MotherOccupation { get; set; }
public string? MotherNationality { get; set; }
}
}

View file

@ -12,5 +12,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
public string? OccupationEmail { get; set; }
public string? OccupationTelephone { get; set; }
public string? OccupationPosition { get; set; }
}
}

View file

@ -2,6 +2,7 @@
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.Request;
using BMA.EHR.Recurit.Exam.Service.Response;
using Microsoft.EntityFrameworkCore;
@ -37,6 +38,30 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
#region " Methods "
public async Task<Candidate> GetsAsync(string candidateId)
{
var candidate = await _context.Candidates.AsQueryable()
.Include(x => x.Prefix)
.Include(x => x.Relationship)
.Include(x => x.CitizenProvince)
.Include(x => x.CitizenDistrict)
.Include(x => x.RegistProvince)
.Include(x => x.RegistDistrict)
.Include(x => x.RegistSubDistrict)
.Include(x => x.CurrentProvince)
.Include(x => x.CurrentDistrict)
.Include(x => x.CurrentSubDistrict)
.Include(x => x.MarryPrefix)
.Include(x => x.FatherPrefix)
.Include(x => x.MotherPrefix)
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
return candidate;
}
public async Task<CandidateInformationResponseItem?> GetsAsyncInformation(string examId)
{
var exam = await _context.PeriodExams.AsQueryable()
@ -121,14 +146,20 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
MarryPrefixId = x.MarryPrefix != null ? x.MarryPrefix.Id.ToString() : null,
MarryFirstName = x.MarryFirstName,
MarryLastName = x.MarryLastName,
MarryOccupation = x.MarryOccupation,
MarryNationality = x.MarryNationality,
FatherPrefix = x.FatherPrefix,
FatherPrefixId = x.FatherPrefix != null ? x.FatherPrefix.Id.ToString() : null,
FatherFirstName = x.FatherFirstName,
FatherLastName = x.FatherLastName,
FatherOccupation = x.FatherOccupation,
FatherNationality = x.FatherNationality,
MotherPrefix = x.MotherPrefix,
MotherPrefixId = x.MotherPrefix != null ? x.MotherPrefix.Id.ToString() : null,
MotherFirstName = x.MotherFirstName,
MotherLastName = x.MotherLastName,
MotherOccupation = x.MotherOccupation,
MotherNationality = x.MotherNationality,
})
.FirstOrDefaultAsync();
}
@ -150,6 +181,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
OccupationDepartment = x.OccupationDepartment,
OccupationEmail = x.OccupationEmail,
OccupationTelephone = x.OccupationTelephone,
OccupationPosition = x.OccupationPosition,
})
.FirstOrDefaultAsync();
}
@ -163,7 +195,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
throw new Exception(GlobalMessages.ExamNotFound);
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId) && x.UserId == UserId);
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId);
return await _context.Careers.AsQueryable()
.Where(x => x.Candidate == candidate)
@ -180,9 +212,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
throw new Exception(GlobalMessages.ExamNotFound);
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId) && x.UserId == UserId);
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId);
return await _context.Educations.AsQueryable()
.Include(x => x.EducationLevel)
.Where(x => x.Candidate == candidate)
.OrderBy(d => d.DurationStart)
.ToListAsync();
@ -197,7 +230,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
throw new Exception(GlobalMessages.ExamNotFound);
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId) && x.UserId == UserId);
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId);
return candidate != null;
}
@ -427,10 +460,16 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
candidate.Marry = updated.Marry;
candidate.MarryFirstName = updated.MarryFirstName;
candidate.MarryLastName = updated.MarryLastName;
candidate.MarryOccupation = updated.MarryOccupation;
candidate.MarryNationality = updated.MarryNationality;
candidate.FatherFirstName = updated.FatherFirstName;
candidate.FatherLastName = updated.FatherLastName;
candidate.FatherOccupation = updated.FatherOccupation;
candidate.FatherNationality = updated.FatherNationality;
candidate.MotherFirstName = updated.MotherFirstName;
candidate.MotherLastName = updated.MotherLastName;
candidate.MotherOccupation = updated.MotherOccupation;
candidate.MotherNationality = updated.MotherNationality;
await _context.SaveChangesAsync();
}
@ -450,6 +489,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
candidate.OccupationDepartment = updated.OccupationDepartment;
candidate.OccupationEmail = updated.OccupationEmail;
candidate.OccupationTelephone = updated.OccupationTelephone;
candidate.OccupationPosition = updated.OccupationPosition;
await _context.SaveChangesAsync();
}
@ -539,6 +579,19 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
await _context.SaveChangesAsync();
}
public async Task DeleteAsyncCareer(string careerId)
{
var career = await _context.Careers.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(careerId));
if (career == null)
throw new Exception(GlobalMessages.CareerNotFound);
_context.Careers.Remove(career);
await _context.SaveChangesAsync();
}
public async Task UpdateAsyncEducation(string educationId, CandidateEducationResponseItem updated)
{
var education = await _context.Educations.AsQueryable()
@ -566,6 +619,19 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
await _context.SaveChangesAsync();
}
public async Task DeleteAsyncEducation(string educationId)
{
var education = await _context.Educations.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(educationId));
if (education == null)
throw new Exception(GlobalMessages.EducationNotFound);
_context.Educations.Remove(education);
await _context.SaveChangesAsync();
}
public async Task<string> GetStatusCandidateService(string examId)
{
var exam = await _context.PeriodExams.AsQueryable()
@ -580,7 +646,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
return candidate.status;
return candidate.Status;
}
public async Task UserCheckCandidateService(string examId, string status)
@ -597,12 +663,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
candidate.status = status;
candidate.Status = status;
await _context.SaveChangesAsync();
}
public async Task AdminCheckCandidateService(string candidateId, string status)
public async Task AdminCheckCandidateService(string candidateId, string status, RequestApprove item)
{
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
@ -610,7 +676,31 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
candidate.status = status;
if (status != "rejectDelete")
{
candidate.Status = status;
if (status == "rejectRegister" || status == "rejectPayment")
{
candidate.RejectDetail = item.Reason;
}
}
else
{
_context.Candidates.Remove(candidate);
}
await _context.SaveChangesAsync();
}
public async Task AdminPassCandidateService(string candidateId, string status)
{
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(candidateId));
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
candidate.Status = status;
await _context.SaveChangesAsync();
}

View file

@ -49,16 +49,29 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.ToListAsync();
}
public async Task<PeriodExam?> GetsExamAndCandidateAsync(string id, bool showAll = true)
public async Task<PeriodExam?> GetsExamAndCandidateAsync(string examId, bool showAll = true)
{
return await _context.PeriodExams.FirstOrDefaultAsync(x => x.Id == Guid.Parse(id));
var periodExam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
if (periodExam == null)
throw new Exception(GlobalMessages.ExamNotFound);
return periodExam;
}
public async Task CreateAsync(PeriodExam inserted)
{
var periodExam = new PeriodExam
{
//xxxxxxxxxxxxxxxxxxxxxxx
Name = inserted.Name,
StartDate = inserted.StartDate,
EndDate = inserted.EndDate,
Round = inserted.Round,
Fee = inserted.Fee,
Year = inserted.Year,
Detail = inserted.Detail,
AnnounceDate = inserted.AnnounceDate,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
@ -80,7 +93,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (periodExam == null)
throw new Exception(GlobalMessages.ExamNotFound);
//xxxxxxxxxxxxxxxxxxxxx
periodExam.Name = updated.Name;
periodExam.StartDate = updated.StartDate;
periodExam.EndDate = updated.EndDate;
periodExam.Round = updated.Round;
periodExam.Fee = updated.Fee;
periodExam.Year = updated.Year;
periodExam.Detail = updated.Detail;
periodExam.AnnounceDate = updated.AnnounceDate;
periodExam.IsActive = updated.IsActive;
periodExam.LastUpdatedAt = DateTime.Now;
periodExam.LastUpdateUserId = UserId ?? "";
@ -101,6 +121,19 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
await _context.SaveChangesAsync();
}
public async Task<IEnumerable<Candidate?>> GetsCandidateByStatusAsync(string examId, string status)
{
var periodExam = await _context.PeriodExams.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
if (periodExam == null)
throw new Exception(GlobalMessages.ExamNotFound);
return await _context.Candidates.AsQueryable()
.Where(x => x.PeriodExam == periodExam && x.Status == status)
.ToListAsync();
}
#endregion
}
}