update model and fix code
All checks were successful
Build & Deploy on Dev / build (push) Successful in 44s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 44s
This commit is contained in:
parent
9c353f40c6
commit
054ef81c63
3 changed files with 10 additions and 6 deletions
|
|
@ -83,6 +83,8 @@ 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;
|
||||||
|
|
||||||
|
public Guid ScoreImportId { get; set; }
|
||||||
|
|
||||||
public ScoreImport ScoreImport { get; set; }
|
public ScoreImport ScoreImport { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,9 @@ namespace BMA.EHR.Recruit.Models.Recruits
|
||||||
{
|
{
|
||||||
public int Year { get; set; }
|
public int Year { get; set; }
|
||||||
|
|
||||||
public Document ImportFile { get; set; } = new Document();
|
public Guid? ImportFileId { get; set; }
|
||||||
|
|
||||||
|
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>();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -615,9 +615,9 @@ public class ImportBackgroundService : BackgroundService
|
||||||
imported.LastUpdateFullName = job.FullName ?? "System Administrator";
|
imported.LastUpdateFullName = job.FullName ?? "System Administrator";
|
||||||
imported.Scores = new List<RecruitScore>();
|
imported.Scores = new List<RecruitScore>();
|
||||||
|
|
||||||
// Save ScoreImport — use shadow FK for ImportFile to avoid re-inserting Document
|
// Save ScoreImport — set ImportFileId FK directly (explicit property, not shadow)
|
||||||
var scoreEntry = _context.ScoreImports.Add(imported);
|
imported.ImportFileId = doc.Id;
|
||||||
scoreEntry.Property("ImportFileId").CurrentValue = doc.Id;
|
_context.ScoreImports.Add(imported);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
_context.ChangeTracker.Clear();
|
_context.ChangeTracker.Clear();
|
||||||
|
|
||||||
|
|
@ -713,7 +713,7 @@ public class ImportBackgroundService : BackgroundService
|
||||||
// Set ScoreImportId FK for all scores in batch
|
// Set ScoreImportId FK for all scores in batch
|
||||||
foreach (var score in batchScores)
|
foreach (var score in batchScores)
|
||||||
{
|
{
|
||||||
_context.Entry(score).Property("ScoreImportId").CurrentValue = scoreImport_id;
|
score.ScoreImportId = scoreImport_id;
|
||||||
}
|
}
|
||||||
await _context.BulkInsertAsync(batchScores);
|
await _context.BulkInsertAsync(batchScores);
|
||||||
batchScores.Clear();
|
batchScores.Clear();
|
||||||
|
|
@ -727,7 +727,7 @@ public class ImportBackgroundService : BackgroundService
|
||||||
{
|
{
|
||||||
foreach (var score in batchScores)
|
foreach (var score in batchScores)
|
||||||
{
|
{
|
||||||
_context.Entry(score).Property("ScoreImportId").CurrentValue = scoreImport_id;
|
score.ScoreImportId = scoreImport_id;
|
||||||
}
|
}
|
||||||
await _context.BulkInsertAsync(batchScores);
|
await _context.BulkInsertAsync(batchScores);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue