Receive and Deploy Command

This commit is contained in:
Suphonchai Phoonsawat 2023-07-28 15:04:26 +07:00
parent 297b1efb57
commit 4e8b7ea32b
24 changed files with 49003 additions and 87 deletions

View file

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddCommandCodetoCommandTypeTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "CommandCode",
table: "CommandTypes",
type: "longtext",
nullable: false,
comment: "รหัสของประเภทคำสั่ง")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CommandCode",
table: "CommandTypes");
}
}
}

View file

@ -0,0 +1,31 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddRefToPlacementProfiletoCommandReceiverTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "RefPlacementProfileId",
table: "CommandReceivers",
type: "char(36)",
nullable: true,
comment: "รหัสอ้างอิงไปยังข้อมูลผู้บรรจุ",
collation: "ascii_general_ci");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "RefPlacementProfileId",
table: "CommandReceivers");
}
}
}

View file

@ -0,0 +1,129 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddFieldtoCommandDeploymentTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "ExamRoundId",
table: "Commands",
newName: "PlacementId");
migrationBuilder.AddColumn<string>(
name: "CitizenId",
table: "CommandDeployments",
type: "varchar(13)",
maxLength: 13,
nullable: false,
defaultValue: "",
comment: "เลขประจำตัวประชาชน")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "FirstName",
table: "CommandDeployments",
type: "varchar(100)",
maxLength: 100,
nullable: false,
defaultValue: "",
comment: "ชื่อ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "LastName",
table: "CommandDeployments",
type: "varchar(100)",
maxLength: 100,
nullable: false,
defaultValue: "",
comment: "นามสกุล")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "OrganizationName",
table: "CommandDeployments",
type: "longtext",
nullable: false,
comment: "ชื่อหน่วยงานของผู้รับสำเนาคำสั่ง")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Prefix",
table: "CommandDeployments",
type: "varchar(50)",
maxLength: 50,
nullable: false,
defaultValue: "",
comment: "คำนำหน้านาม")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<int>(
name: "Sequence",
table: "CommandDeployments",
type: "int",
nullable: false,
defaultValue: 0,
comment: "ลำดับ");
migrationBuilder.CreateIndex(
name: "IX_Commands_PlacementId",
table: "Commands",
column: "PlacementId");
migrationBuilder.AddForeignKey(
name: "FK_Commands_Placements_PlacementId",
table: "Commands",
column: "PlacementId",
principalTable: "Placements",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Commands_Placements_PlacementId",
table: "Commands");
migrationBuilder.DropIndex(
name: "IX_Commands_PlacementId",
table: "Commands");
migrationBuilder.DropColumn(
name: "CitizenId",
table: "CommandDeployments");
migrationBuilder.DropColumn(
name: "FirstName",
table: "CommandDeployments");
migrationBuilder.DropColumn(
name: "LastName",
table: "CommandDeployments");
migrationBuilder.DropColumn(
name: "OrganizationName",
table: "CommandDeployments");
migrationBuilder.DropColumn(
name: "Prefix",
table: "CommandDeployments");
migrationBuilder.DropColumn(
name: "Sequence",
table: "CommandDeployments");
migrationBuilder.RenameColumn(
name: "PlacementId",
table: "Commands",
newName: "ExamRoundId");
}
}
}

View file

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddPositionNametoCommandDeploymentTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "PositionName",
table: "CommandDeployments",
type: "longtext",
nullable: false,
comment: "ชื่อตำแหน่งของผู้รับสำเนาคำสั่ง")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "PositionName",
table: "CommandDeployments");
}
}
}

View file

@ -113,10 +113,6 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<Guid>("ExamRoundId")
.HasColumnType("char(36)")
.HasComment("อ้างอิงรอบการสอบ");
b.Property<Guid>("IssuerOrganizationId")
.HasColumnType("char(36)")
.HasComment("รหัสอ้างอิงหน่วยงานที่ออกคำสั่ง");
@ -149,6 +145,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("char(36)")
.HasComment("รหัสส่วนราชการผู้ออกคำสั่ง");
b.Property<Guid>("PlacementId")
.HasColumnType("char(36)")
.HasComment("อ้างอิงรอบการสอบ");
b.Property<string>("PositionName")
.IsRequired()
.HasColumnType("longtext")
@ -160,6 +160,8 @@ namespace BMA.EHR.Infrastructure.Migrations
b.HasIndex("CommandTypeId");
b.HasIndex("PlacementId");
b.ToTable("Commands");
});
@ -172,6 +174,12 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<string>("CitizenId")
.IsRequired()
.HasMaxLength(13)
.HasColumnType("varchar(13)")
.HasComment("เลขประจำตัวประชาชน");
b.Property<Guid>("CommandId")
.HasColumnType("char(36)")
.HasComment("รหัสอ้างอิงคำสั่ง");
@ -195,6 +203,12 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasComment("ชื่อ");
b.Property<bool>("IsSendInbox")
.HasColumnType("tinyint(1)")
.HasComment("ส่งกล่องข้อความหรือไม่?");
@ -207,6 +221,12 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("tinyint(1)")
.HasComment("ส่งแจ้งเตือนหรือไม่?");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasComment("นามสกุล");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
@ -226,11 +246,31 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("OrganizationName")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงานของผู้รับสำเนาคำสั่ง");
b.Property<string>("PositionName")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อตำแหน่งของผู้รับสำเนาคำสั่ง");
b.Property<string>("Prefix")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasComment("คำนำหน้านาม");
b.Property<string>("ReceiveUserId")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รหัสอ้างอิงผู้ใช้งานระบบ");
b.Property<int>("Sequence")
.HasColumnType("int")
.HasComment("ลำดับ");
b.HasKey("Id");
b.HasIndex("CommandId");
@ -385,6 +425,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("varchar(50)")
.HasComment("คำนำหน้านาม");
b.Property<Guid?>("RefPlacementProfileId")
.HasColumnType("char(36)")
.HasComment("รหัสอ้างอิงไปยังข้อมูลผู้บรรจุ");
b.Property<int>("Sequence")
.HasColumnType("int")
.HasComment("ลำดับในบัญชีแนบท้าย");
@ -473,6 +517,11 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("varchar(100)")
.HasComment("ประเภทคำสั่ง");
b.Property<string>("CommandCode")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รหัสของประเภทคำสั่ง");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
@ -10594,9 +10643,17 @@ namespace BMA.EHR.Infrastructure.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BMA.EHR.Domain.Models.Placement.Placement", "Placement")
.WithMany()
.HasForeignKey("PlacementId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CommandStatus");
b.Navigation("CommandType");
b.Navigation("Placement");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandDeployment", b =>

View file

@ -70,7 +70,8 @@ namespace BMA.EHR.Infrastructure.Persistence
{
Id = Guid.Parse(workSheet?.Cells[row, 1]?.GetValue<string>()!),
Name = workSheet?.Cells[row, 2]?.GetValue<string>()!,
Category = workSheet?.Cells[row, 3]?.GetValue<string>()!
Category = workSheet?.Cells[row, 3]?.GetValue<string>()!,
CommandCode = workSheet?.Cells[row, 4]?.GetValue<string>()!
};
await service.AddAsync(inserted);