เพิ่ม user ใน บรรจุ

This commit is contained in:
Kittapath 2023-08-19 21:03:17 +07:00
parent d5ffd5cb08
commit 824c8267ef
24 changed files with 45466 additions and 16 deletions

View file

@ -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; }
}
}

View file

@ -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; }
}
}

View file

@ -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("คำนำหน้า")]

View file

@ -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("ข้อมูลหน่วยงานเดิม ระดับ")]

View file

@ -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("คำนำหน้า")]

View file

@ -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("คำนำหน้า")]

View file

@ -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("คำนำหน้า")]

View file

@ -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");
}
}
}

View file

@ -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");
}
}
}

View file

@ -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");
}
}
}

View file

@ -8587,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)
@ -8697,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")
@ -10185,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)")
@ -10238,6 +10310,8 @@ namespace BMA.EHR.Infrastructure.Migrations
b.HasIndex("PrefixId");
b.HasIndex("ProfileId");
b.HasIndex("RelationshipId");
b.HasIndex("ReligionId");
@ -10611,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("ตั้งแต่วันที่");
@ -11250,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)")
@ -11301,6 +11382,8 @@ namespace BMA.EHR.Infrastructure.Migrations
b.HasIndex("PrefixId");
b.HasIndex("ProfileId");
b.HasIndex("RelationshipId");
b.HasIndex("ReligionId");
@ -11505,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)")
@ -11556,6 +11642,8 @@ namespace BMA.EHR.Infrastructure.Migrations
b.HasIndex("PrefixId");
b.HasIndex("ProfileId");
b.HasIndex("RelationshipId");
b.HasIndex("ReligionId");
@ -12364,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)")
@ -12417,6 +12508,8 @@ namespace BMA.EHR.Infrastructure.Migrations
b.HasIndex("PrefixId");
b.HasIndex("ProfileId");
b.HasIndex("RelationshipId");
b.HasIndex("ReligionId");
@ -13702,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")
@ -13971,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");
@ -14001,6 +14119,8 @@ namespace BMA.EHR.Infrastructure.Migrations
b.Navigation("Prefix");
b.Navigation("Profile");
b.Navigation("Relationship");
b.Navigation("Religion");
@ -14273,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");
@ -14301,6 +14427,8 @@ namespace BMA.EHR.Infrastructure.Migrations
b.Navigation("Prefix");
b.Navigation("Profile");
b.Navigation("Relationship");
b.Navigation("Religion");
@ -14369,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");
@ -14397,6 +14531,8 @@ namespace BMA.EHR.Infrastructure.Migrations
b.Navigation("Prefix");
b.Navigation("Profile");
b.Navigation("Relationship");
b.Navigation("Religion");
@ -14549,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");
@ -14579,6 +14721,8 @@ namespace BMA.EHR.Infrastructure.Migrations
b.Navigation("Prefix");
b.Navigation("Profile");
b.Navigation("Relationship");
b.Navigation("Religion");

View file

@ -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; }

View file

@ -292,14 +292,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 +440,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 " บันทึกหมายเหตุ "

View file

@ -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();
}
}
}

View file

@ -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; }
}
}

View file

@ -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,

View file

@ -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;

View file

@ -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,

View file

@ -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,

View file

@ -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; }

View file

@ -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,