Merge branch 'develop'

* develop:
  no message
  add CandidateId
  edit template
  export path
  no message
  export payment
  no message
  no message
  no message
  no message
  no message
  เพิ่มฟอร์มชำระเงิน
  แก้เลข excel
  no message
  no message
This commit is contained in:
Warunee Tamkoo 2025-02-11 14:34:38 +07:00
commit 13c083d8b4
16 changed files with 7154 additions and 133 deletions

View file

@ -260,6 +260,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
{
await _periodExamService.UpdateImgAsync(examId, files);
}
else if (type == "barcode")
{
await _periodExamService.UpdateBarcodeAsync(examId, files);
}
else if (type == "qrcode")
{
await _periodExamService.UpdateQrcodeAsync(examId, files);
}
else
{
await _periodExamService.UpdateDocAsync(examId, files);
@ -357,6 +365,32 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
}
}
/// <summary>
/// ข้อมูลเอกสารชำระเงิน
/// </summary>
/// <param name="examId">รหัสรอบสมัคร</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลชำระเงินสำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("payment-export/{examId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> ExportsPaymentExamAsync(string examId)
{
try
{
var items = await _periodExamService.ExportsPaymentExamAsync(examId);
return Success(items);
}
catch (Exception ex)
{
return Error(ex);
}
}
// /// <summary>
// /// รายชื่อผู้สมัครสอบรอ จัดการเลขที่นั่งสอบ
// /// </summary>
@ -735,7 +769,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
//string excelName = $"Candidate_{DateTime.Now.ToString("yyyyMMddHHmmssfff")}.xlsx";
//return File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", excelName);
var data = await _periodExamService.NewDownloadCandidateAsync(examId);
return Success(data);
}
@ -765,7 +799,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
//string excelName = $"Candidate_{DateTime.Now.ToString("yyyyMMddHHmmssfff")}.xlsx";
//return File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", excelName);
var data = await _periodExamService.NewDownloadCandidateAllAsync(examId);
return Success(data);
}

View file

@ -56,6 +56,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Data
public DbSet<PeriodExamDocument> PeriodExamDocuments { get; set; }
public DbSet<PeriodExamImage> PeriodExamImages { get; set; }
public DbSet<PeriodExamBarCode> PeriodExamBarCodes { get; set; }
public DbSet<PeriodExamQrCode> PeriodExamQrCodes { get; set; }
public DbSet<CMSCandidate> CMSCandidates { get; set; }

View file

@ -59,11 +59,6 @@ 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)
@ -124,11 +119,6 @@ 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)
@ -214,11 +204,6 @@ 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)
@ -319,11 +304,6 @@ 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)
@ -520,11 +500,6 @@ 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("ความสามารถพิเศษ");
@ -892,11 +867,6 @@ 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)
@ -971,11 +941,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnOrder(4)
.HasComment("กลุ่ม/ฝ่าย");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(106)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
@ -1096,11 +1061,6 @@ 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)
@ -1253,11 +1213,6 @@ 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)
@ -1388,11 +1343,6 @@ 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)");
@ -1459,11 +1409,6 @@ 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)
@ -1539,11 +1484,6 @@ 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)
@ -1629,11 +1569,6 @@ 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)
@ -1694,11 +1629,6 @@ 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)
@ -1819,11 +1749,6 @@ 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)
@ -1957,11 +1882,6 @@ 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)
@ -2054,11 +1974,6 @@ 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)
@ -2199,11 +2114,6 @@ 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)
@ -2270,6 +2180,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnType("tinyint(1)")
.HasComment("ตรวจสอบเอกสารหลังประกาศผลสอบ");
b.Property<string>("CompanyCode")
.HasColumnType("longtext")
.HasComment("Company code");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
@ -2376,6 +2290,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnOrder(3)
.HasComment("วันเริ่มชำระเงิน");
b.Property<string>("Reason")
.HasColumnType("text")
.HasComment("หมายเหตุ");
b.Property<string>("RefNo1")
.HasColumnType("longtext")
.HasComment("Ref No1");
b.Property<DateTime?>("RegisterEndDate")
.HasColumnType("datetime(6)")
.HasColumnOrder(2)
@ -2386,6 +2308,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnOrder(1)
.HasComment("วันเริ่มสมัครสอบ");
b.Property<string>("Remark")
.HasColumnType("text")
.HasComment("remark");
b.Property<int?>("Round")
.HasColumnType("int")
.HasColumnOrder(9)
@ -2406,6 +2332,68 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.ToTable("PeriodExams");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.PeriodExamBarCode", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<Guid>("DocumentId")
.HasColumnType("char(36)");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<Guid>("PeriodExamId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("DocumentId");
b.HasIndex("PeriodExamId");
b.ToTable("PeriodExamBarCodes");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.PeriodExamDocument", b =>
{
b.Property<Guid>("Id")
@ -2437,11 +2425,6 @@ 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)
@ -2504,11 +2487,6 @@ 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)
@ -2540,6 +2518,68 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.ToTable("PeriodExamImages");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.PeriodExamQrCode", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<Guid>("DocumentId")
.HasColumnType("char(36)");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<Guid>("PeriodExamId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("DocumentId");
b.HasIndex("PeriodExamId");
b.ToTable("PeriodExamQrCodes");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.PositionExam", b =>
{
b.Property<Guid>("Id")
@ -2576,11 +2616,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
.HasColumnType("tinyint(1)")
.HasComment("ปริญญาบัตรขึ้นไป");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasColumnOrder(106)
.HasComment("สถานะการใช้งาน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
@ -2886,6 +2921,25 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.Navigation("ImportFile");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.PeriodExamBarCode", b =>
{
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Documents.Document", "Document")
.WithMany()
.HasForeignKey("DocumentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.PeriodExam", "PeriodExam")
.WithMany("PeriodExamBarCodes")
.HasForeignKey("PeriodExamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Document");
b.Navigation("PeriodExam");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.PeriodExamDocument", b =>
{
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Documents.Document", "Document")
@ -2924,6 +2978,25 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.Navigation("PeriodExam");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.PeriodExamQrCode", b =>
{
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.Documents.Document", "Document")
.WithMany()
.HasForeignKey("DocumentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.PeriodExam", "PeriodExam")
.WithMany("PeriodExamQrCodes")
.HasForeignKey("PeriodExamId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Document");
b.Navigation("PeriodExam");
});
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.PositionExam", b =>
{
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.PeriodExam", "PeriodExam")
@ -2979,10 +3052,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
b.Navigation("ImportHostories");
b.Navigation("PeriodExamBarCodes");
b.Navigation("PeriodExamDocuments");
b.Navigation("PeriodExamImages");
b.Navigation("PeriodExamQrCodes");
b.Navigation("PositionExam");
b.Navigation("ScoreImport");

View file

@ -70,5 +70,46 @@ namespace BMA.EHR.Recurit.Exam.Service.Extensions
}
return result.ToString();
}
public static string NumberToThaiText(this float number)
{
int baht = (int)number; // แยกส่วนบาท
int satang = (int)Math.Round((number - baht) * 100); // คำนวณสตางค์ (ปัดเป็นจำนวนเต็ม)
string bahtText = ConvertIntToThai(baht) + "บาท";
string satangText = satang > 0 ? ConvertIntToThai(satang) + "สตางค์" : "ถ้วน";
return bahtText + satangText;
}
public static string ConvertIntToThai(int number)
{
string[] unit = { "", "สิบ", "ร้อย", "พัน", "หมื่น", "แสน", "ล้าน" };
string[] digit = { "ศูนย์", "หนึ่ง", "สอง", "สาม", "สี่", "ห้า", "หก", "เจ็ด", "แปด", "เก้า" };
string result = "";
string numStr = number.ToString();
int len = numStr.Length;
for (int i = 0; i < len; i++)
{
int num = numStr[i] - '0';
int pos = len - i - 1;
if (num != 0)
{
if (pos == 1 && num == 1)
result += "สิบ";
else if (pos == 1 && num == 2)
result += "ยี่สิบ";
else if (pos == 0 && num == 1 && len > 1)
result += "เอ็ด";
else
result += digit[num] + unit[pos];
}
}
return result;
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,450 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recurit.Exam.Service.Migrations
{
/// <inheritdoc />
public partial class updatetableperiodaddqrcode : Migration
{
/// <inheritdoc />
protected override void Up(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");
migrationBuilder.AddColumn<string>(
name: "CompanyCode",
table: "PeriodExams",
type: "longtext",
nullable: true,
comment: "Company code")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "CustomerName",
table: "PeriodExams",
type: "longtext",
nullable: true,
comment: "Customer name")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Reason",
table: "PeriodExams",
type: "text",
nullable: true,
comment: "หมายเหตุ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "RefNo1",
table: "PeriodExams",
type: "longtext",
nullable: true,
comment: "Ref No1")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Remark",
table: "PeriodExams",
type: "text",
nullable: true,
comment: "remark")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "PeriodExamBarCodes",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
.Annotation("MySql:CharSet", "utf8mb4"),
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
.Annotation("MySql:CharSet", "utf8mb4"),
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
.Annotation("MySql:CharSet", "utf8mb4"),
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
.Annotation("MySql:CharSet", "utf8mb4"),
PeriodExamId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
DocumentId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_PeriodExamBarCodes", x => x.Id);
table.ForeignKey(
name: "FK_PeriodExamBarCodes_Documents_DocumentId",
column: x => x.DocumentId,
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_PeriodExamBarCodes_PeriodExams_PeriodExamId",
column: x => x.PeriodExamId,
principalTable: "PeriodExams",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "PeriodExamQrCodes",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
.Annotation("MySql:CharSet", "utf8mb4"),
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
.Annotation("MySql:CharSet", "utf8mb4"),
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
.Annotation("MySql:CharSet", "utf8mb4"),
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
.Annotation("MySql:CharSet", "utf8mb4"),
PeriodExamId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
DocumentId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_PeriodExamQrCodes", x => x.Id);
table.ForeignKey(
name: "FK_PeriodExamQrCodes_Documents_DocumentId",
column: x => x.DocumentId,
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_PeriodExamQrCodes_PeriodExams_PeriodExamId",
column: x => x.PeriodExamId,
principalTable: "PeriodExams",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_PeriodExamBarCodes_DocumentId",
table: "PeriodExamBarCodes",
column: "DocumentId");
migrationBuilder.CreateIndex(
name: "IX_PeriodExamBarCodes_PeriodExamId",
table: "PeriodExamBarCodes",
column: "PeriodExamId");
migrationBuilder.CreateIndex(
name: "IX_PeriodExamQrCodes_DocumentId",
table: "PeriodExamQrCodes",
column: "DocumentId");
migrationBuilder.CreateIndex(
name: "IX_PeriodExamQrCodes_PeriodExamId",
table: "PeriodExamQrCodes",
column: "PeriodExamId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PeriodExamBarCodes");
migrationBuilder.DropTable(
name: "PeriodExamQrCodes");
migrationBuilder.DropColumn(
name: "CompanyCode",
table: "PeriodExams");
migrationBuilder.DropColumn(
name: "CustomerName",
table: "PeriodExams");
migrationBuilder.DropColumn(
name: "Reason",
table: "PeriodExams");
migrationBuilder.DropColumn(
name: "RefNo1",
table: "PeriodExams");
migrationBuilder.DropColumn(
name: "Remark",
table: "PeriodExams");
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);
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recurit.Exam.Service.Migrations
{
/// <inheritdoc />
public partial class updatetableperiodaddqrcode1 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CustomerName",
table: "PeriodExams");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "CustomerName",
table: "PeriodExams",
type: "longtext",
nullable: true,
comment: "Customer name")
.Annotation("MySql:CharSet", "utf8mb4");
}
}
}

View file

@ -89,6 +89,18 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[Comment("สำนัก")]
public string? Category { get; set; }
[Comment("remark"), Column(TypeName = "text")]
public string? Remark { get; set; }
[Comment("Company code")]
public string? CompanyCode { get; set; }
[Comment("หมายเหตุ"), Column(TypeName = "text")]
public string? Reason { get; set; }
[Comment("Ref No1")]
public string? RefNo1 { get; set; }
[Comment("รายชื่อคนสม้ครในรอบ")]
public List<Candidate> Candidate { get; set; } = new List<Candidate>();
@ -103,6 +115,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
[Comment("รูป")]
public virtual List<PeriodExamImage> PeriodExamImages { get; set; } = new();
[Comment("qr code")]
public virtual List<PeriodExamQrCode> PeriodExamQrCodes { get; set; } = new();
[Comment("bar code")]
public virtual List<PeriodExamBarCode> PeriodExamBarCodes { get; set; } = new();
public Document? ImportFile { get; set; } = new Document();
public List<Disable> Disables { get; set; } = new List<Disable>();
public ScoreImport? ScoreImport { get; set; }

View file

@ -0,0 +1,15 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using BMA.EHR.Recurit.Exam.Service.Models.Documents;
namespace BMA.EHR.Recurit.Exam.Service.Models
{
public class PeriodExamBarCode : EntityBase
{
[Required, Comment("Id รอบสมัครสอบ")]
public virtual PeriodExam? PeriodExam { get; set; }
[Required, Comment("Id ไฟล์รูป")]
public virtual Document? Document { get; set; }
}
}

View file

@ -0,0 +1,15 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using BMA.EHR.Recurit.Exam.Service.Models.Documents;
namespace BMA.EHR.Recurit.Exam.Service.Models
{
public class PeriodExamQrCode : EntityBase
{
[Required, Comment("Id รอบสมัครสอบ")]
public virtual PeriodExam? PeriodExam { get; set; }
[Required, Comment("Id ไฟล์รูป")]
public virtual Document? Document { get; set; }
}
}

View file

@ -29,6 +29,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Request
public string? EditorCondition { get; set; }
public string? EditorConfirm { get; set; }
public string? Note { get; set; }
public string? Remark { get; set; }
public string? CompanyCode { get; set; }
public string? Reason { get; set; }
public string? RefNo1 { get; set; }
public List<FormFile>? Doc { get; set; }
public List<FormFile>? Image { get; set; }
public List<RequestBankExam> BankExam { get; set; } = new();

View file

@ -7,5 +7,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
public string? PaymentImg { get; set; }
public string? RejectDetail { get; set; }
public Guid? CandidateId { get; set; }
}
}

View file

@ -34,10 +34,16 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
public string? Note { get; set; }
public bool IsActive { get; set; }
public bool SetSeat { get; set; }
public string? Remark { get; set; }
public string? CompanyCode { get; set; }
public string? Reason { get; set; }
public string? RefNo1 { get; set; }
public List<Models.Candidate> Candidate { get; set; } = new List<Models.Candidate>();
public List<Models.PositionExam> PositionExam { get; set; } = new List<Models.PositionExam>();
public List<Models.BankExam> BankExam { get; set; } = new List<Models.BankExam>();
public List<FileListResponse> Documents { get; set; } = new List<FileListResponse>();
public List<FileListResponse> Images { get; set; } = new List<FileListResponse>();
public List<FileListResponse> BarCodes { get; set; } = new List<FileListResponse>();
public List<FileListResponse> QrCodes { get; set; } = new List<FileListResponse>();
}
}

View file

@ -601,7 +601,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (candidate.PaymentImg != null)
candidate.PaymentImg.Detail = _minioService.ImagesPath(candidate.PaymentImg.Id).Result;
return new PaymentImgResponse { PaymentImg = candidate.PaymentImg == null ? "" : candidate.PaymentImg.Detail, RejectDetail = candidate.RejectDetail };
return new PaymentImgResponse { PaymentImg = candidate.PaymentImg == null ? "" : candidate.PaymentImg.Detail, RejectDetail = candidate.RejectDetail, CandidateId = candidate.Id };
}
public async Task<string> GetsAsyncPaymentImgCandidate(string candidateId)

View file

@ -115,6 +115,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
IsActive = x.IsActive,
Name = x.Name,
Note = x.Note,
Remark = x.Remark,
CompanyCode = x.CompanyCode,
Reason = x.Reason,
RefNo1 = x.RefNo1,
OrganizationCodeId = x.OrganizationCodeId,
OrganizationCodeName = x.OrganizationCodeName,
OrganizationId = x.OrganizationId,
@ -160,6 +164,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
IsActive = x.IsActive,
Name = x.Name,
Note = x.Note,
Remark = x.Remark,
CompanyCode = x.CompanyCode,
Reason = x.Reason,
RefNo1 = x.RefNo1,
OrganizationCodeId = x.OrganizationCodeId,
OrganizationCodeName = x.OrganizationCodeName,
OrganizationId = x.OrganizationId,
@ -209,6 +217,22 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
FileType = b.Document == null ? "" : b.Document.FileType,
Detail = b.Document == null ? "" : b.Document.Id.ToString(),
}).ToList(),
BarCodes = x.PeriodExamBarCodes.OrderBy(o => o.CreatedAt).Select(b => new FileListResponse
{
Id = b.Document == null ? "" : b.Document.Id.ToString(),
FileName = b.Document == null ? "" : b.Document.FileName,
FileSize = b.Document == null ? 0 : b.Document.FileSize,
FileType = b.Document == null ? "" : b.Document.FileType,
Detail = b.Document == null ? "" : b.Document.Id.ToString(),
}).ToList(),
QrCodes = x.PeriodExamQrCodes.OrderBy(o => o.CreatedAt).Select(b => new FileListResponse
{
Id = b.Document == null ? "" : b.Document.Id.ToString(),
FileName = b.Document == null ? "" : b.Document.FileName,
FileSize = b.Document == null ? 0 : b.Document.FileSize,
FileType = b.Document == null ? "" : b.Document.FileType,
Detail = b.Document == null ? "" : b.Document.Id.ToString(),
}).ToList(),
})
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
@ -229,6 +253,20 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
periodExam.Documents[i].Detail = _minioService.ImagesPath(Guid.Parse(periodExam.Documents[i].Detail)).Result;
i++;
}
i = 0;
foreach (var item in periodExam.QrCodes)
{
if (periodExam.QrCodes[i].Detail != null && periodExam.QrCodes[i].Detail != "")
periodExam.QrCodes[i].Detail = _minioService.ImagesPath(Guid.Parse(periodExam.QrCodes[i].Detail)).Result;
i++;
}
i = 0;
foreach (var item in periodExam.BarCodes)
{
if (periodExam.BarCodes[i].Detail != null && periodExam.BarCodes[i].Detail != "")
periodExam.BarCodes[i].Detail = _minioService.ImagesPath(Guid.Parse(periodExam.BarCodes[i].Detail)).Result;
i++;
}
return periodExam;
}
@ -319,6 +357,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
EditorCondition = inserted.EditorCondition,
EditorConfirm = inserted.EditorConfirm,
Note = inserted.Note,
Remark = inserted.Remark,
CompanyCode = inserted.CompanyCode,
Reason = inserted.Reason,
RefNo1 = inserted.RefNo1,
CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
@ -415,6 +457,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
periodExam.EditorCondition = updated.EditorCondition;
periodExam.EditorConfirm = updated.EditorConfirm;
periodExam.Note = updated.Note;
periodExam.Remark = updated.Remark;
periodExam.CompanyCode = updated.CompanyCode;
periodExam.Reason = updated.Reason;
periodExam.RefNo1 = updated.RefNo1;
periodExam.LastUpdatedAt = DateTime.Now;
periodExam.LastUpdateUserId = UserId ?? "";
periodExam.LastUpdateFullName = FullName ?? "";
@ -599,6 +645,73 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
await _context.SaveChangesAsync();
}
public async Task UpdateBarcodeAsync(string examId, IFormFileCollection files)
{
var periodExam = await _context.PeriodExams.AsQueryable()
.Include(x => x.PeriodExamBarCodes)
.ThenInclude(x => x.Document)
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
if (periodExam == null)
throw new Exception(GlobalMessages.ExamNotFound);
if (periodExam.PeriodExamBarCodes != null && periodExam.PeriodExamBarCodes.Count() > 0 && periodExam.PeriodExamBarCodes[0] != null && periodExam.PeriodExamBarCodes[0].Document != null)
await _minioService.DeleteFileAsync(periodExam.PeriodExamBarCodes[0].Document.Id);
foreach (var file in files)
{
var doc = await _minioService.UploadFileAsync(file);
var document = await _context.Documents.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == doc.Id);
if (document == null)
throw new Exception(GlobalMessages.NoFileToUpload);
var periodExamBarCode = new PeriodExamBarCode
{
PeriodExam = periodExam,
Document = document,
};
await _context.PeriodExamBarCodes.AddAsync(periodExamBarCode);
}
await _context.SaveChangesAsync();
}
public async Task UpdateQrcodeAsync(string examId, IFormFileCollection files)
{
var periodExam = await _context.PeriodExams.AsQueryable()
.Include(x => x.PeriodExamQrCodes)
.ThenInclude(x => x.Document)
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
if (periodExam == null)
throw new Exception(GlobalMessages.ExamNotFound);
if (periodExam.PeriodExamQrCodes != null && periodExam.PeriodExamQrCodes.Count() > 0 && periodExam.PeriodExamQrCodes[0] != null && periodExam.PeriodExamQrCodes[0].Document != null)
await _minioService.DeleteFileAsync(periodExam.PeriodExamQrCodes[0].Document.Id);
foreach (var file in files)
{
var doc = await _minioService.UploadFileAsync(file);
var document = await _context.Documents.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == doc.Id);
if (document == null)
throw new Exception(GlobalMessages.NoFileToUpload);
var periodExamQrCode = new PeriodExamQrCode
{
PeriodExam = periodExam,
Document = document,
};
await _context.PeriodExamQrCodes.AddAsync(periodExamQrCode);
}
await _context.SaveChangesAsync();
}
public async Task DeleteDocument(string documentId)
{
await _minioService.DeleteFileAsync(Guid.Parse(documentId));
@ -1029,9 +1142,37 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
PointPerC = worksheet.Cells[row, 21].Value != null ? worksheet.Cells[row, 21].Value.ToString() : null,
ResultC = worksheet.Cells[row, 22].Value != null ? worksheet.Cells[row, 22].Value.ToString() : null,
Pass = worksheet.Cells[row, 23].Value != null ? (worksheet.Cells[row, 23].Value.ToString()) : null,
ExamReason = worksheet.Cells[row, 27].Value != null ? (worksheet.Cells[row, 27].Value.ToString()) : null,
Pass = worksheet.Cells[row, 23].Value != null ? worksheet.Cells[row, 23].Value.ToString() : null,
ExamReason = worksheet.Cells[row, 27].Value != null ? worksheet.Cells[row, 27].Value.ToString() : null,
});
if (!int.TryParse(worksheet.Cells[row, 9].Value != null ? worksheet.Cells[row, 9].Value.ToString() : "0", out _))
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
if (!int.TryParse(worksheet.Cells[row, 10].Value != null ? worksheet.Cells[row, 10].Value.ToString() : "0", out _))
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
if (!int.TryParse(worksheet.Cells[row, 11].Value != null ? worksheet.Cells[row, 11].Value.ToString() : "0", out _))
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
if (!int.TryParse(worksheet.Cells[3, 12].Value != null ? worksheet.Cells[3, 12].Value.ToString()?.Split(" ")[0] : "0", out _))
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
if (!int.TryParse(worksheet.Cells[row, 12].Value != null ? worksheet.Cells[row, 12].Value.ToString() : "0", out _))
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
if (!int.TryParse(worksheet.Cells[row, 13].Value != null ? worksheet.Cells[row, 13].Value.ToString() : "0", out _))
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
if (!int.TryParse(worksheet.Cells[3, 15].Value != null ? worksheet.Cells[3, 15].Value.ToString()?.Split(" ")[0] : "0", out _))
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
if (!int.TryParse(worksheet.Cells[row, 15].Value != null ? worksheet.Cells[row, 15].Value.ToString() : "0", out _))
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
if (!int.TryParse(worksheet.Cells[row, 16].Value != null ? worksheet.Cells[row, 16].Value.ToString() : "0", out _))
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
if (!int.TryParse(worksheet.Cells[row, 18].Value != null ? worksheet.Cells[row, 18].Value.ToString() : "0", out _))
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
if (!int.TryParse(worksheet.Cells[row, 19].Value != null ? worksheet.Cells[row, 19].Value.ToString() : "0", out _))
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
if (!int.TryParse(worksheet.Cells[3, 20].Value != null ? worksheet.Cells[3, 20].Value.ToString()?.Split(" ")[0] : "0", out _))
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
if (!int.TryParse(worksheet.Cells[row, 20].Value != null ? worksheet.Cells[row, 20].Value.ToString() : "0", out _))
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
if (!int.TryParse(worksheet.Cells[row, 21].Value != null ? worksheet.Cells[row, 21].Value.ToString() : "0", out _))
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
// }
}
}
@ -1377,37 +1518,37 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
{
_data.Add(new
{
Number = item.Number != null ? item.Number.ToThaiNumber() : "-",
Number = item.Number != null ? item.Number.ToString() : "-",
ExamIdenNumber = item.ExamIdenNumber != null ? item.ExamIdenNumber.ToString() : "-",
CitizenId = item.CitizenId != null ? item.CitizenId.ToString() : "-",
SeatNumber = item.SeatNumber != null ? item.SeatNumber.ToThaiNumber() : "-",
PrefixName = item.PrefixName != null ? item.PrefixName.ToThaiNumber() : "-",
SeatNumber = item.SeatNumber != null ? item.SeatNumber.ToString() : "-",
PrefixName = item.PrefixName != null ? item.PrefixName.ToString() : "-",
FullName = item.FirstName != null && item.LastName != null ? $"{item.FirstName} {item.LastName}" : "-",
PositionName = item.PositionExam != null && item.PositionExam?.PositionName != null ? item.PositionExam?.PositionName.ToThaiNumber() : "-",
PositionLevelName = item.PositionExam != null && item.PositionExam?.PositionLevelName != null ? item.PositionExam?.PositionLevelName.ToThaiNumber() : "-",
PositionName = item.PositionExam != null && item.PositionExam?.PositionName != null ? item.PositionExam?.PositionName.ToString() : "-",
PositionLevelName = item.PositionExam != null && item.PositionExam?.PositionLevelName != null ? item.PositionExam?.PositionLevelName.ToString() : "-",
PointPath1A = item.PointPath1A != null ? item.PointPath1A.ToThaiNumber() : "-",
PointPath2A = item.PointPath2A != null ? item.PointPath2A.ToThaiNumber() : "-",
PointPath3A = item.PointPath3A != null ? item.PointPath3A.ToThaiNumber() : "-",
PointA = item.PointA != null ? item.PointA.ToThaiNumber() : "-",
PointPerA = item.PointPerA != null ? item.PointPerA.ToThaiNumber() : "-",
ResultA = item.ResultA != null ? item.ResultA.ToThaiNumber() : "-",
PointPath1A = item.PointPath1A != null ? item.PointPath1A.ToString() : "0",
PointPath2A = item.PointPath2A != null ? item.PointPath2A.ToString() : "0",
PointPath3A = item.PointPath3A != null ? item.PointPath3A.ToString() : "0",
PointA = item.PointA != null ? item.PointA.ToString() : "0",
PointPerA = item.PointPerA != null ? item.PointPerA.ToString() : "0",
ResultA = item.ResultA != null ? item.ResultA.ToString() : "-",
PointB = item.PointB != null ? item.PointB.ToThaiNumber() : "-",
PointPerB = item.PointPerB != null ? item.PointPerB.ToThaiNumber() : "-",
ResultB = item.ResultB != null ? item.ResultB.ToThaiNumber() : "-",
PointB = item.PointB != null ? item.PointB.ToString() : "0",
PointPerB = item.PointPerB != null ? item.PointPerB.ToString() : "0",
ResultB = item.ResultB != null ? item.ResultB.ToString() : "-",
PointPath1C = item.PointPath1C != null ? item.PointPath1C.ToThaiNumber() : "-",
PointPath2C = item.PointPath2C != null ? item.PointPath2C.ToThaiNumber() : "-",
PointC = item.PointC != null ? item.PointC.ToThaiNumber() : "-",
PointPerC = item.PointPerC != null ? item.PointPerC.ToThaiNumber() : "-",
ResultC = item.ResultC != null ? item.ResultC.ToThaiNumber() : "-",
PointPath1C = item.PointPath1C != null ? item.PointPath1C.ToString() : "0",
PointPath2C = item.PointPath2C != null ? item.PointPath2C.ToString() : "0",
PointC = item.PointC != null ? item.PointC.ToString() : "0",
PointPerC = item.PointPerC != null ? item.PointPerC.ToString() : "0",
ResultC = item.ResultC != null ? item.ResultC.ToString() : "-",
Pass = item.Pass != null ? item.Pass.ToThaiNumber() : "-",
Pass = item.Pass != null ? item.Pass.ToString() : "-",
PaymentStatus = item.PeriodExam == null || item.PeriodExam.Fee <= 0 ? "ไม่มีชำระเงิน" : (item.PaymentDate == null ? "ยังไม่ชำระเงิน" : "ชำระแล้ว"),
PaymentDate = item.PaymentDate == null ? "-" : $"{item.PaymentDate.Value.ToThaiShortDate()} {item.PaymentDate.Value:HH:mm:ss.ffff}".ToString().ToThaiNumber(),
RegisterDate = item.RegisterDate == null ? "-" : $"{item.RegisterDate.Value.ToThaiShortDate()} {item.RegisterDate.Value:HH:mm:ss.ffff}".ToString().ToThaiNumber(),
ExamReason = item.ExamReason != null ? item.ExamReason.ToThaiNumber() : "-"
PaymentDate = item.PaymentDate == null ? "-" : $"{item.PaymentDate.Value.ToThaiShortDate()} {item.PaymentDate.Value:HH:mm:ss.ffff}".ToString(),
RegisterDate = item.RegisterDate == null ? "-" : $"{item.RegisterDate.Value.ToThaiShortDate()} {item.RegisterDate.Value:HH:mm:ss.ffff}".ToString(),
ExamReason = item.ExamReason != null ? item.ExamReason.ToString() : "-"
});
}
}
@ -1479,6 +1620,42 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
return periodExam;
}
public async Task<dynamic> ExportsPaymentExamAsync(string candidateId)
{
var periodExam = await _context.Candidates.AsQueryable()
.Include(x => x.PeriodExam)
.ThenInclude(x => x.PeriodExamBarCodes)
.ThenInclude(x => x.Document)
.Include(x => x.PeriodExam)
.ThenInclude(x => x.PeriodExamQrCodes)
.ThenInclude(x => x.Document)
.Where(x => x.Id == Guid.Parse(candidateId))
.FirstOrDefaultAsync();
if (periodExam == null)
throw new Exception(GlobalMessages.ExamNotFound);
return new
{
template = "candidate-payment",
reportName = $"Candidate_{DateTime.Now.ToString("yyyyMMddHHmmssfff")}",
data = new
{
Remark = periodExam?.PeriodExam?.Remark ?? "-",
CompanyCode = periodExam?.PeriodExam?.CompanyCode ?? "-",
PeriodExamBarCodes = (periodExam?.PeriodExam?.PeriodExamBarCodes[0]?.Document?.Id ?? null) == null ? "" : _minioService.ImagesPath(periodExam?.PeriodExam?.PeriodExamBarCodes[0]?.Document?.Id ?? Guid.Parse("00000000-0000-0000-0000-000000000000")).Result,
Reason = periodExam?.PeriodExam?.Reason ?? "-",
RefNo1 = periodExam?.PeriodExam?.RefNo1 ?? "-",
PeriodExamQrCodes = (periodExam?.PeriodExam?.PeriodExamQrCodes[0]?.Document?.Id ?? null) == null ? "" : _minioService.ImagesPath(periodExam?.PeriodExam?.PeriodExamQrCodes[0]?.Document?.Id ?? Guid.Parse("00000000-0000-0000-0000-000000000000")).Result,
CitizenId = periodExam?.CitizenId ?? "-",
FullName = $"{periodExam.PrefixName}{periodExam.FirstName} {periodExam.LastName}",
Fee = periodExam?.PeriodExam?.Fee?.ToString() ?? "-",
Date = DateTime.Now.Date.ToThaiShortDate(),
FeeText = (periodExam?.PeriodExam?.Fee ?? null) == null ? "-" : periodExam?.PeriodExam?.Fee.Value.NumberToThaiText() ?? "-",
}
};
}
public async Task<List<DashboardResponseItem>> GetsDashboardPaymentExamAsync(string examId)
{
var periodExam = await _context.PeriodExams.AsQueryable()