Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
commit
a879c38512
34 changed files with 60943 additions and 22 deletions
|
|
@ -4965,6 +4965,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
.ToList()
|
||||
.Select(h => new InsigniaRequestItem
|
||||
{
|
||||
Id = h.Id,
|
||||
ProfileId = h.Profile.Id,
|
||||
FullName = $"{h.Profile.FirstName} {h.Profile.LastName}",
|
||||
Position = h.Profile.Position.Name,
|
||||
|
|
@ -5109,7 +5110,13 @@ namespace BMA.EHR.Application.Repositories
|
|||
Period = period,
|
||||
Organization = oc,
|
||||
RequestStatus = "st1",
|
||||
RequestNote = ""
|
||||
RequestNote = "",
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
|
||||
foreach (var item in items)
|
||||
|
|
@ -5126,8 +5133,13 @@ namespace BMA.EHR.Application.Repositories
|
|||
RequestInsignia = req_insignia,
|
||||
Salary = item.Salary == null ? null : item.Salary,
|
||||
RequestDate = DateTime.Now,
|
||||
MatchingConditions = System.Text.Json.JsonSerializer.Serialize(item.MatchingConditions) // serialize to string
|
||||
|
||||
MatchingConditions = System.Text.Json.JsonSerializer.Serialize(item.MatchingConditions), // serialize to string
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
13
BMA.EHR.Application/Requests/InsigniaManageRequest.cs
Normal file
13
BMA.EHR.Application/Requests/InsigniaManageRequest.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Application.Requests
|
||||
{
|
||||
public class InsigniaManageRequest
|
||||
{
|
||||
public Guid Insignia { get; set; }
|
||||
public int Year { get; set; }
|
||||
public int Total { get; set; }
|
||||
public string Type { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
{
|
||||
public class InsigniaRequestItem
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid ProfileId { get; set; }
|
||||
public string FullName { get; set; }
|
||||
public string Position { get; set; }
|
||||
|
|
|
|||
21
BMA.EHR.Domain/Models/Insignias/InsigniaManage.cs
Normal file
21
BMA.EHR.Domain/Models/Insignias/InsigniaManage.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using BMA.EHR.Domain.Models.Base;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using BMA.EHR.Domain.Models.Documents;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Insignias
|
||||
{
|
||||
public class InsigniaManage : EntityBase
|
||||
{
|
||||
[Comment("ชื่อเครื่องราช")]
|
||||
public Insignia Insignia { get; set; }
|
||||
[Comment("ปี")]
|
||||
public int Year { get; set; }
|
||||
[Comment("จำนวนทั้งหมด")]
|
||||
public int Total { get; set; }
|
||||
[Comment("ประเภทเครื่องราช")]
|
||||
public string Type { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -21,6 +21,7 @@ namespace BMA.EHR.Domain.Models.OrganizationEmployee
|
|||
public string? PositionCondition { get; set; }
|
||||
public string? PositionMasterUserNote { get; set; }
|
||||
public string? OrganizationOrder { get; set; }
|
||||
public bool? IsPublic { get; set; } = true;
|
||||
|
||||
public OrganizationFax? OrganizationFax { get; set; }
|
||||
public OrganizationLevel? OrganizationLevel { get; set; }
|
||||
|
|
@ -40,6 +41,7 @@ namespace BMA.EHR.Domain.Models.OrganizationEmployee
|
|||
public OrganizationShortName? OrganizationShortName { get; set; }
|
||||
public virtual List<OrganizationPositionEmployeeLevel> OrganizationPositionEmployeeLevels { get; set; } = new List<OrganizationPositionEmployeeLevel>();
|
||||
public virtual List<OrganizationPositionEmployeePositionSide> OrganizationPositionEmployeePositionSides { get; set; } = new List<OrganizationPositionEmployeePositionSide>();
|
||||
public virtual List<OrganizationEmployeeProfile> OrganizationEmployeeProfiles { get; set; } = new List<OrganizationEmployeeProfile>();
|
||||
public Profile? Profile { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
using BMA.EHR.Domain.Models.Base;
|
||||
using BMA.EHR.Domain.Models.HR;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using BMA.EHR.Domain.Models.Organizations;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.OrganizationEmployee
|
||||
{
|
||||
public class OrganizationEmployeeProfile : EntityBase
|
||||
{
|
||||
public Profile Profile { get; set; }
|
||||
public OrgEmployee OrgEmployee { get; set; }
|
||||
public string Status { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -4,11 +4,14 @@ using BMA.EHR.Domain.Models.Base;
|
|||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using BMA.EHR.Domain.Models.Organizations;
|
||||
using BMA.EHR.Domain.Models.Commands.Core;
|
||||
using BMA.EHR.Domain.Models.HR;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Placement
|
||||
{
|
||||
public class PlacementAppointment : EntityBase
|
||||
{
|
||||
[Required, Comment("Id User")]
|
||||
public Profile Profile { get; set; }
|
||||
[Required, MaxLength(20), Comment("เลขประจำตัวประชาชน")]
|
||||
public string? CitizenId { get; set; }
|
||||
[Required, Comment("คำนำหน้า")]
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@ namespace BMA.EHR.Domain.Models.Placement
|
|||
[Comment("สังกัด")]
|
||||
public string? OrganizationPositionOld { get; set; }
|
||||
[Comment("ตั้งแต่วันที่")]
|
||||
public DateTime? Date { get; set; }
|
||||
public DateTime? DateStart { get; set; }
|
||||
[Comment("ถึงวันที่")]
|
||||
public DateTime? DateEnd { get; set; }
|
||||
[Comment("ข้อมูลหน่วยงานเดิม ตำแหน่งประเภท")]
|
||||
public string? PositionTypeOld { get; set; }
|
||||
[Comment("ข้อมูลหน่วยงานเดิม ระดับ")]
|
||||
|
|
|
|||
|
|
@ -3,11 +3,14 @@ using System.ComponentModel.DataAnnotations;
|
|||
using BMA.EHR.Domain.Models.Base;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using BMA.EHR.Domain.Models.Organizations;
|
||||
using BMA.EHR.Domain.Models.HR;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Placement
|
||||
{
|
||||
public class PlacementReceive : EntityBase
|
||||
{
|
||||
[Required, Comment("Id User")]
|
||||
public Profile Profile { get; set; }
|
||||
[Required, MaxLength(20), Comment("เลขประจำตัวประชาชน")]
|
||||
public string CitizenId { get; set; }
|
||||
[Required, Comment("คำนำหน้า")]
|
||||
|
|
|
|||
|
|
@ -3,11 +3,14 @@ using System.ComponentModel.DataAnnotations;
|
|||
using BMA.EHR.Domain.Models.Base;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using BMA.EHR.Domain.Models.Organizations;
|
||||
using BMA.EHR.Domain.Models.HR;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Placement
|
||||
{
|
||||
public class PlacementRelocation : EntityBase
|
||||
{
|
||||
[Required, Comment("Id User")]
|
||||
public Profile Profile { get; set; }
|
||||
[Required, MaxLength(20), Comment("เลขประจำตัวประชาชน")]
|
||||
public string? CitizenId { get; set; }
|
||||
[Required, Comment("คำนำหน้า")]
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ namespace BMA.EHR.Domain.Models.Retirement
|
|||
{
|
||||
public class RetirementOther : EntityBase
|
||||
{
|
||||
[Required, Comment("Id User")]
|
||||
public Profile Profile { get; set; }
|
||||
[Required, MaxLength(20), Comment("เลขประจำตัวประชาชน")]
|
||||
public string? CitizenId { get; set; }
|
||||
[Required, Comment("คำนำหน้า")]
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
public static readonly string RelationshipNotFound = "ไม่พบข้อมูลความสัมพันธ์";
|
||||
public static readonly string BloodGroupNotFound = "ไม่พบข้อมูลกลุ่มเลือก";
|
||||
public static readonly string ReligionNotFound = "ไม่พบข้อมูลศาสนา";
|
||||
public static readonly string InsigniaNotFound = "ไม่พบข้อมูลเครื่องราชย์ฯ";
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -75,8 +76,12 @@
|
|||
|
||||
#region " Insignia "
|
||||
public static readonly string InsigniaDupicate = "มีการยื่นรอบรอบนี้ในปีนี้ไว้อยู่แล้ว";
|
||||
public static readonly string InsigniaRequestNotFound = "ไม่พบข้อมูลการยื่นขอพระราชทานเครื่องราชย์ของหน่วยงานที่ระบุ!!";
|
||||
public static readonly string InsigniaPeriodNotFound = "ไม่พบรอบการยื่นขอพระราชทานเครื่องราชย์อิสริยาภรณ์";
|
||||
public static readonly string InsigniaManageDupicate = "มีการกำหนดจัดสรรเครื่องราชย์ฯ รอบนี้ในปีนี้ไว้อยู่แล้ว";
|
||||
public static readonly string InsigniaRequestNotFound = "ไม่พบข้อมูลการยื่นขอพระราชทานเครื่องราชย์ฯ ของหน่วยงานที่ระบุ!!";
|
||||
public static readonly string InsigniaRequestProfileNotFound = "ไม่พบข้อมูลการยื่นขอพระราชทานเครื่องราชย์ฯ ของบุคคลนี้!!";
|
||||
public static readonly string InsigniaRequestProfileDupicate = "มีการกำหนดจัดสรรเครื่องราชย์ฯ บุคคลนี้ไว้อยู่แล้ว";
|
||||
public static readonly string InsigniaPeriodNotFound = "ไม่พบรอบการยื่นขอพระราชทานเครื่องราชย์อิสริยาภรณ์ฯ ";
|
||||
public static readonly string InsigniaManageNotFound = "ไม่พบจัดสรรเครื่องราชย์ฯ ที่ระบุ";
|
||||
public static readonly string CoinPeriodNotFound = "ไม่พบรอบการขอพระราชทานเหรียญจักรพรรดิมาลาที่ระบุ!!";
|
||||
public static readonly string OCNotFound = "ไม่พบหน่วยงานที่ระบุในระบบ";
|
||||
#endregion
|
||||
|
|
|
|||
14900
BMA.EHR.Infrastructure/Migrations/20230818073245_add table insigniamanage.Designer.cs
generated
Normal file
14900
BMA.EHR.Infrastructure/Migrations/20230818073245_add table insigniamanage.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,60 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addtableinsigniamanage : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "InsigniaManages",
|
||||
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"),
|
||||
InsigniaId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
Year = table.Column<int>(type: "int", nullable: false, comment: "ปี"),
|
||||
Total = table.Column<int>(type: "int", nullable: false, comment: "จำนวนทั้งหมด"),
|
||||
Type = table.Column<string>(type: "longtext", nullable: false, comment: "ประเภทเครื่องราช")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_InsigniaManages", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_InsigniaManages_Insignias_InsigniaId",
|
||||
column: x => x.InsigniaId,
|
||||
principalTable: "Insignias",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_InsigniaManages_InsigniaId",
|
||||
table: "InsigniaManages",
|
||||
column: "InsigniaId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "InsigniaManages");
|
||||
}
|
||||
}
|
||||
}
|
||||
14904
BMA.EHR.Infrastructure/Migrations/20230818092030_update table placementofficer add datestart.Designer.cs
generated
Normal file
14904
BMA.EHR.Infrastructure/Migrations/20230818092030_update table placementofficer add datestart.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class updatetableplacementofficeradddatestart : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "Date",
|
||||
table: "PlacementOfficers",
|
||||
newName: "DateStart");
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "DateEnd",
|
||||
table: "PlacementOfficers",
|
||||
type: "datetime(6)",
|
||||
nullable: true,
|
||||
comment: "ถึงวันที่");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DateEnd",
|
||||
table: "PlacementOfficers");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "DateStart",
|
||||
table: "PlacementOfficers",
|
||||
newName: "Date");
|
||||
}
|
||||
}
|
||||
}
|
||||
14956
BMA.EHR.Infrastructure/Migrations/20230819125019_update table placementreceive add profileid.Designer.cs
generated
Normal file
14956
BMA.EHR.Infrastructure/Migrations/20230819125019_update table placementreceive add profileid.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,151 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class updatetableplacementreceiveaddprofileid : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "ProfileId",
|
||||
table: "RetirementOthers",
|
||||
type: "char(36)",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "ProfileId",
|
||||
table: "PlacementRelocations",
|
||||
type: "char(36)",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "ProfileId",
|
||||
table: "PlacementReceives",
|
||||
type: "char(36)",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "ProfileId",
|
||||
table: "PlacementAppointments",
|
||||
type: "char(36)",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RetirementOthers_ProfileId",
|
||||
table: "RetirementOthers",
|
||||
column: "ProfileId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlacementRelocations_ProfileId",
|
||||
table: "PlacementRelocations",
|
||||
column: "ProfileId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlacementReceives_ProfileId",
|
||||
table: "PlacementReceives",
|
||||
column: "ProfileId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlacementAppointments_ProfileId",
|
||||
table: "PlacementAppointments",
|
||||
column: "ProfileId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PlacementAppointments_Profiles_ProfileId",
|
||||
table: "PlacementAppointments",
|
||||
column: "ProfileId",
|
||||
principalTable: "Profiles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PlacementReceives_Profiles_ProfileId",
|
||||
table: "PlacementReceives",
|
||||
column: "ProfileId",
|
||||
principalTable: "Profiles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PlacementRelocations_Profiles_ProfileId",
|
||||
table: "PlacementRelocations",
|
||||
column: "ProfileId",
|
||||
principalTable: "Profiles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_RetirementOthers_Profiles_ProfileId",
|
||||
table: "RetirementOthers",
|
||||
column: "ProfileId",
|
||||
principalTable: "Profiles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PlacementAppointments_Profiles_ProfileId",
|
||||
table: "PlacementAppointments");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PlacementReceives_Profiles_ProfileId",
|
||||
table: "PlacementReceives");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PlacementRelocations_Profiles_ProfileId",
|
||||
table: "PlacementRelocations");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_RetirementOthers_Profiles_ProfileId",
|
||||
table: "RetirementOthers");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_RetirementOthers_ProfileId",
|
||||
table: "RetirementOthers");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_PlacementRelocations_ProfileId",
|
||||
table: "PlacementRelocations");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_PlacementReceives_ProfileId",
|
||||
table: "PlacementReceives");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_PlacementAppointments_ProfileId",
|
||||
table: "PlacementAppointments");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ProfileId",
|
||||
table: "RetirementOthers");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ProfileId",
|
||||
table: "PlacementRelocations");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ProfileId",
|
||||
table: "PlacementReceives");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ProfileId",
|
||||
table: "PlacementAppointments");
|
||||
}
|
||||
}
|
||||
}
|
||||
15044
BMA.EHR.Infrastructure/Migrations/20230819132553_add table OrganizationEmployeeProfile.Designer.cs
generated
Normal file
15044
BMA.EHR.Infrastructure/Migrations/20230819132553_add table OrganizationEmployeeProfile.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,80 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addtableOrganizationEmployeeProfile : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsPublic",
|
||||
table: "OrganizationEmployees",
|
||||
type: "tinyint(1)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "OrganizationEmployeeProfiles",
|
||||
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"),
|
||||
OrgEmployeeId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
Status = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_OrganizationEmployeeProfiles", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_OrganizationEmployeeProfiles_OrganizationEmployees_OrgEmploy~",
|
||||
column: x => x.OrgEmployeeId,
|
||||
principalTable: "OrganizationEmployees",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_OrganizationEmployeeProfiles_Profiles_ProfileId",
|
||||
column: x => x.ProfileId,
|
||||
principalTable: "Profiles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_OrganizationEmployeeProfiles_OrgEmployeeId",
|
||||
table: "OrganizationEmployeeProfiles",
|
||||
column: "OrgEmployeeId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_OrganizationEmployeeProfiles_ProfileId",
|
||||
table: "OrganizationEmployeeProfiles",
|
||||
column: "ProfileId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "OrganizationEmployeeProfiles");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsPublic",
|
||||
table: "OrganizationEmployees");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5131,6 +5131,76 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
b.ToTable("TypeLeaves");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaManage", 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>("InsigniaId")
|
||||
.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<int>("Total")
|
||||
.HasColumnType("int")
|
||||
.HasComment("จำนวนทั้งหมด");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ประเภทเครื่องราช");
|
||||
|
||||
b.Property<int>("Year")
|
||||
.HasColumnType("int")
|
||||
.HasComment("ปี");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("InsigniaId");
|
||||
|
||||
b.ToTable("InsigniaManages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaPeriod", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
|
|
@ -8517,6 +8587,9 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
b.Property<bool?>("IsDirector")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<bool?>("IsPublic")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("LastUpdateFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
|
|
@ -8627,6 +8700,72 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
b.ToTable("OrganizationEmployees");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationEmployeeProfile", 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>("OrgEmployeeId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid>("ProfileId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrgEmployeeId");
|
||||
|
||||
b.HasIndex("ProfileId");
|
||||
|
||||
b.ToTable("OrganizationEmployeeProfiles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeeLevel", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
|
|
@ -10115,6 +10254,9 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
b.Property<Guid>("PrefixId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid>("ProfileId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Race")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)")
|
||||
|
|
@ -10168,6 +10310,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
b.HasIndex("PrefixId");
|
||||
|
||||
b.HasIndex("ProfileId");
|
||||
|
||||
b.HasIndex("RelationshipId");
|
||||
|
||||
b.HasIndex("ReligionId");
|
||||
|
|
@ -10541,7 +10685,11 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasColumnOrder(101)
|
||||
.HasComment("User Id ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<DateTime?>("Date")
|
||||
b.Property<DateTime?>("DateEnd")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasComment("ถึงวันที่");
|
||||
|
||||
b.Property<DateTime?>("DateStart")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasComment("ตั้งแต่วันที่");
|
||||
|
||||
|
|
@ -11180,6 +11328,9 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
b.Property<Guid>("PrefixId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid>("ProfileId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Race")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)")
|
||||
|
|
@ -11231,6 +11382,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
b.HasIndex("PrefixId");
|
||||
|
||||
b.HasIndex("ProfileId");
|
||||
|
||||
b.HasIndex("RelationshipId");
|
||||
|
||||
b.HasIndex("ReligionId");
|
||||
|
|
@ -11435,6 +11588,9 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
b.Property<Guid>("PrefixId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid>("ProfileId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Race")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)")
|
||||
|
|
@ -11486,6 +11642,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
b.HasIndex("PrefixId");
|
||||
|
||||
b.HasIndex("ProfileId");
|
||||
|
||||
b.HasIndex("RelationshipId");
|
||||
|
||||
b.HasIndex("ReligionId");
|
||||
|
|
@ -12294,6 +12452,9 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
b.Property<Guid>("PrefixId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid>("ProfileId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Race")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)")
|
||||
|
|
@ -12347,6 +12508,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
b.HasIndex("PrefixId");
|
||||
|
||||
b.HasIndex("ProfileId");
|
||||
|
||||
b.HasIndex("RelationshipId");
|
||||
|
||||
b.HasIndex("ReligionId");
|
||||
|
|
@ -13425,6 +13588,17 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
b.Navigation("ProfileTraining");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaManage", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.Insignia", "Insignia")
|
||||
.WithMany()
|
||||
.HasForeignKey("InsigniaId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Insignia");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaPeriod", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "ReliefDoc")
|
||||
|
|
@ -13621,6 +13795,25 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
b.Navigation("Profile");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationEmployeeProfile", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", "OrgEmployee")
|
||||
.WithMany()
|
||||
.HasForeignKey("OrgEmployeeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProfileId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("OrgEmployee");
|
||||
|
||||
b.Navigation("Profile");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeeLevel", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", "OrganizationEmployee")
|
||||
|
|
@ -13890,6 +14083,12 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProfileId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.Relationship", "Relationship")
|
||||
.WithMany()
|
||||
.HasForeignKey("RelationshipId");
|
||||
|
|
@ -13920,6 +14119,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
b.Navigation("Prefix");
|
||||
|
||||
b.Navigation("Profile");
|
||||
|
||||
b.Navigation("Relationship");
|
||||
|
||||
b.Navigation("Religion");
|
||||
|
|
@ -14192,6 +14393,12 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProfileId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.Relationship", "Relationship")
|
||||
.WithMany()
|
||||
.HasForeignKey("RelationshipId");
|
||||
|
|
@ -14220,6 +14427,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
b.Navigation("Prefix");
|
||||
|
||||
b.Navigation("Profile");
|
||||
|
||||
b.Navigation("Relationship");
|
||||
|
||||
b.Navigation("Religion");
|
||||
|
|
@ -14288,6 +14497,12 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProfileId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.Relationship", "Relationship")
|
||||
.WithMany()
|
||||
.HasForeignKey("RelationshipId");
|
||||
|
|
@ -14316,6 +14531,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
b.Navigation("Prefix");
|
||||
|
||||
b.Navigation("Profile");
|
||||
|
||||
b.Navigation("Relationship");
|
||||
|
||||
b.Navigation("Religion");
|
||||
|
|
@ -14468,6 +14685,12 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProfileId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.Relationship", "Relationship")
|
||||
.WithMany()
|
||||
.HasForeignKey("RelationshipId");
|
||||
|
|
@ -14498,6 +14721,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
b.Navigation("Prefix");
|
||||
|
||||
b.Navigation("Profile");
|
||||
|
||||
b.Navigation("Relationship");
|
||||
|
||||
b.Navigation("Religion");
|
||||
|
|
|
|||
|
|
@ -266,6 +266,7 @@ namespace BMA.EHR.Infrastructure.Persistence
|
|||
#region " OrganizationEmployee "
|
||||
|
||||
public DbSet<OrgEmployee> OrganizationEmployees { get; set; }
|
||||
public DbSet<OrganizationEmployeeProfile> OrganizationEmployeeProfiles { get; set; }
|
||||
public DbSet<OrganizationPositionEmployeeLevel> OrganizationPositionEmployeeLevels { get; set; }
|
||||
public DbSet<OrganizationPositionEmployeePositionSide> OrganizationPositionEmployeePositionSides { get; set; }
|
||||
|
||||
|
|
@ -306,6 +307,7 @@ namespace BMA.EHR.Infrastructure.Persistence
|
|||
public DbSet<InsigniaRequest> InsigniaRequests { get; set; }
|
||||
|
||||
public DbSet<InsigniaRequestProfile> InsigniaRequestProfiles { get; set; }
|
||||
public DbSet<InsigniaManage> InsigniaManages { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
|||
225
BMA.EHR.Insignia.Service/Controllers/InsigniaManageController.cs
Normal file
225
BMA.EHR.Insignia.Service/Controllers/InsigniaManageController.cs
Normal file
|
|
@ -0,0 +1,225 @@
|
|||
using System.Security.Claims;
|
||||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Requests;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Models.Insignias;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
using BMA.EHR.Infrastructure.Persistence;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
namespace BMA.EHR.Insignia.Service.Controllers
|
||||
{
|
||||
[Route("api/v{version:apiVersion}/insignia/manage")]
|
||||
[ApiVersion("1.0")]
|
||||
[ApiController]
|
||||
[Produces("application/json")]
|
||||
[Authorize]
|
||||
[SwaggerTag("จัดสรรเครื่องราช")]
|
||||
public class InsigniaManageController : BaseController
|
||||
{
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly InsigniaPeriodsRepository _repository;
|
||||
private readonly string Royal_Type = "Royal";
|
||||
|
||||
public InsigniaManageController(ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
InsigniaPeriodsRepository repository,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_repository = repository;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
|
||||
#region " Properties "
|
||||
|
||||
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||
|
||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 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)
|
||||
{
|
||||
var data = await _context.InsigniaManages.AsQueryable()
|
||||
.Where(x => x.Type == type.Trim().ToUpper())
|
||||
.OrderByDescending(x => x.Year)
|
||||
.Select(p => new
|
||||
{
|
||||
Id = p.Id,
|
||||
Insignia = p.Insignia.Name,
|
||||
InsigniaId = p.Insignia.Id,
|
||||
Year = p.Year,
|
||||
Total = p.Total,
|
||||
Type = p.Type,
|
||||
LastUpdatedAt = p.LastUpdatedAt,
|
||||
CreatedAt = p.CreatedAt,
|
||||
})
|
||||
.ToListAsync();
|
||||
return Success(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get รายละเอียดจัดสรรเครื่องราช
|
||||
/// </summary>
|
||||
/// <param name="id">Id จัดสรรเครื่องราช</param>
|
||||
/// <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}/{id:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetById(string type, Guid id)
|
||||
{
|
||||
var data = await _context.InsigniaManages.AsQueryable()
|
||||
.Where(x => x.Type == type.Trim().ToUpper())
|
||||
.Where(x => x.Id == id)
|
||||
.Select(p => new
|
||||
{
|
||||
Id = p.Id,
|
||||
Insignia = p.Insignia.Name,
|
||||
InsigniaId = p.Insignia.Id,
|
||||
Year = p.Year,
|
||||
Total = p.Total,
|
||||
Type = p.Type,
|
||||
LastUpdatedAt = p.LastUpdatedAt,
|
||||
CreatedAt = p.CreatedAt,
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
return Error(GlobalMessages.InsigniaManageNotFound, 404);
|
||||
|
||||
return Success(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// สร้างจัดสรรเครื่องราช
|
||||
/// </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>
|
||||
[HttpPost("{type}")]
|
||||
public async Task<ActionResult<ResponseObject>> Post([FromForm] InsigniaManageRequest req, string type)
|
||||
{
|
||||
var insignia = await _context.Insignias.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == req.Insignia);
|
||||
if (insignia == null)
|
||||
return Error(GlobalMessages.InsigniaNotFound);
|
||||
|
||||
var insigniaManage = await _context.InsigniaManages.AsQueryable()
|
||||
.Where(x => x.Insignia == insignia && x.Year == req.Year)
|
||||
.FirstOrDefaultAsync();
|
||||
if (insigniaManage != null)
|
||||
return Error(GlobalMessages.InsigniaManageNotFound);
|
||||
|
||||
var period = new InsigniaManage
|
||||
{
|
||||
Insignia = insignia,
|
||||
Year = req.Year,
|
||||
Total = req.Total,
|
||||
Type = type.Trim().ToUpper(),
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
await _context.InsigniaManages.AddAsync(period);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ลบจัดสรรเครื่องราช
|
||||
/// </summary>
|
||||
/// <param name="id">Id จัดสรรเครื่องราช</param>
|
||||
/// <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>
|
||||
[HttpDelete("{type}/{id:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> Delete(Guid id, string type)
|
||||
{
|
||||
var deleted = await _context.InsigniaManages.AsQueryable()
|
||||
.Where(x => x.Type == type.Trim().ToUpper())
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
if (deleted == null)
|
||||
return Error(GlobalMessages.InsigniaManageNotFound);
|
||||
_context.InsigniaManages.Remove(deleted);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// แก้ไขจัดสรรเครื่องราช
|
||||
/// </summary>
|
||||
/// <param name="id">Id จัดสรรเครื่องราช</param>
|
||||
/// <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>
|
||||
[HttpPut("{type}/{id:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> Put([FromForm] InsigniaManageRequest req, Guid id, string type)
|
||||
{
|
||||
var insignia = await _context.Insignias.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == req.Insignia);
|
||||
if (insignia == null)
|
||||
return Error(GlobalMessages.InsigniaNotFound);
|
||||
|
||||
var insigniaManage = await _context.InsigniaManages.AsQueryable()
|
||||
.Where(x => x.Insignia == insignia && x.Year == req.Year && x.Id != id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (insigniaManage != null)
|
||||
return Error(GlobalMessages.InsigniaManageNotFound);
|
||||
|
||||
var uppdated = await _context.InsigniaManages.AsQueryable()
|
||||
.Include(x => x.Insignia)
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (uppdated == null)
|
||||
return Error(GlobalMessages.InsigniaManageNotFound);
|
||||
|
||||
uppdated.Insignia = insignia;
|
||||
uppdated.Year = req.Year;
|
||||
uppdated.Total = req.Total;
|
||||
uppdated.Type = type.Trim().ToUpper();
|
||||
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
uppdated.LastUpdateUserId = UserId ?? "";
|
||||
uppdated.LastUpdatedAt = DateTime.Now;
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ using BMA.EHR.Domain.Common;
|
|||
using BMA.EHR.Domain.Models.Insignias;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
using BMA.EHR.Infrastructure.Persistence;
|
||||
using BMA.EHR.Insignia.Service.Requests;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
|
@ -260,7 +261,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("{insigniaPeriodId:length(36)}/{role}/{status}")]
|
||||
[HttpGet("{insigniaPeriodId:length(36)}/{ocId:length(36)}/{role}/{status}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetInsignaiRequestBkk(Guid insigniaPeriodId, Guid ocId, string role, string status)
|
||||
{
|
||||
// var profile = await _context.Profiles.AsQueryable()
|
||||
|
|
@ -292,14 +293,14 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
OrganizationName = result.OrganizationName,
|
||||
Items = new List<InsigniaRequestItem>()
|
||||
};
|
||||
var candidate = await _repository.GetInsigniaCandidateBKK(period, ocId);
|
||||
// var candidate = await _repository.GetInsigniaCandidateBKK(period, ocId);
|
||||
|
||||
// ตรวจสอบว่ารายการอยู่ใน table insignia_request_new
|
||||
if (requestStatus == null)
|
||||
{
|
||||
// บันทึกรายชื่อ
|
||||
await _repository.InsertCandidate(period, ocId, candidate);
|
||||
}
|
||||
// // ตรวจสอบว่ารายการอยู่ใน table insignia_request_new
|
||||
// if (requestStatus == null)
|
||||
// {
|
||||
// // บันทึกรายชื่อ
|
||||
// await _repository.InsertCandidate(period, ocId, candidate);
|
||||
// }
|
||||
if (role.Trim().ToUpper() == "OFFICER")
|
||||
{
|
||||
resend.Items = await _repository.InsigniaHasProfile(period, ocId, status);
|
||||
|
|
@ -440,6 +441,38 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// คำนวณราชชื่อผู้ได้รับเครื่องราช
|
||||
/// </summary>
|
||||
/// <param name="insigniaPeriodId">Id รอบเครื่องราช</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("{insigniaPeriodId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateInsignaiRequestBkk(Guid insigniaPeriodId)
|
||||
{
|
||||
var oc = await _context.Organizations.Where(x => x.Parent == null).FirstOrDefaultAsync();
|
||||
if (oc == null)
|
||||
return Error(GlobalMessages.Error);
|
||||
|
||||
var result = await _repository.GetInsigniaRequest(insigniaPeriodId, oc.Id);
|
||||
if (result != null)
|
||||
{
|
||||
Guid period = result.PeriodId;
|
||||
string requestStatus = result.RequestStatus;
|
||||
var candidate = await _repository.GetInsigniaCandidateBKK(insigniaPeriodId, oc.Id);
|
||||
// ตรวจสอบว่ารายการอยู่ใน table insignia_request_new
|
||||
if (requestStatus == null)
|
||||
{
|
||||
// บันทึกรายชื่อ
|
||||
await _repository.InsertCandidate(period, oc.Id, candidate);
|
||||
}
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
// #region " บันทึกหมายเหตุ "
|
||||
|
|
@ -559,6 +592,9 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
if (insigniaRequestProfile == null)
|
||||
return Error(GlobalMessages.InsigniaPeriodNotFound);
|
||||
insigniaRequestProfile.Status = "REJECT";
|
||||
insigniaRequestProfile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
insigniaRequestProfile.LastUpdateUserId = UserId ?? "";
|
||||
insigniaRequestProfile.LastUpdatedAt = DateTime.Now;
|
||||
_context.SaveChanges();
|
||||
return Success();
|
||||
}
|
||||
|
|
@ -583,6 +619,9 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
if (insigniaRequestProfile == null)
|
||||
return Error(GlobalMessages.InsigniaPeriodNotFound);
|
||||
insigniaRequestProfile.Status = "DELETE";
|
||||
insigniaRequestProfile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
insigniaRequestProfile.LastUpdateUserId = UserId ?? "";
|
||||
insigniaRequestProfile.LastUpdatedAt = DateTime.Now;
|
||||
_context.SaveChanges();
|
||||
return Success();
|
||||
}
|
||||
|
|
@ -650,5 +689,128 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// หน่วยงานที่อยู่ปัจจุบัน
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("agency")]
|
||||
public async Task<ActionResult<ResponseObject>> GetOrgAgency()
|
||||
{
|
||||
var profile = await _context.Profiles.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.KeycloakId == (UserId != null && UserId != "" ? Guid.Parse(UserId) : Guid.Parse("00000000-0000-0000-0000-000000000000")));
|
||||
if (profile == null)
|
||||
return Error(GlobalMessages.DataNotFound);
|
||||
var orgProfile = await _context.ProfilePositions
|
||||
.Where(x => x.Profile == profile)
|
||||
.Where(x => x.OrganizationPosition != null)
|
||||
.Where(x => x.OrganizationPosition.Organization != null)
|
||||
.Where(x => x.OrganizationPosition.Organization.OrganizationAgencyId != null)
|
||||
.Select(x => x.OrganizationPosition.Organization.OrganizationAgencyId)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
return Success(orgProfile);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// เพิ่มราชชื่อผู้ได้รับเครื่องราช
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost()]
|
||||
public async Task<ActionResult<ResponseObject>> AddUserToRequestInsignia([FromBody] AddUserRequestInsigniaRequest req)
|
||||
{
|
||||
var insigniaPeriod = await _context.InsigniaPeriods.FirstOrDefaultAsync(x => x.Id == req.insigniaPeriodId);
|
||||
if (insigniaPeriod == null)
|
||||
return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||
var profile = await _context.Profiles.FirstOrDefaultAsync(x => x.Id == req.ProfileId);
|
||||
if (profile == null)
|
||||
return Error(GlobalMessages.DataNotFound);
|
||||
var insignia = await _context.Insignias.FirstOrDefaultAsync(x => x.Id == req.insigniaId);
|
||||
if (insignia == null)
|
||||
return Error(GlobalMessages.InsigniaNotFound);
|
||||
var insigniaRequestProfile = await _context.InsigniaRequestProfiles.FirstOrDefaultAsync(x => x.Profile == profile && x.Request.Period == insigniaPeriod);
|
||||
if (insigniaRequestProfile != null)
|
||||
return Error(GlobalMessages.InsigniaRequestProfileDupicate);
|
||||
var insigniaRequest = await _context.InsigniaRequests.FirstOrDefaultAsync(x => x.Period == insigniaPeriod);
|
||||
if (insigniaRequest == null)
|
||||
{
|
||||
var orgProfile = await _context.ProfilePositions
|
||||
.Where(x => x.Profile == profile)
|
||||
.Where(x => x.OrganizationPosition != null)
|
||||
.Where(x => x.OrganizationPosition.Organization != null)
|
||||
.Where(x => x.OrganizationPosition.Organization.OrganizationAgencyId != null)
|
||||
.Select(x => x.OrganizationPosition.Organization.OrganizationAgencyId)
|
||||
.FirstOrDefaultAsync();
|
||||
var org = await _context.Organizations
|
||||
.FirstOrDefaultAsync(x => x.Id == orgProfile);
|
||||
if (org == null)
|
||||
return Error(GlobalMessages.OrganizationNotFound);
|
||||
insigniaRequest = new InsigniaRequest
|
||||
{
|
||||
Period = insigniaPeriod,
|
||||
Organization = org,
|
||||
RequestStatus = "st1",
|
||||
RequestNote = "",
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
}
|
||||
|
||||
await _context.AddAsync(new InsigniaRequestProfile
|
||||
{
|
||||
Status = "PENDING",
|
||||
Profile = profile,
|
||||
RequestInsignia = insignia,
|
||||
Request = insigniaRequest,
|
||||
RequestDate = DateTime.Now,
|
||||
MatchingConditions = System.Text.Json.JsonSerializer.Serialize(new List<dynamic>()), // serialize to string
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// แก้ไขราชชื่อผู้ได้รับเครื่องราช
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("{insigniaRequestProfileId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateUserToRequestInsignia([FromBody] UpdateUserRequestInsigniaRequest req, Guid insigniaRequestProfileId)
|
||||
{
|
||||
var insigniaRequestProfile = await _context.InsigniaRequestProfiles.FirstOrDefaultAsync(x => x.Id == insigniaRequestProfileId);
|
||||
if (insigniaRequestProfile == null)
|
||||
return Error(GlobalMessages.InsigniaRequestProfileNotFound);
|
||||
var insignia = await _context.Insignias.FirstOrDefaultAsync(x => x.Id == req.insigniaId);
|
||||
if (insignia == null)
|
||||
return Error(GlobalMessages.InsigniaNotFound);
|
||||
|
||||
insigniaRequestProfile.RequestInsignia = insignia;
|
||||
insigniaRequestProfile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
insigniaRequestProfile.LastUpdateUserId = UserId ?? "";
|
||||
insigniaRequestProfile.LastUpdatedAt = DateTime.Now;
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Insignia.Service.Requests
|
||||
{
|
||||
public class AddUserRequestInsigniaRequest
|
||||
{
|
||||
public Guid ProfileId { get; set; }
|
||||
public Guid insigniaId { get; set; }
|
||||
public Guid insigniaPeriodId { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Insignia.Service.Requests
|
||||
{
|
||||
public class UpdateUserRequestInsigniaRequest
|
||||
{
|
||||
public Guid insigniaId { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -352,11 +352,11 @@ namespace BMA.EHR.OrganizationEmployee.Service.Controllers
|
|||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
|
||||
var organizationEmployee = await _context.OrganizationEmployees
|
||||
.Where(x => x.Profile == null || (x.Profile != null && x.Profile == profile))
|
||||
.Where(x => x.OrganizationEmployeeProfiles.Count() == 0 || (x.OrganizationEmployeeProfiles.Count() > 0 && x.OrganizationEmployeeProfiles.FirstOrDefault().Profile == profile))
|
||||
.Select(x => new
|
||||
{
|
||||
Id = x.Id,
|
||||
Use = x.Profile == null ? false : (x.Profile == profile ? true : false),
|
||||
Use = x.OrganizationEmployeeProfiles.Count() == 0 ? false : (x.OrganizationEmployeeProfiles.FirstOrDefault().Profile == profile ? true : false),
|
||||
Agency = x.Agency,
|
||||
ConditionNote = x.ConditionNote,
|
||||
Department = x.Department,
|
||||
|
|
@ -432,7 +432,22 @@ namespace BMA.EHR.OrganizationEmployee.Service.Controllers
|
|||
.FirstOrDefaultAsync(x => x.Profile == profile);
|
||||
if (organizationEmployeeProfile != null)
|
||||
organizationEmployeeProfile.Profile = null;
|
||||
organizationEmployee.Profile = profile;
|
||||
|
||||
var data = new OrganizationEmployeeProfile
|
||||
{
|
||||
OrgEmployee = organizationEmployee,
|
||||
Profile = profile,
|
||||
Status = "PENDING",
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
await _context.OrganizationEmployeeProfiles.AddAsync(data);
|
||||
// organizationEmployee.Profile = profile;
|
||||
// organizationEmployee.IsPublic = false;
|
||||
_context.SaveChanges();
|
||||
|
||||
return Success();
|
||||
|
|
@ -510,5 +525,33 @@ namespace BMA.EHR.OrganizationEmployee.Service.Controllers
|
|||
|
||||
return Success(organizationEmployee);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// สั่งรายชื่อไปออกคำสั่ง
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("report")]
|
||||
public async Task<ActionResult<ResponseObject>> PostToReport([FromBody] OrganizationEmployeeProfileRequest req)
|
||||
{
|
||||
foreach (var item in req.Id)
|
||||
{
|
||||
var uppdated = await _context.OrganizationEmployeeProfiles
|
||||
.FirstOrDefaultAsync(x => x.Profile.Id == item);
|
||||
if (uppdated == null)
|
||||
continue;
|
||||
uppdated.Status = "REPORT";
|
||||
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
uppdated.LastUpdateUserId = UserId ?? "";
|
||||
uppdated.LastUpdatedAt = DateTime.Now;
|
||||
}
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.OrganizationEmployee.Service.Requests
|
||||
{
|
||||
public class OrganizationEmployeeProfileRequest
|
||||
{
|
||||
public List<Guid> Id { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -122,6 +122,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
.Select(p => new
|
||||
{
|
||||
p.Id,
|
||||
ProfileId = p.Profile.Id,
|
||||
p.CitizenId,
|
||||
Prefix = p.Prefix == null ? null : p.Prefix.Name,
|
||||
PrefixId = p.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Prefix.Id,
|
||||
|
|
@ -173,6 +174,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
var _data = new
|
||||
{
|
||||
data.Id,
|
||||
data.ProfileId,
|
||||
data.CitizenId,
|
||||
data.Prefix,
|
||||
data.PrefixId,
|
||||
|
|
@ -237,6 +239,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
|
||||
var placementAppointment = new PlacementAppointment
|
||||
{
|
||||
Profile = profile,
|
||||
CitizenId = profile.CitizenId,
|
||||
Prefix = profile.Prefix,
|
||||
Firstname = profile.FirstName,
|
||||
|
|
|
|||
|
|
@ -73,7 +73,8 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
p.Organization,
|
||||
p.Reason,
|
||||
p.Status,
|
||||
p.Date,
|
||||
p.DateStart,
|
||||
p.DateEnd,
|
||||
salary = p.AmountOld,
|
||||
p.PositionTypeOld,
|
||||
p.PositionLevelOld,
|
||||
|
|
@ -118,7 +119,8 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
p.Reason,
|
||||
p.Status,
|
||||
p.Organization,
|
||||
p.Date,
|
||||
p.DateStart,
|
||||
p.DateEnd,
|
||||
salary = p.AmountOld,
|
||||
p.CreatedAt,
|
||||
p.PositionTypeOld,
|
||||
|
|
@ -202,7 +204,8 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
uppdated.AmountOld = req.AmountOld;
|
||||
uppdated.Organization = req.Organization;
|
||||
uppdated.Reason = req.Reason;
|
||||
uppdated.Date = req.Date;
|
||||
uppdated.DateStart = req.DateStart;
|
||||
uppdated.DateEnd = req.DateEnd;
|
||||
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
uppdated.LastUpdateUserId = UserId ?? "";
|
||||
uppdated.LastUpdatedAt = DateTime.Now;
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
.Select(p => new
|
||||
{
|
||||
p.Id,
|
||||
ProfileId = p.Profile.Id,
|
||||
p.CitizenId,
|
||||
Prefix = p.Prefix.Name,
|
||||
PrefixId = p.Prefix.Id,
|
||||
|
|
@ -171,6 +172,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
var _data = new
|
||||
{
|
||||
data.Id,
|
||||
data.ProfileId,
|
||||
data.CitizenId,
|
||||
data.Prefix,
|
||||
data.PrefixId,
|
||||
|
|
@ -236,6 +238,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
|
||||
var placementReceive = new PlacementReceive
|
||||
{
|
||||
Profile = profile,
|
||||
CitizenId = req.CitizenId,
|
||||
Prefix = prefix,
|
||||
Firstname = req.Firstname,
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
.Select(p => new
|
||||
{
|
||||
p.Id,
|
||||
ProfileId = p.Profile.Id,
|
||||
p.CitizenId,
|
||||
Prefix = p.Prefix == null ? null : p.Prefix.Name,
|
||||
PrefixId = p.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Prefix.Id,
|
||||
|
|
@ -171,6 +172,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
var _data = new
|
||||
{
|
||||
data.Id,
|
||||
data.ProfileId,
|
||||
data.CitizenId,
|
||||
data.Prefix,
|
||||
data.PrefixId,
|
||||
|
|
@ -234,6 +236,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
|
||||
var placementRelocation = new PlacementRelocation
|
||||
{
|
||||
Profile = profile,
|
||||
CitizenId = profile.CitizenId,
|
||||
Prefix = profile.Prefix,
|
||||
Firstname = profile.FirstName,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ namespace BMA.EHR.Placement.Service.Requests
|
|||
public string Organization { get; set; }
|
||||
public string Reason { get; set; }
|
||||
public string? OrganizationPositionOld { get; set; }
|
||||
public DateTime? Date { get; set; }
|
||||
public DateTime? DateStart { get; set; }
|
||||
public DateTime? DateEnd { get; set; }
|
||||
public string? PositionTypeOld { get; set; }
|
||||
public string? PositionLevelOld { get; set; }
|
||||
public string? PositionNumberOld { get; set; }
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
.Select(p => new
|
||||
{
|
||||
p.Id,
|
||||
ProfileId = p.Profile.Id,
|
||||
p.CitizenId,
|
||||
Prefix = p.Prefix == null ? null : p.Prefix.Name,
|
||||
PrefixId = p.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Prefix.Id,
|
||||
|
|
@ -173,6 +174,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
var _data = new
|
||||
{
|
||||
data.Id,
|
||||
data.ProfileId,
|
||||
data.CitizenId,
|
||||
data.Prefix,
|
||||
data.PrefixId,
|
||||
|
|
@ -237,6 +239,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
|
||||
var retirementOther = new RetirementOther
|
||||
{
|
||||
Profile = profile,
|
||||
CitizenId = profile.CitizenId,
|
||||
Prefix = profile.Prefix,
|
||||
Firstname = profile.FirstName,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue