Merge branch 'develop' into dev
All checks were successful
Build & Deploy on Dev / build (push) Successful in 47s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 47s
This commit is contained in:
commit
564a9a8a8d
10 changed files with 3310 additions and 69 deletions
|
|
@ -2062,6 +2062,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
||||||
case "notpass":
|
case "notpass":
|
||||||
queryWithScores = queryWithScores.Where(x => x.score != null && x.score.ExamStatus == "ไม่ผ่าน");
|
queryWithScores = queryWithScores.Where(x => x.score != null && x.score.ExamStatus == "ไม่ผ่าน");
|
||||||
break;
|
break;
|
||||||
|
case "other":
|
||||||
|
queryWithScores = queryWithScores.Where(x => x.score != null && !new[] { "ขส.", "ผ่าน", "ไม่ผ่าน" }.Contains(x.score.ExamStatus));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2331,11 +2334,15 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
||||||
Score = score == null ? 0.0 : score.TotalScore,
|
Score = score == null ? 0.0 : score.TotalScore,
|
||||||
Number = score == null ? "" : score.Number,
|
Number = score == null ? "" : score.Number,
|
||||||
ExamCount = _disableService.GetExamCount(disable.CitizenId),
|
ExamCount = _disableService.GetExamCount(disable.CitizenId),
|
||||||
ScoreExpire = disable.PeriodExam.AnnouncementDate == null
|
// เดิมคำนวณวันหมดอายุจาก AnnouncementDate + 2 ปี (เก็บไว้สำหรับอ้างอิงข้อมูลเก่า)
|
||||||
|
//ScoreExpire = disable.PeriodExam.AnnouncementDate == null
|
||||||
|
// ? ""
|
||||||
|
// : disable.PeriodExam.AnnouncementDate != DateTime.MinValue
|
||||||
|
// ? disable.PeriodExam.AnnouncementDate.Value.AddYears(2).ToThaiShortDate()
|
||||||
|
// : "",
|
||||||
|
ScoreExpire = disable.PeriodExam.ScoreExpireDate == null
|
||||||
? ""
|
? ""
|
||||||
: disable.PeriodExam.AnnouncementDate != DateTime.MinValue
|
: disable.PeriodExam.ScoreExpireDate.Value.ToThaiShortDate(),
|
||||||
? disable.PeriodExam.AnnouncementDate.Value.AddYears(2).ToThaiShortDate()
|
|
||||||
: "",
|
|
||||||
typeTest = disable.typeTest,
|
typeTest = disable.typeTest,
|
||||||
ScoreResult = score == null ? null : new
|
ScoreResult = score == null ? null : new
|
||||||
{
|
{
|
||||||
|
|
@ -2687,11 +2694,15 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
||||||
T = score != null ? score.TotalScore.ToString().ToThaiNumber() : "",
|
T = score != null ? score.TotalScore.ToString().ToThaiNumber() : "",
|
||||||
Result = score != null ? score.ExamStatus : "",
|
Result = score != null ? score.ExamStatus : "",
|
||||||
Number = score != null && score.Number != null ? score.Number.ToString().ToThaiNumber() : "",
|
Number = score != null && score.Number != null ? score.Number.ToString().ToThaiNumber() : "",
|
||||||
Expire = disable.PeriodExam.AnnouncementDate == null
|
// เดิมคำนวณวันหมดอายุจาก AnnouncementDate + 2 ปี (เก็บไว้สำหรับอ้างอิงข้อมูลเก่า)
|
||||||
|
//Expire = disable.PeriodExam.AnnouncementDate == null
|
||||||
|
// ? ""
|
||||||
|
// : disable.PeriodExam.AnnouncementDate != DateTime.MinValue
|
||||||
|
// ? disable.PeriodExam.AnnouncementDate.Value.AddYears(2).ToThaiShortDate().ToString().ToThaiNumber()
|
||||||
|
// : "",
|
||||||
|
Expire = disable.PeriodExam.ScoreExpireDate == null
|
||||||
? ""
|
? ""
|
||||||
: disable.PeriodExam.AnnouncementDate != DateTime.MinValue
|
: disable.PeriodExam.ScoreExpireDate.Value.ToThaiShortDate().ToString().ToThaiNumber(),
|
||||||
? disable.PeriodExam.AnnouncementDate.Value.AddYears(2).ToThaiShortDate().ToString().ToThaiNumber()
|
|
||||||
: "",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = new
|
var result = new
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
||||||
Number = sr == null ? "" : sr.Number,
|
Number = sr == null ? "" : sr.Number,
|
||||||
// ExamCount = 10,
|
// ExamCount = 10,
|
||||||
// ExamCount = GetExamCountTes(p.CitizenId),
|
// ExamCount = GetExamCountTes(p.CitizenId),
|
||||||
ScoreExpire = p.PeriodExam.AnnouncementDate == null ? "" : p.PeriodExam.AnnouncementDate.Value.AddYears(2).ToThaiShortDate(),
|
// เดิมคำนวณวันหมดอายุจาก AnnouncementDate + 2 ปี (เก็บไว้สำหรับอ้างอิงข้อมูลเก่า)
|
||||||
|
//ScoreExpire = p.PeriodExam.AnnouncementDate == null ? "" : p.PeriodExam.AnnouncementDate.Value.AddYears(2).ToThaiShortDate(),
|
||||||
|
ScoreExpire = p.PeriodExam.ScoreExpireDate == null ? "" : p.PeriodExam.ScoreExpireDate.Value.ToThaiShortDate(),
|
||||||
FullA = sr == null ? 0 : sr.FullA,
|
FullA = sr == null ? 0 : sr.FullA,
|
||||||
SumA = sr == null ? 0 : sr.SumA,
|
SumA = sr == null ? 0 : sr.SumA,
|
||||||
FullB = sr == null ? 0 : sr.FullB,
|
FullB = sr == null ? 0 : sr.FullB,
|
||||||
|
|
|
||||||
|
|
@ -2392,6 +2392,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
|
||||||
.HasColumnOrder(9)
|
.HasColumnOrder(9)
|
||||||
.HasComment("รอบการสอบ");
|
.HasComment("รอบการสอบ");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("ScoreExpireDate")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(6)
|
||||||
|
.HasComment("วันหมดอายุบัญชี");
|
||||||
|
|
||||||
b.Property<bool>("SetSeat")
|
b.Property<bool>("SetSeat")
|
||||||
.HasColumnType("tinyint(1)")
|
.HasColumnType("tinyint(1)")
|
||||||
.HasComment("เช็คอัพคะแนน");
|
.HasComment("เช็คอัพคะแนน");
|
||||||
|
|
|
||||||
3158
Migrations/20260701102530_update_PeriodExams_add_ScoreExpireDate.Designer.cs
generated
Normal file
3158
Migrations/20260701102530_update_PeriodExams_add_ScoreExpireDate.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,31 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BMA.EHR.Recurit.Exam.Service.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class update_PeriodExams_add_ScoreExpireDate : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<DateTime>(
|
||||||
|
name: "ScoreExpireDate",
|
||||||
|
table: "PeriodExams",
|
||||||
|
type: "datetime(6)",
|
||||||
|
nullable: true,
|
||||||
|
comment: "วันหมดอายุบัญชี")
|
||||||
|
.Annotation("Relational:ColumnOrder", 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "ScoreExpireDate",
|
||||||
|
table: "PeriodExams");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -41,6 +41,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
|
||||||
[Column(Order = 5), Comment("วันประกาศผลสอบ")]
|
[Column(Order = 5), Comment("วันประกาศผลสอบ")]
|
||||||
public DateTime? AnnouncementDate { get; set; }
|
public DateTime? AnnouncementDate { get; set; }
|
||||||
|
|
||||||
|
[Column(Order = 6), Comment("วันหมดอายุบัญชี")]
|
||||||
|
public DateTime? ScoreExpireDate { get; set; }
|
||||||
|
|
||||||
[Required, Column(Order = 6), Comment("วันเริ่มประกาศ")]
|
[Required, Column(Order = 6), Comment("วันเริ่มประกาศ")]
|
||||||
public DateTime AnnouncementStartDate { get; set; } = DateTime.Now.Date;
|
public DateTime AnnouncementStartDate { get; set; } = DateTime.Now.Date;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Request
|
||||||
public DateTime AnnouncementStartDate { get; set; } = DateTime.Now.Date;
|
public DateTime AnnouncementStartDate { get; set; } = DateTime.Now.Date;
|
||||||
public DateTime AnnouncementEndDate { get; set; } = DateTime.Now.Date;
|
public DateTime AnnouncementEndDate { get; set; } = DateTime.Now.Date;
|
||||||
public DateTime? AnnouncementDate { get; set; }
|
public DateTime? AnnouncementDate { get; set; }
|
||||||
|
public DateTime? ScoreExpireDate { get; set; }
|
||||||
public DateTime? ExamDate { get; set; }
|
public DateTime? ExamDate { get; set; }
|
||||||
public Guid? OrganizationCodeId { get; set; }
|
public Guid? OrganizationCodeId { get; set; }
|
||||||
public string? OrganizationCodeName { get; set; }
|
public string? OrganizationCodeName { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
|
||||||
public DateTime AnnouncementStartDate { get; set; }
|
public DateTime AnnouncementStartDate { get; set; }
|
||||||
public DateTime AnnouncementEndDate { get; set; }
|
public DateTime AnnouncementEndDate { get; set; }
|
||||||
public DateTime? AnnouncementDate { get; set; }
|
public DateTime? AnnouncementDate { get; set; }
|
||||||
|
public DateTime? ScoreExpireDate { get; set; }
|
||||||
public DateTime? ExamDate { get; set; }
|
public DateTime? ExamDate { get; set; }
|
||||||
public Guid? OrganizationCodeId { get; set; }
|
public Guid? OrganizationCodeId { get; set; }
|
||||||
public string? OrganizationCodeName { get; set; }
|
public string? OrganizationCodeName { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -2480,7 +2480,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
||||||
Number = candidate.Number,
|
Number = candidate.Number,
|
||||||
ReviewPoint = candidate.ReviewPoint,
|
ReviewPoint = candidate.ReviewPoint,
|
||||||
Review = candidate.Review,
|
Review = candidate.Review,
|
||||||
AnnouncementDate = exam.AnnouncementDate?.AddYears(2),
|
// เดิมคำนวณวันหมดอายุจาก AnnouncementDate + 2 ปี (เก็บไว้สำหรับอ้างอิงข้อมูลเก่า)
|
||||||
|
//AnnouncementDate = exam.AnnouncementDate?.AddYears(2),
|
||||||
|
AnnouncementDate = exam.ScoreExpireDate,
|
||||||
Id = candidate.Id,
|
Id = candidate.Id,
|
||||||
Position = positionName,
|
Position = positionName,
|
||||||
PositionLevel = positionLevelName,
|
PositionLevel = positionLevelName,
|
||||||
|
|
@ -2540,7 +2542,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
||||||
Number = candidate.Number,
|
Number = candidate.Number,
|
||||||
ReviewPoint = candidate.ReviewPoint,
|
ReviewPoint = candidate.ReviewPoint,
|
||||||
Review = candidate.Review,
|
Review = candidate.Review,
|
||||||
AnnouncementDate = candidate.PeriodExam?.AnnouncementDate?.AddYears(2),
|
// เดิมคำนวณวันหมดอายุจาก AnnouncementDate + 2 ปี (เก็บไว้สำหรับอ้างอิงข้อมูลเก่า)
|
||||||
|
//AnnouncementDate = candidate.PeriodExam?.AnnouncementDate?.AddYears(2),
|
||||||
|
AnnouncementDate = candidate.PeriodExam?.ScoreExpireDate,
|
||||||
Id = candidate.Id,
|
Id = candidate.Id,
|
||||||
Position = positionName,
|
Position = positionName,
|
||||||
PositionLevel = positionLevelName,
|
PositionLevel = positionLevelName,
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ using Microsoft.EntityFrameworkCore;
|
||||||
using OfficeOpenXml;
|
using OfficeOpenXml;
|
||||||
using OfficeOpenXml.Style;
|
using OfficeOpenXml.Style;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
|
|
||||||
|
|
@ -108,6 +109,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
||||||
AnnouncementEndDate = x.AnnouncementEndDate,
|
AnnouncementEndDate = x.AnnouncementEndDate,
|
||||||
AnnouncementStartDate = x.AnnouncementStartDate,
|
AnnouncementStartDate = x.AnnouncementStartDate,
|
||||||
AnnouncementDate = x.AnnouncementDate,
|
AnnouncementDate = x.AnnouncementDate,
|
||||||
|
ScoreExpireDate = x.ScoreExpireDate,
|
||||||
CheckDisability = x.CheckDisability,
|
CheckDisability = x.CheckDisability,
|
||||||
CheckDocument = x.CheckDocument,
|
CheckDocument = x.CheckDocument,
|
||||||
Detail = x.Detail,
|
Detail = x.Detail,
|
||||||
|
|
@ -157,6 +159,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
||||||
AnnouncementEndDate = x.AnnouncementEndDate,
|
AnnouncementEndDate = x.AnnouncementEndDate,
|
||||||
AnnouncementStartDate = x.AnnouncementStartDate,
|
AnnouncementStartDate = x.AnnouncementStartDate,
|
||||||
AnnouncementDate = x.AnnouncementDate,
|
AnnouncementDate = x.AnnouncementDate,
|
||||||
|
ScoreExpireDate = x.ScoreExpireDate,
|
||||||
CheckDisability = x.CheckDisability,
|
CheckDisability = x.CheckDisability,
|
||||||
CheckDocument = x.CheckDocument,
|
CheckDocument = x.CheckDocument,
|
||||||
Detail = x.Detail,
|
Detail = x.Detail,
|
||||||
|
|
@ -352,6 +355,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
||||||
PaymentEndDate = inserted.PaymentEndDate,
|
PaymentEndDate = inserted.PaymentEndDate,
|
||||||
AnnouncementStartDate = inserted.AnnouncementStartDate,
|
AnnouncementStartDate = inserted.AnnouncementStartDate,
|
||||||
AnnouncementDate = inserted.AnnouncementDate,
|
AnnouncementDate = inserted.AnnouncementDate,
|
||||||
|
ScoreExpireDate = inserted.ScoreExpireDate,
|
||||||
ExamDate = inserted.ExamDate,
|
ExamDate = inserted.ExamDate,
|
||||||
AnnouncementEndDate = inserted.AnnouncementEndDate,
|
AnnouncementEndDate = inserted.AnnouncementEndDate,
|
||||||
OrganizationCodeId = inserted.OrganizationCodeId,
|
OrganizationCodeId = inserted.OrganizationCodeId,
|
||||||
|
|
@ -454,6 +458,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
||||||
periodExam.PaymentEndDate = updated.PaymentEndDate;
|
periodExam.PaymentEndDate = updated.PaymentEndDate;
|
||||||
periodExam.AnnouncementStartDate = updated.AnnouncementStartDate;
|
periodExam.AnnouncementStartDate = updated.AnnouncementStartDate;
|
||||||
periodExam.AnnouncementDate = updated.AnnouncementDate;
|
periodExam.AnnouncementDate = updated.AnnouncementDate;
|
||||||
|
// ScoreExpireDate อัปเดตเฉพาะเมื่อ FE ส่งค่ามาเท่านั้น (ไม่บังคับส่ง)
|
||||||
|
if (updated.ScoreExpireDate.HasValue)
|
||||||
|
periodExam.ScoreExpireDate = updated.ScoreExpireDate;
|
||||||
periodExam.ExamDate = updated.ExamDate;
|
periodExam.ExamDate = updated.ExamDate;
|
||||||
periodExam.AnnouncementEndDate = updated.AnnouncementEndDate;
|
periodExam.AnnouncementEndDate = updated.AnnouncementEndDate;
|
||||||
periodExam.OrganizationCodeId = updated.OrganizationCodeId;
|
periodExam.OrganizationCodeId = updated.OrganizationCodeId;
|
||||||
|
|
@ -1149,19 +1156,19 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
||||||
PointPath1A = worksheet.Cells[row, 9].Value != null ? worksheet.Cells[row, 9].Value.ToString() : null,
|
PointPath1A = worksheet.Cells[row, 9].Value != null ? worksheet.Cells[row, 9].Value.ToString() : null,
|
||||||
PointPath2A = worksheet.Cells[row, 10].Value != null ? worksheet.Cells[row, 10].Value.ToString() : null,
|
PointPath2A = worksheet.Cells[row, 10].Value != null ? worksheet.Cells[row, 10].Value.ToString() : null,
|
||||||
PointPath3A = worksheet.Cells[row, 11].Value != null ? worksheet.Cells[row, 11].Value.ToString() : null,
|
PointPath3A = worksheet.Cells[row, 11].Value != null ? worksheet.Cells[row, 11].Value.ToString() : null,
|
||||||
PointTotalA = worksheet.Cells[3, 12].Value != null ? worksheet.Cells[3, 12].Value.ToString()?.Split(" ")[0] : null,
|
PointTotalA = worksheet.Cells[3, 12].Value != null ? ExtractFirstNumber(worksheet.Cells[3, 12].Value.ToString()) : null,
|
||||||
PointA = worksheet.Cells[row, 12].Value != null ? worksheet.Cells[row, 12].Value.ToString() : null,
|
PointA = worksheet.Cells[row, 12].Value != null ? worksheet.Cells[row, 12].Value.ToString() : null,
|
||||||
PointPerA = worksheet.Cells[row, 13].Value != null ? worksheet.Cells[row, 13].Value.ToString() : null,
|
PointPerA = worksheet.Cells[row, 13].Value != null ? worksheet.Cells[row, 13].Value.ToString() : null,
|
||||||
ResultA = worksheet.Cells[row, 14].Value != null ? worksheet.Cells[row, 14].Value.ToString() : null,
|
ResultA = worksheet.Cells[row, 14].Value != null ? worksheet.Cells[row, 14].Value.ToString() : null,
|
||||||
|
|
||||||
PointTotalB = worksheet.Cells[3, 15].Value != null ? worksheet.Cells[3, 15].Value.ToString()?.Split(" ")[0] : null,
|
PointTotalB = worksheet.Cells[3, 15].Value != null ? ExtractFirstNumber(worksheet.Cells[3, 15].Value.ToString()) : null,
|
||||||
PointB = worksheet.Cells[row, 15].Value != null ? worksheet.Cells[row, 15].Value.ToString() : null,
|
PointB = worksheet.Cells[row, 15].Value != null ? worksheet.Cells[row, 15].Value.ToString() : null,
|
||||||
PointPerB = worksheet.Cells[row, 16].Value != null ? worksheet.Cells[row, 16].Value.ToString() : null,
|
PointPerB = worksheet.Cells[row, 16].Value != null ? worksheet.Cells[row, 16].Value.ToString() : null,
|
||||||
ResultB = worksheet.Cells[row, 17].Value != null ? worksheet.Cells[row, 17].Value.ToString() : null,
|
ResultB = worksheet.Cells[row, 17].Value != null ? worksheet.Cells[row, 17].Value.ToString() : null,
|
||||||
|
|
||||||
PointPath1C = worksheet.Cells[row, 18].Value != null ? worksheet.Cells[row, 18].Value.ToString() : null,
|
PointPath1C = worksheet.Cells[row, 18].Value != null ? worksheet.Cells[row, 18].Value.ToString() : null,
|
||||||
PointPath2C = worksheet.Cells[row, 19].Value != null ? worksheet.Cells[row, 19].Value.ToString() : null,
|
PointPath2C = worksheet.Cells[row, 19].Value != null ? worksheet.Cells[row, 19].Value.ToString() : null,
|
||||||
PointTotalC = worksheet.Cells[3, 20].Value != null ? worksheet.Cells[3, 20].Value.ToString()?.Split(" ")[0] : null,
|
PointTotalC = worksheet.Cells[3, 20].Value != null ? ExtractFirstNumber(worksheet.Cells[3, 20].Value.ToString()) : null,
|
||||||
PointC = worksheet.Cells[row, 20].Value != null ? worksheet.Cells[row, 20].Value.ToString() : null,
|
PointC = worksheet.Cells[row, 20].Value != null ? worksheet.Cells[row, 20].Value.ToString() : null,
|
||||||
PointPerC = worksheet.Cells[row, 21].Value != null ? worksheet.Cells[row, 21].Value.ToString() : null,
|
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,
|
ResultC = worksheet.Cells[row, 22].Value != null ? worksheet.Cells[row, 22].Value.ToString() : null,
|
||||||
|
|
@ -1175,14 +1182,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
||||||
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
||||||
if (!int.TryParse(worksheet.Cells[row, 11].Value != null ? worksheet.Cells[row, 11].Value.ToString() : "0", out _))
|
if (!int.TryParse(worksheet.Cells[row, 11].Value != null ? worksheet.Cells[row, 11].Value.ToString() : "0", out _))
|
||||||
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
||||||
if (!int.TryParse(worksheet.Cells[3, 12].Value != null ? worksheet.Cells[3, 12].Value.ToString()?.Split(" ")[0] : "0", out _))
|
if (!int.TryParse(ExtractFirstNumber(worksheet.Cells[3, 12].Value?.ToString()) ?? "0", out _))
|
||||||
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
throw new Exception("รูปแบบคะแนนรวมไม่ถูกต้อง กรุณากรอกเป็นตัวเลข (คอลัมน์ L)");
|
||||||
if (!int.TryParse(worksheet.Cells[row, 12].Value != null ? worksheet.Cells[row, 12].Value.ToString() : "0", out _))
|
if (!int.TryParse(worksheet.Cells[row, 12].Value != null ? worksheet.Cells[row, 12].Value.ToString() : "0", out _))
|
||||||
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
||||||
if (!int.TryParse(worksheet.Cells[row, 13].Value != null ? worksheet.Cells[row, 13].Value.ToString() : "0", out _))
|
if (!int.TryParse(worksheet.Cells[row, 13].Value != null ? worksheet.Cells[row, 13].Value.ToString() : "0", out _))
|
||||||
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
||||||
if (!int.TryParse(worksheet.Cells[3, 15].Value != null ? worksheet.Cells[3, 15].Value.ToString()?.Split(" ")[0] : "0", out _))
|
if (!int.TryParse(ExtractFirstNumber(worksheet.Cells[3, 15].Value?.ToString()) ?? "0", out _))
|
||||||
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
throw new Exception("รูปแบบคะแนนรวมไม่ถูกต้อง กรุณากรอกเป็นตัวเลข (คอลัมน์ O)");
|
||||||
if (!int.TryParse(worksheet.Cells[row, 15].Value != null ? worksheet.Cells[row, 15].Value.ToString() : "0", out _))
|
if (!int.TryParse(worksheet.Cells[row, 15].Value != null ? worksheet.Cells[row, 15].Value.ToString() : "0", out _))
|
||||||
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
||||||
if (!int.TryParse(worksheet.Cells[row, 16].Value != null ? worksheet.Cells[row, 16].Value.ToString() : "0", out _))
|
if (!int.TryParse(worksheet.Cells[row, 16].Value != null ? worksheet.Cells[row, 16].Value.ToString() : "0", out _))
|
||||||
|
|
@ -1191,8 +1198,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
||||||
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
||||||
if (!int.TryParse(worksheet.Cells[row, 19].Value != null ? worksheet.Cells[row, 19].Value.ToString() : "0", out _))
|
if (!int.TryParse(worksheet.Cells[row, 19].Value != null ? worksheet.Cells[row, 19].Value.ToString() : "0", out _))
|
||||||
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
||||||
if (!int.TryParse(worksheet.Cells[3, 20].Value != null ? worksheet.Cells[3, 20].Value.ToString()?.Split(" ")[0] : "0", out _))
|
if (!int.TryParse(ExtractFirstNumber(worksheet.Cells[3, 20].Value?.ToString()) ?? "0", out _))
|
||||||
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
throw new Exception("รูปแบบคะแนนรวมไม่ถูกต้อง กรุณากรอกเป็นตัวเลข (คอลัมน์ T)");
|
||||||
if (!int.TryParse(worksheet.Cells[row, 20].Value != null ? worksheet.Cells[row, 20].Value.ToString() : "0", out _))
|
if (!int.TryParse(worksheet.Cells[row, 20].Value != null ? worksheet.Cells[row, 20].Value.ToString() : "0", out _))
|
||||||
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
||||||
if (!int.TryParse(worksheet.Cells[row, 21].Value != null ? worksheet.Cells[row, 21].Value.ToString() : "0", out _))
|
if (!int.TryParse(worksheet.Cells[row, 21].Value != null ? worksheet.Cells[row, 21].Value.ToString() : "0", out _))
|
||||||
|
|
@ -1205,6 +1212,20 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ดึงเฉพาะส่วนตัวเลขนำหน้าจากค่าในเซลล์คะแนน
|
||||||
|
/// เช่น "100 คะแนน" / "100คะแนน" / " 100 " -> "100"
|
||||||
|
/// รองรับทั้งกรณีมี/ไม่มีช่องว่างคั่น หากเซลล์ว่างจะคืน null (เพื่อเก็บ NULL ใน DB)
|
||||||
|
/// หมายเหตุ: จุดที่ใช้ตรวจสอบ (validation) ต้องใส่ ?? "0" เพื่อให้ค่าว่างผ่านการตรวจ
|
||||||
|
/// </summary>
|
||||||
|
private static string? ExtractFirstNumber(string? raw)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(raw))
|
||||||
|
return null;
|
||||||
|
var match = Regex.Match(raw, @"^\s*\d+");
|
||||||
|
return match.Success ? match.Value : raw.Trim();
|
||||||
|
}
|
||||||
|
|
||||||
public async Task UploadSeatCandidateAsync(string examId, IFormFile excels)
|
public async Task UploadSeatCandidateAsync(string examId, IFormFile excels)
|
||||||
{
|
{
|
||||||
var periodExam = await _context.PeriodExams.AsQueryable()
|
var periodExam = await _context.PeriodExams.AsQueryable()
|
||||||
|
|
@ -1570,35 +1591,35 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
||||||
_data.Add(new
|
_data.Add(new
|
||||||
{
|
{
|
||||||
Number = item.Number != null ? item.Number.ToString() : "",
|
Number = item.Number != null ? item.Number.ToString() : "",
|
||||||
ExamIdenNumber = item.ExamIdenNumber != null ? item.ExamIdenNumber.ToString() : "-",
|
ExamIdenNumber = item.ExamIdenNumber != null ? item.ExamIdenNumber.ToString() : "",
|
||||||
CitizenId = item.CitizenId != null ? item.CitizenId.ToString() : "-",
|
CitizenId = item.CitizenId != null ? item.CitizenId.ToString() : "",
|
||||||
SeatNumber = item.SeatNumber != null ? item.SeatNumber.ToString() : "-",
|
SeatNumber = item.SeatNumber != null ? item.SeatNumber.ToString() : "",
|
||||||
PrefixName = item.PrefixName != null ? item.PrefixName.ToString() : "-",
|
PrefixName = item.PrefixName != null ? item.PrefixName.ToString() : "",
|
||||||
FullName = item.FirstName != null && item.LastName != null ? $"{item.FirstName} {item.LastName}" : "-",
|
FullName = item.FirstName != null && item.LastName != null ? $"{item.FirstName} {item.LastName}" : "",
|
||||||
PositionName = item.PositionExam != null && item.PositionExam?.PositionName != null ? item.PositionExam?.PositionName.ToString() : "-",
|
PositionName = item.PositionExam != null && item.PositionExam?.PositionName != null ? item.PositionExam?.PositionName.ToString() : "",
|
||||||
PositionLevelName = item.PositionExam != null && item.PositionExam?.PositionLevelName != null ? item.PositionExam?.PositionLevelName.ToString() : "-",
|
PositionLevelName = item.PositionExam != null && item.PositionExam?.PositionLevelName != null ? item.PositionExam?.PositionLevelName.ToString() : "",
|
||||||
|
|
||||||
PointPath1A = item.PointPath1A != null ? item.PointPath1A.ToString() : "0",
|
PointPath1A = item.PointPath1A != null ? item.PointPath1A.ToString() : "",
|
||||||
PointPath2A = item.PointPath2A != null ? item.PointPath2A.ToString() : "0",
|
PointPath2A = item.PointPath2A != null ? item.PointPath2A.ToString() : "",
|
||||||
PointPath3A = item.PointPath3A != null ? item.PointPath3A.ToString() : "0",
|
PointPath3A = item.PointPath3A != null ? item.PointPath3A.ToString() : "",
|
||||||
PointA = item.PointA != null ? item.PointA.ToString() : "0",
|
PointA = item.PointA != null ? item.PointA.ToString() : "",
|
||||||
PointPerA = item.PointPerA != null ? item.PointPerA.ToString() : "0",
|
PointPerA = item.PointPerA != null ? item.PointPerA.ToString() : "",
|
||||||
ResultA = item.ResultA != null ? item.ResultA.ToString() : "-",
|
ResultA = item.ResultA != null ? item.ResultA.ToString() : "",
|
||||||
|
|
||||||
PointB = item.PointB != null ? item.PointB.ToString() : "0",
|
PointB = item.PointB != null ? item.PointB.ToString() : "",
|
||||||
PointPerB = item.PointPerB != null ? item.PointPerB.ToString() : "0",
|
PointPerB = item.PointPerB != null ? item.PointPerB.ToString() : "",
|
||||||
ResultB = item.ResultB != null ? item.ResultB.ToString() : "-",
|
ResultB = item.ResultB != null ? item.ResultB.ToString() : "",
|
||||||
|
|
||||||
PointPath1C = item.PointPath1C != null ? item.PointPath1C.ToString() : "0",
|
PointPath1C = item.PointPath1C != null ? item.PointPath1C.ToString() : "",
|
||||||
PointPath2C = item.PointPath2C != null ? item.PointPath2C.ToString() : "0",
|
PointPath2C = item.PointPath2C != null ? item.PointPath2C.ToString() : "",
|
||||||
PointC = item.PointC != null ? item.PointC.ToString() : "0",
|
PointC = item.PointC != null ? item.PointC.ToString() : "",
|
||||||
PointPerC = item.PointPerC != null ? item.PointPerC.ToString() : "0",
|
PointPerC = item.PointPerC != null ? item.PointPerC.ToString() : "",
|
||||||
ResultC = item.ResultC != null ? item.ResultC.ToString() : "-",
|
ResultC = item.ResultC != null ? item.ResultC.ToString() : "",
|
||||||
|
|
||||||
Pass = item.Pass != null ? item.Pass.ToString() : "-",
|
Pass = item.Pass != null ? item.Pass.ToString() : "",
|
||||||
PaymentStatus = item.PeriodExam == null || item.PeriodExam.Fee <= 0 ? "ไม่มีชำระเงิน" : (item.PaymentDate == null ? "ยังไม่ชำระเงิน" : "ชำระแล้ว"),
|
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(),
|
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(),
|
RegisterDate = item.RegisterDate == null ? "" : $"{item.RegisterDate.Value.ToThaiShortDate()} {item.RegisterDate.Value:HH:mm:ss.ffff}".ToString(),
|
||||||
ExamReason = item.ExamReason != null ? item.ExamReason.ToString() : ""
|
ExamReason = item.ExamReason != null ? item.ExamReason.ToString() : ""
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -1608,35 +1629,35 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
||||||
_data.Add(new
|
_data.Add(new
|
||||||
{
|
{
|
||||||
Number = "",
|
Number = "",
|
||||||
ExamIdenNumber = "-",
|
ExamIdenNumber = "",
|
||||||
CitizenId = "-",
|
CitizenId = "",
|
||||||
SeatNumber = "-",
|
SeatNumber = "",
|
||||||
PrefixName = "-",
|
PrefixName = "",
|
||||||
FullName = "-",
|
FullName = "",
|
||||||
PositionName = "-",
|
PositionName = "",
|
||||||
PositionLevelName = "-",
|
PositionLevelName = "",
|
||||||
|
|
||||||
PointPath1A = "-",
|
PointPath1A = "",
|
||||||
PointPath2A = "-",
|
PointPath2A = "",
|
||||||
PointPath3A = "-",
|
PointPath3A = "",
|
||||||
PointA = "-",
|
PointA = "",
|
||||||
PointPerA = "-",
|
PointPerA = "",
|
||||||
ResultA = "-",
|
ResultA = "",
|
||||||
|
|
||||||
PointB = "-",
|
PointB = "",
|
||||||
PointPerB = "-",
|
PointPerB = "",
|
||||||
ResultB = "-",
|
ResultB = "",
|
||||||
|
|
||||||
PointPath1C = "-",
|
PointPath1C = "",
|
||||||
PointPath2C = "-",
|
PointPath2C = "",
|
||||||
PointC = "-",
|
PointC = "",
|
||||||
PointPerC = "-",
|
PointPerC = "",
|
||||||
ResultC = "-",
|
ResultC = "",
|
||||||
|
|
||||||
Pass = "-",
|
Pass = "",
|
||||||
PaymentStatus = "-",
|
PaymentStatus = "",
|
||||||
PaymentDate = "",
|
PaymentDate = "",
|
||||||
RegisterDate = "-",
|
RegisterDate = "",
|
||||||
ExamReason = ""
|
ExamReason = ""
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -2965,7 +2986,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
||||||
Number = periodExam.Candidate.Where(x => x.Status.Contains("done")).Count(),
|
Number = periodExam.Candidate.Where(x => x.Status.Contains("done")).Count(),
|
||||||
PlacementType = await _contextMetadata.PlacementTypes.FirstOrDefaultAsync(x => x.Name.Trim().ToUpper().Contains("สอบคัดเลือก")) == null ? await _contextMetadata.PlacementTypes.FirstOrDefaultAsync() : await _contextMetadata.PlacementTypes.FirstOrDefaultAsync(x => x.Name.Trim().ToUpper().Contains("สอบคัดเลือก")),
|
PlacementType = await _contextMetadata.PlacementTypes.FirstOrDefaultAsync(x => x.Name.Trim().ToUpper().Contains("สอบคัดเลือก")) == null ? await _contextMetadata.PlacementTypes.FirstOrDefaultAsync() : await _contextMetadata.PlacementTypes.FirstOrDefaultAsync(x => x.Name.Trim().ToUpper().Contains("สอบคัดเลือก")),
|
||||||
StartDate = DateTime.Now,
|
StartDate = DateTime.Now,
|
||||||
EndDate = DateTime.Now.AddYears(2).AddDays(-1),
|
// เดิมคำนวณวันหมดอายุจาก AnnouncementDate + 2 ปี (เก็บไว้สำหรับอ้างอิงข้อมูลเก่า)
|
||||||
|
//EndDate = DateTime.Now.AddYears(2).AddDays(-1),
|
||||||
|
EndDate = periodExam.ScoreExpireDate ?? DateTime.Now.AddYears(2).AddDays(-1),
|
||||||
CreatedAt = DateTime.Now,
|
CreatedAt = DateTime.Now,
|
||||||
CreatedUserId = UserId ?? "",
|
CreatedUserId = UserId ?? "",
|
||||||
CreatedFullName = FullName ?? "",
|
CreatedFullName = FullName ?? "",
|
||||||
|
|
@ -3197,7 +3220,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
||||||
Number = await _context.Disables.AsQueryable().Where(x => x.PeriodExam == periodExam).CountAsync(),
|
Number = await _context.Disables.AsQueryable().Where(x => x.PeriodExam == periodExam).CountAsync(),
|
||||||
PlacementType = placementTypesCache.FirstOrDefault(x => x.Name.Trim().ToUpper().Contains("คัดเลือกอื่นๆ")) ?? placementTypesCache.First(),
|
PlacementType = placementTypesCache.FirstOrDefault(x => x.Name.Trim().ToUpper().Contains("คัดเลือกอื่นๆ")) ?? placementTypesCache.First(),
|
||||||
StartDate = accountStartDate,
|
StartDate = accountStartDate,
|
||||||
EndDate = accountStartDate.AddYears(2).AddDays(-1),
|
// เดิมคำนวณวันหมดอายุจาก AnnouncementDate + 2 ปี (เก็บไว้สำหรับอ้างอิงข้อมูลเก่า)
|
||||||
|
//EndDate = accountStartDate.AddYears(2).AddDays(-1),
|
||||||
|
EndDate = periodExam.ScoreExpireDate ?? accountStartDate.AddYears(2).AddDays(-1),
|
||||||
CreatedAt = DateTime.Now,
|
CreatedAt = DateTime.Now,
|
||||||
CreatedUserId = UserId ?? "",
|
CreatedUserId = UserId ?? "",
|
||||||
CreatedFullName = FullName ?? "",
|
CreatedFullName = FullName ?? "",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue