ลบรับโอน ขอโอน
This commit is contained in:
parent
c56e3b06b9
commit
61ddd26c0e
11 changed files with 26700 additions and 175 deletions
|
|
@ -34,8 +34,28 @@ namespace BMA.EHR.Domain.Models.Placement
|
|||
public string? TelephoneNumber { get; set; }
|
||||
[Comment("สถานะคำขอ")]
|
||||
public string Status { get; set; } = "PENDING";
|
||||
[Comment("Id เลขที่ตำแหน่ง")]
|
||||
public OrganizationPositionEntity? OrganizationPosition { get; set; }
|
||||
[Comment("วันที่บรรจุ")]
|
||||
public DateTime? RecruitDate { get; set; }
|
||||
|
||||
[Comment("Id ตำแหน่งเลขที่")]
|
||||
public PositionNumberEntity? PositionNumber { get; set; }
|
||||
|
||||
[Comment("Id ตำแหน่ง")]
|
||||
public OrganizationEntity? Organization { get; set; }
|
||||
public PositionPath? PositionPath { get; set; }
|
||||
|
||||
[Comment("Id ด้าน/สาขา")]
|
||||
public PositionPathSide? PositionPathSide { get; set; }
|
||||
|
||||
[Comment("Id ประเภทตำแหน่ง")]
|
||||
public PositionType? PositionType { get; set; }
|
||||
|
||||
[Comment("Id สายงาน")]
|
||||
public PositionLine? PositionLine { get; set; }
|
||||
|
||||
[Comment("Id ระดับ")]
|
||||
public PositionLevel? PositionLevel { get; set; }
|
||||
[Comment("สถานะการใช้งาน")]
|
||||
public bool IsActive { get; set; } = true;
|
||||
public virtual List<PlacementReceiveDoc> PlacementReceiveDocs { get; set; } = new List<PlacementReceiveDoc>();
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
#endregion
|
||||
|
||||
#region " Organization "
|
||||
public static readonly string OrganizationNotFound = "ไม่พบข้อมูลตำแหน่งในสังกัด";
|
||||
public static readonly string PositionPosNoNotFound = "ไม่พบข้อมูลเลขที่ตำแหน่ง";
|
||||
public static readonly string PositionPathNotFound = "ไม่พบข้อมูลตำแหน่ง";
|
||||
public static readonly string PositionLineNotFound = "ไม่พบข้อมูลสายงาน";
|
||||
|
|
@ -60,6 +61,8 @@
|
|||
#region " Placement "
|
||||
public static readonly string CertificateNotFound = "ไม่พบข้อมูลใบประกอบอาชีพ";
|
||||
public static readonly string EducationNotFound = "ไม่พบข้อมูลประวัติการศึกษา";
|
||||
public static readonly string PlacementTransferNotFound = "ไม่พบข้อมูลคำขอโอน";
|
||||
public static readonly string PlacementReceiveNotFound = "ไม่พบข้อมูลรับโอน";
|
||||
#endregion
|
||||
|
||||
#region " OrganizationEmployee "
|
||||
|
|
|
|||
12603
BMA.EHR.Infrastructure/Migrations/20230804094224_add table placementtransfer.Designer.cs
generated
Normal file
12603
BMA.EHR.Infrastructure/Migrations/20230804094224_add table placementtransfer.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,269 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addtableplacementtransfer : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PlacementReceives",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
|
||||
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
|
||||
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CitizenId = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: false, comment: "เลขประจำตัวประชาชน")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
PrefixId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
Firstname = table.Column<string>(type: "longtext", nullable: false, comment: "ชื่อ")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Lastname = table.Column<string>(type: "longtext", nullable: false, comment: "นามสกุล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
DateOfBirth = table.Column<DateTime>(type: "datetime(6)", maxLength: 40, nullable: false, comment: "วันเกิด"),
|
||||
GenderId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||
Nationality = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "สัญชาติ")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Race = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "เชื้อชาติ")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ReligionId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||
BloodGroupId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||
RelationshipId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||
TelephoneNumber = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "เบอร์โทร")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Status = table.Column<string>(type: "longtext", nullable: false, comment: "สถานะคำขอ")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
OrganizationId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PlacementReceives", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_PlacementReceives_BloodGroups_BloodGroupId",
|
||||
column: x => x.BloodGroupId,
|
||||
principalTable: "BloodGroups",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_PlacementReceives_Genders_GenderId",
|
||||
column: x => x.GenderId,
|
||||
principalTable: "Genders",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_PlacementReceives_Organizations_OrganizationId",
|
||||
column: x => x.OrganizationId,
|
||||
principalTable: "Organizations",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_PlacementReceives_Prefixes_PrefixId",
|
||||
column: x => x.PrefixId,
|
||||
principalTable: "Prefixes",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_PlacementReceives_Relationships_RelationshipId",
|
||||
column: x => x.RelationshipId,
|
||||
principalTable: "Relationships",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_PlacementReceives_Religions_ReligionId",
|
||||
column: x => x.ReligionId,
|
||||
principalTable: "Religions",
|
||||
principalColumn: "Id");
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PlacementTransfers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
|
||||
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
|
||||
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ProfileId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
Organization = table.Column<string>(type: "longtext", nullable: true, comment: "หน่วยงานที่ขอโอนไป")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Reason = table.Column<string>(type: "longtext", nullable: true, comment: "เหตุผล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Status = table.Column<string>(type: "longtext", nullable: false, comment: "สถานะคำขอ")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PlacementTransfers", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_PlacementTransfers_Profiles_ProfileId",
|
||||
column: x => x.ProfileId,
|
||||
principalTable: "Profiles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PlacementReceiveDocs",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
|
||||
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
|
||||
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
DocumentId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
PlacementReceiveId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PlacementReceiveDocs", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_PlacementReceiveDocs_Documents_DocumentId",
|
||||
column: x => x.DocumentId,
|
||||
principalTable: "Documents",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_PlacementReceiveDocs_PlacementReceives_PlacementReceiveId",
|
||||
column: x => x.PlacementReceiveId,
|
||||
principalTable: "PlacementReceives",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PlacementTransferDocs",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
|
||||
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
|
||||
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
DocumentId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
PlacementTransferId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PlacementTransferDocs", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_PlacementTransferDocs_Documents_DocumentId",
|
||||
column: x => x.DocumentId,
|
||||
principalTable: "Documents",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_PlacementTransferDocs_PlacementTransfers_PlacementTransferId",
|
||||
column: x => x.PlacementTransferId,
|
||||
principalTable: "PlacementTransfers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlacementReceiveDocs_DocumentId",
|
||||
table: "PlacementReceiveDocs",
|
||||
column: "DocumentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlacementReceiveDocs_PlacementReceiveId",
|
||||
table: "PlacementReceiveDocs",
|
||||
column: "PlacementReceiveId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlacementReceives_BloodGroupId",
|
||||
table: "PlacementReceives",
|
||||
column: "BloodGroupId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlacementReceives_GenderId",
|
||||
table: "PlacementReceives",
|
||||
column: "GenderId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlacementReceives_OrganizationId",
|
||||
table: "PlacementReceives",
|
||||
column: "OrganizationId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlacementReceives_PrefixId",
|
||||
table: "PlacementReceives",
|
||||
column: "PrefixId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlacementReceives_RelationshipId",
|
||||
table: "PlacementReceives",
|
||||
column: "RelationshipId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlacementReceives_ReligionId",
|
||||
table: "PlacementReceives",
|
||||
column: "ReligionId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlacementTransferDocs_DocumentId",
|
||||
table: "PlacementTransferDocs",
|
||||
column: "DocumentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlacementTransferDocs_PlacementTransferId",
|
||||
table: "PlacementTransferDocs",
|
||||
column: "PlacementTransferId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlacementTransfers_ProfileId",
|
||||
table: "PlacementTransfers",
|
||||
column: "ProfileId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "PlacementReceiveDocs");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PlacementTransferDocs");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PlacementReceives");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PlacementTransfers");
|
||||
}
|
||||
}
|
||||
}
|
||||
12673
BMA.EHR.Infrastructure/Migrations/20230804105621_add table placementtransfer1.Designer.cs
generated
Normal file
12673
BMA.EHR.Infrastructure/Migrations/20230804105621_add table placementtransfer1.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,258 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addtableplacementtransfer1 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PlacementReceives_Organizations_OrganizationId",
|
||||
table: "PlacementReceives");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "OrganizationId",
|
||||
table: "PlacementReceives",
|
||||
newName: "PositionTypeId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_PlacementReceives_OrganizationId",
|
||||
table: "PlacementReceives",
|
||||
newName: "IX_PlacementReceives_PositionTypeId");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "OrganizationPositionId",
|
||||
table: "PlacementReceives",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "PositionLevelId",
|
||||
table: "PlacementReceives",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "PositionLineId",
|
||||
table: "PlacementReceives",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "PositionNumberId",
|
||||
table: "PlacementReceives",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "PositionPathId",
|
||||
table: "PlacementReceives",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "PositionPathSideId",
|
||||
table: "PlacementReceives",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "RecruitDate",
|
||||
table: "PlacementReceives",
|
||||
type: "datetime(6)",
|
||||
nullable: true,
|
||||
comment: "วันที่บรรจุ");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlacementReceives_OrganizationPositionId",
|
||||
table: "PlacementReceives",
|
||||
column: "OrganizationPositionId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlacementReceives_PositionLevelId",
|
||||
table: "PlacementReceives",
|
||||
column: "PositionLevelId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlacementReceives_PositionLineId",
|
||||
table: "PlacementReceives",
|
||||
column: "PositionLineId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlacementReceives_PositionNumberId",
|
||||
table: "PlacementReceives",
|
||||
column: "PositionNumberId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlacementReceives_PositionPathId",
|
||||
table: "PlacementReceives",
|
||||
column: "PositionPathId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlacementReceives_PositionPathSideId",
|
||||
table: "PlacementReceives",
|
||||
column: "PositionPathSideId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PlacementReceives_OrganizationPositions_OrganizationPosition~",
|
||||
table: "PlacementReceives",
|
||||
column: "OrganizationPositionId",
|
||||
principalTable: "OrganizationPositions",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PlacementReceives_PositionLevels_PositionLevelId",
|
||||
table: "PlacementReceives",
|
||||
column: "PositionLevelId",
|
||||
principalTable: "PositionLevels",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PlacementReceives_PositionLines_PositionLineId",
|
||||
table: "PlacementReceives",
|
||||
column: "PositionLineId",
|
||||
principalTable: "PositionLines",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PlacementReceives_PositionNumbers_PositionNumberId",
|
||||
table: "PlacementReceives",
|
||||
column: "PositionNumberId",
|
||||
principalTable: "PositionNumbers",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PlacementReceives_PositionPathSides_PositionPathSideId",
|
||||
table: "PlacementReceives",
|
||||
column: "PositionPathSideId",
|
||||
principalTable: "PositionPathSides",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PlacementReceives_PositionPaths_PositionPathId",
|
||||
table: "PlacementReceives",
|
||||
column: "PositionPathId",
|
||||
principalTable: "PositionPaths",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PlacementReceives_PositionTypes_PositionTypeId",
|
||||
table: "PlacementReceives",
|
||||
column: "PositionTypeId",
|
||||
principalTable: "PositionTypes",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PlacementReceives_OrganizationPositions_OrganizationPosition~",
|
||||
table: "PlacementReceives");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PlacementReceives_PositionLevels_PositionLevelId",
|
||||
table: "PlacementReceives");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PlacementReceives_PositionLines_PositionLineId",
|
||||
table: "PlacementReceives");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PlacementReceives_PositionNumbers_PositionNumberId",
|
||||
table: "PlacementReceives");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PlacementReceives_PositionPathSides_PositionPathSideId",
|
||||
table: "PlacementReceives");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PlacementReceives_PositionPaths_PositionPathId",
|
||||
table: "PlacementReceives");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PlacementReceives_PositionTypes_PositionTypeId",
|
||||
table: "PlacementReceives");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_PlacementReceives_OrganizationPositionId",
|
||||
table: "PlacementReceives");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_PlacementReceives_PositionLevelId",
|
||||
table: "PlacementReceives");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_PlacementReceives_PositionLineId",
|
||||
table: "PlacementReceives");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_PlacementReceives_PositionNumberId",
|
||||
table: "PlacementReceives");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_PlacementReceives_PositionPathId",
|
||||
table: "PlacementReceives");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_PlacementReceives_PositionPathSideId",
|
||||
table: "PlacementReceives");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "OrganizationPositionId",
|
||||
table: "PlacementReceives");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PositionLevelId",
|
||||
table: "PlacementReceives");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PositionLineId",
|
||||
table: "PlacementReceives");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PositionNumberId",
|
||||
table: "PlacementReceives");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PositionPathId",
|
||||
table: "PlacementReceives");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PositionPathSideId",
|
||||
table: "PlacementReceives");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RecruitDate",
|
||||
table: "PlacementReceives");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "PositionTypeId",
|
||||
table: "PlacementReceives",
|
||||
newName: "OrganizationId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_PlacementReceives_PositionTypeId",
|
||||
table: "PlacementReceives",
|
||||
newName: "IX_PlacementReceives_OrganizationId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PlacementReceives_Organizations_OrganizationId",
|
||||
table: "PlacementReceives",
|
||||
column: "OrganizationId",
|
||||
principalTable: "Organizations",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -10447,6 +10447,365 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
b.ToTable("PlacementProfiles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementReceive", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(0)
|
||||
.HasComment("PrimaryKey")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||
|
||||
b.Property<Guid?>("BloodGroupId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("CitizenId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("varchar(20)")
|
||||
.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<DateTime>("DateOfBirth")
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasComment("วันเกิด");
|
||||
|
||||
b.Property<string>("Firstname")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ชื่อ");
|
||||
|
||||
b.Property<Guid?>("GenderId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasComment("สถานะการใช้งาน");
|
||||
|
||||
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<string>("Lastname")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("นามสกุล");
|
||||
|
||||
b.Property<string>("Nationality")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)")
|
||||
.HasComment("สัญชาติ");
|
||||
|
||||
b.Property<Guid?>("OrganizationPositionId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("PositionLevelId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("PositionLineId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("PositionNumberId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("PositionPathId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("PositionPathSideId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("PositionTypeId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid>("PrefixId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Race")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)")
|
||||
.HasComment("เชื้อชาติ");
|
||||
|
||||
b.Property<DateTime?>("RecruitDate")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasComment("วันที่บรรจุ");
|
||||
|
||||
b.Property<Guid?>("RelationshipId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("ReligionId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("สถานะคำขอ");
|
||||
|
||||
b.Property<string>("TelephoneNumber")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasComment("เบอร์โทร");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BloodGroupId");
|
||||
|
||||
b.HasIndex("GenderId");
|
||||
|
||||
b.HasIndex("OrganizationPositionId");
|
||||
|
||||
b.HasIndex("PositionLevelId");
|
||||
|
||||
b.HasIndex("PositionLineId");
|
||||
|
||||
b.HasIndex("PositionNumberId");
|
||||
|
||||
b.HasIndex("PositionPathId");
|
||||
|
||||
b.HasIndex("PositionPathSideId");
|
||||
|
||||
b.HasIndex("PositionTypeId");
|
||||
|
||||
b.HasIndex("PrefixId");
|
||||
|
||||
b.HasIndex("RelationshipId");
|
||||
|
||||
b.HasIndex("ReligionId");
|
||||
|
||||
b.ToTable("PlacementReceives");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementReceiveDoc", 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<Guid>("DocumentId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
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>("PlacementReceiveId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DocumentId");
|
||||
|
||||
b.HasIndex("PlacementReceiveId");
|
||||
|
||||
b.ToTable("PlacementReceiveDocs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementTransfer", 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<bool>("IsActive")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasComment("สถานะการใช้งาน");
|
||||
|
||||
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<string>("Organization")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("หน่วยงานที่ขอโอนไป");
|
||||
|
||||
b.Property<Guid>("ProfileId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Reason")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("เหตุผล");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("สถานะคำขอ");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ProfileId");
|
||||
|
||||
b.ToTable("PlacementTransfers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementTransferDoc", 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<Guid>("DocumentId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
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>("PlacementTransferId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DocumentId");
|
||||
|
||||
b.HasIndex("PlacementTransferId");
|
||||
|
||||
b.ToTable("PlacementTransferDocs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementType", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
|
|
@ -11928,6 +12287,132 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
b.Navigation("Religion");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementReceive", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.BloodGroup", "BloodGroup")
|
||||
.WithMany()
|
||||
.HasForeignKey("BloodGroupId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.Gender", "Gender")
|
||||
.WithMany()
|
||||
.HasForeignKey("GenderId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationPositionEntity", "OrganizationPosition")
|
||||
.WithMany()
|
||||
.HasForeignKey("OrganizationPositionId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLevel", "PositionLevel")
|
||||
.WithMany()
|
||||
.HasForeignKey("PositionLevelId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLine", "PositionLine")
|
||||
.WithMany()
|
||||
.HasForeignKey("PositionLineId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionNumberEntity", "PositionNumber")
|
||||
.WithMany()
|
||||
.HasForeignKey("PositionNumberId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPath", "PositionPath")
|
||||
.WithMany()
|
||||
.HasForeignKey("PositionPathId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPathSide", "PositionPathSide")
|
||||
.WithMany()
|
||||
.HasForeignKey("PositionPathSideId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionType", "PositionType")
|
||||
.WithMany()
|
||||
.HasForeignKey("PositionTypeId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.Prefix", "Prefix")
|
||||
.WithMany()
|
||||
.HasForeignKey("PrefixId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.Relationship", "Relationship")
|
||||
.WithMany()
|
||||
.HasForeignKey("RelationshipId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.Religion", "Religion")
|
||||
.WithMany()
|
||||
.HasForeignKey("ReligionId");
|
||||
|
||||
b.Navigation("BloodGroup");
|
||||
|
||||
b.Navigation("Gender");
|
||||
|
||||
b.Navigation("OrganizationPosition");
|
||||
|
||||
b.Navigation("PositionLevel");
|
||||
|
||||
b.Navigation("PositionLine");
|
||||
|
||||
b.Navigation("PositionNumber");
|
||||
|
||||
b.Navigation("PositionPath");
|
||||
|
||||
b.Navigation("PositionPathSide");
|
||||
|
||||
b.Navigation("PositionType");
|
||||
|
||||
b.Navigation("Prefix");
|
||||
|
||||
b.Navigation("Relationship");
|
||||
|
||||
b.Navigation("Religion");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementReceiveDoc", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document")
|
||||
.WithMany()
|
||||
.HasForeignKey("DocumentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.Placement.PlacementReceive", "PlacementReceive")
|
||||
.WithMany("PlacementReceiveDocs")
|
||||
.HasForeignKey("PlacementReceiveId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Document");
|
||||
|
||||
b.Navigation("PlacementReceive");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementTransfer", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProfileId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Profile");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementTransferDoc", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document")
|
||||
.WithMany()
|
||||
.HasForeignKey("DocumentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.Placement.PlacementTransfer", "PlacementTransfer")
|
||||
.WithMany("PlacementTransferDocs")
|
||||
.HasForeignKey("PlacementTransferId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Document");
|
||||
|
||||
b.Navigation("PlacementTransfer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementPeriodHistory", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.Retirement.RetirementPeriod", "RetirementPeriod")
|
||||
|
|
@ -12163,6 +12648,16 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
b.Navigation("PlacementEducations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementReceive", b =>
|
||||
{
|
||||
b.Navigation("PlacementReceiveDocs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementTransfer", b =>
|
||||
{
|
||||
b.Navigation("PlacementTransferDocs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementPeriod", b =>
|
||||
{
|
||||
b.Navigation("RetirementPeriodHistorys");
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ using System.Security.Cryptography;
|
|||
|
||||
namespace BMA.EHR.Placement.Service.Controllers
|
||||
{
|
||||
[Route("api/v{version:apiVersion}/placement/receive")]
|
||||
[Route("api/v{version:apiVersion}/placement/Receive")]
|
||||
[ApiVersion("1.0")]
|
||||
[ApiController]
|
||||
[Produces("application/json")]
|
||||
|
|
@ -50,119 +50,167 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// list รอบเครื่องราช
|
||||
/// list รายการรับโอน
|
||||
/// </summary>
|
||||
/// <param name="type">ประเภทเครื่องราช(insignia=เครื่องราช,coin=เหรียญ)</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("{type}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetList(string type)
|
||||
[HttpGet()]
|
||||
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
|
||||
{
|
||||
var insigniaPeriods = await _context.InsigniaPeriods.AsQueryable()
|
||||
.Where(x => x.Type == type)
|
||||
.OrderByDescending(x => x.Year)
|
||||
.ThenByDescending(x => x.StartDate)
|
||||
|
||||
var placementReceives = await _context.PlacementReceives.AsQueryable()
|
||||
.OrderByDescending(x => x.CreatedAt)
|
||||
.Select(p => new
|
||||
{
|
||||
period_id = p.Id,
|
||||
period_amount = p.Amount,
|
||||
period_name = p.Name,
|
||||
period_start = p.StartDate,
|
||||
period_end = p.EndDate,
|
||||
period_year = p.Year,
|
||||
period_doc = p.ReliefDoc == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.ReliefDoc.Id,
|
||||
p.Id,
|
||||
p.CitizenId,
|
||||
Prefix = p.Prefix.Name,
|
||||
p.Firstname,
|
||||
p.Lastname,
|
||||
p.DateOfBirth,
|
||||
Gender = p.Gender == null ? null : p.Gender.Name,
|
||||
p.Status,
|
||||
p.RecruitDate,
|
||||
PositionNumber = p.PositionNumber == null ? null : p.PositionNumber.Name,
|
||||
PositionPath = p.PositionPath == null ? null : p.PositionPath.Name,
|
||||
PositionPathSide = p.PositionPathSide == null ? null : p.PositionPathSide.Name,
|
||||
PositionType = p.PositionType == null ? null : p.PositionType.Name,
|
||||
PositionLine = p.PositionLine == null ? null : p.PositionLine.Name,
|
||||
PositionLevel = p.PositionLevel == null ? null : p.PositionLevel.Name,
|
||||
p.IsActive,
|
||||
p.CreatedAt,
|
||||
})
|
||||
.ToListAsync();
|
||||
var data = new List<dynamic>();
|
||||
foreach (var insigniaPeriod in insigniaPeriods)
|
||||
{
|
||||
var _data = new
|
||||
{
|
||||
period_id = insigniaPeriod.period_id,
|
||||
period_amount = insigniaPeriod.period_amount,
|
||||
period_name = insigniaPeriod.period_name,
|
||||
period_start = insigniaPeriod.period_start,
|
||||
period_end = insigniaPeriod.period_end,
|
||||
period_year = insigniaPeriod.period_year,
|
||||
period_doc = insigniaPeriod.period_doc == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(insigniaPeriod.period_doc),
|
||||
};
|
||||
data.Add(_data);
|
||||
}
|
||||
if (PlacementAdmin == true)
|
||||
placementReceives.Where(x => x.Status.Trim().ToUpper().Contains("DONE"));
|
||||
|
||||
return Success(data);
|
||||
return Success(placementReceives);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get รายละเอียดรอบเครื่องราช
|
||||
/// get รายละเอียดรับโอน
|
||||
/// </summary>
|
||||
/// <param name="id">Id เครื่องราช</param>
|
||||
/// <param name="id">Id รับโอน</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("{id:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetById(Guid id)
|
||||
public async Task<ActionResult<ResponseObject>> GetDetailByUser(Guid id)
|
||||
{
|
||||
var data = await _context.InsigniaPeriods.AsQueryable()
|
||||
var data = await _context.PlacementReceives.AsQueryable()
|
||||
.Where(x => x.Id == id)
|
||||
.Select(p => new
|
||||
{
|
||||
period_id = p.Id,
|
||||
period_amount = p.Amount,
|
||||
period_name = p.Name,
|
||||
period_start = p.StartDate,
|
||||
period_end = p.EndDate,
|
||||
period_year = p.Year,
|
||||
period_doc = p.ReliefDoc == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.ReliefDoc.Id,
|
||||
p.Id,
|
||||
p.CitizenId,
|
||||
Prefix = p.Prefix.Id,
|
||||
p.Firstname,
|
||||
p.Lastname,
|
||||
p.DateOfBirth,
|
||||
Gender = p.Gender == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Gender.Id,
|
||||
p.Nationality,
|
||||
p.Race,
|
||||
Religion = p.Religion == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Religion.Id,
|
||||
BloodGroup = p.BloodGroup == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.BloodGroup.Id,
|
||||
Relationship = p.Relationship == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Relationship.Id,
|
||||
p.TelephoneNumber,
|
||||
p.Status,
|
||||
p.RecruitDate,
|
||||
PositionNumber = p.PositionNumber == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionNumber.Id,
|
||||
PositionPath = p.PositionPath == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionPath.Id,
|
||||
PositionPathSide = p.PositionPathSide == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionPathSide.Id,
|
||||
PositionType = p.PositionType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionType.Id,
|
||||
PositionLine = p.PositionLine == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionLine.Id,
|
||||
PositionLevel = p.PositionLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionLevel.Id,
|
||||
OrganizationPosition = p.OrganizationPosition == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OrganizationPosition.Id,
|
||||
p.CreatedAt,
|
||||
PlacementReceiveDocs = p.PlacementReceiveDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
|
||||
var placementReceiveDocs = new List<dynamic>();
|
||||
foreach (var doc in data.PlacementReceiveDocs)
|
||||
{
|
||||
var _doc = new
|
||||
{
|
||||
doc.FileName,
|
||||
PathName = await _documentService.ImagesPath(doc.Id)
|
||||
};
|
||||
placementReceiveDocs.Add(_doc);
|
||||
}
|
||||
var _data = new
|
||||
{
|
||||
period_id = data.period_id,
|
||||
period_amount = data.period_amount,
|
||||
period_name = data.period_name,
|
||||
period_start = data.period_start,
|
||||
period_end = data.period_end,
|
||||
period_year = data.period_year,
|
||||
period_doc = data.period_doc == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.period_doc),
|
||||
data.Id,
|
||||
data.CitizenId,
|
||||
data.Prefix,
|
||||
data.Firstname,
|
||||
data.Lastname,
|
||||
data.DateOfBirth,
|
||||
data.Gender,
|
||||
data.Nationality,
|
||||
data.Race,
|
||||
data.Religion,
|
||||
data.BloodGroup,
|
||||
data.Relationship,
|
||||
data.TelephoneNumber,
|
||||
data.Status,
|
||||
data.RecruitDate,
|
||||
data.PositionNumber,
|
||||
data.PositionPath,
|
||||
data.PositionPathSide,
|
||||
data.PositionType,
|
||||
data.PositionLine,
|
||||
data.PositionLevel,
|
||||
data.OrganizationPosition,
|
||||
data.CreatedAt,
|
||||
Docs = placementReceiveDocs,
|
||||
};
|
||||
|
||||
return Success(_data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// สร้างรอบเครื่องราช
|
||||
/// สร้างรับโอน
|
||||
/// </summary>
|
||||
/// <param name="type">ประเภทเครื่องราช(insignia=เครื่องราช,coin=เหรียญ)</param>
|
||||
/// <param name="req.Name">ชื่อรอบ</param>
|
||||
/// <param name="req.Year">ปีที่เสนอ</param>
|
||||
/// <param name="req.StartDate">วันที่เริ่มต้น</param>
|
||||
/// <param name="req.EndDate">วันที่สิ้นสุด</param>
|
||||
/// <param name="req.Amount">จำนวนวันแจ้งเตือน</param>
|
||||
/// <param name="req.File">เอกสารประกอบ</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("{type}")]
|
||||
public async Task<ActionResult<ResponseObject>> Post([FromForm] InsigniaPeriodRequest req, string type)
|
||||
[HttpPost()]
|
||||
public async Task<ActionResult<ResponseObject>> Post([FromForm] PlacementReceiveRequest req)
|
||||
{
|
||||
var period = new InsigniaPeriod
|
||||
var profile = await _context.Profiles
|
||||
.FirstOrDefaultAsync(x => x.KeycloakId == Guid.Parse(UserId));
|
||||
if (profile == null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
|
||||
var prefix = await _context.Prefixes.FindAsync(req.Prefix);
|
||||
if (prefix == null)
|
||||
return Error(GlobalMessages.PrefixNotFound, 404);
|
||||
|
||||
var placementReceive = new PlacementReceive
|
||||
{
|
||||
Name = Request.Form.ContainsKey("Name") ? Request.Form["Name"] : "",
|
||||
Year = Request.Form.ContainsKey("Year") ? Int32.Parse(Request.Form["Year"]) : DateTime.Now.Year,
|
||||
StartDate = Request.Form.ContainsKey("StartDate") ? DateTime.Parse(Request.Form["StartDate"]) : DateTime.Now,
|
||||
EndDate = Request.Form.ContainsKey("EndDate") ? DateTime.Parse(Request.Form["EndDate"]) : DateTime.Now,
|
||||
Amount = Request.Form.ContainsKey("Amount") ? Request.Form["Amount"] : "",
|
||||
Type = type.Trim().ToUpper(),
|
||||
CitizenId = req.CitizenId,
|
||||
Prefix = prefix,
|
||||
Firstname = req.Firstname,
|
||||
Lastname = req.Lastname,
|
||||
DateOfBirth = req.DateOfBirth,
|
||||
Gender = await _context.Genders.FindAsync(req.Gender),
|
||||
Nationality = req.Nationality,
|
||||
Race = req.Race,
|
||||
Religion = await _context.Religions.FindAsync(req.Religion),
|
||||
BloodGroup = await _context.BloodGroups.FindAsync(req.BloodGroup),
|
||||
Relationship = await _context.Relationships.FindAsync(req.Relationship),
|
||||
TelephoneNumber = req.TelephoneNumber,
|
||||
Status = "PENDING",
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
|
|
@ -170,27 +218,153 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
await _context.InsigniaPeriods.AddAsync(period);
|
||||
await _context.PlacementReceives.AddAsync(placementReceive);
|
||||
await _context.SaveChangesAsync();
|
||||
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
|
||||
{
|
||||
var file = Request.Form.Files[0];
|
||||
var fileExtension = Path.GetExtension(file.FileName);
|
||||
foreach (var file in Request.Form.Files)
|
||||
{
|
||||
var fileExtension = Path.GetExtension(file.FileName);
|
||||
|
||||
var doc = await _documentService.UploadFileAsync(file, file.FileName);
|
||||
period.ReliefDoc = doc;
|
||||
var doc = await _documentService.UploadFileAsync(file, file.FileName);
|
||||
var _doc = await _context.Documents.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == doc.Id);
|
||||
if (_doc != null)
|
||||
{
|
||||
var placementReceiveDoc = new PlacementReceiveDoc
|
||||
{
|
||||
PlacementReceive = placementReceive,
|
||||
Document = _doc,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
await _context.PlacementReceiveDocs.AddAsync(placementReceiveDoc);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// await _context.InsigniaPeriods.AddAsync(period);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ลบรอบเครื่องราช
|
||||
/// เลือกหน่วยงาน
|
||||
/// </summary>
|
||||
/// <param name="id">Id เครื่องราช</param>
|
||||
/// <param name="id">Id รับโอน</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("position/{id:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> UpdatePositionPlacementReceive([FromBody] PersonSelectPositionReceiveRequest req, Guid id)
|
||||
{
|
||||
var uppdated = await _context.PlacementReceives
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (uppdated == null)
|
||||
return Error(GlobalMessages.PlacementReceiveNotFound, 404);
|
||||
var organization = await _context.Organizations
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (organization == null)
|
||||
return Error(GlobalMessages.OrganizationNotFound, 404);
|
||||
if (req.PosNoId != null)
|
||||
{
|
||||
var save_posNo = await _context.PositionNumbers.FindAsync(req.PosNoId);
|
||||
if (save_posNo == null)
|
||||
return Error(GlobalMessages.PositionPosNoNotFound, 404);
|
||||
uppdated.PositionNumber = save_posNo;
|
||||
|
||||
var save_orgPosition = await _context.OrganizationPositions.FirstOrDefaultAsync(x => x.PositionNumber == save_posNo);
|
||||
if (save_orgPosition == null)
|
||||
return Error(GlobalMessages.PositionPosNoNotFound, 404);
|
||||
uppdated.OrganizationPosition = save_orgPosition;
|
||||
}
|
||||
|
||||
if (req.PositionId != null)
|
||||
{
|
||||
var save = await _context.PositionPaths.FindAsync(req.PositionId);
|
||||
if (save == null)
|
||||
return Error(GlobalMessages.PositionPathNotFound, 404);
|
||||
uppdated.PositionPath = save;
|
||||
}
|
||||
|
||||
if (req.PositionLevelId != null)
|
||||
{
|
||||
var save = await _context.PositionLevels.FindAsync(req.PositionLevelId);
|
||||
if (save == null)
|
||||
return Error(GlobalMessages.PositionLevelNotFound, 404);
|
||||
uppdated.PositionLevel = save;
|
||||
}
|
||||
|
||||
if (req.PositionLineId != null)
|
||||
{
|
||||
var save = await _context.PositionLines.FindAsync(req.PositionLineId);
|
||||
if (save == null)
|
||||
return Error(GlobalMessages.PositionLineNotFound, 404);
|
||||
uppdated.PositionLine = save;
|
||||
}
|
||||
|
||||
if (req.PositionPathSideId != null)
|
||||
{
|
||||
var save = await _context.PositionPathSides.FindAsync(req.PositionPathSideId);
|
||||
if (save == null)
|
||||
return Error(GlobalMessages.PositionPathSideNotFound, 404);
|
||||
uppdated.PositionPathSide = save;
|
||||
}
|
||||
|
||||
if (req.PositionTypeId != null)
|
||||
{
|
||||
var save = await _context.PositionTypes.FindAsync(req.PositionTypeId);
|
||||
if (save == null)
|
||||
return Error(GlobalMessages.PositionTypeNotFound, 404);
|
||||
uppdated.PositionType = save;
|
||||
}
|
||||
|
||||
uppdated.RecruitDate = req.RecruitDate;
|
||||
uppdated.Status = "DONE";
|
||||
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
uppdated.LastUpdateUserId = UserId ?? "";
|
||||
uppdated.LastUpdatedAt = DateTime.Now;
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// View หน่วยงาน
|
||||
// /// </summary>
|
||||
// /// <param name="id">Id รับโอน</param>
|
||||
// /// <returns></returns>
|
||||
// /// <response code="200"></response>
|
||||
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
// [HttpGet("position/{id:length(36)}")]
|
||||
// public async Task<ActionResult<ResponseObject>> GetPositionPlacementReceive(Guid id)
|
||||
// {
|
||||
// var uppdated = await _context.PlacementReceives
|
||||
// .FirstOrDefaultAsync(x => x.Id == id);
|
||||
// if (uppdated == null)
|
||||
// return Error(GlobalMessages.PlacementReceiveNotFound, 404);
|
||||
|
||||
// uppdated.Status = "DONE";
|
||||
// uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
// uppdated.LastUpdateUserId = UserId ?? "";
|
||||
// uppdated.LastUpdatedAt = DateTime.Now;
|
||||
// await _context.SaveChangesAsync();
|
||||
|
||||
// return Success();
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// ลบรับโอน
|
||||
/// </summary>
|
||||
/// <param name="id">Id รับโอน</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
|
|
@ -199,73 +373,29 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
[HttpDelete("{id:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> Delete(Guid id)
|
||||
{
|
||||
var deleted = await _context.InsigniaPeriods.AsQueryable()
|
||||
.Include(x => x.ReliefDoc)
|
||||
var deleted = await _context.PlacementReceives.AsQueryable()
|
||||
.Include(x => x.PlacementReceiveDocs)
|
||||
.ThenInclude(x => x.Document)
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
|
||||
if (deleted == null)
|
||||
return NotFound();
|
||||
_context.InsigniaPeriods.Remove(deleted);
|
||||
await _context.SaveChangesAsync();
|
||||
if (deleted.ReliefDoc != null)
|
||||
await _documentService.DeleteFileAsync(deleted.ReliefDoc.Id);
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// แก้ไขรอบเครื่องราช
|
||||
/// </summary>
|
||||
/// <param name="id">Id เครื่องราช</param>
|
||||
/// <param name="req.Name">ชื่อรอบ</param>
|
||||
/// <param name="req.Year">ปีที่เสนอ</param>
|
||||
/// <param name="req.StartDate">วันที่เริ่มต้น</param>
|
||||
/// <param name="req.EndDate">วันที่สิ้นสุด</param>
|
||||
/// <param name="req.Amount">จำนวนวันแจ้งเตือน</param>
|
||||
/// <param name="req.File">เอกสารประกอบ</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("{id:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> Put([FromForm] InsigniaPeriodRequest req, Guid id)
|
||||
{
|
||||
if (req == null)
|
||||
return BadRequest();
|
||||
|
||||
var uppdated = await _context.InsigniaPeriods.AsQueryable()
|
||||
.Include(x => x.ReliefDoc)
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
|
||||
if (uppdated == null)
|
||||
return NotFound();
|
||||
|
||||
uppdated.Name = Request.Form.ContainsKey("Name") ? Request.Form["Name"] : "";
|
||||
uppdated.Year = Request.Form.ContainsKey("Year") ? Int32.Parse(Request.Form["Year"]) : DateTime.Now.Year;
|
||||
uppdated.StartDate = Request.Form.ContainsKey("StartDate") ? DateTime.Parse(Request.Form["StartDate"]) : DateTime.Now;
|
||||
uppdated.EndDate = Request.Form.ContainsKey("EndDate") ? DateTime.Parse(Request.Form["EndDate"]) : DateTime.Now;
|
||||
uppdated.Amount = Request.Form.ContainsKey("Amount") ? Request.Form["Amount"] : "";
|
||||
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
uppdated.LastUpdateUserId = UserId ?? "";
|
||||
uppdated.LastUpdatedAt = DateTime.Now;
|
||||
|
||||
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
|
||||
var placementReceiveDocs = new List<dynamic>();
|
||||
foreach (var doc in deleted.PlacementReceiveDocs)
|
||||
{
|
||||
if (uppdated.ReliefDoc != null)
|
||||
await _documentService.DeleteFileAsync(uppdated.ReliefDoc.Id);
|
||||
var file = Request.Form.Files[0];
|
||||
var fileExtension = Path.GetExtension(file.FileName);
|
||||
|
||||
var doc = await _documentService.UploadFileAsync(file, file.FileName);
|
||||
uppdated.ReliefDoc = doc;
|
||||
if (doc.Document != null)
|
||||
placementReceiveDocs.Add(doc.Document.Id);
|
||||
}
|
||||
_context.PlacementReceiveDocs.RemoveRange(deleted.PlacementReceiveDocs);
|
||||
await _context.SaveChangesAsync();
|
||||
_context.PlacementReceives.Remove(deleted);
|
||||
foreach (var doc in placementReceiveDocs)
|
||||
{
|
||||
if (doc != null)
|
||||
await _documentService.DeleteFileAsync(doc);
|
||||
}
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// list คำขอโอนของ User
|
||||
/// list รายการคำขอโอนของ User
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
|
|
@ -67,6 +67,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
|
||||
var placementTransfers = await _context.PlacementTransfers.AsQueryable()
|
||||
.Where(x => x.Profile == profile)
|
||||
.OrderByDescending(x => x.CreatedAt)
|
||||
.Select(p => new
|
||||
{
|
||||
p.Id,
|
||||
|
|
@ -86,7 +87,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// list คำขอโอนของ Admin
|
||||
/// list รายการคำขอโอนของ Admin
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
|
|
@ -98,6 +99,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
{
|
||||
|
||||
var placementTransfers = await _context.PlacementTransfers.AsQueryable()
|
||||
.OrderByDescending(x => x.CreatedAt)
|
||||
.Select(p => new
|
||||
{
|
||||
p.Id,
|
||||
|
|
@ -112,6 +114,8 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
p.IsActive,
|
||||
})
|
||||
.ToListAsync();
|
||||
if (PlacementAdmin == true)
|
||||
placementTransfers.Where(x => x.Status.Trim().ToUpper().Contains("DONE"));
|
||||
|
||||
return Success(placementTransfers);
|
||||
}
|
||||
|
|
@ -142,12 +146,22 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
Status = p.Status,
|
||||
Organization = p.Organization,
|
||||
CreatedAt = p.CreatedAt,
|
||||
// doc = p.ReliefDoc == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.ReliefDoc.Id,
|
||||
PlacementTransferDocs = p.PlacementTransferDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
return Error(GlobalMessages.DataNotFound, 404)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
|
||||
var placementTransferDocs = new List<dynamic>();
|
||||
foreach (var doc in data.PlacementTransferDocs)
|
||||
{
|
||||
var _doc = new
|
||||
{
|
||||
FileName = doc.FileName,
|
||||
PathName = await _documentService.ImagesPath(doc.Id)
|
||||
};
|
||||
placementTransferDocs.Add(_doc);
|
||||
}
|
||||
var _data = new
|
||||
{
|
||||
Id = data.Id,
|
||||
|
|
@ -155,7 +169,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
Status = data.Status,
|
||||
Organization = data.Organization,
|
||||
CreatedAt = data.CreatedAt,
|
||||
// period_doc = data.period_doc == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.period_doc),
|
||||
Docs = placementTransferDocs,
|
||||
};
|
||||
|
||||
return Success(_data);
|
||||
|
|
@ -199,18 +213,24 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
var fileExtension = Path.GetExtension(file.FileName);
|
||||
|
||||
var doc = await _documentService.UploadFileAsync(file, file.FileName);
|
||||
var placementTransferDoc = new PlacementTransferDoc
|
||||
var _doc = await _context.Documents.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == doc.Id);
|
||||
if (_doc != null)
|
||||
{
|
||||
PlacementTransfer = placementTransfer,
|
||||
Document = doc,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
await _context.PlacementTransferDocs.AddAsync(placementTransferDoc);
|
||||
var placementTransferDoc = new PlacementTransferDoc
|
||||
{
|
||||
PlacementTransfer = placementTransfer,
|
||||
Document = _doc,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
await _context.PlacementTransferDocs.AddAsync(placementTransferDoc);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
|
|
@ -219,7 +239,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// แก้ไขคำขอโอน
|
||||
/// อนุมัติคำขอโอน
|
||||
/// </summary>
|
||||
/// <param name="id">Id คำขอโอน</param>
|
||||
/// <returns></returns>
|
||||
|
|
@ -228,38 +248,54 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("confirm/{id:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> Confirm(Guid id)
|
||||
public async Task<ActionResult<ResponseObject>> AdminConfirm(Guid id)
|
||||
{
|
||||
if (req == null)
|
||||
return BadRequest();
|
||||
|
||||
var uppdated = await _context.InsigniaPeriods.AsQueryable()
|
||||
.Include(x => x.ReliefDoc)
|
||||
var uppdated = await _context.PlacementTransfers
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
|
||||
if (uppdated == null)
|
||||
return NotFound();
|
||||
return Error(GlobalMessages.PlacementTransferNotFound, 404);
|
||||
|
||||
uppdated.Name = Request.Form.ContainsKey("Name") ? Request.Form["Name"] : "";
|
||||
uppdated.Year = Request.Form.ContainsKey("Year") ? Int32.Parse(Request.Form["Year"]) : DateTime.Now.Year;
|
||||
uppdated.StartDate = Request.Form.ContainsKey("StartDate") ? DateTime.Parse(Request.Form["StartDate"]) : DateTime.Now;
|
||||
uppdated.EndDate = Request.Form.ContainsKey("EndDate") ? DateTime.Parse(Request.Form["EndDate"]) : DateTime.Now;
|
||||
uppdated.Amount = Request.Form.ContainsKey("Amount") ? Request.Form["Amount"] : "";
|
||||
uppdated.Status = "DONE";
|
||||
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
uppdated.LastUpdateUserId = UserId ?? "";
|
||||
uppdated.LastUpdatedAt = DateTime.Now;
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ลบคำขอโอน
|
||||
/// </summary>
|
||||
/// <param name="id">Id คำขอโอน</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpDelete("{id:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> Delete(Guid id)
|
||||
{
|
||||
var deleted = await _context.PlacementTransfers.AsQueryable()
|
||||
.Include(x => x.PlacementTransferDocs)
|
||||
.ThenInclude(x => x.Document)
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (deleted == null)
|
||||
return NotFound();
|
||||
var placementTransferDocs = new List<dynamic>();
|
||||
foreach (var doc in deleted.PlacementTransferDocs)
|
||||
{
|
||||
if (uppdated.ReliefDoc != null)
|
||||
await _documentService.DeleteFileAsync(uppdated.ReliefDoc.Id);
|
||||
var file = Request.Form.Files[0];
|
||||
var fileExtension = Path.GetExtension(file.FileName);
|
||||
|
||||
var doc = await _documentService.UploadFileAsync(file, file.FileName);
|
||||
uppdated.ReliefDoc = doc;
|
||||
if (doc.Document != null)
|
||||
placementTransferDocs.Add(doc.Document.Id);
|
||||
}
|
||||
_context.PlacementTransferDocs.RemoveRange(deleted.PlacementTransferDocs);
|
||||
await _context.SaveChangesAsync();
|
||||
_context.PlacementTransfers.Remove(deleted);
|
||||
foreach (var doc in placementTransferDocs)
|
||||
{
|
||||
if (doc != null)
|
||||
await _documentService.DeleteFileAsync(doc);
|
||||
}
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Placement.Service.Requests
|
||||
{
|
||||
public class PersonSelectPositionReceiveRequest
|
||||
{
|
||||
public DateTime? RecruitDate { get; set; }
|
||||
public Guid? PosNoId { get; set; }
|
||||
public Guid? PositionId { get; set; }
|
||||
public Guid? PositionLevelId { get; set; }
|
||||
public Guid? PositionLineId { get; set; }
|
||||
public Guid? PositionPathSideId { get; set; }
|
||||
public Guid? PositionTypeId { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Placement.Service.Requests
|
||||
{
|
||||
public class PlacementReceiveRequest
|
||||
{
|
||||
public string CitizenId { get; set; }
|
||||
public Guid Prefix { get; set; }
|
||||
public string Firstname { get; set; }
|
||||
public string Lastname { get; set; }
|
||||
public DateTime DateOfBirth { get; set; }
|
||||
public Guid? Gender { get; set; }
|
||||
public string? Nationality { get; set; }
|
||||
public string? Race { get; set; }
|
||||
public Guid? Religion { get; set; }
|
||||
public Guid? BloodGroup { get; set; }
|
||||
public Guid? Relationship { get; set; }
|
||||
public string? TelephoneNumber { get; set; }
|
||||
public List<FormFile>? File { get; set; }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue