Compare commits

..

No commits in common. "dev" and "v1.0.14" have entirely different histories.
dev ... v1.0.14

11 changed files with 263 additions and 2106 deletions

View file

@ -24,8 +24,6 @@
<PackageReference Include="CoreAdmin" Version="2.7.0" /> <PackageReference Include="CoreAdmin" Version="2.7.0" />
<PackageReference Include="EFCore.BulkExtensions.MySql" Version="6.7.16" /> <PackageReference Include="EFCore.BulkExtensions.MySql" Version="6.7.16" />
<PackageReference Include="EPPlus" Version="6.1.3" /> <PackageReference Include="EPPlus" Version="6.1.3" />
<PackageReference Include="ExcelDataReader" Version="3.8.0" />
<PackageReference Include="ExcelDataReader.DataSet" Version="3.8.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.20" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.20" />
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="7.1.2" /> <PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="7.1.2" />
<PackageReference Include="Microsoft.IdentityModel.Protocols" Version="7.1.2" /> <PackageReference Include="Microsoft.IdentityModel.Protocols" Version="7.1.2" />

View file

@ -377,7 +377,6 @@ namespace BMA.EHR.Recruit.Controllers
try try
{ {
var data = await _context.RecruitImports.AsQueryable() var data = await _context.RecruitImports.AsQueryable()
.AsNoTracking()
.Include(x => x.RecruitImages) .Include(x => x.RecruitImages)
.ThenInclude(x => x.Document) .ThenInclude(x => x.Document)
.Include(x => x.RecruitDocuments) .Include(x => x.RecruitDocuments)
@ -2010,7 +2009,6 @@ namespace BMA.EHR.Recruit.Controllers
public async Task<ActionResult<ResponseObject>> ExportExamAsync(Guid id) public async Task<ActionResult<ResponseObject>> ExportExamAsync(Guid id)
{ {
var data = await _context.RecruitImports.AsQueryable() var data = await _context.RecruitImports.AsQueryable()
.AsNoTracking()
.Include(x => x.Recruits) .Include(x => x.Recruits)
.FirstOrDefaultAsync(x => x.Id == id); .FirstOrDefaultAsync(x => x.Id == id);
@ -2519,7 +2517,6 @@ namespace BMA.EHR.Recruit.Controllers
public async Task<IActionResult> GetCandidateNewListReportAsync(Guid id) public async Task<IActionResult> GetCandidateNewListReportAsync(Guid id)
{ {
var data = await _context.Recruits.AsQueryable() var data = await _context.Recruits.AsQueryable()
.AsNoTracking()
.Include(x => x.RecruitImport) .Include(x => x.RecruitImport)
.Where(x => x.RecruitImport.Id == id) .Where(x => x.RecruitImport.Id == id)
.OrderBy(x => x.ExamId) .OrderBy(x => x.ExamId)

View file

@ -20,7 +20,6 @@ namespace BMA.EHR.Recruit.Data
modelBuilder.Entity<Models.Recruits.Recruit>().HasMany(x => x.Addresses).WithOne(x => x.Recruit).OnDelete(DeleteBehavior.Cascade); modelBuilder.Entity<Models.Recruits.Recruit>().HasMany(x => x.Addresses).WithOne(x => x.Recruit).OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<Models.Recruits.Recruit>().HasMany(x => x.Certificates).WithOne(x => x.Recruit).OnDelete(DeleteBehavior.Cascade); modelBuilder.Entity<Models.Recruits.Recruit>().HasMany(x => x.Certificates).WithOne(x => x.Recruit).OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<Models.Recruits.Recruit>().HasMany(x => x.Payments).WithOne(x => x.Recruit).OnDelete(DeleteBehavior.Cascade); modelBuilder.Entity<Models.Recruits.Recruit>().HasMany(x => x.Payments).WithOne(x => x.Recruit).OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<ScoreImport>().HasMany(x => x.Scores).WithOne(x => x.ScoreImport).HasForeignKey(x => x.ScoreImportId).OnDelete(DeleteBehavior.Cascade);
} }
public DbSet<Document> Documents { get; set; } public DbSet<Document> Documents { get; set; }

File diff suppressed because it is too large Load diff

View file

@ -1,64 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recruit.Migrations
{
/// <inheritdoc />
public partial class fixrelation : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ScoreImports_Documents_ImportFileId",
table: "ScoreImports");
migrationBuilder.AlterColumn<Guid>(
name: "ImportFileId",
table: "ScoreImports",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AddForeignKey(
name: "FK_ScoreImports_Documents_ImportFileId",
table: "ScoreImports",
column: "ImportFileId",
principalTable: "Documents",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ScoreImports_Documents_ImportFileId",
table: "ScoreImports");
migrationBuilder.AlterColumn<Guid>(
name: "ImportFileId",
table: "ScoreImports",
type: "char(36)",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AddForeignKey(
name: "FK_ScoreImports_Documents_ImportFileId",
table: "ScoreImports",
column: "ImportFileId",
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View file

@ -1353,7 +1353,7 @@ namespace BMA.EHR.Recruit.Migrations
.HasColumnOrder(101) .HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล"); .HasComment("User Id ที่สร้างข้อมูล");
b.Property<Guid?>("ImportFileId") b.Property<Guid>("ImportFileId")
.HasColumnType("char(36)"); .HasColumnType("char(36)");
b.Property<string>("LastUpdateFullName") b.Property<string>("LastUpdateFullName")
@ -1550,7 +1550,9 @@ namespace BMA.EHR.Recruit.Migrations
{ {
b.HasOne("BMA.EHR.Recruit.Models.Documents.Document", "ImportFile") b.HasOne("BMA.EHR.Recruit.Models.Documents.Document", "ImportFile")
.WithMany() .WithMany()
.HasForeignKey("ImportFileId"); .HasForeignKey("ImportFileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BMA.EHR.Recruit.Models.Recruits.RecruitImport", "RecruitImport") b.HasOne("BMA.EHR.Recruit.Models.Recruits.RecruitImport", "RecruitImport")
.WithOne("ScoreImport") .WithOne("ScoreImport")

View file

@ -1,6 +1,5 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace BMA.EHR.Recruit.Models.Recruits namespace BMA.EHR.Recruit.Models.Recruits
{ {
@ -84,9 +83,6 @@ namespace BMA.EHR.Recruit.Models.Recruits
[MaxLength(50), Comment("สถานะคัดกรองคุณสมบัติ")] [MaxLength(50), Comment("สถานะคัดกรองคุณสมบัติ")]
public string ExamAttribute { get; set; } = string.Empty; public string ExamAttribute { get; set; } = string.Empty;
[ForeignKey("ScoreImport")]
public Guid ScoreImportId { get; set; }
public ScoreImport ScoreImport { get; set; } public ScoreImport ScoreImport { get; set; }
} }
} }

View file

@ -7,9 +7,7 @@ namespace BMA.EHR.Recruit.Models.Recruits
{ {
public int Year { get; set; } public int Year { get; set; }
public Guid? ImportFileId { get; set; } public Document ImportFile { get; set; } = new Document();
public Document ImportFile { get; set; }
public virtual List<RecruitScore> Scores { get; set; } = new List<RecruitScore>(); public virtual List<RecruitScore> Scores { get; set; } = new List<RecruitScore>();

View file

@ -4,13 +4,13 @@ using BMA.EHR.Recruit.Services;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using OfficeOpenXml;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using BMA.EHR.Recruit.Data; using BMA.EHR.Recruit.Data;
using BMA.EHR.Recruit.Extensions;
using EFCore.BulkExtensions; using EFCore.BulkExtensions;
using BMA.EHR.Recruit.Extensions;
using BMA.EHR.Recruit.Models.Recruits; using BMA.EHR.Recruit.Models.Recruits;
using BMA.EHR.Recruit.Requests.Recruits; using BMA.EHR.Recruit.Requests.Recruits;
using ExcelDataReader;
namespace BMA.EHR.Recruit.Services; namespace BMA.EHR.Recruit.Services;
@ -108,18 +108,14 @@ public class ImportBackgroundService : BackgroundService
var imported = await _context.RecruitImports.FindAsync(job.RecruitImportId); var imported = await _context.RecruitImports.FindAsync(job.RecruitImportId);
if (imported == null) throw new Exception("RecruitImport not found"); if (imported == null) throw new Exception("RecruitImport not found");
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); using var c_package = new ExcelPackage(new FileInfo(job.ImportFile));
using var stream = System.IO.File.OpenRead(job.ImportFile); for (int i = 0; i < c_package.Workbook.Worksheets.Count; i++)
using var reader = ExcelReaderFactory.CreateReader(stream);
do
{ {
// Read header row (row 1) to build column index map var workSheet = c_package.Workbook.Worksheets[i];
if (!reader.Read()) continue; var totalRows = workSheet.Dimension.Rows;
var cols = new string[reader.FieldCount]; var cols = workSheet.GetHeaderColumns();
for (int c = 0; c < reader.FieldCount; c++)
cols[c] = reader.GetValue(c)?.ToString() ?? "";
int row = 2;
int batchCount = 0; int batchCount = 0;
const int batchSize = 500; const int batchSize = 500;
int totalProcessed = 0; int totalProcessed = 0;
@ -131,105 +127,105 @@ public class ImportBackgroundService : BackgroundService
var batchPayments = new List<RecruitPayment>(); var batchPayments = new List<RecruitPayment>();
var batchCertificates = new List<RecruitCertificate>(); var batchCertificates = new List<RecruitCertificate>();
while (reader.Read()) while (row <= totalRows)
{ {
var cell1 = reader.GetValue(0)?.ToString(); var cell1 = workSheet?.Cells[row, 1]?.GetValue<string>();
if (string.IsNullOrEmpty(cell1)) break; if (cell1 == "" || cell1 == null) break;
var r = new Models.Recruits.Recruit(); var r = new Models.Recruits.Recruit();
r.ExamId = GetCellValue(reader, cols, CandidateFileHeader.ExamID); r.ExamId = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.ExamID)]?.GetValue<string>();
r.CitizenId = GetCellValue(reader, cols, CandidateFileHeader.PersonalID); r.CitizenId = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.PersonalID)]?.GetValue<string>();
r.Prefix = GetCellValue(reader, cols, CandidateFileHeader.Prefix); r.Prefix = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Prefix)]?.GetValue<string>();
r.FirstName = GetCellValue(reader, cols, CandidateFileHeader.FirstName); r.FirstName = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.FirstName)]?.GetValue<string>();
r.LastName = GetCellValue(reader, cols, CandidateFileHeader.LastName); r.LastName = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.LastName)]?.GetValue<string>();
r.Gendor = GetCellValue(reader, cols, CandidateFileHeader.Gender); r.Gendor = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Gender)]?.GetValue<string>();
r.National = GetCellValue(reader, cols, CandidateFileHeader.National).IsNull(""); r.National = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.National)]?.GetValue<string>().IsNull("");
r.Race = GetCellValue(reader, cols, CandidateFileHeader.Race).IsNull(""); r.Race = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Race)]?.GetValue<string>().IsNull("");
r.Religion = GetCellValue(reader, cols, CandidateFileHeader.Religion).IsNull(""); r.Religion = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Religion)]?.GetValue<string>().IsNull("");
r.DateOfBirth = Convert.ToDateTime(GetCellValue(reader, cols, CandidateFileHeader.DateOfBirth).ToDateTime(DateTimeFormat.Ymd, "-")); r.DateOfBirth = Convert.ToDateTime(workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.DateOfBirth)]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-"));
r.Marry = GetCellValue(reader, cols, CandidateFileHeader.Marry); r.Marry = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Marry)]?.GetValue<string>();
r.Isspecial = "N"; r.Isspecial = "N";
r.CitizenCardIssuer = GetCellValue(reader, cols, CandidateFileHeader.PersonalCardIssue); r.CitizenCardIssuer = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.PersonalCardIssue)]?.GetValue<string>();
r.CitizenCardExpireDate = Convert.ToDateTime(GetCellValue(reader, cols, CandidateFileHeader.PersonalCardExpireDate).ToDateTime(DateTimeFormat.Ymd, "-")); r.CitizenCardExpireDate = Convert.ToDateTime(workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.PersonalCardExpireDate)]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-"));
r.ApplyDate = GetCellDateTime(reader, cols, CandidateFileHeader.ApplyDate) ?? DateTime.MinValue; r.ApplyDate = (DateTime)workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.ApplyDate)]?.GetValue<DateTime>();
r.PositionName = GetCellValue(reader, cols, CandidateFileHeader.PositionName).IsNull(""); r.PositionName = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.PositionName)]?.GetValue<string>().IsNull("");
r.PositionType = GetCellValue(reader, cols, CandidateFileHeader.PositionType).IsNull(""); r.PositionType = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.PositionType)]?.GetValue<string>().IsNull("");
r.PositionLevel = GetCellValue(reader, cols, CandidateFileHeader.PositionLevel).IsNull(""); r.PositionLevel = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.PositionLevel)]?.GetValue<string>().IsNull("");
// address // address
var address = new RecruitAddress() var address = new RecruitAddress()
{ {
Address = GetCellValue(reader, cols, CandidateFileHeader.Address), Address = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Address)]?.GetValue<string>() ?? "",
Moo = GetCellValue(reader, cols, CandidateFileHeader.Moo), Moo = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Moo)]?.GetValue<string>() ?? "",
Soi = GetCellValue(reader, cols, CandidateFileHeader.Soi), Soi = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Soi)]?.GetValue<string>() ?? "",
Road = GetCellValue(reader, cols, CandidateFileHeader.Road), Road = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Road)]?.GetValue<string>() ?? "",
District = GetCellValue(reader, cols, CandidateFileHeader.District), District = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.District)]?.GetValue<string>() ?? "",
Amphur = GetCellValue(reader, cols, CandidateFileHeader.Amphur), Amphur = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Amphur)]?.GetValue<string>() ?? "",
Province = GetCellValue(reader, cols, CandidateFileHeader.Province), Province = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Province)]?.GetValue<string>() ?? "",
ZipCode = GetCellValue(reader, cols, CandidateFileHeader.ZipCode), ZipCode = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.ZipCode)]?.GetValue<string>() ?? "",
Telephone = GetCellValue(reader, cols, CandidateFileHeader.Telephone), Telephone = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Telephone)]?.GetValue<string>() ?? "",
Mobile = GetCellValue(reader, cols, CandidateFileHeader.Mobile), Mobile = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Mobile)]?.GetValue<string>() ?? "",
Address1 = GetCellValue(reader, cols, CandidateFileHeader.Address1), Address1 = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Address1)]?.GetValue<string>() ?? "",
Moo1 = GetCellValue(reader, cols, CandidateFileHeader.Moo1), Moo1 = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Moo1)]?.GetValue<string>() ?? "",
Soi1 = GetCellValue(reader, cols, CandidateFileHeader.Soi1), Soi1 = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Soi1)]?.GetValue<string>() ?? "",
Road1 = GetCellValue(reader, cols, CandidateFileHeader.Road1), Road1 = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Road1)]?.GetValue<string>() ?? "",
District1 = GetCellValue(reader, cols, CandidateFileHeader.District1), District1 = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.District1)]?.GetValue<string>() ?? "",
Amphur1 = GetCellValue(reader, cols, CandidateFileHeader.Amphur1), Amphur1 = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Amphur1)]?.GetValue<string>() ?? "",
Province1 = GetCellValue(reader, cols, CandidateFileHeader.Province1), Province1 = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Province1)]?.GetValue<string>() ?? "",
ZipCode1 = GetCellValue(reader, cols, CandidateFileHeader.ZipCode1), ZipCode1 = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.ZipCode1)]?.GetValue<string>() ?? "",
}; };
// payment // payment
var payment = new RecruitPayment() var payment = new RecruitPayment()
{ {
PaymentId = GetCellValue(reader, cols, CandidateFileHeader.PaymentID), PaymentId = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.PaymentID)]?.GetValue<string>() ?? "",
CompanyCode = GetCellValue(reader, cols, CandidateFileHeader.CompanyCode), CompanyCode = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.CompanyCode)]?.GetValue<string>() ?? "",
TextFile = GetCellValue(reader, cols, CandidateFileHeader.TextFile), TextFile = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.TextFile)]?.GetValue<string>() ?? "",
BankCode = GetCellValue(reader, cols, CandidateFileHeader.BankCode), BankCode = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.BankCode)]?.GetValue<string>() ?? "",
AccountNumber = GetCellValue(reader, cols, CandidateFileHeader.AccouontNumer), AccountNumber = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.AccouontNumer)]?.GetValue<string>() ?? "",
TransDate = GetCellValue(reader, cols, CandidateFileHeader.TransDate), TransDate = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.TransDate)]?.GetValue<string>() ?? "",
TransTime = GetCellValue(reader, cols, CandidateFileHeader.TransTime), TransTime = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.TransTime)]?.GetValue<string>() ?? "",
CustomerName = GetCellValue(reader, cols, CandidateFileHeader.CustomerName), CustomerName = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.CustomerName)]?.GetValue<string>() ?? "",
RefNo1 = GetCellValue(reader, cols, CandidateFileHeader.RefNo1), RefNo1 = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.RefNo1)]?.GetValue<string>() ?? "",
TermBranch = GetCellValue(reader, cols, CandidateFileHeader.TermBranch), TermBranch = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.TermBranch)]?.GetValue<string>() ?? "",
TellerId = GetCellValue(reader, cols, CandidateFileHeader.TellerID), TellerId = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.TellerID)]?.GetValue<string>() ?? "",
CreditDebit = GetCellValue(reader, cols, CandidateFileHeader.CreditDebit), CreditDebit = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.CreditDebit)]?.GetValue<string>() ?? "",
PaymentType = GetCellValue(reader, cols, CandidateFileHeader.Type), PaymentType = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Type)]?.GetValue<string>(),
ChequeNo = GetCellValue(reader, cols, CandidateFileHeader.ChequeNo), ChequeNo = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.ChequeNo)]?.GetValue<string>() ?? "",
Amount = GetCellDecimal(reader, cols, CandidateFileHeader.Amount), Amount = (decimal)workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Amount)]?.GetValue<decimal>(),
ChqueBankCode = GetCellValue(reader, cols, CandidateFileHeader.ChqBankCode) ChqueBankCode = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.ChqBankCode)]?.GetValue<string>() ?? ""
}; };
// occupation // occupation
var occupation = new RecruitOccupation() var occupation = new RecruitOccupation()
{ {
Occupation = GetCellValue(reader, cols, CandidateFileHeader.Occupation), Occupation = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Occupation)]?.GetValue<string>() ?? "",
Position = GetCellValue(reader, cols, CandidateFileHeader.Position), Position = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Position)]?.GetValue<string>() ?? "",
Workplace = GetCellValue(reader, cols, CandidateFileHeader.Workplace), Workplace = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Workplace)]?.GetValue<string>() ?? "",
Telephone = GetCellValue(reader, cols, CandidateFileHeader.WorkplaceTelephone), Telephone = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.WorkplaceTelephone)]?.GetValue<string>() ?? "",
WorkAge = GetCellValue(reader, cols, CandidateFileHeader.WorkAge), WorkAge = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.WorkAge)]?.GetValue<string>() ?? "",
}; };
// certificate // certificate
var certificate = new RecruitCertificate() var certificate = new RecruitCertificate()
{ {
CertificateNo = GetCellValue(reader, cols, CandidateFileHeader.CertificateNo), CertificateNo = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.CertificateNo)]?.GetValue<string>() ?? "",
Description = GetCellValue(reader, cols, CandidateFileHeader.CertificateDesc), Description = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.CertificateDesc)]?.GetValue<string>() ?? "",
IssueDate = Convert.ToDateTime(GetCellValue(reader, cols, CandidateFileHeader.CertificateIssueDate).ToDateTime(DateTimeFormat.Ymd, "-")), IssueDate = Convert.ToDateTime(workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.CertificateIssueDate)]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-")),
ExpiredDate = Convert.ToDateTime(GetCellValue(reader, cols, CandidateFileHeader.CertificateExpireDate).ToDateTime(DateTimeFormat.Ymd, "-")) ExpiredDate = Convert.ToDateTime(workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.CertificateExpireDate)]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-"))
}; };
var education = new RecruitEducation() var education = new RecruitEducation()
{ {
Degree = GetCellValue(reader, cols, CandidateFileHeader.Degree), Degree = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Degree)]?.GetValue<string>() ?? "",
Major = GetCellValue(reader, cols, CandidateFileHeader.Major), Major = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Major)]?.GetValue<string>() ?? "",
MajorGroupId = GetCellValue(reader, cols, CandidateFileHeader.MajorGroupID), MajorGroupId = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.MajorGroupID)]?.GetValue<string>() ?? "",
MajorGroupName = GetCellValue(reader, cols, CandidateFileHeader.MajorGroupName), MajorGroupName = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.MajorGroupName)]?.GetValue<string>() ?? "",
University = GetCellValue(reader, cols, CandidateFileHeader.University), University = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.University)]?.GetValue<string>() ?? "",
GPA = GetCellDouble(reader, cols, CandidateFileHeader.GPA), GPA = (double)workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.GPA)]?.GetValue<double>(),
Specialist = GetCellValue(reader, cols, CandidateFileHeader.SpecialList), Specialist = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.SpecialList)]?.GetValue<string>() ?? "",
HighDegree = GetCellValue(reader, cols, CandidateFileHeader.HighDegree), HighDegree = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.HighDegree)]?.GetValue<string>() ?? "",
BachelorDate = Convert.ToDateTime(GetCellValue(reader, cols, CandidateFileHeader.BachelorDate).ToDateTime(DateTimeFormat.Ymd, "-")) BachelorDate = Convert.ToDateTime(workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.BachelorDate)]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-"))
}; };
r.Addresses.Add(address); r.Addresses.Add(address);
@ -246,6 +242,7 @@ public class ImportBackgroundService : BackgroundService
batchCertificates.Add(certificate); batchCertificates.Add(certificate);
batchEducations.Add(education); batchEducations.Add(education);
row++;
batchCount++; batchCount++;
totalProcessed++; totalProcessed++;
@ -303,7 +300,7 @@ public class ImportBackgroundService : BackgroundService
_context.ChangeTracker.Clear(); _context.ChangeTracker.Clear();
} }
} while (reader.NextResult()); }
job.TotalCount = _tracker.GetJob(job.JobId)?.ProcessedCount ?? 0; job.TotalCount = _tracker.GetJob(job.JobId)?.ProcessedCount ?? 0;
} }
@ -334,14 +331,11 @@ public class ImportBackgroundService : BackgroundService
var importId = imported.Id; var importId = imported.Id;
var importRef = _context.Attach(new RecruitImport { Id = importId }).Entity; var importRef = _context.Attach(new RecruitImport { Id = importId }).Entity;
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); using var c_package = new ExcelPackage(new FileInfo(job.ImportFile));
using var stream = System.IO.File.OpenRead(job.ImportFile); for (int i = 0; i < c_package.Workbook.Worksheets.Count; i++)
using var reader = ExcelReaderFactory.CreateReader(stream);
do
{ {
// Skip header row var workSheet = c_package.Workbook.Worksheets[i];
if (!reader.Read()) continue; var totalRows = workSheet.Dimension.Rows;
int row = 2; int row = 2;
int batchCount = 0; int batchCount = 0;
@ -354,33 +348,33 @@ public class ImportBackgroundService : BackgroundService
var batchAddresses = new List<RecruitAddress>(); var batchAddresses = new List<RecruitAddress>();
var batchPayments = new List<RecruitPayment>(); var batchPayments = new List<RecruitPayment>();
while (reader.Read()) while (row <= totalRows)
{ {
var cell1 = reader.GetValue(0)?.ToString(); var cell1 = workSheet?.Cells[row, 1]?.GetValue<string>();
if (string.IsNullOrEmpty(cell1)) break; if (cell1 == "" || cell1 == null) break;
try try
{ {
var r = new Models.Recruits.Recruit(); var r = new Models.Recruits.Recruit();
r.Id = Guid.NewGuid(); r.Id = Guid.NewGuid();
r.ExamId = reader.GetValue(0)?.ToString() ?? ""; r.ExamId = workSheet?.Cells[row, 1]?.GetValue<string>() ?? "";
r.PositionName = reader.GetValue(2)?.ToString() ?? ""; r.PositionName = workSheet?.Cells[row, 3]?.GetValue<string>() ?? "";
r.HddPosition = reader.GetValue(3)?.ToString() ?? ""; r.HddPosition = workSheet?.Cells[row, 4]?.GetValue<string>() ?? "";
r.Prefix = reader.GetValue(4)?.ToString() == "อื่น ๆ" ? reader.GetValue(5)?.ToString() ?? "" : reader.GetValue(4)?.ToString() ?? ""; r.Prefix = workSheet?.Cells[row, 5]?.GetValue<string>() == "อื่น ๆ" ? workSheet?.Cells[row, 6]?.GetValue<string>() ?? "" : workSheet?.Cells[row, 5]?.GetValue<string>() ?? "";
r.FirstName = reader.GetValue(6)?.ToString() ?? ""; r.FirstName = workSheet?.Cells[row, 7]?.GetValue<string>() ?? "";
r.LastName = reader.GetValue(7)?.ToString() ?? ""; r.LastName = workSheet?.Cells[row, 8]?.GetValue<string>() ?? "";
r.Gendor = reader.GetValue(97)?.ToString() ?? ""; r.Gendor = workSheet?.Cells[row, 98]?.GetValue<string>() ?? "";
r.National = reader.GetValue(8)?.ToString() ?? ""; r.National = workSheet?.Cells[row, 9]?.GetValue<string>() ?? "";
r.Race = ""; r.Race = "";
r.Religion = reader.GetValue(9)?.ToString() ?? ""; r.Religion = workSheet?.Cells[row, 10]?.GetValue<string>() ?? "";
r.DateOfBirth = !string.IsNullOrWhiteSpace(reader.GetValue(10)?.ToString()) ? _recruitService.CheckDateTime(reader.GetValue(10)?.ToString() ?? "", "dd/MM/yyyy") : null; r.DateOfBirth = !string.IsNullOrWhiteSpace(workSheet?.Cells[row, 11]?.GetValue<string>()) ? _recruitService.CheckDateTime(workSheet?.Cells[row, 11]?.GetValue<string>() ?? "", "dd/MM/yyyy") : null;
r.CitizenId = reader.GetValue(11)?.ToString() ?? ""; r.CitizenId = workSheet?.Cells[row, 12]?.GetValue<string>() ?? "";
r.typeTest = reader.GetValue(12)?.ToString() ?? ""; r.typeTest = workSheet?.Cells[row, 13]?.GetValue<string>() ?? "";
r.Marry = ""; r.Marry = "";
r.Isspecial = "N"; r.Isspecial = "N";
r.CitizenCardExpireDate = null; r.CitizenCardExpireDate = null;
r.ModifiedDate = null; r.ModifiedDate = null;
r.ApplyDate = !string.IsNullOrWhiteSpace(reader.GetValue(86)?.ToString()) ? _recruitService.CheckDateTime(reader.GetValue(86)?.ToString() ?? "", "dd/MM/yyyy") : null; r.ApplyDate = !string.IsNullOrWhiteSpace(workSheet?.Cells[row, 87]?.GetValue<string>()) ? _recruitService.CheckDateTime(workSheet?.Cells[row, 87]?.GetValue<string>() ?? "", "dd/MM/yyyy") : null;
r.PositionType = ""; r.PositionType = "";
r.PositionLevel = ""; r.PositionLevel = "";
r.CreatedAt = DateTime.Now; r.CreatedAt = DateTime.Now;
@ -395,15 +389,15 @@ public class ImportBackgroundService : BackgroundService
var education = new RecruitEducation() var education = new RecruitEducation()
{ {
Id = Guid.NewGuid(), Id = Guid.NewGuid(),
Degree = reader.GetValue(17)?.ToString() ?? "", Degree = workSheet?.Cells[row, 18]?.GetValue<string>() ?? "",
Major = reader.GetValue(18)?.ToString() == "อื่น ๆ" ? reader.GetValue(19)?.ToString() ?? "" : reader.GetValue(18)?.ToString() ?? "", Major = workSheet?.Cells[row, 19]?.GetValue<string>() == "อื่น ๆ" ? workSheet?.Cells[row, 20]?.GetValue<string>() ?? "" : workSheet?.Cells[row, 19]?.GetValue<string>() ?? "",
MajorGroupId = "", MajorGroupId = "",
MajorGroupName = "", MajorGroupName = "",
University = reader.GetValue(20)?.ToString() == "อื่น ๆ" ? reader.GetValue(21)?.ToString() ?? "" : reader.GetValue(20)?.ToString() ?? "", University = workSheet?.Cells[row, 21]?.GetValue<string>() == "อื่น ๆ" ? workSheet?.Cells[row, 22]?.GetValue<string>() ?? "" : workSheet?.Cells[row, 21]?.GetValue<string>() ?? "",
GPA = GetReaderDouble(reader, 25), GPA = (double)workSheet?.Cells[row, 26]?.GetValue<double>(),
Specialist = "", Specialist = "",
HighDegree = reader.GetValue(26)?.ToString() ?? "", HighDegree = workSheet?.Cells[row, 27]?.GetValue<string>() ?? "",
BachelorDate = !string.IsNullOrWhiteSpace(reader.GetValue(24)?.ToString()) ? _recruitService.CheckDateTime(reader.GetValue(24)?.ToString() ?? "", "dd/MM/yyyy") : null, BachelorDate = !string.IsNullOrWhiteSpace(workSheet?.Cells[row, 25]?.GetValue<string>()) ? _recruitService.CheckDateTime(workSheet?.Cells[row, 25]?.GetValue<string>() ?? "", "dd/MM/yyyy") : null,
Recruit = r, Recruit = r,
CreatedAt = DateTime.Now, CreatedAt = DateTime.Now,
CreatedUserId = job.UserId ?? "", CreatedUserId = job.UserId ?? "",
@ -416,11 +410,11 @@ public class ImportBackgroundService : BackgroundService
var occupation = new RecruitOccupation() var occupation = new RecruitOccupation()
{ {
Id = Guid.NewGuid(), Id = Guid.NewGuid(),
Occupation = reader.GetValue(32)?.ToString() == "อื่น ๆ" ? reader.GetValue(33)?.ToString() ?? "" : reader.GetValue(32)?.ToString() ?? "", Occupation = workSheet?.Cells[row, 33]?.GetValue<string>() == "อื่น ๆ" ? workSheet?.Cells[row, 34]?.GetValue<string>() ?? "" : workSheet?.Cells[row, 33]?.GetValue<string>() ?? "",
Position = reader.GetValue(36)?.ToString() ?? "", Position = workSheet?.Cells[row, 37]?.GetValue<string>() ?? "",
Workplace = $"{(reader.GetValue(35)?.ToString() ?? "")} {(reader.GetValue(34)?.ToString() ?? "")}", Workplace = $"{(workSheet?.Cells[row, 36]?.GetValue<string>() ?? "")} {(workSheet?.Cells[row, 35]?.GetValue<string>() ?? "")}",
Telephone = "", Telephone = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
WorkAge = "", WorkAge = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
Recruit = r, Recruit = r,
CreatedAt = DateTime.Now, CreatedAt = DateTime.Now,
CreatedUserId = job.UserId ?? "", CreatedUserId = job.UserId ?? "",
@ -433,24 +427,24 @@ public class ImportBackgroundService : BackgroundService
var address = new RecruitAddress() var address = new RecruitAddress()
{ {
Id = Guid.NewGuid(), Id = Guid.NewGuid(),
Address = $"{(reader.GetValue(48)?.ToString() ?? "")} {(reader.GetValue(49)?.ToString() ?? "")}", Address = $"{(workSheet?.Cells[row, 49]?.GetValue<string>() ?? "")} {(workSheet?.Cells[row, 50]?.GetValue<string>() ?? "")}",
Moo = reader.GetValue(50)?.ToString() ?? "", Moo = workSheet?.Cells[row, 51]?.GetValue<string>() ?? "",
Soi = reader.GetValue(51)?.ToString() ?? "", Soi = workSheet?.Cells[row, 52]?.GetValue<string>() ?? "",
Road = reader.GetValue(52)?.ToString() ?? "", Road = workSheet?.Cells[row, 53]?.GetValue<string>() ?? "",
District = reader.GetValue(53)?.ToString() ?? "", District = workSheet?.Cells[row, 54]?.GetValue<string>() ?? "",
Amphur = reader.GetValue(54)?.ToString() ?? "", Amphur = workSheet?.Cells[row, 55]?.GetValue<string>() ?? "",
Province = reader.GetValue(55)?.ToString() ?? "", Province = workSheet?.Cells[row, 56]?.GetValue<string>() ?? "",
ZipCode = (reader.GetValue(56)?.ToString() ?? "").Trim(), ZipCode = (workSheet?.Cells[row, 57]?.GetValue<string>() ?? "").Trim(),
Telephone = reader.GetValue(57)?.ToString() ?? "", Telephone = workSheet?.Cells[row, 58]?.GetValue<string>() ?? "",
Mobile = "", Mobile = "",
Address1 = $"{(reader.GetValue(60)?.ToString() ?? "")} {(reader.GetValue(61)?.ToString() ?? "")}", Address1 = $"{(workSheet?.Cells[row, 61]?.GetValue<string>() ?? "")} {(workSheet?.Cells[row, 62]?.GetValue<string>() ?? "")}",
Moo1 = reader.GetValue(62)?.ToString() ?? "", Moo1 = workSheet?.Cells[row, 63]?.GetValue<string>() ?? "",
Soi1 = reader.GetValue(63)?.ToString() ?? "", Soi1 = workSheet?.Cells[row, 64]?.GetValue<string>() ?? "",
Road1 = reader.GetValue(64)?.ToString() ?? "", Road1 = workSheet?.Cells[row, 65]?.GetValue<string>() ?? "",
District1 = reader.GetValue(65)?.ToString() ?? "", District1 = workSheet?.Cells[row, 66]?.GetValue<string>() ?? "",
Amphur1 = reader.GetValue(66)?.ToString() ?? "", Amphur1 = workSheet?.Cells[row, 67]?.GetValue<string>() ?? "",
Province1 = reader.GetValue(67)?.ToString() ?? "", Province1 = workSheet?.Cells[row, 68]?.GetValue<string>() ?? "",
ZipCode1 = (reader.GetValue(68)?.ToString() ?? "").Trim(), ZipCode1 = (workSheet?.Cells[row, 69]?.GetValue<string>() ?? "").Trim(),
Recruit = r, Recruit = r,
CreatedAt = DateTime.Now, CreatedAt = DateTime.Now,
CreatedUserId = job.UserId ?? "", CreatedUserId = job.UserId ?? "",
@ -463,22 +457,22 @@ public class ImportBackgroundService : BackgroundService
var payment = new RecruitPayment() var payment = new RecruitPayment()
{ {
Id = Guid.NewGuid(), Id = Guid.NewGuid(),
PaymentId = reader.GetValue(103)?.ToString() ?? "", PaymentId = workSheet?.Cells[row, 104]?.GetValue<string>() ?? "",
CompanyCode = reader.GetValue(104)?.ToString() ?? "", CompanyCode = workSheet?.Cells[row, 105]?.GetValue<string>() ?? "",
TextFile = reader.GetValue(105)?.ToString() ?? "", TextFile = workSheet?.Cells[row, 106]?.GetValue<string>() ?? "",
BankCode = reader.GetValue(106)?.ToString() ?? "", BankCode = workSheet?.Cells[row, 107]?.GetValue<string>() ?? "",
AccountNumber = reader.GetValue(107)?.ToString() ?? "", AccountNumber = workSheet?.Cells[row, 108]?.GetValue<string>() ?? "",
TransDate = reader.GetValue(108)?.ToString() ?? "", TransDate = workSheet?.Cells[row, 109]?.GetValue<string>() ?? "",
TransTime = reader.GetValue(109)?.ToString() ?? "", TransTime = workSheet?.Cells[row, 110]?.GetValue<string>() ?? "",
CustomerName = reader.GetValue(110)?.ToString() ?? "", CustomerName = workSheet?.Cells[row, 111]?.GetValue<string>() ?? "",
RefNo1 = reader.GetValue(111)?.ToString() ?? "", RefNo1 = workSheet?.Cells[row, 112]?.GetValue<string>() ?? "",
TermBranch = reader.GetValue(112)?.ToString() ?? "", TermBranch = workSheet?.Cells[row, 113]?.GetValue<string>() ?? "",
TellerId = reader.GetValue(113)?.ToString() ?? "", TellerId = workSheet?.Cells[row, 114]?.GetValue<string>() ?? "",
CreditDebit = reader.GetValue(114)?.ToString() ?? "", CreditDebit = workSheet?.Cells[row, 115]?.GetValue<string>() ?? "",
PaymentType = reader.GetValue(115)?.ToString() ?? "", PaymentType = workSheet?.Cells[row, 116]?.GetValue<string>() ?? "",
ChequeNo = reader.GetValue(116)?.ToString() ?? "", ChequeNo = workSheet?.Cells[row, 117]?.GetValue<string>() ?? "",
Amount = GetReaderDecimal(reader, 117), Amount = (decimal)workSheet?.Cells[row, 118]?.GetValue<decimal>(),
ChqueBankCode = reader.GetValue(118)?.ToString() ?? "", ChqueBankCode = workSheet?.Cells[row, 119]?.GetValue<string>() ?? "",
Recruit = r, Recruit = r,
CreatedAt = DateTime.Now, CreatedAt = DateTime.Now,
CreatedUserId = job.UserId ?? "", CreatedUserId = job.UserId ?? "",
@ -551,7 +545,7 @@ public class ImportBackgroundService : BackgroundService
_context.ChangeTracker.Clear(); _context.ChangeTracker.Clear();
} }
} while (reader.NextResult()); }
job.TotalCount = _tracker.GetJob(job.JobId)?.ProcessedCount ?? 0; job.TotalCount = _tracker.GetJob(job.JobId)?.ProcessedCount ?? 0;
} }
@ -570,30 +564,51 @@ public class ImportBackgroundService : BackgroundService
if (rec_import == null) throw new Exception("RecruitImport not found"); if (rec_import == null) throw new Exception("RecruitImport not found");
var rec_import_id = rec_import.Id; if (rec_import.ScoreImport != null && rec_import.ScoreImport.Scores != null)
var rec_import_year = rec_import.Year;
var existingScoreImport = rec_import.ScoreImport;
if (existingScoreImport != null)
{ {
var existingScores = existingScoreImport.Scores?.ToList() ?? new List<RecruitScore>(); // Store old ScoreImport ID and MinIO document ID for cleanup
if (existingScores.Count > 0) var oldScoreImportId = rec_import.ScoreImport.Id;
await _context.BulkDeleteAsync(existingScores); var oldDocId = rec_import.ScoreImport.ImportFile?.Id;
// Also delete the ScoreImport row itself (has unique index on RecruitImportId)
// Use Remove+SaveChanges instead of BulkDelete since BulkDelete fails with detached entities // Delete old scores first
var scoreImportToDelete = existingScoreImport; await _context.BulkDeleteAsync(rec_import.ScoreImport.Scores.ToList());
// Delete the old ScoreImport entity to prevent duplicate FK constraint
await _context.BulkDeleteAsync(new List<ScoreImport> { rec_import.ScoreImport });
// TODO: Implement retention policy for old MinIO documents
// For now, keep old files to allow recovery and avoid immediate deletion
// if (oldDocId.HasValue && oldDocId.Value != Guid.Empty)
// {
// try { await _minioService.DeleteFileAsync(oldDocId.Value); } catch { }
// }
// Clear ChangeTracker after bulk operations
_context.ChangeTracker.Clear(); _context.ChangeTracker.Clear();
var deleteStub = new ScoreImport { Id = scoreImportToDelete.Id };
_context.ScoreImports.Attach(deleteStub);
_context.ScoreImports.Remove(deleteStub);
await _context.SaveChangesAsync();
} }
// Clear tracker to avoid stale references after BulkDelete (which bypasses EF tracking) // Reload to get fresh entity state after clearing
rec_import = await _context.RecruitImports.AsQueryable()
.Include(x => x.ImportHostories)
.FirstOrDefaultAsync(x => x.Id == job.RecruitImportId)
?? throw new Exception("RecruitImport not found after reload");
// get doc from minio
var doc = await _minioService.UploadFileAsync(new DummyFormFile(job.ImportFile));
var docId = doc.Id; // Store the ID before clearing tracker
// Detach document entity to prevent duplicate INSERT on next SaveChangesAsync
_context.Entry(doc).State = EntityState.Detached;
_context.ChangeTracker.Clear(); _context.ChangeTracker.Clear();
// Add history record — set FK shadow property directly to avoid Attach side-effects // Reload RecruitImport after clearing tracker to get fresh entity
var historyEntry = _context.RecruitImportHistories.Add(new RecruitImportHistory rec_import = await _context.RecruitImports.AsQueryable()
.Include(x => x.ImportHostories)
.FirstOrDefaultAsync(x => x.Id == job.RecruitImportId)
?? throw new Exception("RecruitImport not found after MinIO upload");
// Add import history
rec_import.ImportHostories.Add(new RecruitImportHistory
{ {
Description = "นำเข้าข้อมูลผลคะแนนสอบ", Description = "นำเข้าข้อมูลผลคะแนนสอบ",
CreatedAt = DateTime.Now, CreatedAt = DateTime.Now,
@ -603,124 +618,117 @@ public class ImportBackgroundService : BackgroundService
LastUpdateUserId = job.UserId ?? "", LastUpdateUserId = job.UserId ?? "",
LastUpdateFullName = job.FullName ?? "System Administrator", LastUpdateFullName = job.FullName ?? "System Administrator",
}); });
historyEntry.Property("RecruitImportId").CurrentValue = rec_import_id;
// get doc from minio (MinIOService already saves Document to its own context) // Load Document entity fresh from database to avoid tracking conflicts
var doc = await _minioService.UploadFileAsync(new DummyFormFile(job.ImportFile)); var freshDoc = await _context.Documents.FindAsync(docId)
var scoreImport_id = Guid.NewGuid(); // Pre-generate Id to use as FK ?? throw new Exception("Failed to retrieve uploaded document. Please contact support.");
var imported = new ScoreImport();
imported.Id = scoreImport_id;
imported.Year = rec_import_year;
imported.RecruitImportId = rec_import_id;
imported.CreatedAt = DateTime.Now;
imported.CreatedUserId = job.UserId ?? "";
imported.CreatedFullName = job.FullName ?? "System Administrator";
imported.LastUpdatedAt = DateTime.Now;
imported.LastUpdateUserId = job.UserId ?? "";
imported.LastUpdateFullName = job.FullName ?? "System Administrator";
imported.Scores = new List<RecruitScore>();
// Save ScoreImport — set ImportFileId FK directly (explicit property, not shadow) var imported = new ScoreImport
imported.ImportFileId = doc.Id; {
_context.ScoreImports.Add(imported); Year = rec_import.Year,
ImportFile = freshDoc,
CreatedAt = DateTime.Now,
CreatedUserId = job.UserId ?? "",
CreatedFullName = job.FullName ?? "System Administrator",
LastUpdatedAt = DateTime.Now,
LastUpdateUserId = job.UserId ?? "",
LastUpdateFullName = job.FullName ?? "System Administrator",
Scores = new List<RecruitScore>()
};
// Add ScoreImport to context explicitly to ensure EF Core knows to INSERT it
_context.Add(imported);
// Save ScoreImport parent first to get its Id
rec_import.ScoreImport = imported;
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
var scoreImportId = imported.Id;
_context.ChangeTracker.Clear(); _context.ChangeTracker.Clear();
// preload recruits using AsNoTracking to avoid EF tracking overhead // Re-attach ScoreImport reference to avoid FK issues during bulk insert
var importRef = _context.Attach(new ScoreImport { Id = scoreImportId }).Entity;
// preload recruits (lightweight - only ExamId)
var recruitsDict = await _context.Recruits var recruitsDict = await _context.Recruits
.AsNoTracking()
.Where(x => x.RecruitImport.Id == rec_import.Id) .Where(x => x.RecruitImport.Id == rec_import.Id)
.GroupBy(x => x.ExamId) .GroupBy(x => x.ExamId)
.Where(g => g.Count() == 1) .Where(g => g.Count() == 1)
.Select(g => g.First()) .Select(g => g.First())
.ToDictionaryAsync(x => x.ExamId, x => x); .ToDictionaryAsync(x => x.ExamId, x => x);
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); using var c_package = new ExcelPackage(new FileInfo(job.ImportFile));
using var stream = System.IO.File.OpenRead(job.ImportFile); for (int i = 0; i < c_package.Workbook.Worksheets.Count; i++)
using var reader = ExcelReaderFactory.CreateReader(stream);
do
{ {
// Read header rows (rows 1-7), then data starts at row 8 var workSheet = c_package.Workbook.Worksheets[i];
// Skip 7 rows: first 7 are header/metadata var cols = workSheet.GetHeaderColumns();
for (int skip = 0; skip < 7; skip++) int row = 8;
{
if (!reader.Read()) break;
}
var cols = new string[reader.FieldCount];
// Use current row (row 7) as header reference — not actually used for ScoreFile column mapping
// ScoreFile uses hardcoded column indices
int batchCount = 0; int batchCount = 0;
const int batchSize = 500; const int batchSize = 500;
int totalProcessed = 0; int totalProcessed = 0;
var endRow = workSheet.Dimension.End.Row;
var batchScores = new List<RecruitScore>(); var batchScores = new List<RecruitScore>();
while (reader.Read()) while (row <= endRow)
{ {
var cell1 = reader.GetValue(0)?.ToString(); var cell1 = workSheet?.Cells[row, 1]?.GetValue<string>();
if (string.IsNullOrEmpty(cell1)) break; if (cell1 == "" || cell1 == null) break;
var r = new RecruitScore(); var r = new RecruitScore();
r.Id = Guid.NewGuid(); r.ExamId = workSheet?.Cells[row, 2]?.GetValue<string>();
r.ExamId = reader.GetValue(1)?.ToString();
if (!string.IsNullOrEmpty(r.ExamId) && recruitsDict.TryGetValue(r.ExamId, out var recruit)) if (!string.IsNullOrEmpty(r.ExamId) && recruitsDict.TryGetValue(r.ExamId, out var recruit))
{ {
r.CitizenId = reader.GetValue(2)?.ToString()?.Trim(); r.Id = Guid.NewGuid(); // Generate unique ID for each record
r.CitizenId = workSheet?.Cells[row, 3]?.GetValue<string>()?.Trim();
r.FullA = 200; r.FullA = 200;
r.SumA = string.IsNullOrWhiteSpace(reader.GetValue(4)?.ToString()) ? 0.00 : Math.Round(Convert.ToDouble(reader.GetValue(4)), 2); r.SumA = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 5]?.GetValue<string>()) ? 0.00 : Math.Round(workSheet.Cells[row, 5].GetValue<double>(), 2);
r.PercentageA = string.IsNullOrWhiteSpace(reader.GetValue(5)?.ToString()) ? 0.00 : Math.Round(Convert.ToDouble(reader.GetValue(5)), 2); r.PercentageA = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 6]?.GetValue<string>()) ? 0.00 : Math.Round(workSheet.Cells[row, 6].GetValue<double>(), 2);
r.AStatus = string.IsNullOrWhiteSpace(reader.GetValue(6)?.ToString()) ? "" : reader.GetValue(6)?.ToString(); r.AStatus = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 7]?.GetValue<string>()) ? "" : workSheet?.Cells[row, 7]?.GetValue<string>();
r.SumAB = string.IsNullOrWhiteSpace(reader.GetValue(4)?.ToString()) ? 0.00 : Math.Round(Convert.ToDouble(reader.GetValue(4)), 2); r.SumAB = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 5]?.GetValue<string>()) ? 0.00 : Math.Round(workSheet.Cells[row, 5].GetValue<double>(), 2);
r.ABStatus = string.IsNullOrWhiteSpace(reader.GetValue(6)?.ToString()) ? "" : reader.GetValue(6)?.ToString(); r.ABStatus = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 7]?.GetValue<string>()) ? "" : workSheet?.Cells[row, 7]?.GetValue<string>();
r.FullC = 50; r.FullC = 50;
r.SumC = string.IsNullOrWhiteSpace(reader.GetValue(7)?.ToString()) ? 0.00 : Math.Round(Convert.ToDouble(reader.GetValue(7)), 2); r.SumC = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 8]?.GetValue<string>()) ? 0.00 : Math.Round(workSheet.Cells[row, 8].GetValue<double>(), 2);
r.FullD = 50; r.FullD = 50;
r.SumD = string.IsNullOrWhiteSpace(reader.GetValue(8)?.ToString()) ? 0.00 : Math.Round(Convert.ToDouble(reader.GetValue(8)), 2); r.SumD = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 9]?.GetValue<string>()) ? 0.00 : Math.Round(workSheet.Cells[row, 9].GetValue<double>(), 2);
r.SumCD = string.IsNullOrWhiteSpace(reader.GetValue(9)?.ToString()) ? 0.00 : Math.Round(Convert.ToDouble(reader.GetValue(9)), 2); r.SumCD = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 10]?.GetValue<string>()) ? 0.00 : Math.Round(workSheet.Cells[row, 10].GetValue<double>(), 2);
r.PercentageC = string.IsNullOrWhiteSpace(reader.GetValue(10)?.ToString()) ? 0.00 : Math.Round(Convert.ToDouble(reader.GetValue(10)), 2); r.PercentageC = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 11]?.GetValue<string>()) ? 0.00 : Math.Round(workSheet.Cells[row, 11].GetValue<double>(), 2);
r.CStatus = string.IsNullOrWhiteSpace(reader.GetValue(11)?.ToString()) ? "" : reader.GetValue(11)?.ToString(); r.CStatus = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 12]?.GetValue<string>()) ? "" : workSheet?.Cells[row, 12]?.GetValue<string>();
r.FullScore = 300; r.FullScore = 300;
r.TotalScore = string.IsNullOrWhiteSpace(reader.GetValue(12)?.ToString()) ? 0.00 : Math.Round(Convert.ToDouble(reader.GetValue(12)), 2); r.TotalScore = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 13]?.GetValue<string>()) ? 0.00 : Math.Round(workSheet.Cells[row, 13].GetValue<double>(), 2);
var examStatusCol7 = reader.GetValue(6)?.ToString()?.Trim(); var examStatusCol7 = workSheet?.Cells[row, 7]?.GetValue<string>()?.Trim();
var examStatusCol14 = reader.GetValue(13)?.ToString()?.Trim(); var examStatusCol14 = workSheet?.Cells[row, 14]?.GetValue<string>()?.Trim();
r.ExamStatus = r.ExamStatus =
examStatusCol7 == "ขาดสอบ" ? "ขส." : examStatusCol7 == "ขาดสอบ" ? "ขส." :
examStatusCol14 == "ได้" ? "ผ่าน" : examStatusCol14 == "ได้" ? "ผ่าน" :
examStatusCol14 == "ตก" ? "ไม่ผ่าน" : "-"; examStatusCol14 == "ตก" ? "ไม่ผ่าน" : "-";
r.RemarkScore = string.IsNullOrWhiteSpace(reader.GetValue(14)?.ToString()) ? string.Empty : reader.GetValue(14)?.ToString(); r.RemarkScore = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 15]?.GetValue<string>()) ? string.Empty : workSheet?.Cells[row, 15]?.GetValue<string>();
var examAttr = reader.GetValue(15)?.ToString()?.Trim(); var examAttr = workSheet?.Cells[row, 16]?.GetValue<string>()?.Trim();
r.ExamAttribute = r.ExamAttribute =
examAttr == "ผ่าน" ? "มีคุณสมบัติ" : examAttr == "ผ่าน" ? "มีคุณสมบัติ" :
examAttr == "ไม่ผ่าน" ? "ไม่มีคุณสมบัติ" : ""; examAttr == "ไม่ผ่าน" ? "ไม่มีคุณสมบัติ" : "";
r.Major = reader.Name; // worksheet name r.Major = workSheet.Name;
r.CreatedAt = DateTime.Now; r.CreatedAt = DateTime.Now;
r.CreatedUserId = job.UserId ?? ""; r.CreatedUserId = job.UserId ?? "";
r.CreatedFullName = job.FullName ?? "System Administrator"; r.CreatedFullName = job.FullName ?? "System Administrator";
r.LastUpdatedAt = DateTime.Now; r.LastUpdatedAt = DateTime.Now;
r.LastUpdateUserId = job.UserId ?? ""; r.LastUpdateUserId = job.UserId ?? "";
r.LastUpdateFullName = job.FullName ?? "System Administrator"; r.LastUpdateFullName = job.FullName ?? "System Administrator";
r.ScoreImport = importRef;
batchScores.Add(r); batchScores.Add(r);
} }
row++;
batchCount++; batchCount++;
totalProcessed++; totalProcessed++;
if (batchCount >= batchSize) if (batchCount >= batchSize)
{ {
// Set ScoreImportId FK for all scores in batch
foreach (var score in batchScores)
{
score.ScoreImportId = scoreImport_id;
}
await _context.BulkInsertAsync(batchScores); await _context.BulkInsertAsync(batchScores);
batchScores.Clear(); batchScores.Clear();
batchCount = 0; batchCount = 0;
@ -731,13 +739,9 @@ public class ImportBackgroundService : BackgroundService
// Process remaining records // Process remaining records
if (batchScores.Count > 0) if (batchScores.Count > 0)
{ {
foreach (var score in batchScores)
{
score.ScoreImportId = scoreImport_id;
}
await _context.BulkInsertAsync(batchScores); await _context.BulkInsertAsync(batchScores);
} }
} while (reader.NextResult()); }
job.TotalCount = _tracker.GetJob(job.JobId)?.ProcessedCount ?? 0; job.TotalCount = _tracker.GetJob(job.JobId)?.ProcessedCount ?? 0;
} }
@ -786,9 +790,8 @@ public class ImportBackgroundService : BackgroundService
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
_context.ChangeTracker.Clear(); _context.ChangeTracker.Clear();
// preload scores using AsNoTracking to avoid EF tracking overhead // preload scores - re-query from DB to avoid tracking issues
var scoreList = await _context.RecruitScores var scoreList = await _context.RecruitScores
.AsNoTracking()
.Where(s => s.ScoreImport.RecruitImportId == rec_import.Id && !string.IsNullOrEmpty(s.ExamId)) .Where(s => s.ScoreImport.RecruitImportId == rec_import.Id && !string.IsNullOrEmpty(s.ExamId))
.GroupBy(x => x.ExamId) .GroupBy(x => x.ExamId)
.Where(g => g.Count() == 1) .Where(g => g.Count() == 1)
@ -796,34 +799,31 @@ public class ImportBackgroundService : BackgroundService
.ToListAsync(); .ToListAsync();
var score = scoreList.ToDictionary(s => s.ExamId!, s => s); var score = scoreList.ToDictionary(s => s.ExamId!, s => s);
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); // Read from saved file (ResultFile uses stream from Form, but we saved to disk)
using var stream = System.IO.File.OpenRead(job.ImportFile); using var stream = System.IO.File.OpenRead(job.ImportFile);
using var reader = ExcelReaderFactory.CreateReader(stream); using var c_package = new ExcelPackage(stream);
do foreach (var workSheet in c_package.Workbook.Worksheets)
{ {
// Skip 6 header rows, data starts at row 7 int row = 7;
for (int skip = 0; skip < 6; skip++)
{
if (!reader.Read()) break;
}
int batchCount = 0; int batchCount = 0;
const int batchSize = 500; const int batchSize = 500;
var endRow = workSheet.Dimension.End.Row;
var batchUpdates = new List<RecruitScore>(); var batchUpdates = new List<RecruitScore>();
while (reader.Read()) while (row <= endRow)
{ {
var examId = reader.GetValue(1)?.ToString(); var examId = workSheet?.Cells[row, 2]?.GetValue<string>();
if (string.IsNullOrWhiteSpace(examId)) if (string.IsNullOrWhiteSpace(examId))
{ {
row++;
continue; continue;
} }
if (score.TryGetValue(examId, out var existingScore)) if (score.TryGetValue(examId, out var existingScore))
{ {
existingScore.Number = reader.GetValue(0)?.ToString(); existingScore.Number = workSheet?.Cells[row, 1]?.GetValue<string>();
existingScore.RemarkExamOrder = reader.GetValue(3)?.ToString() ?? string.Empty; existingScore.RemarkExamOrder = workSheet?.Cells[row, 4]?.GetValue<string>() ?? string.Empty;
existingScore.LastUpdatedAt = DateTime.Now; existingScore.LastUpdatedAt = DateTime.Now;
existingScore.LastUpdateUserId = job.UserId ?? ""; existingScore.LastUpdateUserId = job.UserId ?? "";
existingScore.LastUpdateFullName = job.FullName ?? "System Administrator"; existingScore.LastUpdateFullName = job.FullName ?? "System Administrator";
@ -831,6 +831,8 @@ public class ImportBackgroundService : BackgroundService
batchCount++; batchCount++;
} }
row++;
if (batchCount >= batchSize) if (batchCount >= batchSize)
{ {
await _context.BulkUpdateAsync(batchUpdates); await _context.BulkUpdateAsync(batchUpdates);
@ -844,7 +846,7 @@ public class ImportBackgroundService : BackgroundService
{ {
await _context.BulkUpdateAsync(batchUpdates); await _context.BulkUpdateAsync(batchUpdates);
} }
} while (reader.NextResult()); }
} }
#endregion #endregion
@ -866,81 +868,6 @@ public class ImportBackgroundService : BackgroundService
} }
} }
/// <summary>
/// Get string value from ExcelDataReader by header column name
/// </summary>
private static string GetCellValue(IExcelDataReader reader, string[] cols, string headerName)
{
var idx = GetColumnIndex(cols, headerName);
if (idx <= 0 || idx > reader.FieldCount) return "";
return reader.GetValue(idx - 1)?.ToString() ?? "";
}
/// <summary>
/// Get DateTime value from ExcelDataReader by header column name
/// </summary>
private static DateTime? GetCellDateTime(IExcelDataReader reader, string[] cols, string headerName)
{
var idx = GetColumnIndex(cols, headerName);
if (idx <= 0 || idx > reader.FieldCount) return null;
var val = reader.GetValue(idx - 1);
if (val is DateTime dt) return dt;
if (val != null && DateTime.TryParse(val.ToString(), out var parsed)) return parsed;
return null;
}
/// <summary>
/// Get double value from ExcelDataReader by header column name
/// </summary>
private static double GetCellDouble(IExcelDataReader reader, string[] cols, string headerName)
{
var idx = GetColumnIndex(cols, headerName);
if (idx <= 0 || idx > reader.FieldCount) return 0.0;
var val = reader.GetValue(idx - 1);
if (val is double d) return d;
if (val != null && double.TryParse(val.ToString(), out var parsed)) return parsed;
return 0.0;
}
/// <summary>
/// Get decimal value from ExcelDataReader by header column name
/// </summary>
private static decimal GetCellDecimal(IExcelDataReader reader, string[] cols, string headerName)
{
var idx = GetColumnIndex(cols, headerName);
if (idx <= 0 || idx > reader.FieldCount) return 0m;
var val = reader.GetValue(idx - 1);
if (val is decimal dec) return dec;
if (val is double dbl) return (decimal)dbl;
if (val != null && decimal.TryParse(val.ToString(), out var parsed)) return parsed;
return 0m;
}
/// <summary>
/// Get double value from ExcelDataReader by 0-based column index
/// </summary>
private static double GetReaderDouble(IExcelDataReader reader, int index)
{
if (index < 0 || index >= reader.FieldCount) return 0.0;
var val = reader.GetValue(index);
if (val is double d) return d;
if (val != null && double.TryParse(val.ToString(), out var parsed)) return parsed;
return 0.0;
}
/// <summary>
/// Get decimal value from ExcelDataReader by 0-based column index
/// </summary>
private static decimal GetReaderDecimal(IExcelDataReader reader, int index)
{
if (index < 0 || index >= reader.FieldCount) return 0m;
var val = reader.GetValue(index);
if (val is decimal dec) return dec;
if (val is double dbl) return (decimal)dbl;
if (val != null && decimal.TryParse(val.ToString(), out var parsed)) return parsed;
return 0m;
}
#endregion #endregion
} }

View file

@ -289,35 +289,6 @@
"lib/net7.0/EPPlus.System.Drawing.dll": {} "lib/net7.0/EPPlus.System.Drawing.dll": {}
} }
}, },
"ExcelDataReader/3.8.0": {
"type": "package",
"compile": {
"lib/netstandard2.1/ExcelDataReader.dll": {
"related": ".pdb;.xml"
}
},
"runtime": {
"lib/netstandard2.1/ExcelDataReader.dll": {
"related": ".pdb;.xml"
}
}
},
"ExcelDataReader.DataSet/3.8.0": {
"type": "package",
"dependencies": {
"ExcelDataReader": "3.8.0"
},
"compile": {
"lib/netstandard2.1/ExcelDataReader.DataSet.dll": {
"related": ".pdb;.xml"
}
},
"runtime": {
"lib/netstandard2.1/ExcelDataReader.DataSet.dll": {
"related": ".pdb;.xml"
}
}
},
"Google.Protobuf/3.19.4": { "Google.Protobuf/3.19.4": {
"type": "package", "type": "package",
"compile": { "compile": {
@ -5699,56 +5670,6 @@
"readme.md" "readme.md"
] ]
}, },
"ExcelDataReader/3.8.0": {
"sha512": "kbUsldc5Fn9IKgzL2nr4VvN/mKqPqn8zGXUZpA7uL6svCA4psF+qMK519EhMvderpU4pAJoqk9DWpiSIkiZtXA==",
"type": "package",
"path": "exceldatareader/3.8.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"ExcelDataReader.png",
"README.md",
"exceldatareader.3.8.0.nupkg.sha512",
"exceldatareader.nuspec",
"lib/net462/ExcelDataReader.dll",
"lib/net462/ExcelDataReader.pdb",
"lib/net462/ExcelDataReader.xml",
"lib/net8.0/ExcelDataReader.dll",
"lib/net8.0/ExcelDataReader.pdb",
"lib/net8.0/ExcelDataReader.xml",
"lib/netstandard2.0/ExcelDataReader.dll",
"lib/netstandard2.0/ExcelDataReader.pdb",
"lib/netstandard2.0/ExcelDataReader.xml",
"lib/netstandard2.1/ExcelDataReader.dll",
"lib/netstandard2.1/ExcelDataReader.pdb",
"lib/netstandard2.1/ExcelDataReader.xml"
]
},
"ExcelDataReader.DataSet/3.8.0": {
"sha512": "+eQg5oinHir7ayE/rF4dedvy8J6FBDG8RDyKFQsS/VZG9ygrnNgW6U8JSlrfGfe3DxYgbVoVwYV9Hbk63JQJFQ==",
"type": "package",
"path": "exceldatareader.dataset/3.8.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"ExcelDataReader.png",
"README.md",
"exceldatareader.dataset.3.8.0.nupkg.sha512",
"exceldatareader.dataset.nuspec",
"lib/net462/ExcelDataReader.DataSet.dll",
"lib/net462/ExcelDataReader.DataSet.pdb",
"lib/net462/ExcelDataReader.DataSet.xml",
"lib/net8.0/ExcelDataReader.DataSet.dll",
"lib/net8.0/ExcelDataReader.DataSet.pdb",
"lib/net8.0/ExcelDataReader.DataSet.xml",
"lib/netstandard2.0/ExcelDataReader.DataSet.dll",
"lib/netstandard2.0/ExcelDataReader.DataSet.pdb",
"lib/netstandard2.0/ExcelDataReader.DataSet.xml",
"lib/netstandard2.1/ExcelDataReader.DataSet.dll",
"lib/netstandard2.1/ExcelDataReader.DataSet.pdb",
"lib/netstandard2.1/ExcelDataReader.DataSet.xml"
]
},
"Google.Protobuf/3.19.4": { "Google.Protobuf/3.19.4": {
"sha512": "fd07/ykL4O4FhqrZIELm5lmiyOHfdPg9+o+hWr6tcfRdS7tHXnImg/2wtogLzlW2eEmr0J7j6ZrZvaWOLiJbxQ==", "sha512": "fd07/ykL4O4FhqrZIELm5lmiyOHfdPg9+o+hWr6tcfRdS7tHXnImg/2wtogLzlW2eEmr0J7j6ZrZvaWOLiJbxQ==",
"type": "package", "type": "package",
@ -14075,8 +13996,6 @@
"CoreAdmin >= 2.7.0", "CoreAdmin >= 2.7.0",
"EFCore.BulkExtensions.MySql >= 6.7.16", "EFCore.BulkExtensions.MySql >= 6.7.16",
"EPPlus >= 6.1.3", "EPPlus >= 6.1.3",
"ExcelDataReader >= 3.8.0",
"ExcelDataReader.DataSet >= 3.8.0",
"Microsoft.AspNetCore.Authentication.JwtBearer >= 7.0.20", "Microsoft.AspNetCore.Authentication.JwtBearer >= 7.0.20",
"Microsoft.AspNetCore.Mvc.NewtonsoftJson >= 7.0.3", "Microsoft.AspNetCore.Mvc.NewtonsoftJson >= 7.0.3",
"Microsoft.AspNetCore.Mvc.Versioning >= 5.0.0", "Microsoft.AspNetCore.Mvc.Versioning >= 5.0.0",
@ -14170,14 +14089,6 @@
"target": "Package", "target": "Package",
"version": "[6.1.3, )" "version": "[6.1.3, )"
}, },
"ExcelDataReader": {
"target": "Package",
"version": "[3.8.0, )"
},
"ExcelDataReader.DataSet": {
"target": "Package",
"version": "[3.8.0, )"
},
"Microsoft.AspNetCore.Authentication.JwtBearer": { "Microsoft.AspNetCore.Authentication.JwtBearer": {
"target": "Package", "target": "Package",
"version": "[7.0.20, )" "version": "[7.0.20, )"

View file

@ -1,6 +1,6 @@
{ {
"version": 2, "version": 2,
"dgSpecHash": "++tptrWNc3M=", "dgSpecHash": "XR3lYvVwNcQ=",
"success": true, "success": true,
"projectFilePath": "/Users/suphonchaip/Develop/hrms/hrms-api-recruit/BMA.EHR.Recruit.csproj", "projectFilePath": "/Users/suphonchaip/Develop/hrms/hrms-api-recruit/BMA.EHR.Recruit.csproj",
"expectedPackageFiles": [ "expectedPackageFiles": [
@ -21,8 +21,6 @@
"/Users/suphonchaip/.nuget/packages/epplus/6.1.3/epplus.6.1.3.nupkg.sha512", "/Users/suphonchaip/.nuget/packages/epplus/6.1.3/epplus.6.1.3.nupkg.sha512",
"/Users/suphonchaip/.nuget/packages/epplus.interfaces/6.1.1/epplus.interfaces.6.1.1.nupkg.sha512", "/Users/suphonchaip/.nuget/packages/epplus.interfaces/6.1.1/epplus.interfaces.6.1.1.nupkg.sha512",
"/Users/suphonchaip/.nuget/packages/epplus.system.drawing/6.1.1/epplus.system.drawing.6.1.1.nupkg.sha512", "/Users/suphonchaip/.nuget/packages/epplus.system.drawing/6.1.1/epplus.system.drawing.6.1.1.nupkg.sha512",
"/Users/suphonchaip/.nuget/packages/exceldatareader/3.8.0/exceldatareader.3.8.0.nupkg.sha512",
"/Users/suphonchaip/.nuget/packages/exceldatareader.dataset/3.8.0/exceldatareader.dataset.3.8.0.nupkg.sha512",
"/Users/suphonchaip/.nuget/packages/google.protobuf/3.19.4/google.protobuf.3.19.4.nupkg.sha512", "/Users/suphonchaip/.nuget/packages/google.protobuf/3.19.4/google.protobuf.3.19.4.nupkg.sha512",
"/Users/suphonchaip/.nuget/packages/humanizer.core/2.14.1/humanizer.core.2.14.1.nupkg.sha512", "/Users/suphonchaip/.nuget/packages/humanizer.core/2.14.1/humanizer.core.2.14.1.nupkg.sha512",
"/Users/suphonchaip/.nuget/packages/k4os.compression.lz4/1.2.6/k4os.compression.lz4.1.2.6.nupkg.sha512", "/Users/suphonchaip/.nuget/packages/k4os.compression.lz4/1.2.6/k4os.compression.lz4.1.2.6.nupkg.sha512",