Merge branch 'develop' into working

# Conflicts:
#	Controllers/DisableReportController.cs
This commit is contained in:
Suphonchai Phoonsawat 2023-06-17 06:06:18 +07:00
commit 072f150eed
34 changed files with 15259 additions and 2576 deletions

View file

@ -13,6 +13,7 @@ env:
IMAGE_NAME: ehr/bma-ehr-recruit-exam-service
DEPLOY_HOST: frappet.com
COMPOSE_PATH: /home/frappet/docker/bma-ehr-recruit-exam
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
jobs:
# act workflow_dispatch -W .github/workflows/release.yaml --input IMAGE_VER=test-v6.1 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd
@ -65,3 +66,21 @@ jobs:
docker-compose pull
docker-compose up -d
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
- uses: snow-actions/line-notify@v1.1.0
if: success()
with:
access_token: ${{ env.TOKEN_LINE }}
message: |
-Success✅✅✅
Image: ${{env.IMAGE_NAME}}
Version: ${{ github.event.inputs.IMAGE_VER }}
By: ${{secrets.DOCKER_USER}}
- uses: snow-actions/line-notify@v1.1.0
if: failure()
with:
access_token: ${{ env.TOKEN_LINE }}
message: |
-Failure❌❌❌
Image: ${{env.IMAGE_NAME}}
Version: ${{ github.event.inputs.IMAGE_VER }}
By: ${{secrets.DOCKER_USER}}

View file

@ -38,6 +38,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
#region " Fields "
private readonly ApplicationDbContext _context;
private readonly MetadataDbContext _contextMetadata;
private readonly MinIOService _minioService;
private readonly IWebHostEnvironment _webHostEnvironment;
private readonly DisableService _disableService;
@ -50,6 +51,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
#region " Constructor and Destructor "
public DisableController(ApplicationDbContext context,
MetadataDbContext contextMetadata,
MinIOService minioService,
IWebHostEnvironment webHostEnvironment,
DisableService disableService,
@ -57,6 +59,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
ILogger<DisableController> logger)
{
_context = context;
_contextMetadata = contextMetadata;
_minioService = minioService;
_webHostEnvironment = webHostEnvironment;
_disableService = disableService;
@ -175,6 +178,32 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
throw;
}
}
private List<Guid?> GetAllIdByRoot(Guid id)
{
try
{
var ret = new List<Guid?>();
var oc = _contextMetadata.Organizations.FirstOrDefault(x => x.Id == id && x.IsActive);
if (oc != null)
ret.Add(oc.Id);
var child = _contextMetadata.Organizations.AsQueryable().Where(x => x.ParentId == id && x.IsActive).ToList();
if (child.Any())
{
foreach (var item in child)
{
ret.AddRange(GetAllIdByRoot(item.Id));
}
}
return ret;
}
catch
{
throw;
}
}
#endregion
@ -659,11 +688,49 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
ImportDate = x.CreatedAt.Date.ToThaiShortDate(),
ScoreCount = x.ScoreImport.Scores.Count(),
}
},
x.CreatedUserId,
})
.ToListAsync();
var profileOrganizations = await _contextMetadata.ProfileOrganizations.AsQueryable()
.ToListAsync();
var _periodExams = (from x in data
join po in profileOrganizations on Guid.Parse(x.CreatedUserId) equals po?.UserId into poGroup
from po in poGroup.DefaultIfEmpty()
select new
{
x.Id,
x.Year,
x.Name,
x.Round,
x.ImportDate,
x.ExamCount,
x.Score,
x.CreatedUserId,
OcId = po == null ? null : po.OrganizationId,
}).AsQueryable()
.ToList();
return Success(data);
var roles = _httpContextAccessor?.HttpContext?.User?.FindAll(ClaimTypes.Role)?.Select(c => c.Value).ToList();
if (!roles.Contains("head"))
{
var criteria = new List<Guid?>();
var profileOrganization = await _contextMetadata.ProfileOrganizations.AsQueryable()
.FirstOrDefaultAsync(x => x.UserId == Guid.Parse(UserId));
if (profileOrganization == null)
return Success(new List<dynamic>());
var ocId = _contextMetadata.Organizations.AsQueryable()
.FirstOrDefault(x => x.Id == profileOrganization.OrganizationId);
if (ocId == null)
return Success(new List<dynamic>());
criteria = GetAllIdByRoot(ocId.Id);
if (criteria.Any())
_periodExams = _periodExams.Where(x => x.CreatedUserId == UserId || criteria.Contains(x.OcId == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OcId)).ToList();
}
return Success(_periodExams);
}
catch (Exception ex)
{
@ -1619,7 +1686,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
Number = sr == null ? "" : sr.Number,
CitizenId = p.CitizenId,
ExamCount = 0,
ScoreExpire = p.PeriodExam.AnnouncementDate == null ? "" : p.PeriodExam.AnnouncementDate.AddYears(2).ToThaiShortDate(),
ScoreExpire = p.PeriodExam.AnnouncementDate == null ? "" : p.PeriodExam.AnnouncementDate.Value.AddYears(2).ToThaiShortDate(),
ScoreResult = sr == null ? null : new
{
ScoreAFull = sr.FullA,
@ -1669,11 +1736,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
announcement_startDate = r.AnnouncementStartDate == null ? "" : r.AnnouncementStartDate.ToString("yyyy-mm-dd"),
announcement_endDate = r.AnnouncementEndDate == null ? "" : r.AnnouncementEndDate.ToString("yyyy-MM-dd"),
announcementExam = true,
register_startDate = r.RegisterStartDate == null ? "" : r.RegisterStartDate.ToString("yyyy-MM-dd"),
register_endDate = r.RegisterEndDate == null ? "" : r.RegisterEndDate.ToString("yyyy-MM-dd"),
payment_startDate = r.PaymentStartDate == null ? "" : r.PaymentStartDate.ToString("yyyy-MM-dd"),
payment_endDate = r.PaymentEndDate == null ? "" : r.PaymentEndDate.ToString("yyyy-MM-dd"),
exam_date = r.ExamDate == null ? "" : r.ExamDate.ToString("yyyy-MM-dd")
register_startDate = r.RegisterStartDate == null ? "" : r.RegisterStartDate.Value.ToString("yyyy-MM-dd"),
register_endDate = r.RegisterEndDate == null ? "" : r.RegisterEndDate.Value.ToString("yyyy-MM-dd"),
payment_startDate = r.PaymentStartDate == null ? "" : r.PaymentStartDate.Value.ToString("yyyy-MM-dd"),
payment_endDate = r.PaymentEndDate == null ? "" : r.PaymentEndDate.Value.ToString("yyyy-MM-dd"),
exam_date = r.ExamDate == null ? "" : r.ExamDate.Value.ToString("yyyy-MM-dd")
})
.ToList();

View file

@ -15,240 +15,240 @@ using BMA.EHR.Recurit.Exam.Service.Models;
namespace BMA.EHR.Recurit.Exam.Service.Controllers
{
[Route("api/v{version:apiVersion}/candidate/disable-exam/report")]
[ApiVersion("1.0")]
[ApiController]
[Produces("application/json")]
[Authorize]
[SwaggerTag("รายงานข้อมูลการสอบแข่งขัน")]
public class DisableReportController : BaseController
{
#region " Fields "
[Route("api/v{version:apiVersion}/candidate/disable-exam/report")]
[ApiVersion("1.0")]
[ApiController]
[Produces("application/json")]
[Authorize]
[SwaggerTag("รายงานข้อมูลการสอบแข่งขัน")]
public class DisableReportController : BaseController
{
#region " Fields "
private readonly ApplicationDbContext _context;
private readonly IWebHostEnvironment _hostingEnvironment;
private readonly IConfiguration _configuration;
private readonly string space = "";
private readonly ApplicationDbContext _context;
private readonly IWebHostEnvironment _hostingEnvironment;
private readonly IConfiguration _configuration;
private readonly string space = "";
#endregion
#endregion
#region " Constructor and Destructor "
#region " Constructor and Destructor "
public DisableReportController(ApplicationDbContext context,
IWebHostEnvironment hostingEnvironment,
IConfiguration configuration,
DisableService disableService)
{
this._context = context;
this._hostingEnvironment = hostingEnvironment;
this._configuration = configuration;
}
public DisableReportController(ApplicationDbContext context,
IWebHostEnvironment hostingEnvironment,
IConfiguration configuration,
DisableService disableService)
{
this._context = context;
this._hostingEnvironment = hostingEnvironment;
this._configuration = configuration;
}
#endregion
private int GetExamCountTes(string citizenId)
{
try
{
var count = _context.Candidates.AsQueryable()
.Where(x => x.CitizenId == citizenId)
.Count();
#endregion
private int GetExamCountTes(string citizenId)
{
try
{
var count = _context.Candidates.AsQueryable()
.Where(x => x.CitizenId == citizenId)
.Count();
return count;
}
catch
{
throw;
}
}
return count;
}
catch
{
throw;
}
}
#region " Methods "
#region " Methods "
/// <summary>
/// แสดงหนังสือรับรอง
/// </summary>
/// <param name="id">รหัสรอบการสอบ</param>
/// <param name="examId">เลขประจำตัวผู้สมัครสอบ</param>
/// <param name="type">ชนิดของรายงาน</param>
/// <returns></returns>
/// <response code="200">เมื่อแสดงรายงานสำเร็จ</response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
/// <summary>
/// แสดงหนังสือรับรอง
/// </summary>
/// <param name="id">รหัสรอบการสอบ</param>
/// <param name="examId">เลขประจำตัวผู้สมัครสอบ</param>
/// <param name="type">ชนิดของรายงาน</param>
/// <returns></returns>
/// <response code="200">เมื่อแสดงรายงานสำเร็จ</response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("certificate/{type:int}/{id:length(36)}/{examId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCertificateReportAsync(Guid id, string examId, int type)
{
try
{
var data = await _context.Disables.AsQueryable()
.Include(x => x.PeriodExam)
.Where(x => x.PeriodExam.Id == id)
.Where(x => x.ExamId == examId)
.Join(_context.DisableScores.AsQueryable()
.Include(x => x.ScoreImport),
rc => new { rc.PeriodExam.Year, rc.ExamId },
sc => new { sc.ScoreImport.Year, sc.ExamId },
(p, sr) => new
{
ExamID = p.ExamId,
p.CitizenId,
Order = p.PeriodExam.Round,
Year = p.PeriodExam.Year.Value.ToThaiYear(),
FullName = $"{p.Prefix}{p.FirstName} {p.LastName}",
ExamResult = sr == null ? "" : sr.ExamStatus,
EndDate = p.PeriodExam.RegisterEndDate.ToThaiFullDate3(),
AuthName = "นายณัฐพงศ์ ดิษยบุตร",
AuthPosition = "หัวหน้าสำนักงาน ก.ก."
})
.FirstOrDefaultAsync();
[HttpGet("certificate/{type:int}/{id:length(36)}/{examId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCertificateReportAsync(Guid id, string examId, int type)
{
try
{
var data = await _context.Disables.AsQueryable()
.Include(x => x.PeriodExam)
.Where(x => x.PeriodExam.Id == id)
.Where(x => x.ExamId == examId)
.Join(_context.DisableScores.AsQueryable()
.Include(x => x.ScoreImport),
rc => new { rc.PeriodExam.Year, rc.ExamId },
sc => new { sc.ScoreImport.Year, sc.ExamId },
(p, sr) => new
{
ExamID = p.ExamId,
p.CitizenId,
Order = p.PeriodExam.Round,
Year = p.PeriodExam.Year.Value.ToThaiYear(),
FullName = $"{p.Prefix}{p.FirstName} {p.LastName}",
ExamResult = sr == null ? "" : sr.ExamStatus,
EndDate = p.PeriodExam.RegisterEndDate == null ? null : p.PeriodExam.RegisterEndDate.Value.ToThaiFullDate3(),
AuthName = "นายณัฐพงศ์ ดิษยบุตร",
AuthPosition = "หัวหน้าสำนักงาน ก.ก."
})
.FirstOrDefaultAsync();
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Recruit", $"rptCertificate{type}.trdp");
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Recruit", $"rptCertificate{type}.trdp");
ReportPackager reportPackager = new ReportPackager();
Telerik.Reporting.Report? report = null;
using (var sourceStream = System.IO.File.OpenRead(rptFile))
{
report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
}
ReportPackager reportPackager = new ReportPackager();
Telerik.Reporting.Report? report = null;
using (var sourceStream = System.IO.File.OpenRead(rptFile))
{
report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
}
report.DataSource = data;
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
report.DataSource = data;
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
InstanceReportSource instanceReportSource = new InstanceReportSource()
{
ReportDocument = report
};
InstanceReportSource instanceReportSource = new InstanceReportSource()
{
ReportDocument = report
};
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo);
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo);
var content = result.DocumentBytes;
return File(content, "application/pdf", $"หนังสือรับรอง_{data.CitizenId}_{data.FullName}.pdf");
var content = result.DocumentBytes;
return File(content, "application/pdf", $"หนังสือรับรอง_{data.CitizenId}_{data.FullName}.pdf");
}
catch (Exception ex)
{
return Error(ex, "เกิดข้อผิดพลาดในการแสดงรายงาน");
}
}
}
catch (Exception ex)
{
return Error(ex, "เกิดข้อผิดพลาดในการแสดงรายงาน");
}
}
/// <summary>
/// แสดงเอกสารผลสอบ
/// </summary>
/// <param name="id">รหัสรอบการสอบ</param>
/// <param name="examId">เลขประจำตัวผู้สมัครสอบ</param>
/// <returns></returns>
/// <response code="200">เมื่อแสดงรายงานสำเร็จ</response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("score/{id:length(36)}/{examId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetScoreReportAsync(Guid id, string examId)
{
try
{
var data = await _context.Disables.AsQueryable()
.Include(x => x.PeriodExam)
.Include(x => x.Documents)
.ThenInclude(x => x.DocumentFile)
.Where(x => x.PeriodExam.Id == id)
.Where(x => x.ExamId == examId)
.Join(_context.DisableScores.AsQueryable()
.Include(x => x.ScoreImport),
rc => new { rc.PeriodExam.Year, rc.ExamId },
sc => new { sc.ScoreImport.Year, sc.ExamId },
(p, sr) => new
{
ExamId = p.ExamId,
CitizenId = p.CitizenId,
p.Prefix,
FullName = $"{p.Prefix}{p.FirstName} {p.LastName}",
DateOfBirth = p.DateOfBirth.ToThaiShortDate(),
Gender = p.Gendor,
Degree = p.Educations.First().Degree,
Major = p.Educations.First().Major,
ExamResult = sr == null ? "" : sr.ExamStatus,
University = p.Educations.First().University,
PositionName = p.PositionName,
ExamName = $"{p.PeriodExam.Name} ครั้งที่ {p.PeriodExam.Round}/{p.PeriodExam.Year.Value.ToThaiYear()}",
Number = sr == null ? "" : sr.Number,
// ExamCount = 10,
// ExamCount = GetExamCountTes(p.CitizenId),
ScoreExpire = p.PeriodExam.AnnouncementDate == null ? "" : p.PeriodExam.AnnouncementDate.AddYears(2).ToThaiShortDate(),
FullA = sr == null ? 0 : sr.FullA,
SumA = sr == null ? 0 : sr.SumA,
FullB = sr == null ? 0 : sr.FullB,
SumB = sr == null ? 0 : sr.SumB,
FullC = sr == null ? 0 : sr.FullC,
SumC = sr == null ? 0 : sr.SumC,
})
.FirstOrDefaultAsync();
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Recruit", $"rptExamResult.trdp");
ReportPackager reportPackager = new ReportPackager();
Telerik.Reporting.Report? report = null;
using (var sourceStream = System.IO.File.OpenRead(rptFile))
{
report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
}
/// <summary>
/// แสดงเอกสารผลสอบ
/// </summary>
/// <param name="id">รหัสรอบการสอบ</param>
/// <param name="examId">เลขประจำตัวผู้สมัครสอบ</param>
/// <returns></returns>
/// <response code="200">เมื่อแสดงรายงานสำเร็จ</response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("score/{id:length(36)}/{examId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetScoreReportAsync(Guid id, string examId)
{
try
{
var data = await _context.Disables.AsQueryable()
.Include(x => x.PeriodExam)
.Include(x => x.Documents)
.ThenInclude(x => x.DocumentFile)
.Where(x => x.PeriodExam.Id == id)
.Where(x => x.ExamId == examId)
.Join(_context.DisableScores.AsQueryable()
.Include(x => x.ScoreImport),
rc => new { rc.PeriodExam.Year, rc.ExamId },
sc => new { sc.ScoreImport.Year, sc.ExamId },
(p, sr) => new
{
ExamId = p.ExamId,
CitizenId = p.CitizenId,
p.Prefix,
FullName = $"{p.Prefix}{p.FirstName} {p.LastName}",
DateOfBirth = p.DateOfBirth.ToThaiShortDate(),
Gender = p.Gendor,
Degree = p.Educations.First().Degree,
Major = p.Educations.First().Major,
ExamResult = sr == null ? "" : sr.ExamStatus,
University = p.Educations.First().University,
PositionName = p.PositionName,
ExamName = $"{p.PeriodExam.Name} ครั้งที่ {p.PeriodExam.Round}/{p.PeriodExam.Year.Value.ToThaiYear()}",
Number = sr == null ? "" : sr.Number,
// ExamCount = 10,
// ExamCount = GetExamCountTes(p.CitizenId),
ScoreExpire = p.PeriodExam.AnnouncementDate == null ? "" : p.PeriodExam.AnnouncementDate.Value.AddYears(2).ToThaiShortDate(),
FullA = sr == null ? 0 : sr.FullA,
SumA = sr == null ? 0 : sr.SumA,
FullB = sr == null ? 0 : sr.FullB,
SumB = sr == null ? 0 : sr.SumB,
FullC = sr == null ? 0 : sr.FullC,
SumC = sr == null ? 0 : sr.SumC,
})
.FirstOrDefaultAsync();
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Recruit", $"rptExamResult.trdp");
ReportPackager reportPackager = new ReportPackager();
Telerik.Reporting.Report report = null;
using (var sourceStream = System.IO.File.OpenRead(rptFile))
{
report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
}
report.DataSource = data;
if (data != null)
{
var _data = new
{
ExamId = data.ExamId,
CitizenId = data.CitizenId,
Prefix = data.Prefix,
FullName = data.FullName,
DateOfBirth = data.DateOfBirth,
Gender = data.Gender,
Degree = data.Degree,
Major = data.Major,
ExamResult = data.ExamResult,
University = data.University,
PositionName = data.PositionName,
ExamName = data.ExamName,
Number = data.Number,
ExamCount = GetExamCountTes(data.CitizenId),
ScoreExpire = data.ScoreExpire,
FullA = data.FullA,
SumA = data.SumA,
FullB = data.FullB,
SumB = data.SumB,
FullC = data.FullC,
SumC = data.SumC,
};
report.DataSource = _data;
}
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
report.DataSource = data;
if (data != null)
{
var _data = new
{
ExamId = data.ExamId,
CitizenId = data.CitizenId,
Prefix = data.Prefix,
FullName = data.FullName,
DateOfBirth = data.DateOfBirth,
Gender = data.Gender,
Degree = data.Degree,
Major = data.Major,
ExamResult = data.ExamResult,
University = data.University,
PositionName = data.PositionName,
ExamName = data.ExamName,
Number = data.Number,
ExamCount = GetExamCountTes(data.CitizenId),
ScoreExpire = data.ScoreExpire,
FullA = data.FullA,
SumA = data.SumA,
FullB = data.FullB,
SumB = data.SumB,
FullC = data.FullC,
SumC = data.SumC,
};
report.DataSource = _data;
}
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
InstanceReportSource instanceReportSource = new InstanceReportSource()
{
ReportDocument = report
};
InstanceReportSource instanceReportSource = new InstanceReportSource()
{
ReportDocument = report
};
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo);
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo);
var content = result.DocumentBytes;
return File(content, "application/pdf", $"ผลคะแนนสอบ_{data.CitizenId}_{data.FullName}.pdf");
}
catch (Exception ex)
{
return Error(ex, "เกิดข้อผิดพลาดในการแสดงรายงาน");
}
}
var content = result.DocumentBytes;
return File(content, "application/pdf", $"ผลคะแนนสอบ_{data.CitizenId}_{data.FullName}.pdf");
}
catch (Exception ex)
{
return Error(ex, "เกิดข้อผิดพลาดในการแสดงรายงาน");
}
}
#endregion
}
#endregion
}
}

View file

@ -804,6 +804,34 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
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("download/payment/{examId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> DownloadCandidatePaymentAllAsync(string examId)
{
try
{
var stream = await _periodExamService.DownloadCandidatePaymentAllAsync(examId);
string excelName = $"Candidate_Payment_{DateTime.Now.ToString("yyyyMMddHHmmssfff")}.xlsx";
return File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", excelName);
// return Success();
}
catch (Exception ex)
{
return Error(ex);
}
}
#endregion
}
}

View file

@ -23,5 +23,6 @@
public const string ReligionNotFound = "ไม่พบข้อมูลศาสนา";
public const string SubDistrictNotFound = "ไม่พบข้อมูลตำบล/แขวง";
public const string CMSNotFound = "ไม่พบข้อมูล CMS";
public const string OrganizationNotFound = "ไม่พบข้อมูลสังกัด";
}
}

View file

@ -33,6 +33,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Data
}
}
public DbSet<BMA.EHR.Profile.Service.Models.HR.ProfileOrganization> ProfileOrganizations { get; set; }
public DbSet<BMA.EHR.Profile.Service.Models.HR.Profile> Profiles { get; set; }
public DbSet<BMA.EHR.Profile.Service.Models.HR.OrganizationEntity> Organizations { get; set; }
public DbSet<Prefix> Prefixes { get; set; }

View file

@ -59,6 +59,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(106)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
@ -119,6 +124,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(106)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
@ -204,6 +214,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnType("longtext")
.HasComment("อำเภอ");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(106)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
@ -304,6 +319,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(106)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
@ -472,6 +492,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnOrder(1)
.HasComment("ชื่อจริง");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(106)
.HasComment("สถานะการใช้งาน");
b.Property<string>("Knowledge")
.HasColumnType("longtext")
.HasComment("ความสามารถพิเศษ");
@ -606,6 +631,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnType("longtext")
.HasComment("ผลสมัครสอบ");
b.Property<DateTime?>("PaymentDate")
.HasColumnType("datetime(6)")
.HasComment("วันที่ชำระเงิน");
b.Property<Guid?>("PaymentImgId")
.HasColumnType("char(36)");
@ -679,6 +708,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnType("varchar(10)")
.HasComment("รหัสไปรษณีย์ที่อยู่ตามทะเบียนบ้าน");
b.Property<DateTime?>("RegisterDate")
.HasMaxLength(40)
.HasColumnType("datetime(6)")
.HasComment("วันที่สมัคร");
b.Property<string>("RejectDetail")
.HasColumnType("longtext")
.HasComment("เหตุผลการไม่อนุมัติ");
@ -775,6 +809,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.Property<Guid>("DocumentId")
.HasColumnType("char(36)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(106)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
@ -844,6 +883,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnOrder(1)
.HasComment("ระยะเวลาเริ่ม");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(106)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
@ -960,6 +1004,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasMaxLength(20)
.HasColumnType("varchar(20)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(106)
.HasComment("สถานะการใช้งาน");
b.Property<string>("Isspecial")
.IsRequired()
.HasMaxLength(1)
@ -1106,6 +1155,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasMaxLength(200)
.HasColumnType("varchar(200)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(106)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
@ -1236,6 +1290,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.Property<DateTime>("ExpiredDate")
.HasColumnType("datetime(6)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(106)
.HasComment("สถานะการใช้งาน");
b.Property<DateTime>("IssueDate")
.HasColumnType("datetime(6)");
@ -1302,6 +1361,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.Property<Guid>("DocumentFileId")
.HasColumnType("char(36)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(106)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
@ -1377,6 +1441,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasMaxLength(200)
.HasColumnType("varchar(200)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(106)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
@ -1462,6 +1531,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnOrder(1)
.HasComment("รายละเอียดการนำเข้า");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(106)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
@ -1522,6 +1596,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.Property<Guid>("DisableId")
.HasColumnType("char(36)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(106)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
@ -1642,6 +1721,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.Property<Guid>("DisableId")
.HasColumnType("char(36)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(106)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
@ -1775,6 +1859,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.Property<int>("FullC")
.HasColumnType("int");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(106)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
@ -1867,6 +1956,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.Property<Guid>("ImportFileId")
.HasColumnType("char(36)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(106)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
@ -1985,6 +2079,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnType("longtext")
.HasComment("วุฒิที่ได้รับ");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(106)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
@ -2038,7 +2137,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("AnnouncementDate")
b.Property<DateTime?>("AnnouncementDate")
.HasColumnType("datetime(6)")
.HasColumnOrder(5)
.HasComment("วันประกาศผลสอบ");
@ -2092,7 +2191,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnType("longtext")
.HasComment("รายละเอียดสมัครสอบ");
b.Property<DateTime>("ExamDate")
b.Property<DateTime?>("ExamDate")
.HasColumnType("datetime(6)")
.HasComment("วันที่สอบ");
@ -2153,7 +2252,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน");
b.Property<DateTime>("PaymentEndDate")
b.Property<DateTime?>("PaymentEndDate")
.HasColumnType("datetime(6)")
.HasColumnOrder(4)
.HasComment("วันสิ้นสุดชำระเงิน");
@ -2162,17 +2261,17 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnType("longtext")
.HasComment("ชำระเงินผ่านกรุงไทย");
b.Property<DateTime>("PaymentStartDate")
b.Property<DateTime?>("PaymentStartDate")
.HasColumnType("datetime(6)")
.HasColumnOrder(3)
.HasComment("วันเริ่มชำระเงิน");
b.Property<DateTime>("RegisterEndDate")
b.Property<DateTime?>("RegisterEndDate")
.HasColumnType("datetime(6)")
.HasColumnOrder(2)
.HasComment("วันสิ้นสุดสมัครสอบ");
b.Property<DateTime>("RegisterStartDate")
b.Property<DateTime?>("RegisterStartDate")
.HasColumnType("datetime(6)")
.HasColumnOrder(1)
.HasComment("วันเริ่มสมัครสอบ");
@ -2228,6 +2327,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.Property<Guid>("DocumentId")
.HasColumnType("char(36)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(106)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
@ -2290,6 +2394,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.Property<Guid>("DocumentId")
.HasColumnType("char(36)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(106)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
@ -2349,6 +2458,15 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<bool>("HighDegree")
.HasColumnType("tinyint(1)")
.HasComment("ปริญญาขึ้นไป");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(106)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,291 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recurit.Exam.Service.Migrations
{
/// <inheritdoc />
public partial class updatetablebaseaddIsActive : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsActive",
table: "ScoreImports",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "สถานะการใช้งาน")
.Annotation("Relational:ColumnOrder", 106);
migrationBuilder.AddColumn<bool>(
name: "IsActive",
table: "PositionExams",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "สถานะการใช้งาน")
.Annotation("Relational:ColumnOrder", 106);
migrationBuilder.AddColumn<bool>(
name: "IsActive",
table: "PeriodExamImages",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "สถานะการใช้งาน")
.Annotation("Relational:ColumnOrder", 106);
migrationBuilder.AddColumn<bool>(
name: "IsActive",
table: "PeriodExamDocuments",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "สถานะการใช้งาน")
.Annotation("Relational:ColumnOrder", 106);
migrationBuilder.AddColumn<bool>(
name: "IsActive",
table: "Educations",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "สถานะการใช้งาน")
.Annotation("Relational:ColumnOrder", 106);
migrationBuilder.AddColumn<bool>(
name: "IsActive",
table: "DisableScores",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "สถานะการใช้งาน")
.Annotation("Relational:ColumnOrder", 106);
migrationBuilder.AddColumn<bool>(
name: "IsActive",
table: "Disables",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "สถานะการใช้งาน")
.Annotation("Relational:ColumnOrder", 106);
migrationBuilder.AddColumn<bool>(
name: "IsActive",
table: "DisablePayments",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "สถานะการใช้งาน")
.Annotation("Relational:ColumnOrder", 106);
migrationBuilder.AddColumn<bool>(
name: "IsActive",
table: "DisableOccupations",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "สถานะการใช้งาน")
.Annotation("Relational:ColumnOrder", 106);
migrationBuilder.AddColumn<bool>(
name: "IsActive",
table: "DisableImportHistories",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "สถานะการใช้งาน")
.Annotation("Relational:ColumnOrder", 106);
migrationBuilder.AddColumn<bool>(
name: "IsActive",
table: "DisableEducations",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "สถานะการใช้งาน")
.Annotation("Relational:ColumnOrder", 106);
migrationBuilder.AddColumn<bool>(
name: "IsActive",
table: "DisableDocuments",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "สถานะการใช้งาน")
.Annotation("Relational:ColumnOrder", 106);
migrationBuilder.AddColumn<bool>(
name: "IsActive",
table: "DisableCertificates",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "สถานะการใช้งาน")
.Annotation("Relational:ColumnOrder", 106);
migrationBuilder.AddColumn<bool>(
name: "IsActive",
table: "DisableAddresses",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "สถานะการใช้งาน")
.Annotation("Relational:ColumnOrder", 106);
migrationBuilder.AddColumn<bool>(
name: "IsActive",
table: "CMSGovernments",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "สถานะการใช้งาน")
.Annotation("Relational:ColumnOrder", 106);
migrationBuilder.AddColumn<bool>(
name: "IsActive",
table: "CMSCandidates",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "สถานะการใช้งาน")
.Annotation("Relational:ColumnOrder", 106);
migrationBuilder.AddColumn<bool>(
name: "IsActive",
table: "CMSAgencys",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "สถานะการใช้งาน")
.Annotation("Relational:ColumnOrder", 106);
migrationBuilder.AddColumn<bool>(
name: "IsActive",
table: "Careers",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "สถานะการใช้งาน")
.Annotation("Relational:ColumnOrder", 106);
migrationBuilder.AddColumn<bool>(
name: "IsActive",
table: "Candidates",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "สถานะการใช้งาน")
.Annotation("Relational:ColumnOrder", 106);
migrationBuilder.AddColumn<bool>(
name: "IsActive",
table: "CandidateDocuments",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "สถานะการใช้งาน")
.Annotation("Relational:ColumnOrder", 106);
migrationBuilder.AddColumn<bool>(
name: "IsActive",
table: "BankExams",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "สถานะการใช้งาน")
.Annotation("Relational:ColumnOrder", 106);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsActive",
table: "ScoreImports");
migrationBuilder.DropColumn(
name: "IsActive",
table: "PositionExams");
migrationBuilder.DropColumn(
name: "IsActive",
table: "PeriodExamImages");
migrationBuilder.DropColumn(
name: "IsActive",
table: "PeriodExamDocuments");
migrationBuilder.DropColumn(
name: "IsActive",
table: "Educations");
migrationBuilder.DropColumn(
name: "IsActive",
table: "DisableScores");
migrationBuilder.DropColumn(
name: "IsActive",
table: "Disables");
migrationBuilder.DropColumn(
name: "IsActive",
table: "DisablePayments");
migrationBuilder.DropColumn(
name: "IsActive",
table: "DisableOccupations");
migrationBuilder.DropColumn(
name: "IsActive",
table: "DisableImportHistories");
migrationBuilder.DropColumn(
name: "IsActive",
table: "DisableEducations");
migrationBuilder.DropColumn(
name: "IsActive",
table: "DisableDocuments");
migrationBuilder.DropColumn(
name: "IsActive",
table: "DisableCertificates");
migrationBuilder.DropColumn(
name: "IsActive",
table: "DisableAddresses");
migrationBuilder.DropColumn(
name: "IsActive",
table: "CMSGovernments");
migrationBuilder.DropColumn(
name: "IsActive",
table: "CMSCandidates");
migrationBuilder.DropColumn(
name: "IsActive",
table: "CMSAgencys");
migrationBuilder.DropColumn(
name: "IsActive",
table: "Careers");
migrationBuilder.DropColumn(
name: "IsActive",
table: "Candidates");
migrationBuilder.DropColumn(
name: "IsActive",
table: "CandidateDocuments");
migrationBuilder.DropColumn(
name: "IsActive",
table: "BankExams");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,43 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recurit.Exam.Service.Migrations
{
/// <inheritdoc />
public partial class updatetablecandidateaddhighdegree : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "HighDegree",
table: "PositionExams",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "ปริญญาขึ้นไป");
migrationBuilder.AddColumn<DateTime>(
name: "RegisterDate",
table: "Candidates",
type: "datetime(6)",
maxLength: 40,
nullable: true,
comment: "วันที่สมัคร");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "HighDegree",
table: "PositionExams");
migrationBuilder.DropColumn(
name: "RegisterDate",
table: "Candidates");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,151 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recurit.Exam.Service.Migrations
{
/// <inheritdoc />
public partial class updatetableperiodexamdatecannull : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
name: "RegisterStartDate",
table: "PeriodExams",
type: "datetime(6)",
nullable: true,
comment: "วันเริ่มสมัครสอบ",
oldClrType: typeof(DateTime),
oldType: "datetime(6)",
oldComment: "วันเริ่มสมัครสอบ");
migrationBuilder.AlterColumn<DateTime>(
name: "RegisterEndDate",
table: "PeriodExams",
type: "datetime(6)",
nullable: true,
comment: "วันสิ้นสุดสมัครสอบ",
oldClrType: typeof(DateTime),
oldType: "datetime(6)",
oldComment: "วันสิ้นสุดสมัครสอบ");
migrationBuilder.AlterColumn<DateTime>(
name: "PaymentStartDate",
table: "PeriodExams",
type: "datetime(6)",
nullable: true,
comment: "วันเริ่มชำระเงิน",
oldClrType: typeof(DateTime),
oldType: "datetime(6)",
oldComment: "วันเริ่มชำระเงิน");
migrationBuilder.AlterColumn<DateTime>(
name: "PaymentEndDate",
table: "PeriodExams",
type: "datetime(6)",
nullable: true,
comment: "วันสิ้นสุดชำระเงิน",
oldClrType: typeof(DateTime),
oldType: "datetime(6)",
oldComment: "วันสิ้นสุดชำระเงิน");
migrationBuilder.AlterColumn<DateTime>(
name: "ExamDate",
table: "PeriodExams",
type: "datetime(6)",
nullable: true,
comment: "วันที่สอบ",
oldClrType: typeof(DateTime),
oldType: "datetime(6)",
oldComment: "วันที่สอบ");
migrationBuilder.AlterColumn<DateTime>(
name: "AnnouncementDate",
table: "PeriodExams",
type: "datetime(6)",
nullable: true,
comment: "วันประกาศผลสอบ",
oldClrType: typeof(DateTime),
oldType: "datetime(6)",
oldComment: "วันประกาศผลสอบ");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
name: "RegisterStartDate",
table: "PeriodExams",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
comment: "วันเริ่มสมัครสอบ",
oldClrType: typeof(DateTime),
oldType: "datetime(6)",
oldNullable: true,
oldComment: "วันเริ่มสมัครสอบ");
migrationBuilder.AlterColumn<DateTime>(
name: "RegisterEndDate",
table: "PeriodExams",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
comment: "วันสิ้นสุดสมัครสอบ",
oldClrType: typeof(DateTime),
oldType: "datetime(6)",
oldNullable: true,
oldComment: "วันสิ้นสุดสมัครสอบ");
migrationBuilder.AlterColumn<DateTime>(
name: "PaymentStartDate",
table: "PeriodExams",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
comment: "วันเริ่มชำระเงิน",
oldClrType: typeof(DateTime),
oldType: "datetime(6)",
oldNullable: true,
oldComment: "วันเริ่มชำระเงิน");
migrationBuilder.AlterColumn<DateTime>(
name: "PaymentEndDate",
table: "PeriodExams",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
comment: "วันสิ้นสุดชำระเงิน",
oldClrType: typeof(DateTime),
oldType: "datetime(6)",
oldNullable: true,
oldComment: "วันสิ้นสุดชำระเงิน");
migrationBuilder.AlterColumn<DateTime>(
name: "ExamDate",
table: "PeriodExams",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
comment: "วันที่สอบ",
oldClrType: typeof(DateTime),
oldType: "datetime(6)",
oldNullable: true,
oldComment: "วันที่สอบ");
migrationBuilder.AlterColumn<DateTime>(
name: "AnnouncementDate",
table: "PeriodExams",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
comment: "วันประกาศผลสอบ",
oldClrType: typeof(DateTime),
oldType: "datetime(6)",
oldNullable: true,
oldComment: "วันประกาศผลสอบ");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,30 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recurit.Exam.Service.Migrations
{
/// <inheritdoc />
public partial class updatetablecandidateaddpaymentdate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "PaymentDate",
table: "Candidates",
type: "datetime(6)",
nullable: true,
comment: "วันที่ชำระเงิน");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "PaymentDate",
table: "Candidates");
}
}
}

View file

@ -252,5 +252,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[Comment("ข้อแนะนำ")]
public string? Review { get; set; }
[MaxLength(40), Comment("วันที่สมัคร")]
public DateTime? RegisterDate { get; set; }
[Comment("วันที่ชำระเงิน")]
public DateTime? PaymentDate { get; set; }
}
}

View file

@ -28,5 +28,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[Column(Order = 105), Comment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"), MaxLength(200)]
public string LastUpdateFullName { get; set; } = string.Empty;
[Column(Order = 106), Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true;
}
}

View file

@ -0,0 +1,73 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using BMA.EHR.Recurit.Exam.Service.Models;
namespace BMA.EHR.Profile.Service.Models.HR
{
public class OrganizationEntity : EntityBase
{
//[ForeignKey("OrganizationOrganizationId")]
//public OrganizationOrganization? OrganizationOrganization_OrganizationOrganizationId { get; set; }
[Column(Order = 2), Comment("OrganizationOrganizationId")]
public Guid? OrganizationOrganizationId { get; set; }
//[ForeignKey("OrganizationShortNameId")]
//public OrganizationShortName? OrganizationShortName_OrganizationShortNameId { get; set; }
[Column(Order = 3), Comment("OrganizationShortNameId")]
public Guid? OrganizationShortNameId { get; set; }
//[ForeignKey("OrganizationTypeId")]
//public OrganizationType? OrganizationType_OrganizationTypeId { get; set; }
[Column(Order = 4), Comment("OrganizationTypeId")]
public Guid? OrganizationTypeId { get; set; }
//[ForeignKey("OrganizationLevelId")]
//public OrganizationLevel? OrganizationLevel_OrganizationLevelId { get; set; }
[Column(Order = 5), Comment("OrganizationLevelId")]
public Guid? OrganizationLevelId { get; set; }
//[ForeignKey("OrganizationTelExternalId")]
//public OrganizationTelExternal? OrganizationTelExternal_OrganizationTelExternalId { get; set; }
[Column(Order = 6), Comment("OrganizationTelExternalId")]
public Guid? OrganizationTelExternalId { get; set; }
//[ForeignKey("OrganizationTelInternalId")]
//public OrganizationTelInternal? OrganizationTelInternal_OrganizationTelInternalId { get; set; }
[Column(Order = 7), Comment("OrganizationTelInternalId")]
public Guid? OrganizationTelInternalId { get; set; }
//[ForeignKey("OrganizationFaxId")]
//public OrganizationFax? OrganizationFax_OrganizationFaxId { get; set; }
[Column(Order = 8), Comment("OrganizationFaxId")]
public Guid? OrganizationFaxId { get; set; }
[ForeignKey("ParentId")]
public OrganizationEntity? Organization_ParentId { get; set; }
[Column(Order = 9), Comment("ParentId")]
public Guid? ParentId { get; set; }
[Column(Order = 10), Comment("OrganizationAgencyId")]
public Guid? OrganizationAgencyId { get; set; }
[Column(Order = 11), Comment("OrganizationGovernmentAgencyId")]
public Guid? OrganizationGovernmentAgencyId { get; set; }
[Column(Order = 12), Comment("OrganizationOrder")]
public int? OrganizationOrder { get; set; }
[Column(Order = 13), Comment("OrganizationUserNote")]
public string? OrganizationUserNote { get; set; }
public List<OrganizationEntity> Organizations { get; } = new();
}
}

210
Models/HR/Profile.cs Normal file
View file

@ -0,0 +1,210 @@
using BMA.EHR.Recurit.Exam.Service.Models;
using System.ComponentModel.DataAnnotations;
namespace BMA.EHR.Profile.Service.Models.HR
{
public class Profile : EntityBase
{
[Key]
public Guid Id { get; set; }
[MaxLength(13)]
public string? CitizenId { get; set; }
[MaxLength(50)]
public string? ProfileType { get; set; }
[MaxLength(20)]
public string? EmployeeType { get; set; }
[MaxLength(20)]
public string? EmployeeClass { get; set; }
public Guid? PrefixId { get; set; }
[MaxLength(100)]
[Required]
public string? FirstName { get; set; }
[MaxLength(100)]
[Required]
public string? LastName { get; set; }
[MaxLength(100)]
public string AvatarRef { get; set; }
public Guid? GenderId { get; set; }
[MaxLength(100)]
public string? Nationality { get; set; }
[MaxLength(100)]
public string? Race { get; set; }
public Guid? ReligionId { get; set; }
[Required]
public DateTime BirthDate { get; set; }
public Guid? BloodGroupId { get; set; }
public Guid? RelationshipId { get; set; }
[MaxLength(50)]
public string? TelephoneNumber { get; set; }
public bool? Couple { get; set; }
public Guid? CouplePrefixId { get; set; }
[MaxLength(100)]
public string? CoupleFirstName { get; set; }
[MaxLength(100)]
public string? CoupleLastName { get; set; }
[MaxLength(100)]
public string? CoupleCareer { get; set; }
public Guid? FatherPrefixId { get; set; }
[MaxLength(100)]
public string? FatherFirstName { get; set; }
[MaxLength(100)]
public string? FatherLastName { get; set; }
[MaxLength(100)]
public string? FatherCareer { get; set; }
public Guid? MotherPrefixId { get; set; }
[MaxLength(100)]
public string? MotherFirstName { get; set; }
[MaxLength(100)]
public string? MotherLastName { get; set; }
[MaxLength(100)]
public string? MotherCareer { get; set; }
[MaxLength(200)]
public string? CurrentAddress { get; set; }
public Guid? CurrentSubDistrictId { get; set; }
public Guid? CurrentDistrictId { get; set; }
public Guid? CurrentProvinceId { get; set; }
[MaxLength(5)]
public string? CurrentZipCode { get; set; }
public bool? RegistrationSame { get; set; } = false;
[MaxLength(200)]
public string? RegistrationAddress { get; set; }
public Guid? RegistrationSubDistrictId { get; set; }
public Guid? RegistrationDistrictId { get; set; }
public Guid? RegistrationProvinceId { get; set; }
[MaxLength(5)]
public string? RegistrationZipCode { get; set; }
public DateTime? DateAppoint { get; set; }
public DateTime? DateStart { get; set; }
public DateTime? DateRetire { get; set; }
// public Guid? AffiliationId { get; set; }
// public Guid? PositionId { get; set; }
// public Guid? WorkId { get; set; }
// public Guid? TypeId { get; set; }
// public Guid? LevelId { get; set; }
// public Guid? NumberId { get; set; }
// public Guid? BusinessId { get; set; }
// public Guid? OcId { get; set; }
// public Guid? PositionId { get; set; }
// public Guid? PosNoId { get; set; }
public Guid? OcId { get; set; }
public string? Oc { get; set; }
public Guid? OrganizationShortNameId { get; set; }
public string? OrganizationShortName { get; set; }
public string? GovernmentCode { get; set; }
public Guid? OrganizationOrganizationId { get; set; }
public string? OrganizationOrganization { get; set; }
public Guid? PositionId { get; set; }
public string? Position { get; set; }
public Guid? PosNoId { get; set; }
public string? PosNo { get; set; }
public Guid? PositionLineId { get; set; }
public string? PositionLine { get; set; }
public Guid? PositionPathSideId { get; set; }
public string? PositionPathSide { get; set; }
public Guid? PositionTypeId { get; set; }
public string? PositionType { get; set; }
public Guid? PositionLevelId { get; set; }
public string? PositionLevel { get; set; }
public Guid? PositionExecutiveId { get; set; }
public string? PositionExecutive { get; set; }
public Guid? PositionExecutiveSideId { get; set; }
public string? PositionExecutiveSide { get; set; }
[MaxLength(100)]
public string Physical { get; set; }
[MaxLength(100)]
public string Ability { get; set; }
public bool IsActive { get; set; } = true;
public bool IsLeave { get; set; } = false;
public DateTime? LeaveDate { get; set; }
[MaxLength(1000)]
public string? LeaveReason { get; set; }
public DateTime? CreatedDate { get; set; }
public DateTime? ModifiedDate { get; set; }
[MaxLength(250)]
public string CreatedUser { get; set; } = string.Empty;
[MaxLength(5)]
public string EntryStatus { get; set; } = "st1"; // สถานะการตรวจสอบ st1 = create; st2 = pending
public bool IsTransfer { get; set; } = false;
public DateTime? TransferDate { get; set; }
public int GovAgeAbsent { get; set; } = 0;
public int GovAgePlus { get; set; } = 0;
// public OrganizationEntity? Organization { get; set; }
// public PositionNumberEntity PositionNumber { get; set; }
// public Position Position { get; set; }
// public PositionExecutive PositionExecutive { get; set; }
public bool IsVerified { get; set; } = false;
[MaxLength(100)]
public string VerifiedUser { get; set; } = string.Empty;
public DateTime? VerifiedDate { get; set; }
public bool IsProbation { get; set; } = true;
}
}

View file

@ -0,0 +1,10 @@
using BMA.EHR.Recurit.Exam.Service.Models;
namespace BMA.EHR.Profile.Service.Models.HR
{
public class ProfileOrganization : EntityBase
{
public Guid? OrganizationId { get; set; }
public Guid? UserId { get; set; }
}
}

View file

@ -26,20 +26,20 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[Comment("ค่าธรรมเนียม")]
public float? Fee { get; set; } = 0;
[Required, Column(Order = 1), Comment("วันเริ่มสมัครสอบ")]
public DateTime RegisterStartDate { get; set; } = DateTime.Now.Date;
[Column(Order = 1), Comment("วันเริ่มสมัครสอบ")]
public DateTime? RegisterStartDate { get; set; }
[Required, Column(Order = 2), Comment("วันสิ้นสุดสมัครสอบ")]
public DateTime RegisterEndDate { get; set; } = DateTime.Now.Date;
[Column(Order = 2), Comment("วันสิ้นสุดสมัครสอบ")]
public DateTime? RegisterEndDate { get; set; }
[Required, Column(Order = 3), Comment("วันเริ่มชำระเงิน")]
public DateTime PaymentStartDate { get; set; } = DateTime.Now.Date;
[Column(Order = 3), Comment("วันเริ่มชำระเงิน")]
public DateTime? PaymentStartDate { get; set; }
[Required, Column(Order = 4), Comment("วันสิ้นสุดชำระเงิน")]
public DateTime PaymentEndDate { get; set; } = DateTime.Now.Date;
[Column(Order = 4), Comment("วันสิ้นสุดชำระเงิน")]
public DateTime? PaymentEndDate { get; set; }
[Required, Column(Order = 5), Comment("วันประกาศผลสอบ")]
public DateTime AnnouncementDate { get; set; } = DateTime.Now.Date;
[Column(Order = 5), Comment("วันประกาศผลสอบ")]
public DateTime? AnnouncementDate { get; set; }
[Required, Column(Order = 6), Comment("วันเริ่มประกาศ")]
public DateTime AnnouncementStartDate { get; set; } = DateTime.Now.Date;
@ -47,8 +47,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[Required, Column(Order = 7), Comment("วันสิ้นสุดประกาศ")]
public DateTime AnnouncementEndDate { get; set; } = DateTime.Now.Date;
[Required, Comment("วันที่สอบ")]
public DateTime ExamDate { get; set; } = DateTime.Now.Date;
[Comment("วันที่สอบ")]
public DateTime? ExamDate { get; set; }
[Comment("Id รหัสส่วนราชการ")]
public Guid? OrganizationCodeId { get; set; }

View file

@ -21,5 +21,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[Comment("ชื่อประเภทแบบฟอร์ม")]
public string? TypeName { get; set; }
[Comment("ปริญญาขึ้นไป")]
public bool HighDegree { get; set; }
}
}

View file

@ -22,6 +22,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Request
public string? Number { get; set; }
public int? ReviewPoint { get; set; }
public string? Review { get; set; }
public string? Position { get; set; }
public string? HighDegree { get; set; }
public DateTime? AnnouncementDate { get; set; }
public Guid? Id { get; set; }
}

View file

@ -10,14 +10,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Request
public int? Round { get; set; }
public int? Year { get; set; }
public float? Fee { get; set; } = 0;
public DateTime RegisterStartDate { get; set; } = DateTime.Now.Date;
public DateTime RegisterEndDate { get; set; } = DateTime.Now.Date;
public DateTime PaymentStartDate { get; set; } = DateTime.Now.Date;
public DateTime PaymentEndDate { get; set; } = DateTime.Now.Date;
public DateTime? RegisterStartDate { get; set; }
public DateTime? RegisterEndDate { get; set; }
public DateTime? PaymentStartDate { get; set; }
public DateTime? PaymentEndDate { get; set; }
public DateTime AnnouncementStartDate { get; set; } = DateTime.Now.Date;
public DateTime AnnouncementEndDate { get; set; } = DateTime.Now.Date;
public DateTime AnnouncementDate { get; set; } = DateTime.Now.Date;
public DateTime ExamDate { get; set; } = DateTime.Now.Date;
public DateTime? AnnouncementDate { get; set; }
public DateTime? ExamDate { get; set; }
public Guid? OrganizationCodeId { get; set; }
public string? OrganizationCodeName { get; set; }
public Guid? OrganizationId { get; set; }

View file

@ -7,6 +7,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Request
public Guid? Id { get; set; }
public Guid? PositionId { get; set; }
public string? PositionName { get; set; }
public bool HighDegree { get; set; }
public string? TypeId { get; set; }
public string? TypeName { get; set; }
}

View file

@ -20,5 +20,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
public string? Url { get; set; }
public string? Id { get; set; }
public string? Path { get; set; }
public string? HighDegree { get; set; }
}
}

View file

@ -11,15 +11,17 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
public bool CheckDisability { get; set; }
public int? Round { get; set; }
public int? Year { get; set; }
public Guid? OcId { get; set; }
public string CreatedUserId { get; set; }
public float? Fee { get; set; }
public DateTime RegisterStartDate { get; set; }
public DateTime RegisterEndDate { get; set; }
public DateTime PaymentStartDate { get; set; }
public DateTime PaymentEndDate { get; set; }
public DateTime? RegisterStartDate { get; set; }
public DateTime? RegisterEndDate { get; set; }
public DateTime? PaymentStartDate { get; set; }
public DateTime? PaymentEndDate { get; set; }
public DateTime AnnouncementStartDate { get; set; }
public DateTime AnnouncementEndDate { get; set; }
public DateTime AnnouncementDate { get; set; }
public DateTime ExamDate { get; set; }
public DateTime? AnnouncementDate { get; set; }
public DateTime? ExamDate { get; set; }
public Guid? OrganizationCodeId { get; set; }
public string? OrganizationCodeName { get; set; }
public Guid? OrganizationId { get; set; }

View file

@ -362,17 +362,17 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Id = x.Id.ToString(),
Category = GetNameCategory(x.Category),
CategoryId = x.Category,
Start = x.ExamDate.ToString("yyyy-MM-dd"),
End = x.ExamDate.ToString("yyyy-MM-dd"),
ExamDate = x.ExamDate.ToString("yyyy-MM-dd"),
Announcement_date = x.AnnouncementDate.ToString("yyyy-MM-dd"),
Start = x.ExamDate == null ? null : x.ExamDate.Value.ToString("yyyy-MM-dd"),
End = x.ExamDate == null ? null : x.ExamDate.Value.ToString("yyyy-MM-dd"),
ExamDate = x.ExamDate == null ? null : x.ExamDate.Value.ToString("yyyy-MM-dd"),
Announcement_date = x.AnnouncementDate == null ? null : x.AnnouncementDate.Value.ToString("yyyy-MM-dd"),
Announcement_startDate = x.AnnouncementStartDate.ToString("yyyy-MM-dd"),
Announcement_endDate = x.AnnouncementEndDate.ToString("yyyy-MM-dd"),
AnnouncementExam = x.AnnouncementExam,
Register_startDate = x.RegisterStartDate.ToString("yyyy-MM-dd"),
Register_endDate = x.RegisterEndDate.ToString("yyyy-MM-dd"),
Payment_startDate = x.PaymentStartDate.ToString("yyyy-MM-dd"),
Payment_endDate = x.PaymentEndDate.ToString("yyyy-MM-dd"),
Register_startDate = x.RegisterStartDate == null ? null : x.RegisterStartDate.Value.ToString("yyyy-MM-dd"),
Register_endDate = x.RegisterEndDate == null ? null : x.RegisterEndDate.Value.ToString("yyyy-MM-dd"),
Payment_startDate = x.PaymentStartDate == null ? null : x.PaymentStartDate.Value.ToString("yyyy-MM-dd"),
Payment_endDate = x.PaymentEndDate == null ? null : x.PaymentEndDate.Value.ToString("yyyy-MM-dd"),
Title = x.Name,
Image = x.PeriodExamImages.OrderBy(o => o.CreatedAt).FirstOrDefault() == null ?
"" :
@ -407,17 +407,17 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Id = x.Id.ToString(),
Category = GetNameCategory(x.Category),
CategoryId = x.Category,
Start = x.ExamDate.ToString("yyyy-MM-dd"),
End = x.ExamDate.ToString("yyyy-MM-dd"),
ExamDate = x.ExamDate.ToString("yyyy-MM-dd"),
Announcement_date = x.AnnouncementDate.ToString("yyyy-MM-dd"),
Start = x.ExamDate == null ? null : x.ExamDate.Value.ToString("yyyy-MM-dd"),
End = x.ExamDate == null ? null : x.ExamDate.Value.ToString("yyyy-MM-dd"),
ExamDate = x.ExamDate == null ? null : x.ExamDate.Value.ToString("yyyy-MM-dd"),
Announcement_date = x.AnnouncementDate == null ? null : x.AnnouncementDate.Value.ToString("yyyy-MM-dd"),
Announcement_startDate = x.AnnouncementStartDate.ToString("yyyy-MM-dd"),
Announcement_endDate = x.AnnouncementEndDate.ToString("yyyy-MM-dd"),
AnnouncementExam = x.AnnouncementExam,
Register_startDate = x.RegisterStartDate.ToString("yyyy-MM-dd"),
Register_endDate = x.RegisterEndDate.ToString("yyyy-MM-dd"),
Payment_startDate = x.PaymentStartDate.ToString("yyyy-MM-dd"),
Payment_endDate = x.PaymentEndDate.ToString("yyyy-MM-dd"),
Register_startDate = x.RegisterStartDate == null ? null : x.RegisterStartDate.Value.ToString("yyyy-MM-dd"),
Register_endDate = x.RegisterEndDate == null ? null : x.RegisterEndDate.Value.ToString("yyyy-MM-dd"),
Payment_startDate = x.PaymentStartDate == null ? null : x.PaymentStartDate.Value.ToString("yyyy-MM-dd"),
Payment_endDate = x.PaymentEndDate == null ? null : x.PaymentEndDate.Value.ToString("yyyy-MM-dd"),
Title = x.Name,
Image = x.PeriodExamImages.OrderBy(o => o.CreatedAt).FirstOrDefault() == null ?
"" :
@ -454,15 +454,15 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
CategoryId = x.Category,
Start = x.AnnouncementStartDate.ToString("yyyy-MM-dd"),
End = x.AnnouncementEndDate.ToString("yyyy-MM-dd"),
ExamDate = x.ExamDate.ToString("yyyy-MM-dd"),
Announcement_date = x.AnnouncementDate.ToString("yyyy-MM-dd"),
ExamDate = x.ExamDate == null ? null : x.ExamDate.Value.ToString("yyyy-MM-dd"),
Announcement_date = x.AnnouncementDate == null ? null : x.AnnouncementDate.Value.ToString("yyyy-MM-dd"),
Announcement_startDate = x.AnnouncementStartDate.ToString("yyyy-MM-dd"),
Announcement_endDate = x.AnnouncementEndDate.ToString("yyyy-MM-dd"),
AnnouncementExam = x.AnnouncementExam,
Register_startDate = x.RegisterStartDate.ToString("yyyy-MM-dd"),
Register_endDate = x.RegisterEndDate.ToString("yyyy-MM-dd"),
Payment_startDate = x.PaymentStartDate.ToString("yyyy-MM-dd"),
Payment_endDate = x.PaymentEndDate.ToString("yyyy-MM-dd"),
Register_startDate = x.RegisterStartDate == null ? null : x.RegisterStartDate.Value.ToString("yyyy-MM-dd"),
Register_endDate = x.RegisterEndDate == null ? null : x.RegisterEndDate.Value.ToString("yyyy-MM-dd"),
Payment_startDate = x.PaymentStartDate == null ? null : x.PaymentStartDate.Value.ToString("yyyy-MM-dd"),
Payment_endDate = x.PaymentEndDate == null ? null : x.PaymentEndDate.Value.ToString("yyyy-MM-dd"),
Title = x.Name,
Detail = x.Detail,
Images = x.PeriodExamImages.OrderBy(x => x.CreatedAt).Select(s => new HomePageLinkResponseItem
@ -479,6 +479,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
{
Id = s.Id.ToString(),
Title = s.PositionName == null ? x.Name : s.PositionName,
HighDegree = s.HighDegree == true ? "ปริญญาขึ้นไป" : "ต่ำกว่าปริญญาตรี",
Path = $"{x.Id}/{s.Id}",
}).ToList(),
})

View file

@ -604,7 +604,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var candidatePosition = await _context.Candidates.AsQueryable()
.Include(x => x.PositionExam)
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId && x.Status != "register" && x.Status != "rejectRegister");
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId && x.RegisterDate != null && x.Status != "register" && x.Status != "rejectRegister");
return new RequestStatusRegistry
{
@ -1444,11 +1444,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (exam == null)
throw new Exception(GlobalMessages.ExamNotFound);
var position = exam.PositionExam.Where(x => x.Id == Guid.Parse(positionId)).FirstOrDefault();
if (position == null)
throw new Exception(GlobalMessages.PositionExamNotFound);
// if (exam.PositionExam != null)
// {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// var position = exam.PositionExam.Where(x => x.Id == Guid.Parse(positionId)).FirstOrDefault();
// if (position == null)
// throw new Exception(GlobalMessages.PositionExamNotFound);
// }
await _minioService.DeleteFileAsync(Guid.Parse(documentId));
}
@ -1729,6 +1731,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + exam.Name;
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: รอเจ้าหน้าที่ตรวจสอบข้อมูล";
_mailService.SendMailToUser(subject, body, "ananda@frappet.com");
if (candidate.RegisterDate == null)
candidate.RegisterDate = DateTime.Now;
}
if (status == "checkPayment")
{
@ -1768,21 +1772,21 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
{
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name;
var body = candidate.FirstName + " " + candidate.LastName + " มีคุณสมบัติสมัครสอบไม่ผ่านกรุณาตรวจสอบข้อมูล เนื่องจาก: " + item.Reason;
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
candidate.RejectDetail = item.Reason;
}
if (status == "rejectPayment")
{
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name;
var body = candidate.FirstName + " " + candidate.LastName + " มีหลักฐานชำระเงินไม่ถูกต้องกรุณาตรวจสอบข้อมูล เนื่องจาก: " + item.Reason;
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
candidate.RejectDetail = item.Reason;
}
else if (status == "payment" && candidate.PeriodExam.Fee == 0)
{
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name;
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: รอเจ้าหน้าที่จัดที่นั่งสอบ";
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
candidate.Status = "checkSeat";
var num = periodExam.Count() + 1;
candidate.ExamIdenNumber = "CDC-" + num;
@ -1791,22 +1795,23 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
{
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name;
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: รอชำระค่าสมัครสอบ";
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
}
if (candidate.Status == "checkSeat")
{
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name;
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: รอเจ้าหน้าที่จัดที่นั่งสอบ";
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
var num = periodExam.Count() + 1;
candidate.ExamIdenNumber = "CDC-" + num;
candidate.PaymentDate = DateTime.Now;
}
}
else
{
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name;
var body = candidate.FirstName + " " + candidate.LastName + " มีคุณสมบัติไม่ผ่านตามเงื่อนไข";
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
_context.Candidates.Remove(candidate);
}
@ -1829,13 +1834,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
{
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name;
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: สอบคัดเลือกสำเร็จ";
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
}
if (status == "checkPoint")
{
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name;
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: รอเจ้าหน้าที่สรุปคะแนนสอบ";
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
}
candidate.Status = status;
@ -1881,6 +1886,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Where(x => x.PeriodExam == exam && x.UserId == UserId)
.FirstOrDefaultAsync();
var positionName = "";
var highDegree = "";
if (positionId != "00000000-0000-0000-0000-000000000000")
{
var position = await _context.PositionExams.AsQueryable()
@ -1892,6 +1899,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
candidate = await _context.Candidates.AsQueryable()
.Where(x => x.PeriodExam == exam && x.UserId == UserId && x.PositionExam == position)
.FirstOrDefaultAsync();
positionName = position.PositionName;
highDegree = position.HighDegree == true ? "ปริญญาขึ้นไป" : "ต่ำกว่าปริญญาตรี";
}
if (candidate == null)
@ -1916,8 +1925,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Number = candidate.Number,
ReviewPoint = candidate.ReviewPoint,
Review = candidate.Review,
AnnouncementDate = exam.AnnouncementDate.AddYears(2),
AnnouncementDate = exam.AnnouncementDate?.AddYears(2),
Id = candidate.Id,
Position = positionName,
HighDegree = highDegree,
};
}
@ -1931,6 +1942,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
var positionName = "";
var highDegree = "";
if (candidate.PositionExam != null)
{
positionName = candidate.PositionExam.PositionName;
highDegree = candidate.PositionExam.HighDegree == true ? "ปริญญาขึ้นไป" : "ต่ำกว่าปริญญาตรี";
}
return new RequestCardCandidate
{
Avatar = candidate.ProfileImg == null ? "" : _minioService.ImagesPath(candidate.ProfileImg.Id).Result,
@ -1950,8 +1969,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Number = candidate.Number,
ReviewPoint = candidate.ReviewPoint,
Review = candidate.Review,
AnnouncementDate = candidate.PeriodExam?.AnnouncementDate.AddYears(2),
AnnouncementDate = candidate.PeriodExam?.AnnouncementDate?.AddYears(2),
Id = candidate.Id,
Position = positionName,
HighDegree = highDegree,
};
}
@ -1994,7 +2015,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
// })
// .ToListAsync();
return _minioService.ImagesPath(Guid.Parse("08db463c-9bf7-494f-8b35-e9b777256dae")).Result;
return _minioService.ImagesPathString("ใบจ่ายเงิน.pdf").Result;
}
public async Task UpdateReviewAsyncCandidate(string examId, string positionId, RequestReview item)

View file

@ -224,6 +224,29 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
return path;
}
public async Task<string> ImagesPathString(string fileId)
{
if (fileId == null)
return "";
var config = new AmazonS3Config
{
ServiceURL = Configuration.GetValue<string>("MinIO:Endpoint"),
ForcePathStyle = true
};
DateTime expires = DateTime.UtcNow.AddHours(6);
GetPreSignedUrlRequest request = new GetPreSignedUrlRequest
{
BucketName = _bucketName,
Key = fileId,
Expires = expires,
};
string path = _s3Client.GetPreSignedURL(request);
return path;
}
#endregion
}
}

View file

@ -84,43 +84,98 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
}
}
private List<Guid?> GetAllIdByRoot(Guid id)
{
try
{
var ret = new List<Guid?>();
var oc = _contextMetadata.Organizations.FirstOrDefault(x => x.Id == id && x.IsActive);
if (oc != null)
ret.Add(oc.Id);
var child = _contextMetadata.Organizations.AsQueryable().Where(x => x.ParentId == id && x.IsActive).ToList();
if (child.Any())
{
foreach (var item in child)
{
ret.AddRange(GetAllIdByRoot(item.Id));
}
}
return ret;
}
catch
{
throw;
}
}
public async Task<IEnumerable<PeriodExamCandidateResponseItem>> GetsAsync(string type, bool showAll = true)
{
return await _context.PeriodExams.AsQueryable()
.Where(p => p.IsActive)
.Where(p => p.CheckDisability == false)
.Where(p => type.ToUpper() == "ALL" ? (p.AnnouncementExam == true || p.AnnouncementExam == false) : (type.ToUpper() == "EXAM" ? p.AnnouncementExam == true : p.AnnouncementExam == false))
.OrderByDescending(d => d.CreatedAt)
.Select(x => new PeriodExamCandidateResponseItem
{
ExamDate = x.ExamDate,
AnnouncementEndDate = x.AnnouncementEndDate,
AnnouncementStartDate = x.AnnouncementStartDate,
AnnouncementDate = x.AnnouncementDate,
CheckDisability = x.CheckDisability,
CheckDocument = x.CheckDocument,
Detail = x.Detail,
Fee = x.Fee,
Id = x.Id,
IsActive = x.IsActive,
Name = x.Name,
Note = x.Note,
OrganizationCodeId = x.OrganizationCodeId,
OrganizationCodeName = x.OrganizationCodeName,
OrganizationId = x.OrganizationId,
OrganizationName = x.OrganizationName,
PaymentEndDate = x.PaymentEndDate,
PaymentKrungThai = x.PaymentKrungThai,
AnnouncementExam = x.AnnouncementExam,
Category = x.Category,
PaymentStartDate = x.PaymentStartDate,
RegisterEndDate = x.RegisterEndDate,
RegisterStartDate = x.RegisterStartDate,
Round = x.Round,
SetSeat = x.SetSeat,
Year = x.Year,
})
.ToListAsync();
var periodExams = await _context.PeriodExams.AsQueryable()
.Where(p => p.IsActive)
.Where(p => p.CheckDisability == false)
.Where(p => type.ToUpper() == "ALL" ? (p.AnnouncementExam == true || p.AnnouncementExam == false) : (type.ToUpper() == "EXAM" ? p.AnnouncementExam == true : p.AnnouncementExam == false))
.OrderByDescending(d => d.CreatedAt).ToListAsync();
var profileOrganizations = await _contextMetadata.ProfileOrganizations.AsQueryable()
.ToListAsync();
var _periodExams = (from x in periodExams
join po in profileOrganizations on Guid.Parse(x.CreatedUserId) equals po?.UserId into poGroup
from po in poGroup.DefaultIfEmpty()
select new PeriodExamCandidateResponseItem
{
ExamDate = x.ExamDate,
AnnouncementEndDate = x.AnnouncementEndDate,
AnnouncementStartDate = x.AnnouncementStartDate,
AnnouncementDate = x.AnnouncementDate,
CheckDisability = x.CheckDisability,
CheckDocument = x.CheckDocument,
Detail = x.Detail,
Fee = x.Fee,
Id = x.Id,
IsActive = x.IsActive,
Name = x.Name,
Note = x.Note,
OrganizationCodeId = x.OrganizationCodeId,
OrganizationCodeName = x.OrganizationCodeName,
OrganizationId = x.OrganizationId,
OrganizationName = x.OrganizationName,
PaymentEndDate = x.PaymentEndDate,
PaymentKrungThai = x.PaymentKrungThai,
AnnouncementExam = x.AnnouncementExam,
Category = x.Category,
PaymentStartDate = x.PaymentStartDate,
RegisterEndDate = x.RegisterEndDate,
RegisterStartDate = x.RegisterStartDate,
Round = x.Round,
SetSeat = x.SetSeat,
Year = x.Year,
OcId = po == null ? null : po.OrganizationId,
CreatedUserId = x.CreatedUserId,
}).AsQueryable()
.ToList();
var roles = _httpContextAccessor?.HttpContext?.User?.FindAll(ClaimTypes.Role)?.Select(c => c.Value).ToList();
if (!roles.Contains("head"))
{
var criteria = new List<Guid?>();
var profileOrganization = await _contextMetadata.ProfileOrganizations.AsQueryable()
.FirstOrDefaultAsync(x => x.UserId == Guid.Parse(UserId));
if (profileOrganization == null)
return new List<PeriodExamCandidateResponseItem>();
var ocId = _contextMetadata.Organizations.AsQueryable()
.FirstOrDefault(x => x.Id == profileOrganization.OrganizationId);
if (ocId == null)
return new List<PeriodExamCandidateResponseItem>();
criteria = GetAllIdByRoot(ocId.Id);
if (criteria.Any())
_periodExams = _periodExams.Where(x => x.CreatedUserId == UserId || criteria.Contains(x.OcId == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OcId)).ToList();
}
return _periodExams;
}
public async Task<PeriodExamCandidateResponseItem?> GetsExamAndCandidateAsync(string examId, bool showAll = true)
@ -172,6 +227,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
TypeName = b.TypeName,
PositionId = b.PositionId,
PositionName = b.PositionName,
HighDegree = b.HighDegree,
}).ToList(),
Documents = x.PeriodExamDocuments.OrderBy(o => o.CreatedAt).Select(b => new FileListResponse
{
@ -226,7 +282,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Name = periodExam.Name,
Round = periodExam.Round,
Year = periodExam.Year,
Status = DateTime.Now > periodExam.PaymentEndDate,
Status = periodExam.PaymentEndDate == null ? true : DateTime.Now > periodExam.PaymentEndDate,
SetSeat = periodExam.SetSeat,
};
}
@ -325,6 +381,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
PeriodExam = periodExam,
PositionId = position.PositionId,
PositionName = position.PositionName,
HighDegree = position.HighDegree,
TypeId = position.TypeId,
TypeName = position.TypeName,
CreatedAt = DateTime.Now,
@ -448,6 +505,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
{
position.PositionId = positionData.PositionId;
position.PositionName = positionData.PositionName;
position.HighDegree = positionData.HighDegree;
position.TypeId = positionData.TypeId;
position.TypeName = positionData.TypeName;
position.LastUpdatedAt = DateTime.Now;
@ -478,6 +536,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
PeriodExam = periodExam,
PositionId = position.PositionId,
PositionName = position.PositionName,
HighDegree = position.HighDegree,
TypeId = position.TypeId,
TypeName = position.TypeName,
CreatedAt = DateTime.Now,
@ -600,10 +659,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var candidate = await _context.Candidates.AsQueryable()
.Include(x => x.ProfileImg)
.OrderByDescending(d => d.CreatedAt)
.Where(x => x.PeriodExam == periodExam && x.Status != "register" && x.Status != "rejectRegister")
.Where(x => x.PeriodExam == periodExam && x.RegisterDate != null && x.Status != "register" && x.Status != "rejectRegister")
.ToListAsync();
if (candidate.Where(x => x.Status == "done").FirstOrDefault() != null)
candidate = candidate.OrderBy(x => x.Number).ToList();
candidate = candidate.OrderBy(x => Convert.ToInt32(x.Number)).ToList();
var i = 0;
foreach (var item in candidate)
{
@ -621,7 +680,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Where(x => x.PeriodExam == periodExam && x.Status == status)
.ToListAsync();
if (candidate.Where(x => x.Status == "done").FirstOrDefault() != null)
candidate = candidate.OrderBy(x => x.Number).ToList();
candidate = candidate.OrderBy(x => Convert.ToInt32(x.Number)).ToList();
var i = 0;
foreach (var item in candidate)
{
@ -821,23 +880,23 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
for (int row = 2; row <= rowCount; row++)
{
System.Diagnostics.Debug.WriteLine(worksheet);
if (worksheet.Cells[row, 1].Value != null)
// if (worksheet.Cells[row, 2].Value != null)
// {
list.Add(new RequestImportSeat
{
list.Add(new RequestImportSeat
{
Number = worksheet.Cells[row, 1].Value != null ? worksheet.Cells[row, 1].Value.ToString() : null,
CitizenId = worksheet.Cells[row, 2].Value != null ? worksheet.Cells[row, 2].Value.ToString() : null,
ExamIdenNumber = worksheet.Cells[row, 3].Value != null ? worksheet.Cells[row, 3].Value.ToString() : null,
SeatNumber = worksheet.Cells[row, 4].Value != null ? worksheet.Cells[row, 4].Value.ToString() : null,
PointTotalB = worksheet.Cells[row, 5].Value != null ? worksheet.Cells[row, 5].Value.ToString() : null,
PointB = worksheet.Cells[row, 6].Value != null ? worksheet.Cells[row, 6].Value.ToString() : null,
ResultB = worksheet.Cells[row, 7].Value != null ? worksheet.Cells[row, 7].Value.ToString() : null,
PointTotalC = worksheet.Cells[row, 8].Value != null ? worksheet.Cells[row, 8].Value.ToString() : null,
PointC = worksheet.Cells[row, 9].Value != null ? worksheet.Cells[row, 9].Value.ToString() : null,
ResultC = worksheet.Cells[row, 10].Value != null ? worksheet.Cells[row, 10].Value.ToString() : null,
Pass = worksheet.Cells[row, 11].Value != null ? (worksheet.Cells[row, 11].Value.ToString()) : null,
});
}
Number = worksheet.Cells[row, 4].Value != null ? worksheet.Cells[row, 4].Value.ToString() : null,
CitizenId = worksheet.Cells[row, 5].Value != null ? worksheet.Cells[row, 5].Value.ToString() : null,
ExamIdenNumber = worksheet.Cells[row, 6].Value != null ? worksheet.Cells[row, 6].Value.ToString() : null,
SeatNumber = worksheet.Cells[row, 7].Value != null ? worksheet.Cells[row, 7].Value.ToString() : null,
PointTotalB = worksheet.Cells[row, 8].Value != null ? worksheet.Cells[row, 8].Value.ToString() : null,
PointB = worksheet.Cells[row, 9].Value != null ? worksheet.Cells[row, 9].Value.ToString() : null,
ResultB = worksheet.Cells[row, 10].Value != null ? worksheet.Cells[row, 10].Value.ToString() : null,
PointTotalC = worksheet.Cells[row, 11].Value != null ? worksheet.Cells[row, 11].Value.ToString() : null,
PointC = worksheet.Cells[row, 12].Value != null ? worksheet.Cells[row, 12].Value.ToString() : null,
ResultC = worksheet.Cells[row, 13].Value != null ? worksheet.Cells[row, 13].Value.ToString() : null,
Pass = worksheet.Cells[row, 14].Value != null ? (worksheet.Cells[row, 14].Value.ToString()) : null,
});
// }
}
}
}
@ -863,7 +922,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
foreach (var candidate in candidates)
{
var item = items.FirstOrDefault(x => x.CitizenId == candidate.CitizenId && x.ExamIdenNumber.Trim().ToUpper() == candidate.ExamIdenNumber.Trim().ToUpper());
if (candidate.ExamIdenNumber == null || candidate.CitizenId == null)
continue;
var item = items.FirstOrDefault(x => x.CitizenId == candidate.CitizenId && x.ExamIdenNumber == candidate.ExamIdenNumber);
if (item != null)
{
@ -872,7 +933,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
candidate.SeatNumber = item.SeatNumber;
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + periodExam.Name;
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: รอเจ้าหน้าที่สรุปคะแนนสอบ";
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
candidate.Status = "checkPoint";
}
else
@ -881,7 +942,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
{
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + periodExam.Name;
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: สละสิทธิ์สอบ";
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
}
candidate.Status = "waiver";
}
@ -892,7 +953,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
{
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + periodExam.Name;
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: สละสิทธิ์สอบ";
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
}
candidate.Status = "waiver";
}
@ -919,6 +980,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
foreach (var candidate in candidates)
{
if (candidate.ExamIdenNumber == null || candidate.CitizenId == null)
continue;
var item = items.FirstOrDefault(x => x.CitizenId == candidate.CitizenId && x.ExamIdenNumber == candidate.ExamIdenNumber);
if (item != null)
@ -935,7 +998,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
candidate.Number = item.Number;
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + periodExam.Name;
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: สอบคัดเลือกสำเร็จ";
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
// if (candidate.Email != null&& candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
candidate.Status = "done";
}
else
@ -944,9 +1007,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
{
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + periodExam.Name;
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: สละสิทธิ์สอบ";
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
// if (candidate.Email != null&& candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
}
candidate.Status = "waiver";
// candidate.Status = "waiver";
}
}
else
@ -955,9 +1018,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
{
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + periodExam.Name;
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: สละสิทธิ์สอบ";
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
// if (candidate.Email != null&& candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
}
candidate.Status = "waiver";
// candidate.Status = "waiver";
}
periodExam.SetSeat = true;
}
@ -999,32 +1062,38 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.TabColor = System.Drawing.Color.Black;
// summarySheet.DefaultRowHeight = 17;
summarySheet.Row(1).Style.Font.Bold = true;
summarySheet.Cells[1, 1].Value = "ลำดับที่สอบได้";
summarySheet.Cells[1, 2].Value = "เลขบัตรประชาชน";
summarySheet.Cells[1, 3].Value = "เลขประจำตัวสอบ";
summarySheet.Cells[1, 4].Value = "เลขที่นั่งสอบ";
summarySheet.Cells[1, 5].Value = "คะแนนเต็มภาค ข";
summarySheet.Cells[1, 6].Value = "คะแนนภาค ข";
summarySheet.Cells[1, 7].Value = "ผลสอบภาค ข";
summarySheet.Cells[1, 8].Value = "คะแนนเต็มภาค ค";
summarySheet.Cells[1, 9].Value = "คะแนนภาค ค";
summarySheet.Cells[1, 10].Value = "ผลสอบภาค ค";
summarySheet.Cells[1, 11].Value = "ผลการสอบ";
summarySheet.Cells[1, 1].Value = "ชำระค่าธรรมเนียม";
summarySheet.Cells[1, 2].Value = "วันเวลาชำระ";
summarySheet.Cells[1, 3].Value = "วันและเวลาที่สมัคร";
summarySheet.Cells[1, 4].Value = "ลำดับที่สอบได้";
summarySheet.Cells[1, 5].Value = "เลขบัตรประชาชน";
summarySheet.Cells[1, 6].Value = "เลขประจำตัวสอบ";
summarySheet.Cells[1, 7].Value = "เลขที่นั่งสอบ";
summarySheet.Cells[1, 8].Value = "คะแนนเต็มภาค ข";
summarySheet.Cells[1, 9].Value = "คะแนนภาค ข";
summarySheet.Cells[1, 10].Value = "ผลสอบภาค ข";
summarySheet.Cells[1, 11].Value = "คะแนนเต็มภาค ค";
summarySheet.Cells[1, 12].Value = "คะแนนภาค ค";
summarySheet.Cells[1, 13].Value = "ผลสอบภาค ค";
summarySheet.Cells[1, 14].Value = "ผลการสอบ";
int row = 2;
foreach (var item in candidates)
{
summarySheet.Cells[row, 1].Value = item.Number;
summarySheet.Cells[row, 2].Value = item.CitizenId;
summarySheet.Cells[row, 3].Value = item.ExamIdenNumber;
summarySheet.Cells[row, 4].Value = item.SeatNumber;
summarySheet.Cells[row, 5].Value = item.PointTotalB;
summarySheet.Cells[row, 6].Value = item.PointB;
summarySheet.Cells[row, 7].Value = item.ResultB;
summarySheet.Cells[row, 8].Value = item.PointTotalC;
summarySheet.Cells[row, 9].Value = item.PointC;
summarySheet.Cells[row, 10].Value = item.ResultC;
summarySheet.Cells[row, 11].Value = item.Pass;
summarySheet.Cells[row, 1].Value = item.PaymentDate == null ? "ยังไม่ชำระเงิน" : "ชำระแล้ว";
summarySheet.Cells[row, 2].Value = item.PaymentDate == null ? "" : item.PaymentDate.Value.ToThaiShortDateTime();
summarySheet.Cells[row, 3].Value = item.RegisterDate == null ? "" : item.RegisterDate.Value.ToThaiShortDateTime();
summarySheet.Cells[row, 4].Value = item.Number;
summarySheet.Cells[row, 5].Value = item.CitizenId;
summarySheet.Cells[row, 6].Value = item.ExamIdenNumber;
summarySheet.Cells[row, 7].Value = item.SeatNumber;
summarySheet.Cells[row, 8].Value = item.PointTotalB;
summarySheet.Cells[row, 9].Value = item.PointB;
summarySheet.Cells[row, 10].Value = item.ResultB;
summarySheet.Cells[row, 11].Value = item.PointTotalC;
summarySheet.Cells[row, 12].Value = item.PointC;
summarySheet.Cells[row, 13].Value = item.ResultC;
summarySheet.Cells[row, 14].Value = item.Pass;
row++;
}
summarySheet.Cells[summarySheet.Dimension.Address].AutoFitColumns();
@ -1084,7 +1153,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
{
Id = 3,
Name = "จำนวนผู้เข้ารับการคัดเลือกทั้งหมด",
Count = periodExam.Candidate.Where(x=>x.PaymentImg!=null).Count()
Count = periodExam.Candidate.Where(x=>x.SeatNumber != null).Count()
},
new DashboardResponseItem
{
@ -1167,7 +1236,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
OccupationDepartment = c.OccupationDepartment,
OccupationEmail = c.OccupationEmail,
OccupationTelephone = c.OccupationTelephone,
RegisterDate = c.RegisterDate,
Number = c.Number,
ExamIdenNumber = c.ExamIdenNumber,
@ -1243,6 +1312,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.Cells[1, 51].Value = "ผลสอบภาค ค";
summarySheet.Cells[1, 52].Value = "ผลการสอบ";
summarySheet.Cells[1, 53].Value = "วันที่สมัคร";
summarySheet.Cells[1, 54].Value = "วันเและเวลาที่สมัคร";
int row = 2;
foreach (var item in candidates)
@ -1279,7 +1349,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.Cells[row, 22].Value = item.MarryFullName;
summarySheet.Cells[row, 23].Value = item.FatherFullName;
summarySheet.Cells[row, 24].Value = item.MotherFullName;
summarySheet.Cells[row, 25].Value = GenerateStatusOccupation(item.OccupationType);
summarySheet.Cells[row, 25].Value = item.OccupationType == null ? null : GenerateStatusOccupation(item.OccupationType);
summarySheet.Cells[row, 26].Value = item.OccupationPosition;
summarySheet.Cells[row, 27].Value = item.OccupationCompany;
summarySheet.Cells[row, 28].Value = item.OccupationDepartment;
@ -1302,6 +1372,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.Cells[row, 51].Value = item.ResultC;
summarySheet.Cells[row, 52].Value = item.Pass;
summarySheet.Cells[row, 53].Value = item.CreatedAt.Date.ToThaiShortDate();
summarySheet.Cells[row, 54].Value = item.RegisterDate;
row++;
}
var careers = await _context.Careers
@ -1336,7 +1407,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.Cells[row, 22].Value = item.MarryFullName;
summarySheet.Cells[row, 23].Value = item.FatherFullName;
summarySheet.Cells[row, 24].Value = item.MotherFullName;
summarySheet.Cells[row, 25].Value = GenerateStatusOccupation(item.OccupationType);
summarySheet.Cells[row, 25].Value = item.OccupationType == null ? null : GenerateStatusOccupation(item.OccupationType);
summarySheet.Cells[row, 26].Value = item.OccupationPosition;
summarySheet.Cells[row, 27].Value = item.OccupationCompany;
summarySheet.Cells[row, 28].Value = item.OccupationDepartment;
@ -1359,6 +1430,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.Cells[row, 51].Value = item.ResultC;
summarySheet.Cells[row, 52].Value = item.Pass;
summarySheet.Cells[row, 53].Value = item.CreatedAt.Date.ToThaiShortDate();
summarySheet.Cells[row, 54].Value = item.RegisterDate;
row++;
}
if (educations.Count() == 0 && careers.Count() == 0)
@ -1387,7 +1459,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.Cells[row, 22].Value = item.MarryFullName;
summarySheet.Cells[row, 23].Value = item.FatherFullName;
summarySheet.Cells[row, 24].Value = item.MotherFullName;
summarySheet.Cells[row, 25].Value = GenerateStatusOccupation(item.OccupationType);
summarySheet.Cells[row, 25].Value = item.OccupationType == null ? null : GenerateStatusOccupation(item.OccupationType);
summarySheet.Cells[row, 26].Value = item.OccupationPosition;
summarySheet.Cells[row, 27].Value = item.OccupationCompany;
summarySheet.Cells[row, 28].Value = item.OccupationDepartment;
@ -1405,6 +1477,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.Cells[row, 51].Value = item.ResultC;
summarySheet.Cells[row, 52].Value = item.Pass;
summarySheet.Cells[row, 53].Value = item.CreatedAt.Date.ToThaiShortDate();
summarySheet.Cells[row, 54].Value = item.RegisterDate;
row++;
}
}
@ -1580,6 +1653,54 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
stream.Position = 0;
return stream;
}
public async Task<MemoryStream> DownloadCandidatePaymentAllAsync(string examId)
{
var periodExam = await _context.PeriodExams.AsQueryable()
.Where(x => x.CheckDisability == false)
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
if (periodExam == null)
throw new Exception(GlobalMessages.ExamNotFound);
var candidates = await _context.Candidates
.AsQueryable()
.Where(x => x.PeriodExam == periodExam)
.Select(c => new
{
CitizenId = c.CitizenId,
FullName = $"{c.PrefixName}{c.FirstName} {c.LastName}",
PaymentDate = c.PaymentDate,
})
.ToListAsync();
var stream = new MemoryStream();
using (var package = new ExcelPackage(stream))
{
var summarySheet = package.Workbook.Worksheets.Add("Payment");
summarySheet.TabColor = System.Drawing.Color.Black;
summarySheet.Row(1).Style.Font.Bold = true;
summarySheet.Cells[1, 1].Value = "เลขบัตรประชาชน";
summarySheet.Cells[1, 2].Value = "ชื่อ-สกุล";
summarySheet.Cells[1, 3].Value = "ชำระค่าธรรมเนียม";
summarySheet.Cells[1, 4].Value = "วันเวลาชำระ";
int row = 2;
foreach (var item in candidates)
{
summarySheet.Cells[row, 1].Value = item.CitizenId;
summarySheet.Cells[row, 2].Value = item.FullName;
summarySheet.Cells[row, 3].Value = item.PaymentDate == null ? "ยังไม่ชำระเงิน" : "ชำระแล้ว";
summarySheet.Cells[row, 4].Value = item.PaymentDate == null ? "" : item.PaymentDate.Value;
row++;
}
summarySheet.Cells[summarySheet.Dimension.Address].AutoFitColumns();
package.Save();
}
stream.Position = 0;
return stream;
}
#endregion
}
}

View file

@ -15,8 +15,9 @@
"ConnectionStrings": {
"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=192.168.1.9;user=root;password=adminVM123;port=3308;database=bma_ehr_exam;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;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;"
},
"Jwt": {
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",

View file

@ -15,8 +15,9 @@
"ConnectionStrings": {
"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=192.168.1.9;user=root;password=adminVM123;port=3308;database=bma_ehr_exam;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;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;"
},
"Jwt": {
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",

File diff suppressed because it is too large Load diff