pdf ใบสมัครสอบ

This commit is contained in:
Kittapath 2023-10-08 13:54:20 +07:00
parent 86a9e90b7a
commit 98b6cc0275
15 changed files with 710 additions and 68 deletions

View file

@ -31,6 +31,7 @@ namespace BMA.EHR.Application
services.AddTransient<ProbationReportRepository>();
services.AddTransient<TransferReportRepository>();
services.AddTransient<EmailSenderService>();
services.AddTransient<CandidateReportRepository>();
return services;
}

View file

@ -5,6 +5,7 @@ using BMA.EHR.Domain.Extensions;
using BMA.EHR.Domain.Models.HR;
using BMA.EHR.Domain.Models.Organizations;
using BMA.EHR.Domain.Models.Retirement;
using BMA.EHR.Domain.ModelsExam.Candidate;
using BMA.EHR.Domain.Shared;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
@ -45,65 +46,102 @@ namespace BMA.EHR.Application.Repositories.Reports
#region
public async Task<dynamic> GetExamCandidateAsync(Guid id)
{
var data = await _dbContext.Set<RetirementDeceased>().AsQueryable()
var data = await _dbContext.Set<Candidate>().AsQueryable()
.Where(x => x.Id == id)
.Select(p => new
{
p.Id,
ProfileId = p.Profile.Id,
Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
PrefixId = p.Profile.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Prefix.Id,
p.Profile.FirstName,
p.Profile.LastName,
Position = p.Profile.Position == null ? null : p.Profile.Position.Name,
PositionId = p.Profile.Position == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Position.Id,
PositionType = p.Profile.PositionType == null ? null : p.Profile.PositionType.Name,
PositionTypeId = p.Profile.PositionType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.PositionType.Id,
p.Profile.PositionLine,
p.Profile.PositionLineId,
PositionLevel = p.Profile.PositionLevel == null ? null : p.Profile.PositionLevel.Name,
PositionLevelId = p.Profile.PositionLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.PositionLevel.Id,
p.Profile.PositionExecutive,
p.Profile.PositionExecutiveId,
Organization = p.Profile.Oc,
OrganizationId = p.Profile.OcId,
p.Number,
p.Date,
p.Location,
p.Reason,
ExamIdenNumber = p.ExamIdenNumber,
PositionName = p.PositionExam == null ? "" : p.PositionExam.PositionName,
PeriodExamName = p.PeriodExam == null ? "" : p.PeriodExam.Name,
PeriodExamRound = p.PeriodExam == null ? "" : p.PeriodExam.Round.ToString(),
PeriodExamYear = p.PeriodExam == null ? "" : p.PeriodExam.Year.ToString(),
FullName = $"{p.PrefixName}{p.FirstName} {p.LastName}",
Religion = p.ReligionName,
Nationality = p.Nationality,
DateOfBirth = p.DateOfBirth == null ? "" : p.DateOfBirth.Value.ToThaiShortDate2(),
Age = p.DateOfBirth == null ? "" : p.DateOfBirth.Value.CalculateAgeStrV2(0, 0),
CitizenId = p.CitizenId,
EducationLevelExamName = p.Educations.FirstOrDefault() == null ? "" : p.Educations.FirstOrDefault().EducationLevelExamName,
EducationName = p.Educations.FirstOrDefault() == null ? "" : p.Educations.FirstOrDefault().EducationName,
EducationMajor = p.Educations.FirstOrDefault() == null ? "" : p.Educations.FirstOrDefault().EducationMajor,
EducationLocation = p.Educations.FirstOrDefault() == null ? "" : p.Educations.FirstOrDefault().EducationLocation,
EducationEndDate = p.Educations.FirstOrDefault() == null || p.Educations.FirstOrDefault().EducationEndDate == null ? "" : p.Educations.FirstOrDefault().EducationEndDate.Value.ToThaiShortDate2(),
EducationScores = p.Educations.FirstOrDefault() == null ? "" : p.Educations.FirstOrDefault().EducationScores,
EducationType = p.Educations.FirstOrDefault() == null ? "" : p.Educations.FirstOrDefault().EducationType,
EducationLevelHighName = p.Educations.FirstOrDefault() == null ? "" : p.Educations.FirstOrDefault().EducationLevelHighName,
OccupationPositionType = p.OccupationPositionType == "other" ? "ผู้ปฏิบัติงานอื่นในกรุงเทพมหานคร" : (p.OccupationPositionType == "temp" ? "ลูกจ้างชั่วคราว" : (p.OccupationPositionType == "perm" ? "ลูกจ้างประจำ" : "-")),
OccupationPosition = p.OccupationPosition,
OccupationSalary = p.OccupationSalary,
OccupationGroup = p.OccupationGroup,
OccupationPile = p.OccupationPile,
OccupationOrg = p.OccupationOrg,
OccupationTelephone = p.OccupationTelephone,
Careers = p.Careers.Select(y => new
{
Position = y.Position,
Type = y.Type,
DurationStart = y.DurationStart.ToThaiShortDate2(),
DurationEnd = y.DurationEnd.ToThaiShortDate2(),
RangeDate = y.RangeDate,
}),
RegistAddress = p.RegistAddress,
RegistProvinceName = p.RegistProvinceName,
RegistDistrictName = p.RegistDistrictName,
RegistSubDistrictName = p.RegistSubDistrictName,
RegistZipCode = p.RegistZipCode,
CurrentAddress = p.CurrentAddress,
CurrentProvinceName = p.CurrentProvinceName,
CurrentSubDistrictName = p.CurrentSubDistrictName,
CurrentDistrictName = p.CurrentDistrictName,
CurrentZipCode = p.CurrentZipCode,
Telephone = p.Telephone,
Email = p.Email,
ContactFullName = $"{p.ContactPrefixName}{p.ContactFirstname} {p.ContactLastname}",
ContactRelations = p.ContactRelations,
ContactTel = p.ContactTel,
RegisterDate = p.RegisterDate == null ? "" : p.RegisterDate.Value.ToThaiFullDate(),
})
.FirstOrDefaultAsync();
if (data == null)
throw new Exception(GlobalMessages.CandidateNotFound);
return data;
string Prefix = string.IsNullOrEmpty(data.Prefix.ToString()) ? string.Empty : data.Prefix.ToString();
string FirstName = string.IsNullOrEmpty(data.FirstName.ToString()) ? string.Empty : data.FirstName.ToString();
string LastName = string.IsNullOrEmpty(data.LastName.ToString()) ? string.Empty : data.LastName.ToString();
string FullName = $"{Prefix} {FirstName} {LastName}";
string Date = string.IsNullOrEmpty(data.Date.ToString()) ? "วันที่ - เดือน - พ.ศ. -" : DateTime.Parse(data.Date.ToString()).ToThaiFullDate().ToString().ToThaiNumber();
string CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).ToThaiFullDate().ToString().ToThaiNumber();
return new
{
FullName,
Date,
CurrentDate,
data.Position,
data.PositionExecutive,
data.PositionType,
data.PositionLine,
data.PositionLevel,
data.Organization,
data.PositionId,
data.PositionExecutiveId,
data.PositionTypeId,
data.PositionLineId,
data.PositionLevelId,
data.OrganizationId,
data.Number,
data.Location,
data.Reason,
};
// string Prefix = string.IsNullOrEmpty(data.Prefix.ToString()) ? string.Empty : data.Prefix.ToString();
// string FirstName = string.IsNullOrEmpty(data.FirstName.ToString()) ? string.Empty : data.FirstName.ToString();
// string LastName = string.IsNullOrEmpty(data.LastName.ToString()) ? string.Empty : data.LastName.ToString();
// string FullName = $"{Prefix} {FirstName} {LastName}";
// string Date = string.IsNullOrEmpty(data.Date.ToString()) ? "วันที่ - เดือน - พ.ศ. -" : DateTime.Parse(data.Date.ToString()).ToThaiFullDate().ToString().ToThaiNumber();
// string CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).ToThaiFullDate().ToString().ToThaiNumber();
// return new
// {
// FullName,
// Date,
// CurrentDate,
// data.Position,
// data.PositionExecutive,
// data.PositionType,
// data.PositionLine,
// data.PositionLevel,
// data.Organization,
// data.PositionId,
// data.PositionExecutiveId,
// data.PositionTypeId,
// data.PositionLineId,
// data.PositionLevelId,
// data.OrganizationId,
// data.Number,
// data.Location,
// data.Reason,
// };
}
#endregion

View file

@ -0,0 +1,323 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using BMA.EHR.Domain.Models.Base;
using BMA.EHR.Domain.Models.Documents;
namespace BMA.EHR.Domain.ModelsExam.Candidate
{
public class Candidate : EntityBase
{
[Required, Comment("Id การสอบ")]
public virtual PeriodExam? PeriodExam { get; set; }
[Comment("Id ตำแหน่งสอบ")]
public virtual PositionExam? PositionExam { get; set; }
[Required, MaxLength(40), Comment("User Id ผู้สมัคร")]
public string UserId { get; set; } = string.Empty;
[Required, MaxLength(20), Comment("สถานะผู้สมัคร")]
public string Status { get; set; } = "register";
[Comment("เลขประจำตัวสอบ")]
public string? ExamIdenNumber { get; set; }
[Comment("เลขที่นั่งสอบ")]
public string? SeatNumber { get; set; }
[Comment("คะแนนเต็มภาค ก")]
public string? PointTotalA { get; set; }
[Comment("คะแนนภาค ก ความสามารถในการคิดวิเคราะห์")]
public string? PointPath1A { get; set; }
[Comment("คะแนนภาค ก ภาษาอังกฤษ")]
public string? PointPath2A { get; set; }
[Comment("คะแนนภาค ก ความรู้และลักษณะการเป็นข้าราชการที่ดี")]
public string? PointPath3A { get; set; }
[Comment("คะแนนภาค ก")]
public string? PointA { get; set; }
[Comment("คะแนนภาค ก เปอร์เซนต์")]
public string? PointPerA { get; set; }
[Comment("ผลสอบภาค ก")]
public string? ResultA { get; set; }
[Comment("คะแนนเต็มภาค ข")]
public string? PointTotalB { get; set; }
[Comment("คะแนนภาค ข")]
public string? PointB { get; set; }
[Comment("คะแนนภาค ข เปอร์เซนต์")]
public string? PointPerB { get; set; }
[Comment("ผลสอบภาค ข")]
public string? ResultB { get; set; }
[Comment("คะแนนเต็มภาค ค")]
public string? PointTotalC { get; set; }
[Comment("คะแนนภาค คทดสอบสมรรถนะหลัก")]
public string? PointPath1C { get; set; }
[Comment("คะแนนภาค ค สัมภาษณ์")]
public string? PointPath2C { get; set; }
[Comment("คะแนนภาค ค")]
public string? PointC { get; set; }
[Comment("คะแนนภาค ค เปอร์เซนต์")]
public string? PointPerC { get; set; }
[Comment("ผลสอบภาค ค")]
public string? ResultC { get; set; }
[Comment("Id รูปโปรไฟล์")]
public virtual Document? ProfileImg { get; set; }
[Comment("Id หลักฐานชำระเงิน")]
public virtual Document? PaymentImg { get; set; }
[Comment("ลำดับที่สอบได้")]
public string? Number { get; set; }
[Comment("Id คำนำหน้าชื่อ")]
public Guid? PrefixId { get; set; }
[Comment("คำนำหน้าชื่อ")]
public string? PrefixName { get; set; }
[MaxLength(100), Column(Order = 1), Comment("ชื่อจริง")]
public string? FirstName { get; set; }
[MaxLength(100), Column(Order = 2), Comment("นามสกุล")]
public string? LastName { get; set; }
[MaxLength(40), Column(Order = 3), Comment("สัญชาติ")]
public string? Nationality { get; set; }
[MaxLength(40), Comment("วันเกิด")]
public DateTime? DateOfBirth { get; set; }
[Comment("Id สถานภาพ")]
public Guid? RelationshipId { get; set; }
[Comment("สถานภาพ")]
public string? RelationshipName { get; set; }
[Comment("Id ศาสนา")]
public Guid? ReligionId { get; set; }
[Comment("ศาสนา")]
public string? ReligionName { get; set; }
[MaxLength(200), Comment("อีเมล")]
public string? Email { get; set; }
[MaxLength(20), Comment("เลขประจำตัวประชาชน")]
public string? CitizenId { get; set; }
[Comment("Id เขตที่ออกบัตรประชาชน")]
public Guid? CitizenDistrictId { get; set; }
[Comment("เขตที่ออกบัตรประชาชน")]
public string? CitizenDistrictName { get; set; }
[Comment("Id จังหวัดที่ออกบัตรประชาชน")]
public Guid? CitizenProvinceId { get; set; }
[Comment("จังหวัดที่ออกบัตรประชาชน")]
public string? CitizenProvinceName { get; set; }
[Comment("วันที่ออกบัตร")]
public DateTime? CitizenDate { get; set; }
[MaxLength(20), Comment("โทรศัพท์")]
public string? Telephone { get; set; }
[MaxLength(20), Comment("โทรศัพท์มือถือ")]
public string? MobilePhone { get; set; }
[Comment("ความสามารถพิเศษ")]
public string? Knowledge { get; set; }
[Comment("ที่อยู่ตามทะเบียนบ้าน")]
public string? RegistAddress { get; set; }
[Comment("Id จังหวัดที่อยู่ตามทะเบียนบ้าน")]
public Guid? RegistProvinceId { get; set; }
[Comment("จังหวัดที่อยู่ตามทะเบียนบ้าน")]
public string? RegistProvinceName { get; set; }
[Comment("Id อำเภอที่อยู่ตามทะเบียนบ้าน")]
public Guid? RegistDistrictId { get; set; }
[Comment("อำเภอที่อยู่ตามทะเบียนบ้าน")]
public string? RegistDistrictName { get; set; }
[Comment("Id ตำบลที่อยู่ตามทะเบียนบ้าน")]
public Guid? RegistSubDistrictId { get; set; }
[Comment("ตำบลที่อยู่ตามทะเบียนบ้าน")]
public string? RegistSubDistrictName { get; set; }
[MaxLength(10), Comment("รหัสไปรษณีย์ที่อยู่ตามทะเบียนบ้าน")]
public string? RegistZipCode { get; set; }
[Comment("ที่อยู่ปัจจุบันเหมือนที่อยู่ตามทะเบียนบ้าน")]
public bool? RegistSame { get; set; }
[Comment("ที่อยู่ปัจจุบัน")]
public string? CurrentAddress { get; set; }
[Comment("Id จังหวัดที่อยู่ปัจจุบัน")]
public Guid? CurrentProvinceId { get; set; }
[Comment("จังหวัดที่อยู่ปัจจุบัน")]
public string? CurrentProvinceName { get; set; }
[Comment("Id อำเภอที่อยู่ปัจจุบัน")]
public Guid? CurrentDistrictId { get; set; }
[Comment("อำเภอที่อยู่ปัจจุบัน")]
public string? CurrentDistrictName { get; set; }
[Comment("Id ตำบลที่อยู่ปัจจุบัน")]
public Guid? CurrentSubDistrictId { get; set; }
[Comment("ตำบลที่อยู่ปัจจุบัน")]
public string? CurrentSubDistrictName { get; set; }
[MaxLength(10), Comment("รหัสไปรษณีย์ที่อยู่ปัจจุบัน")]
public string? CurrentZipCode { get; set; }
[Comment("คู่สมรส")]
public bool? Marry { get; set; }
[Comment("Id คำนำหน้าชื่อคู่สมรส")]
public Guid? MarryPrefixId { get; set; }
[Comment("คำนำหน้าชื่อคู่สมรส")]
public string? MarryPrefixName { get; set; }
[MaxLength(100), Comment("ชื่อจริงคู่สมรส")]
public string? MarryFirstName { get; set; }
[MaxLength(100), Comment("นามสกุลคู่สมรส")]
public string? MarryLastName { get; set; }
[MaxLength(200), Comment("อาชีพคู่สมรส")]
public string? MarryOccupation { get; set; }
[MaxLength(100), Comment("สัญชาติคู่สมรส")]
public string? MarryNationality { get; set; }
[Comment("Id คำนำหน้าชื่อบิดา")]
public Guid? FatherPrefixId { get; set; }
[Comment("คำนำหน้าชื่อบิดา")]
public string? FatherPrefixName { get; set; }
[MaxLength(100), Comment("ชื่อจริงบิดา")]
public string? FatherFirstName { get; set; }
[MaxLength(100), Comment("นามสกุลบิดา")]
public string? FatherLastName { get; set; }
[MaxLength(200), Comment("อาชีพบิดา")]
public string? FatherOccupation { get; set; }
[MaxLength(100), Comment("สัญชาติบิดา")]
public string? FatherNationality { get; set; }
[Comment("Id คำนำหน้าชื่อมารดา")]
public Guid? MotherPrefixId { get; set; }
[Comment("คำนำหน้าชื่อมารดา")]
public string? MotherPrefixName { get; set; }
[MaxLength(100), Comment("ชื่อจริงมารดา")]
public string? MotherFirstName { get; set; }
[MaxLength(100), Comment("นามสกุลมารดา")]
public string? MotherLastName { get; set; }
[MaxLength(200), Comment("อาชีพมารดา")]
public string? MotherOccupation { get; set; }
[MaxLength(100), Comment("สัญชาติมารดา")]
public string? MotherNationality { get; set; }
[Comment("ตำแหน่งปัจจุบัน ชื่อตำแหน่ง")]
public string? OccupationOrg { get; set; }
[Comment("ตำแหน่งปัจจุบัน กอง")]
public string? OccupationPile { get; set; }
[Comment("ตำแหน่งปัจจุบัน กลุ่ม/ฝ่าย")]
public string? OccupationGroup { get; set; }
[Comment("ตำแหน่งปัจจุบัน เงินเดือน")]
public int? OccupationSalary { get; set; }
[Comment("ตำแหน่งปัจจุบัน สังกัด")]
public string? OccupationPosition { get; set; }
[Comment("ตำแหน่งปัจจุบัน ประเภทราชการ")]
public string? OccupationPositionType { get; set; }
[MaxLength(20), Comment("ตำแหน่งปัจจุบัน เบอร์โทรที่ทำงาน")]
public string? OccupationTelephone { get; set; }
[Comment("เหตุผลการไม่อนุมัติ")]
public string? RejectDetail { get; set; }
[Comment("ผลสมัครสอบ")]
public string? Pass { get; set; }
[Comment("หมายเหตุ")]
public string? ExamReason { get; set; }
[Comment("คะแนนความพึงพอใจ")]
public int? ReviewPoint { get; set; }
[Comment("ข้อแนะนำ")]
public string? Review { get; set; }
[MaxLength(40), Comment("วันที่สมัคร")]
public DateTime? RegisterDate { get; set; }
[Comment("วันที่ชำระเงิน")]
public DateTime? PaymentDate { get; set; }
[Comment("Id คำนำหน้า บุคคลที่สามารถติดต่อได้")]
public Guid? ContactPrefixId { get; set; }
[Comment("คำนำหน้า บุคคลที่สามารถติดต่อได้")]
public string? ContactPrefixName { get; set; }
[Comment("ชื่อ บุคคลที่สามารถติดต่อได้")]
public string? ContactFirstname { get; set; }
[Comment("สกุล บุคคลที่สามารถติดต่อได้")]
public string? ContactLastname { get; set; }
[Comment("เกี่ยวข้องเป็น บุคคลที่สามารถติดต่อได้")]
public string? ContactRelations { get; set; }
[Comment("โทรศัพท์ บุคคลที่สามารถติดต่อได้")]
public string? ContactTel { get; set; }
public virtual List<Education> Educations { get; set; } = new List<Education>();
public virtual List<Career> Careers { get; set; } = new List<Career>();
}
}

View file

@ -0,0 +1,37 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using BMA.EHR.Domain.Models.Base;
namespace BMA.EHR.Domain.ModelsExam.Candidate
{
public class Career : EntityBase
{
[Required, Column(Order = 9), Comment("Id ผู้สมัคร")]
public virtual Candidate? Candidate { get; set; }
[Required, Column(Order = 3), Comment("ชื่อตำแหน่ง")]
public string Position { get; set; } = string.Empty;
[Column(Order = 4), Comment("กลุ่ม/ฝ่าย")]
public string? Group { get; set; } = string.Empty;
[Column(Order = 5), Comment("กอง")]
public string? Pile { get; set; } = string.Empty;
[Column(Order = 6), Comment("สังกัด")]
public string? Org { get; set; } = string.Empty;
[Required, Column(Order = 1), Comment("ระยะเวลาเริ่ม")]
public DateTime DurationStart { get; set; } = DateTime.Now.Date;
[Required, Column(Order = 2), Comment("ระยะเวลาสิ้นสุด")]
public DateTime DurationEnd { get; set; } = DateTime.Now.Date;
[Required, Column(Order = 7), Comment("ระยะเวลา")]
public string RangeDate { get; set; } = string.Empty;
[Required, Column(Order = 8), Comment("ประเภท")]
public string Type { get; set; } = string.Empty;
}
}

View file

@ -0,0 +1,33 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using BMA.EHR.Domain.Models.Base;
namespace BMA.EHR.Domain.ModelsExam.Candidate
{
public class Education : EntityBase
{
[Required, Column(Order = 7), Comment("Id ผู้สมัคร")]
public virtual Candidate? Candidate { get; set; }
[Comment("Id วุฒิที่ใช้สมัครสอบ")]
public Guid? EducationLevelExamId { get; set; }
[Comment("วุฒิที่ใช้สมัครสอบ")]
public string? EducationLevelExamName { get; set; }
[Comment("ชื่อปริญญา")]
public string? EducationName { get; set; }
[Comment("สาขาวิชา/วิชาเอก")]
public string? EducationMajor { get; set; }
[Comment("ชื่อสถานศึกษา")]
public string? EducationLocation { get; set; }
[Comment("ประเภทสถานศึกษา")]
public string? EducationType { get; set; }
[Comment("วันที่สำเร็จการศึกษา")]
public DateTime? EducationEndDate { get; set; }
[Comment("คะแนนเฉลี่ยสะสม")]
public string? EducationScores { get; set; }
[Comment("Id วุฒิการศึกษาสูงสุด")]
public Guid? EducationLevelHighId { get; set; }
[Comment("วุฒิการศึกษาสูงสุด")]
public string? EducationLevelHighName { get; set; }
}
}

View file

@ -0,0 +1,110 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using BMA.EHR.Domain.Models.Base;
namespace BMA.EHR.Domain.ModelsExam.Candidate
{
public class PeriodExam : EntityBase
{
[Required, MaxLength(150), Column(Order = 8), Comment("ชื่อการสอบ")]
public string Name { get; set; } = string.Empty;
[Required, Comment("ตรวจสอบเอกสารหลังประกาศผลสอบ")]
public bool CheckDocument { get; set; } = false;
[Required, Comment("คนพิการ")]
public bool CheckDisability { get; set; } = false;
[Column(Order = 9), Comment("รอบการสอบ")]
public int? Round { get; set; }
[Comment("ปีงบประมาณ")]
public int? Year { get; set; }
[Comment("ค่าธรรมเนียม")]
public float? Fee { get; set; } = 0;
[Column(Order = 1), Comment("วันเริ่มสมัครสอบ")]
public DateTime? RegisterStartDate { get; set; }
[Column(Order = 2), Comment("วันสิ้นสุดสมัครสอบ")]
public DateTime? RegisterEndDate { get; set; }
[Column(Order = 3), Comment("วันเริ่มชำระเงิน")]
public DateTime? PaymentStartDate { get; set; }
[Column(Order = 4), Comment("วันสิ้นสุดชำระเงิน")]
public DateTime? PaymentEndDate { get; set; }
[Column(Order = 5), Comment("วันประกาศผลสอบ")]
public DateTime? AnnouncementDate { get; set; }
[Required, Column(Order = 6), Comment("วันเริ่มประกาศ")]
public DateTime AnnouncementStartDate { get; set; } = DateTime.Now.Date;
[Required, Column(Order = 7), Comment("วันสิ้นสุดประกาศ")]
public DateTime AnnouncementEndDate { get; set; } = DateTime.Now.Date;
[Comment("วันที่สอบ")]
public DateTime? ExamDate { get; set; }
[Comment("Id รหัสส่วนราชการ")]
public Guid? OrganizationCodeId { get; set; }
[Comment("ชื่อรหัสส่วนราชการ")]
public string? OrganizationCodeName { get; set; }
[Comment("Id หน่วยงาน")]
public Guid? OrganizationId { get; set; }
[Comment("ชื่อหน่วยงาน")]
public string? OrganizationName { get; set; }
[Comment("ชำระเงินผ่านกรุงไทย")]
public string? PaymentKrungThai { get; set; }
[Comment("รายละเอียดสมัครสอบ")]
public string? Detail { get; set; }
[Comment("รายละเอียดเงื่อนไขการสมัคร")]
public string? EditorCondition { get; set; }
[Comment("รายละเอียดคำรับรอง")]
public string? EditorConfirm { get; set; }
[Comment("หมายเหตุ")]
public string? Note { get; set; }
[Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true;
[Comment("เช็คอัพคะแนน")]
public bool SetSeat { get; set; } = false;
[Comment("ประกาศนี้มีสมัครสอบคัดเลือก")]
public bool AnnouncementExam { get; set; } = false;
[Comment("สำนัก")]
public string? Category { get; set; }
[Comment("รายชื่อคนสม้ครในรอบ")]
public List<Candidate> Candidate { get; set; } = new List<Candidate>();
[Comment("ตำแหน่งสมัคร")]
public List<PositionExam> PositionExam { get; set; } = new List<PositionExam>();
// [Comment("ช่องทางชำระเงิน")]
// public List<BankExam> BankExam { get; set; } = new List<BankExam>();
// [Comment("เอกสารอื่นๆ")]
// public virtual List<PeriodExamDocument> PeriodExamDocuments { get; set; } = new();
// [Comment("รูป")]
// public virtual List<PeriodExamImage> PeriodExamImages { get; set; } = new();
// public Document? ImportFile { get; set; } = new Document();
// public List<Disable> Disables { get; set; } = new List<Disable>();
// public ScoreImport? ScoreImport { get; set; }
// public List<DisableImportHistory> ImportHostories { get; set; } = new List<DisableImportHistory>();
}
}

View file

@ -0,0 +1,37 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using BMA.EHR.Domain.Models.Base;
namespace BMA.EHR.Domain.ModelsExam.Candidate
{
public class PositionExam : EntityBase
{
[Required, Comment("Id การสอบ")]
public virtual PeriodExam? PeriodExam { get; set; }
[Comment("Id ตำแหน่ง")]
public Guid? PositionId { get; set; }
[Comment("ชื่อตำแหน่ง")]
public string? PositionName { get; set; }
[Comment("Id ระดับ")]
public Guid? PositionLevelId { get; set; }
[Comment("ชื่อระดับ")]
public string? PositionLevelName { get; set; }
[Comment("Id ประเภทแบบฟอร์ม")]
public string? TypeId { get; set; }
[Comment("ชื่อประเภทแบบฟอร์ม")]
public string? TypeName { get; set; }
[Comment("ปริญญาบัตรขึ้นไป")]
public bool HighDegree { get; set; }
[Comment("รหัสประจำตำแหน่งที่สอบ")]
public string? Code { get; set; }
}
}

View file

@ -7,30 +7,44 @@ using Microsoft.Extensions.DependencyInjection;
namespace BMA.EHR.Infrastructure
{
public static class InfrastructureServiceRegistration
{
public static IServiceCollection AddPersistence(this IServiceCollection services,
IConfiguration configuration)
public static class InfrastructureServiceRegistration
{
public static IServiceCollection AddPersistence(this IServiceCollection services,
IConfiguration configuration)
{
services.AddTransient<MinIOService>();
var connectionString = configuration.GetConnectionString("DefaultConnection");
services.AddDbContext<ApplicationDBContext>(options =>
options.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString),
b =>
{
b.MigrationsAssembly(typeof(ApplicationDBContext).Assembly.FullName);
b.MigrationsHistoryTable("__EHRMigrationsHistory");
options.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString),
b =>
{
b.MigrationsAssembly(typeof(ApplicationDBContext).Assembly.FullName);
b.MigrationsHistoryTable("__EHRMigrationsHistory");
}),
ServiceLifetime.Transient);
services.AddScoped<IApplicationDBContext>(provider => provider.GetService<ApplicationDBContext>());
}),
ServiceLifetime.Transient);
return services;
}
services.AddScoped<IApplicationDBContext>(provider => provider.GetService<ApplicationDBContext>());
}
var connectionStringExam = configuration.GetConnectionString("ExamConnection");
services.AddDbContext<ApplicationDBExamContext>(options =>
options.UseMySql(connectionStringExam, ServerVersion.AutoDetect(connectionStringExam),
b =>
{
b.MigrationsAssembly(typeof(ApplicationDBExamContext).Assembly.FullName);
b.MigrationsHistoryTable("__EHRMigrationsHistory");
}),
ServiceLifetime.Transient);
services.AddScoped<IApplicationDBContext>(provider => provider.GetService<ApplicationDBExamContext>());
return services;
}
}
}

View file

@ -0,0 +1,44 @@
using BMA.EHR.Application.Common.Interfaces;
using BMA.EHR.Domain.Models.Commands.Core;
using BMA.EHR.Domain.Models.Documents;
using BMA.EHR.Domain.Models.HR;
using BMA.EHR.Domain.Models.Insignias;
using BMA.EHR.Domain.Models.MetaData;
using BMA.EHR.Domain.Models.Notifications;
using BMA.EHR.Domain.Models.OrganizationEmployee;
using BMA.EHR.Domain.Models.Organizations;
using BMA.EHR.Domain.Models.Organizations.Report2;
using BMA.EHR.Domain.Models.Placement;
using BMA.EHR.Domain.Models.Probation;
using BMA.EHR.Domain.Models.Retirement;
using BMA.EHR.Domain.ModelsExam.Candidate;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Infrastructure.Persistence
{
public class ApplicationDBExamContext : DbContext, IApplicationDBContext
{
#region " From Existing Database "
public DbSet<Candidate> Candidates { get; set; }
public DbSet<Career> Careers { get; set; }
public DbSet<Education> Educations { get; set; }
public DbSet<PeriodExam> PeriodExams { get; set; }
public DbSet<PositionExam> PositionExams { get; set; }
#endregion
public ApplicationDBExamContext(DbContextOptions<ApplicationDBExamContext> options) : base(options)
{
}
public Task<int> SaveChangesAsync()
{
return base.SaveChangesAsync();
}
public void Attatch<T>(T entity) where T : class
{
Attach(entity);
}
}
}

View file

@ -646,6 +646,9 @@
<None Update="Reports\26-หนังสือถึงสถาบันพัฒนาข้าราชการ-5.trdp">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Reports\ผลสอบคัดเลือกรายบุคคล.trdp">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View file

@ -52,7 +52,7 @@ namespace BMA.EHR.Report.Service.Controllers
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
}
var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"ใบสมัครสอบคัดเลือก.trdp");
var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"ผลสอบคัดเลือกรายบุคคล.trdp");
ReportPackager reportPacker = new ReportPackager();
Telerik.Reporting.Report? report = null;
using (var sourceStream = System.IO.File.OpenRead(rptFile))

View file

@ -133,6 +133,7 @@ var app = builder.Build();
// apply migrations
await using var scope = app.Services.CreateAsyncScope();
await using var db = scope.ServiceProvider.GetRequiredService<ApplicationDBContext>();
await using var dbExam = scope.ServiceProvider.GetRequiredService<ApplicationDBExamContext>();
await db.Database.MigrateAsync();
app.Run();

View file

@ -14,7 +14,8 @@
"AllowedHosts": "*",
"ConnectionStrings": {
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
"DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
"DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"ExamConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_exam_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
},
"Jwt": {
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",