เพิ่มฟิวตำแหน่งตอนสร้างรอบสมัคร
This commit is contained in:
parent
dee47f326d
commit
bed23f911a
19 changed files with 3228 additions and 568 deletions
|
|
@ -38,7 +38,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Data
|
|||
public DbSet<Education> Educations { get; set; }
|
||||
|
||||
public DbSet<Document> Documents { get; set; }
|
||||
|
||||
public DbSet<CandidateDocument> CandidateDocuments { get; set; }
|
||||
public DbSet<PositionExam> PositionExams { get; set; }
|
||||
public DbSet<BankExam> BankExams { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -311,54 +311,54 @@ namespace BMA.EHR.Recurit.Exam.Service.Data
|
|||
}
|
||||
public static async Task SeedPeriodExamAsync(WebApplication app)
|
||||
{
|
||||
using var scope = app.Services.CreateScope();
|
||||
var service = scope.ServiceProvider.GetRequiredService<PeriodExamService>();
|
||||
// using var scope = app.Services.CreateScope();
|
||||
// var service = scope.ServiceProvider.GetRequiredService<PeriodExamService>();
|
||||
|
||||
var insertedPeriodExam = new List<PeriodExam>();
|
||||
// var insertedPeriodExam = new List<PeriodExam>();
|
||||
|
||||
if ((await service.GetsAsync()).Count() == 0)
|
||||
{
|
||||
// read excels into object
|
||||
var excelFile = "SeedPeriodExam.xlsx";
|
||||
using (var excel = new ExcelPackage(new FileInfo(excelFile)))
|
||||
{
|
||||
// 1. Seed PeriodExam
|
||||
var workSheet = excel.Workbook.Worksheets.FirstOrDefault(x => x.Name.ToLower() == "periodexam");
|
||||
var totalRows = workSheet?.Dimension.Rows;
|
||||
// if ((await service.GetsAsync()).Count() == 0)
|
||||
// {
|
||||
// // read excels into object
|
||||
// var excelFile = "SeedPeriodExam.xlsx";
|
||||
// using (var excel = new ExcelPackage(new FileInfo(excelFile)))
|
||||
// {
|
||||
// // 1. Seed PeriodExam
|
||||
// var workSheet = excel.Workbook.Worksheets.FirstOrDefault(x => x.Name.ToLower() == "periodexam");
|
||||
// var totalRows = workSheet?.Dimension.Rows;
|
||||
|
||||
int row = 2;
|
||||
// int row = 2;
|
||||
|
||||
while (row <= totalRows)
|
||||
{
|
||||
var cell1 = workSheet?.Cells[row, 1]?.GetValue<string>();
|
||||
if (cell1 == "" || cell1 == null) break;
|
||||
// while (row <= totalRows)
|
||||
// {
|
||||
// var cell1 = workSheet?.Cells[row, 1]?.GetValue<string>();
|
||||
// if (cell1 == "" || cell1 == null) break;
|
||||
|
||||
var PeriodExam = insertedPeriodExam.Where(x => x.Name == (workSheet?.Cells[row, 1]?.GetValue<string>() ?? "")).FirstOrDefault();
|
||||
if (PeriodExam == null)
|
||||
{
|
||||
// var PeriodExam = insertedPeriodExam.Where(x => x.Name == (workSheet?.Cells[row, 1]?.GetValue<string>() ?? "")).FirstOrDefault();
|
||||
// if (PeriodExam == null)
|
||||
// {
|
||||
|
||||
var inserted = new PeriodExam
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Name = workSheet?.Cells[row, 1]?.GetValue<string>() ?? "",
|
||||
Round = workSheet?.Cells[row, 2]?.GetValue<int>() ?? 0,
|
||||
Fee = workSheet?.Cells[row, 3]?.GetValue<float>() ?? 0,
|
||||
StartDate = workSheet?.Cells[row, 4]?.GetValue<DateTime>() ?? DateTime.Now.Date,
|
||||
EndDate = workSheet?.Cells[row, 5]?.GetValue<DateTime>() ?? DateTime.Now.Date,
|
||||
Year = workSheet?.Cells[row, 6]?.GetValue<int>() ?? 0,
|
||||
AnnounceDate = workSheet?.Cells[row, 7]?.GetValue<DateTime>() ?? DateTime.Now.Date,
|
||||
IsActive = true,
|
||||
CreatedFullName = "System Administrator",
|
||||
CreatedAt = DateTime.Now
|
||||
};
|
||||
insertedPeriodExam.Add(inserted);
|
||||
// var inserted = new PeriodExam
|
||||
// {
|
||||
// Id = Guid.NewGuid(),
|
||||
// Name = workSheet?.Cells[row, 1]?.GetValue<string>() ?? "",
|
||||
// Round = workSheet?.Cells[row, 2]?.GetValue<int>() ?? 0,
|
||||
// Fee = workSheet?.Cells[row, 3]?.GetValue<float>() ?? 0,
|
||||
// // StartDate = workSheet?.Cells[row, 4]?.GetValue<DateTime>() ?? DateTime.Now.Date,
|
||||
// // EndDate = workSheet?.Cells[row, 5]?.GetValue<DateTime>() ?? DateTime.Now.Date,
|
||||
// Year = workSheet?.Cells[row, 6]?.GetValue<int>() ?? 0,
|
||||
// // AnnounceDate = workSheet?.Cells[row, 7]?.GetValue<DateTime>() ?? DateTime.Now.Date,
|
||||
// IsActive = true,
|
||||
// CreatedFullName = "System Administrator",
|
||||
// CreatedAt = DateTime.Now
|
||||
// };
|
||||
// insertedPeriodExam.Add(inserted);
|
||||
|
||||
await service.CreateAsync(inserted);
|
||||
}
|
||||
row++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// await service.CreateAsync(inserted);
|
||||
// }
|
||||
// row++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,75 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
|
|||
.HasAnnotation("ProductVersion", "7.0.4")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.BankExam", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(0)
|
||||
.HasComment("PrimaryKey")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||
|
||||
b.Property<string>("AccountName")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ชื่อบัญชี");
|
||||
|
||||
b.Property<string>("AccountNumber")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("เลขบัญชี");
|
||||
|
||||
b.Property<string>("BankName")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ธนาคาร");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(100)
|
||||
.HasComment("สร้างข้อมูลเมื่อ");
|
||||
|
||||
b.Property<string>("CreatedFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(104)
|
||||
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<string>("CreatedUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(101)
|
||||
.HasComment("User Id ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<string>("LastUpdateFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(105)
|
||||
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<string>("LastUpdateUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(103)
|
||||
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<DateTime?>("LastUpdatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(102)
|
||||
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||
|
||||
b.Property<Guid>("PeriodExamId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PeriodExamId");
|
||||
|
||||
b.ToTable("BankExams");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Candidate", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
|
|
@ -753,10 +822,23 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
|
|||
.HasComment("PrimaryKey")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||
|
||||
b.Property<DateTime>("AnnounceDate")
|
||||
b.Property<DateTime>("AnnouncementEndDate")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(3)
|
||||
.HasComment("วันประกาศ");
|
||||
.HasColumnOrder(6)
|
||||
.HasComment("วันสิ้นสุดประกาศ");
|
||||
|
||||
b.Property<DateTime>("AnnouncementStartDate")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(5)
|
||||
.HasComment("วันเริ่มประกาศ");
|
||||
|
||||
b.Property<bool>("CheckDisability")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasComment("คนพิการ");
|
||||
|
||||
b.Property<bool>("CheckDocument")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasComment("ตรวจสอบเอกสารหลังประกาศผลสอบ");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
|
|
@ -781,11 +863,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
|
|||
.HasColumnType("longtext")
|
||||
.HasComment("รายละเอียดสมัครสอบ");
|
||||
|
||||
b.Property<DateTime>("EndDate")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(2)
|
||||
.HasComment("วันสิ้นสุด");
|
||||
|
||||
b.Property<float?>("Fee")
|
||||
.HasColumnType("float")
|
||||
.HasComment("ค่าธรรมเนียม");
|
||||
|
|
@ -817,19 +894,58 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
|
|||
.IsRequired()
|
||||
.HasMaxLength(150)
|
||||
.HasColumnType("varchar(150)")
|
||||
.HasColumnOrder(4)
|
||||
.HasColumnOrder(7)
|
||||
.HasComment("ชื่อการสอบ");
|
||||
|
||||
b.Property<int?>("Round")
|
||||
.HasColumnType("int")
|
||||
.HasColumnOrder(5)
|
||||
.HasComment("รอบการสอบ");
|
||||
b.Property<string>("Note")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("หมายเหตุ");
|
||||
|
||||
b.Property<DateTime>("StartDate")
|
||||
b.Property<Guid?>("OrganizationCodeId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasComment("Id รหัสส่วนราชการ");
|
||||
|
||||
b.Property<string>("OrganizationCodeName")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ชื่อรหัสส่วนราชการ");
|
||||
|
||||
b.Property<Guid?>("OrganizationId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasComment("Id หน่วยงาน");
|
||||
|
||||
b.Property<string>("OrganizationName")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ชื่อหน่วยงาน");
|
||||
|
||||
b.Property<DateTime>("PaymentEndDate")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(4)
|
||||
.HasComment("วันสิ้นสุดชำระเงิน");
|
||||
|
||||
b.Property<string>("PaymentKrungThai")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ชำระเงินผ่านกรุงไทย");
|
||||
|
||||
b.Property<DateTime>("PaymentStartDate")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(3)
|
||||
.HasComment("วันเริ่มชำระเงิน");
|
||||
|
||||
b.Property<DateTime>("RegisterEndDate")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(2)
|
||||
.HasComment("วันสิ้นสุดสมัครสอบ");
|
||||
|
||||
b.Property<DateTime>("RegisterStartDate")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(1)
|
||||
.HasComment("วันเริ่มสมัครสอบ");
|
||||
|
||||
b.Property<int?>("Round")
|
||||
.HasColumnType("int")
|
||||
.HasColumnOrder(8)
|
||||
.HasComment("รอบการสอบ");
|
||||
|
||||
b.Property<int?>("Year")
|
||||
.HasColumnType("int")
|
||||
.HasComment("ปีงบประมาณ");
|
||||
|
|
@ -839,6 +955,75 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
|
|||
b.ToTable("PeriodExams");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.PositionExam", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(0)
|
||||
.HasComment("PrimaryKey")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(100)
|
||||
.HasComment("สร้างข้อมูลเมื่อ");
|
||||
|
||||
b.Property<string>("CreatedFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(104)
|
||||
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<string>("CreatedUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(101)
|
||||
.HasComment("User Id ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<string>("LastUpdateFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(105)
|
||||
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<string>("LastUpdateUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(103)
|
||||
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<DateTime?>("LastUpdatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(102)
|
||||
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||
|
||||
b.Property<Guid>("PeriodExamId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("PositionId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasComment("Id ตำแหน่ง");
|
||||
|
||||
b.Property<string>("PositionName")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ชื่อตำแหน่ง");
|
||||
|
||||
b.Property<string>("TypeName")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ชื่อประเภทแบบฟอร์ม");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PeriodExamId");
|
||||
|
||||
b.ToTable("PositionExams");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Prefix", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
|
|
@ -1171,6 +1356,17 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
|
|||
b.ToTable("SubDistricts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.BankExam", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.PeriodExam", "PeriodExam")
|
||||
.WithMany()
|
||||
.HasForeignKey("PeriodExamId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("PeriodExam");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.Candidate", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.District", "CitizenDistrict")
|
||||
|
|
@ -1330,6 +1526,17 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
|
|||
b.Navigation("EducationLevel");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.PositionExam", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.PeriodExam", "PeriodExam")
|
||||
.WithMany()
|
||||
.HasForeignKey("PeriodExamId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("PeriodExam");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Recurit.Exam.Service.Models.SubDistrict", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Recurit.Exam.Service.Models.District", "District")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue