แก้ออกคำสั่ง

This commit is contained in:
kittapath 2025-01-05 21:57:27 +07:00
parent ad70e8164c
commit 564a23988d
17 changed files with 77109 additions and 252 deletions

View file

@ -138,12 +138,6 @@ namespace BMA.EHR.Application.Repositories.Commands
join p in _dbContext.Set<PlacementProfile>()
.Include(x => x.PlacementEducations)
.Include(x => x.Placement)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x.Organization)
.Include(x => x.PositionPath)
.Include(x => x.PositionLevel)
.Include(x => x.PositionNumber)
.Include(x => x.PositionType)
on r.RefPlacementProfileId equals p.Id
orderby r.Sequence
select new CommandType01Response
@ -196,12 +190,6 @@ namespace BMA.EHR.Application.Repositories.Commands
join p in _dbContext.Set<PlacementProfile>()
.Include(x => x.PlacementEducations)
.Include(x => x.Placement)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x.Organization)
.Include(x => x.PositionPath)
.Include(x => x.PositionLevel)
.Include(x => x.PositionNumber)
.Include(x => x.PositionType)
on r.RefPlacementProfileId equals p.Id
orderby r.Sequence
select new CommandType03Response
@ -267,12 +255,6 @@ namespace BMA.EHR.Application.Repositories.Commands
join p in _dbContext.Set<PlacementProfile>()
.Include(x => x.PlacementEducations)
.Include(x => x.Placement)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x.Organization)
.Include(x => x.PositionPath)
.Include(x => x.PositionLevel)
.Include(x => x.PositionNumber)
.Include(x => x.PositionType)
on r.RefPlacementProfileId equals p.Id
orderby r.Sequence
select new CommandType03Response
@ -333,12 +315,6 @@ namespace BMA.EHR.Application.Repositories.Commands
join p in _dbContext.Set<PlacementProfile>()
.Include(x => x.PlacementEducations)
.Include(x => x.Placement)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x.Organization)
.Include(x => x.PositionPath)
.Include(x => x.PositionLevel)
.Include(x => x.PositionNumber)
.Include(x => x.PositionType)
on r.RefPlacementProfileId equals p.Id
orderby r.Sequence
select new CommandType03Response

View file

@ -2981,37 +2981,8 @@ namespace BMA.EHR.Application.Repositories.Commands
var placementProfile = await _dbContext.Set<PlacementProfile>()
.Include(x => x.PlacementProfileDocs)
.ThenInclude(x => x.Document)
.Include(x => x.PositionPath)
.Include(x => x.PositionPathSide)
.Include(x => x.PositionType)
.Include(x => x.PositionLine)
.Include(x => x.PositionLevel)
.Include(x => x.PositionNumber)
.Include(x => x.PlacementCertificates)
.Include(x => x.PlacementEducations)
.ThenInclude(x => x.EducationLevel)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x.Organization)
.ThenInclude(x => x.OrganizationShortName)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x.PositionMaster)
.ThenInclude(x => x.PositionExecutive)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x.PositionMaster)
.ThenInclude(x => x.PositionExecutiveSide)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x.PositionMaster)
.ThenInclude(x => x.PositionLine)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x.Organization)
.ThenInclude(x => x.OrganizationOrganization)
.FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId);
if (placementProfile == null)
@ -3093,7 +3064,7 @@ namespace BMA.EHR.Application.Repositories.Commands
other = edu.Other == null ? string.Empty : edu.Other,
startDate = edu.StartDate == null ? (DateTime?)null : edu.StartDate,
endDate = edu.EndDate == null ? (DateTime?)null : edu.EndDate,
educationLevel = edu.EducationLevel == null ? string.Empty : edu.EducationLevel.Name,
educationLevel = edu.EducationLevelName,
educationLevelId = string.Empty,
positionPath = edu.PositionPath == null ? null : edu.PositionPath,
positionPathId = string.Empty,
@ -10162,13 +10133,12 @@ namespace BMA.EHR.Application.Repositories.Commands
var data = await (from r in _dbContext.Set<CommandReceiver>()
.Include(x => x.Command)
join pf in _dbContext.Set<PlacementProfile>()
.Include(x => x.PositionPath)
on r.RefPlacementProfileId equals pf.Id
where r.Command.Id == id
select new
{
r.RefPlacementProfileId,
Position = pf.PositionPath!.Name
Position = pf.positionName
}).ToListAsync();
if (data.Count > 0)
@ -10678,27 +10648,6 @@ namespace BMA.EHR.Application.Repositories.Commands
}
}
public async Task<List<PositionPath>> GetPlacementPositionPath(Guid id)
{
try
{
var data = await _dbContext.Set<PlacementProfile>()
.Include(x => x.PositionPath)
.Include(x => x.Placement)
.Where(x => x.Placement!.Id == id)
.Where(x => x.PositionPath != null)
.Select(x => x.PositionPath)
.Distinct()
.ToListAsync();
return data!;
}
catch
{
throw;
}
}
#endregion
#region " Command Info "

View file

@ -1109,13 +1109,10 @@ namespace BMA.EHR.Application.Repositories.Reports
{
if (insigniaPeriod.StartDate >= DateTime.Now.Date || insigniaPeriod.InsigniaRequests.Count > 0)
continue;
//var organizationType = await _dbContext.Set<OrganizationType>().Where(x => x.Name == "หน่วยงาน").FirstOrDefaultAsync();
//if (organizationType == null)
// continue;
//var organizations = await _dbContext.Set<OrganizationEntity>().Where(x => x.OrganizationType == organizationType).ToListAsync();
var organizations = await _userProfileRepository.GetActiveRootLatestAsync(AccessToken);
if (organizations == null)
continue;
insigniaPeriod.RevisionId = Guid.Parse(organizations[0].OrgRevisionId);
foreach (var organization in organizations)
{
if (organization == null)

View file

@ -9,7 +9,7 @@
public Guid LastUpdateUserId { get; set; }
public string CreatedFullName { get; set; } = string.Empty;
public string LastUpdateFullName { get; set; } = string.Empty;
public string OrgRootName { get; set; } = string.Empty;
public string OrgRevisionId { get; set; } = string.Empty;
}
}

View file

@ -24,6 +24,9 @@ namespace BMA.EHR.Domain.Models.Placement
[Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true;
[Comment("Id การสอบ")]
public Guid? RefId { get; set; }
public virtual List<PlacementProfile> PlacementProfiles { get; set; } = new List<PlacementProfile>();
}
}

View file

@ -10,7 +10,9 @@ namespace BMA.EHR.Domain.Models.Placement
[Required, Comment("Id ผู้สมัคร")]
public virtual PlacementProfile? PlacementProfile { get; set; }
[Comment("Idวุฒิที่ได้รับ")]
public virtual EducationLevel? EducationLevel { get; set; }
public Guid? EducationLevelId { get; set; }
[Comment("วุฒิที่ได้รับ")]
public string? EducationLevelName { get; set; }
[MaxLength(1000), Comment("สถานศึกษา")]
public string? Institute { get; set; }
[MaxLength(200), Comment("วุฒิการศึกษา")]

View file

@ -28,10 +28,10 @@ namespace BMA.EHR.Domain.Models.Placement
// [Comment("ลำดับที่สอบได้")]
// public int? Number { get; set; }
[Comment("Id ตำแหน่งที่สอบได้")]
public PositionPath? PositionCandidate { get; set; }
[Comment("Id เลขที่ตำแหน่ง")]
public OrganizationPositionEntity? OrganizationPosition { get; set; }
// [Comment("Id ตำแหน่งที่สอบได้")]
// public PositionPath? PositionCandidate { get; set; }
// [Comment("Id เลขที่ตำแหน่ง")]
// public OrganizationPositionEntity? OrganizationPosition { get; set; }
[Comment("วันที่บรรจุ")]
public DateTime? RecruitDate { get; set; }
[Comment("วันที่รายงานตัว")]
@ -198,21 +198,12 @@ namespace BMA.EHR.Domain.Models.Placement
[MaxLength(20), Comment("โทรศัพท์ บริษัท")]
public string? OccupationTelephone { get; set; }
[Comment("ชื่อตำแหน่งเลขที่")]
public PositionNumberEntity? PositionNumber { get; set; }
[Comment("ชื่อตำแหน่ง")]
public PositionPath? PositionPath { get; set; }
[Comment("Id ด้าน/สาขา")]
public PositionPathSide? PositionPathSide { get; set; }
[Comment("ตำแหน่งสอบ")]
public string? PositionCandidate { get; set; }
[Comment("ประเภทตำแหน่ง")]
public string? PositionType { get; set; }
[Comment("Id สายงาน")]
public PositionLine? PositionLine { get; set; }
[Comment("ระดับ")]
public string? PositionLevel { get; set; }
@ -331,7 +322,6 @@ namespace BMA.EHR.Domain.Models.Placement
[Comment("ประเภทคำสั่ง")]
public string? typeCommand { get; set; }
[Comment("ข้อมูลเก่า")]
public bool? IsOld { get; set; }

View file

@ -0,0 +1,261 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableplacementprofiledeleteposcandidate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_PlacementEducations_EducationLevels_EducationLevelId",
table: "PlacementEducations");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_OrganizationPositions_OrganizationPosition~",
table: "PlacementProfiles");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_PositionLines_PositionLineId",
table: "PlacementProfiles");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_PositionNumbers_PositionNumberId",
table: "PlacementProfiles");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_PositionPathSides_PositionPathSideId",
table: "PlacementProfiles");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_PositionPaths_PositionCandidateId",
table: "PlacementProfiles");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_PositionPaths_PositionPathId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_OrganizationPositionId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_PositionCandidateId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_PositionLineId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_PositionNumberId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_PositionPathId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_PositionPathSideId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementEducations_EducationLevelId",
table: "PlacementEducations");
migrationBuilder.DropColumn(
name: "OrganizationPositionId",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "PositionCandidateId",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "PositionLineId",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "PositionNumberId",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "PositionPathId",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "PositionPathSideId",
table: "PlacementProfiles");
migrationBuilder.AlterColumn<Guid>(
name: "EducationLevelId",
table: "PlacementEducations",
type: "char(36)",
nullable: true,
comment: "Idวุฒิที่ได้รับ",
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AddColumn<string>(
name: "EducationLevelName",
table: "PlacementEducations",
type: "longtext",
nullable: true,
comment: "วุฒิที่ได้รับ")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "EducationLevelName",
table: "PlacementEducations");
migrationBuilder.AddColumn<Guid>(
name: "OrganizationPositionId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "PositionCandidateId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "PositionLineId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "PositionNumberId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "PositionPathId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "PositionPathSideId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AlterColumn<Guid>(
name: "EducationLevelId",
table: "PlacementEducations",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true,
oldComment: "Idวุฒิที่ได้รับ")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_OrganizationPositionId",
table: "PlacementProfiles",
column: "OrganizationPositionId");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_PositionCandidateId",
table: "PlacementProfiles",
column: "PositionCandidateId");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_PositionLineId",
table: "PlacementProfiles",
column: "PositionLineId");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_PositionNumberId",
table: "PlacementProfiles",
column: "PositionNumberId");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_PositionPathId",
table: "PlacementProfiles",
column: "PositionPathId");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_PositionPathSideId",
table: "PlacementProfiles",
column: "PositionPathSideId");
migrationBuilder.CreateIndex(
name: "IX_PlacementEducations_EducationLevelId",
table: "PlacementEducations",
column: "EducationLevelId");
migrationBuilder.AddForeignKey(
name: "FK_PlacementEducations_EducationLevels_EducationLevelId",
table: "PlacementEducations",
column: "EducationLevelId",
principalTable: "EducationLevels",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_OrganizationPositions_OrganizationPosition~",
table: "PlacementProfiles",
column: "OrganizationPositionId",
principalTable: "OrganizationPositions",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_PositionLines_PositionLineId",
table: "PlacementProfiles",
column: "PositionLineId",
principalTable: "PositionLines",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_PositionNumbers_PositionNumberId",
table: "PlacementProfiles",
column: "PositionNumberId",
principalTable: "PositionNumbers",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_PositionPathSides_PositionPathSideId",
table: "PlacementProfiles",
column: "PositionPathSideId",
principalTable: "PositionPathSides",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_PositionPaths_PositionCandidateId",
table: "PlacementProfiles",
column: "PositionCandidateId",
principalTable: "PositionPaths",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_PositionPaths_PositionPathId",
table: "PlacementProfiles",
column: "PositionPathId",
principalTable: "PositionPaths",
principalColumn: "Id");
}
}
}

View file

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableplacementprofileaddposcandidate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "PositionCandidate",
table: "PlacementProfiles",
type: "longtext",
nullable: true,
comment: "ตำแหน่งสอบ")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "PositionCandidate",
table: "PlacementProfiles");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableplacementaddrefId : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,31 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableplacementaddrefIds : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "RefId",
table: "Placements",
type: "char(36)",
nullable: true,
comment: "Id การสอบ",
collation: "ascii_general_ci");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "RefId",
table: "Placements");
}
}
}

View file

@ -11245,6 +11245,10 @@ namespace BMA.EHR.Infrastructure.Migrations
b.Property<Guid>("PlacementTypeId")
.HasColumnType("char(36)");
b.Property<Guid?>("RefId")
.HasColumnType("char(36)")
.HasComment("Id การสอบ");
b.Property<string>("Round")
.IsRequired()
.HasColumnType("longtext")
@ -11786,7 +11790,12 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasComment("ระยะเวลาหลักสูตร");
b.Property<Guid?>("EducationLevelId")
.HasColumnType("char(36)");
.HasColumnType("char(36)")
.HasComment("Idวุฒิที่ได้รับ");
b.Property<string>("EducationLevelName")
.HasColumnType("longtext")
.HasComment("วุฒิที่ได้รับ");
b.Property<DateTime?>("EndDate")
.HasColumnType("datetime(6)")
@ -11860,8 +11869,6 @@ namespace BMA.EHR.Infrastructure.Migrations
b.HasKey("Id");
b.HasIndex("EducationLevelId");
b.HasIndex("PlacementProfileId");
b.HasIndex("PositionPathId");
@ -12409,9 +12416,6 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("varchar(20)")
.HasComment("โทรศัพท์ บริษัท");
b.Property<Guid?>("OrganizationPositionId")
.HasColumnType("char(36)");
b.Property<string>("Pass")
.HasColumnType("longtext")
.HasComment("ผลสมัครสอบ");
@ -12456,25 +12460,14 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("ชื่อตำแหน่ง");
b.Property<Guid?>("PositionCandidateId")
.HasColumnType("char(36)");
b.Property<string>("PositionCandidate")
.HasColumnType("longtext")
.HasComment("ตำแหน่งสอบ");
b.Property<string>("PositionLevel")
.HasColumnType("longtext")
.HasComment("ระดับ");
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<double?>("PositionSalaryAmount")
.HasColumnType("double")
.HasComment("เงินประจำตำแหน่ง");
@ -12802,20 +12795,8 @@ namespace BMA.EHR.Infrastructure.Migrations
b.HasKey("Id");
b.HasIndex("OrganizationPositionId");
b.HasIndex("PlacementId");
b.HasIndex("PositionCandidateId");
b.HasIndex("PositionLineId");
b.HasIndex("PositionNumberId");
b.HasIndex("PositionPathId");
b.HasIndex("PositionPathSideId");
b.HasIndex("ProfileImgId");
b.HasIndex("ReliefDocId");
@ -18471,10 +18452,6 @@ namespace BMA.EHR.Infrastructure.Migrations
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementEducation", b =>
{
b.HasOne("BMA.EHR.Domain.Models.MetaData.EducationLevel", "EducationLevel")
.WithMany()
.HasForeignKey("EducationLevelId");
b.HasOne("BMA.EHR.Domain.Models.Placement.PlacementProfile", "PlacementProfile")
.WithMany("PlacementEducations")
.HasForeignKey("PlacementProfileId")
@ -18485,8 +18462,6 @@ namespace BMA.EHR.Infrastructure.Migrations
.WithMany()
.HasForeignKey("PositionPathId");
b.Navigation("EducationLevel");
b.Navigation("PlacementProfile");
b.Navigation("PositionPath");
@ -18494,34 +18469,10 @@ namespace BMA.EHR.Infrastructure.Migrations
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementProfile", b =>
{
b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationPositionEntity", "OrganizationPosition")
.WithMany()
.HasForeignKey("OrganizationPositionId");
b.HasOne("BMA.EHR.Domain.Models.Placement.Placement", "Placement")
.WithMany("PlacementProfiles")
.HasForeignKey("PlacementId");
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPath", "PositionCandidate")
.WithMany()
.HasForeignKey("PositionCandidateId");
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.Documents.Document", "ProfileImg")
.WithMany()
.HasForeignKey("ProfileImgId");
@ -18530,20 +18481,8 @@ namespace BMA.EHR.Infrastructure.Migrations
.WithMany()
.HasForeignKey("ReliefDocId");
b.Navigation("OrganizationPosition");
b.Navigation("Placement");
b.Navigation("PositionCandidate");
b.Navigation("PositionLine");
b.Navigation("PositionNumber");
b.Navigation("PositionPath");
b.Navigation("PositionPathSide");
b.Navigation("ProfileImg");
b.Navigation("ReliefDoc");

View file

@ -217,7 +217,7 @@ namespace BMA.EHR.Placement.Service.Controllers
IsRelief = x.IsRelief,
posLevelCandidate = x.PositionLevel,
posTypeCandidate = x.PositionType,
positionCandidate = x.positionName,
positionCandidate = x.PositionCandidate,
}).OrderBy(x => x.ExamNumber).ToListAsync();
var result1 = new List<dynamic>();
@ -329,7 +329,7 @@ namespace BMA.EHR.Placement.Service.Controllers
IsRelief = x.IsRelief,
posLevelCandidate = x.PositionLevel,
posTypeCandidate = x.PositionType,
positionCandidate = x.positionName,
positionCandidate = x.PositionCandidate,
}).OrderBy(x => x.ExamNumber).ToListAsync();
var result = new List<dynamic>();
@ -432,7 +432,7 @@ namespace BMA.EHR.Placement.Service.Controllers
DateOfBirth = x.DateOfBirth,
Age = x.DateOfBirth == null ? null : x.DateOfBirth.Value.CalculateAgeStrV2(0, 0),
Telephone = x.Telephone,
PositionCandidate = x.positionName,
PositionCandidate = x.PositionCandidate,
Gender = x.Gender,
Relationship = x.Relationship,
BloodGroup = x.BloodGroup,
@ -445,8 +445,8 @@ namespace BMA.EHR.Placement.Service.Controllers
Education = x.PlacementEducations.Select(p => new
{
Id = p.Id,
EducationLevel = p.EducationLevel == null ? null : p.EducationLevel.Name,
EducationLevelId = p.EducationLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.EducationLevel.Id,
EducationLevel = p.EducationLevelId,
EducationLevelId = p.EducationLevelName,
Institute = p.Institute,
Degree = p.Degree,
Field = p.Field,
@ -717,23 +717,11 @@ namespace BMA.EHR.Placement.Service.Controllers
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
var person = await _context.PlacementProfiles
.Include(x => x.OrganizationPosition)
.Include(x => x.PositionNumber)
.Include(x => x.PositionPath)
// .Include(x => x.PositionLevel)
.Include(x => x.PositionLine)
.Include(x => x.PositionPathSide)
// .Include(x => x.PositionType)
.FirstOrDefaultAsync(x => x.Id == req.PersonalId);
if (person == null)
return Error(GlobalMessages.DataNotFound, 404);
bool? _nullBool = null;
person.OrganizationPosition = null;
person.PositionNumber = null;
person.PositionPath = null;
person.PositionLevel = null;
person.PositionLine = null;
person.PositionPathSide = null;
person.PositionType = null;
person.Amount = null;
person.MouthSalaryAmount = null;
@ -762,7 +750,7 @@ namespace BMA.EHR.Placement.Service.Controllers
person.child4ShortName = null;
person.orgRevisionId = null;
person.posMasterNo = null;
//person.positionName = null;
//person.positionName = null;
person.positionField = null;
person.posTypeId = null;
person.posTypeName = null;
@ -837,19 +825,6 @@ namespace BMA.EHR.Placement.Service.Controllers
if (person.Draft == true)
return Error("ไม่สามารถแก้ไขข้อมูลนี้ได้เนื่องจากเผยแพร่ไปแล้ว");
// person.organizationName = req.organizationName;
// person.orgTreeShortName = req.orgTreeShortName;
// person.PosPath = req.posPath;
// person.PosNumber = req.posNumber;
// person.node = req.node;
// person.nodeId = req.nodeId;
// person.posmasterId = req.posmasterId;
// person.positionId = req.positionId;
// person.Amount = req.SalaryAmount;
// person.MouthSalaryAmount = req.MouthSalaryAmount;
// person.PositionSalaryAmount = req.PositionSalaryAmount;
// person.RecruitDate = req.ReportingDate;
var apiUrl = $"{_configuration["API"]}/org/find/all";
using (var client = new HttpClient())
@ -1135,10 +1110,6 @@ namespace BMA.EHR.Placement.Service.Controllers
if (profile == null)
return Error(GlobalMessages.DataNotFound, 404);
var educationLevel = await _context.EducationLevels.FirstOrDefaultAsync(x => x.Id == req.EducationLevelId);
if (educationLevel == null && req.EducationLevelId != null)
return Error(GlobalMessages.DataNotFound, 404);
var positionPath = await _context.PositionPaths.FirstOrDefaultAsync(x => x.Id == req.PositionPathId);
if (positionPath == null && req.PositionPathId != null)
return Error(GlobalMessages.DataNotFound, 404);
@ -1146,7 +1117,7 @@ namespace BMA.EHR.Placement.Service.Controllers
var data = new PlacementEducation
{
PlacementProfile = profile,
EducationLevel = educationLevel,
EducationLevelId = req.EducationLevelId,
PositionPath = positionPath,
Institute = req.Institute,
Degree = req.Degree,
@ -1180,10 +1151,6 @@ namespace BMA.EHR.Placement.Service.Controllers
if (profile == null)
return Error(GlobalMessages.DataNotFound, 404);
var educationLevel = await _context.EducationLevels.FirstOrDefaultAsync(x => x.Id == req.EducationLevelId);
if (educationLevel == null && req.EducationLevelId != null)
return Error(GlobalMessages.DataNotFound, 404);
var positionPath = await _context.PositionPaths.FirstOrDefaultAsync(x => x.Id == req.PositionPathId);
if (positionPath == null && req.PositionPathId != null)
return Error(GlobalMessages.DataNotFound, 404);
@ -1192,7 +1159,7 @@ namespace BMA.EHR.Placement.Service.Controllers
if (education == null)
return Error(GlobalMessages.EducationNotFound, 404);
education.EducationLevel = educationLevel;
education.EducationLevelId = req.EducationLevelId;
education.PositionPath = positionPath;
education.Institute = req.Institute;
education.Degree = req.Degree;
@ -1256,13 +1223,6 @@ namespace BMA.EHR.Placement.Service.Controllers
public async Task<ActionResult<ResponseObject>> UpdatePositionDraft(Guid personalId)
{
var profile = await _context.PlacementProfiles
.Include(x => x.OrganizationPosition)
.Include(x => x.PositionNumber)
.Include(x => x.PositionPath)
// .Include(x => x.PositionLevel)
.Include(x => x.PositionLine)
.Include(x => x.PositionPathSide)
// .Include(x => x.PositionType)
.FirstOrDefaultAsync(x => x.Id == personalId);
if (profile == null)
return Error(GlobalMessages.DataNotFound, 404);
@ -1301,16 +1261,11 @@ namespace BMA.EHR.Placement.Service.Controllers
profile.posLevelId = null;
profile.posLevelName = null;
profile.OrganizationPosition = null;
profile.PositionNumber = null;
profile.PositionPath = null;
profile.PositionLevel = null;
profile.PositionLine = null;
profile.PositionPathSide = null;
profile.PositionType = null;
profile.Amount = null;
profile.MouthSalaryAmount = null;
profile.PositionSalaryAmount = null;
// profile.PositionLevel = null;
// profile.PositionType = null;
// profile.Amount = null;
// profile.MouthSalaryAmount = null;
// profile.PositionSalaryAmount = null;
profile.RecruitDate = null;
profile.ReportingDate = null;
@ -1601,8 +1556,8 @@ namespace BMA.EHR.Placement.Service.Controllers
AppointDate = p.ReportingDate == null ? "-" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
CommandExcecuteDate = string.IsNullOrEmpty(r.CommandExcecuteDate.ToString()) ? "-" : r.CommandExcecuteDate.Value.ToThaiShortDate2().ToThaiNumber(),
OccupationPosition = p.OccupationPosition == null ? "-" : p.OccupationPosition, //ตำแหน่งเก่าก่อนสอบ
PositionCandidate = p.positionName, //ตำแหน่งที่สอบแข่งขัน
OcCandidate = p.root == null ? p.PositionCandidate == null ? "-" : $"{p.PositionCandidate}/-" :
PositionCandidate = p.PositionCandidate, //ตำแหน่งที่สอบแข่งขัน
OcCandidate = p.root == null ? p.positionName == null ? "-" : $"{p.positionName}/-" :
p.node == 4
? p.positionName == null ? $"{p.child4}/{p.child3}/{p.child2}/{p.child1}/{p.root}" : $"{p.positionName}/{p.child4}/{p.child3}/{p.child2}/{p.child1}/{p.root}" :
p.node == 3
@ -1672,7 +1627,6 @@ namespace BMA.EHR.Placement.Service.Controllers
var placementProfile = await _context.PlacementProfiles
.Include(x => x.PlacementCertificates)
.Include(x => x.PlacementEducations)
.ThenInclude(x => x.EducationLevel)
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.ToListAsync();
@ -1741,8 +1695,8 @@ namespace BMA.EHR.Placement.Service.Controllers
other = e.Other ?? string.Empty,
startDate = e.StartDate ?? null,
endDate = e.EndDate ?? null,
educationLevel = e.EducationLevel?.Name ?? string.Empty,
educationLevelId = e.EducationLevel?.Id.ToString() ?? string.Empty,
educationLevel = e.EducationLevelName,
educationLevelId = e.EducationLevelId,
positionPath = e.PositionPath?.Name ?? string.Empty,
positionPathId = e.PositionPath?.Id.ToString() ?? string.Empty,
isDate = e.IsDate ?? false,
@ -1919,7 +1873,7 @@ namespace BMA.EHR.Placement.Service.Controllers
Salary = r.Amount == null ? "-" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber().ToThaiNumber(),
AppointDate = p.ReportingDate == null ? "-" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
CommandExcecuteDate = string.IsNullOrEmpty(r.CommandExcecuteDate.ToString()) ? "-" : r.CommandExcecuteDate.Value.ToThaiShortDate2().ToThaiNumber(),
PositionCandidate = p.positionName,
PositionCandidate = p.PositionCandidate,
RemarkHorizontal = r.RemarkHorizontal,
RemarkVertical = r.RemarkVertical,
}).ToList();
@ -1930,7 +1884,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
No = _null,
@ -1977,7 +1932,6 @@ namespace BMA.EHR.Placement.Service.Controllers
var placementProfile = await _context.PlacementProfiles
.Include(x => x.PlacementCertificates)
.Include(x => x.PlacementEducations)
.ThenInclude(x => x.EducationLevel)
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.ToListAsync();
@ -2017,16 +1971,16 @@ namespace BMA.EHR.Placement.Service.Controllers
gender = p.Gender == null ? string.Empty : p.Gender,
relationship = p.Relationship == null ? string.Empty : p.Relationship,
religion = p.Religion == null ? string.Empty : p.Religion,
bloodGroup = string.Empty,
bloodGroup = p.BloodGroup,
registrationAddress = p.RegistAddress == null ? string.Empty : p.RegistAddress,
registrationProvinceId = (String?)null,
registrationDistrictId = (String?)null,
registrationSubDistrictId = (String?)null,
registrationProvinceId = p.RegistProvinceId,
registrationDistrictId = p.RegistDistrictId,
registrationSubDistrictId = p.RegistSubDistrictId,
registrationZipCode = p.RegistZipCode == null ? string.Empty : p.RegistZipCode,
currentAddress = p.CurrentAddress == null ? string.Empty : p.CurrentAddress,
currentProvinceId = (String?)null,
currentDistrictId = (String?)null,
currentSubDistrictId = (String?)null,
currentProvinceId = p.CurrentProvinceId,
currentDistrictId = p.CurrentDistrictId,
currentSubDistrictId = p.CurrentSubDistrictId,
currentZipCode = p.CurrentZipCode == null ? string.Empty : p.CurrentZipCode,
amount = r.amount,
amountSpecial = r.amountSpecial,
@ -2046,8 +2000,8 @@ namespace BMA.EHR.Placement.Service.Controllers
other = e.Other ?? string.Empty,
startDate = e.StartDate ?? null,
endDate = e.EndDate ?? null,
educationLevel = e.EducationLevel?.Name ?? string.Empty,
educationLevelId = e.EducationLevel?.Id.ToString() ?? string.Empty,
educationLevel = e.EducationLevelName,
educationLevelId = e.EducationLevelId,
positionPath = e.PositionPath?.Name ?? string.Empty,
positionPathId = e.PositionPath?.Id.ToString() ?? string.Empty,
isDate = e.IsDate ?? false,
@ -2255,7 +2209,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
No = _null,
@ -2483,7 +2438,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
No = _null,
@ -2702,7 +2658,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
No = _null,
@ -2722,7 +2679,7 @@ namespace BMA.EHR.Placement.Service.Controllers
AppointDate = _null,
RemarkHorizontal = _null,
RemarkVertical = _null,
});
});
}
}
return Success(result);