แก้บันทึกพ้นราชการ (ยังไม่เสร็จ)
This commit is contained in:
parent
e55c0f746b
commit
2e7abdb60a
13 changed files with 12478 additions and 189 deletions
|
|
@ -7,10 +7,13 @@ namespace BMA.EHR.Domain.Models.MetaData
|
|||
{
|
||||
public class PositionEmployeeLevel : EntityBase
|
||||
{
|
||||
[Required, MaxLength(100), Column(Order = 1), Comment("ชื่อระดับชั้นงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ")]
|
||||
[Column(Order = 1), Comment("ลำดับ")]
|
||||
public int? Order { get; set; }
|
||||
|
||||
[Required, MaxLength(100), Column(Order = 2), Comment("ชื่อระดับชั้นงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[Column(Order = 2), Comment("สถานะการใช้งาน")]
|
||||
[Column(Order = 3), Comment("สถานะการใช้งาน")]
|
||||
public bool IsActive { get; set; } = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,16 +7,19 @@ namespace BMA.EHR.Domain.Models.MetaData
|
|||
{
|
||||
public class PositionLevel : EntityBase
|
||||
{
|
||||
[Required, MaxLength(100), Column(Order = 1), Comment("ชื่อระดับตำแหน่ง")]
|
||||
[Column(Order = 1), Comment("ลำดับ")]
|
||||
public int? Order { get; set; }
|
||||
|
||||
[Required, MaxLength(100), Column(Order = 2), Comment("ชื่อระดับตำแหน่ง")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[Required, MaxLength(100), Column(Order = 2), Comment("ชื่อย่อระดับตำแหน่ง")]
|
||||
[Required, MaxLength(100), Column(Order = 3), Comment("ชื่อย่อระดับตำแหน่ง")]
|
||||
public string ShortName { get; set; } = string.Empty;
|
||||
|
||||
[Column(Order = 3), Comment("ลำดับชั้นของระดับตำแหน่ง")]
|
||||
[Column(Order = 4), Comment("ลำดับชั้นของระดับตำแหน่ง")]
|
||||
public int Level { get; set; } = 0;
|
||||
|
||||
[Column(Order = 4), Comment("สถานะการใช้งาน")]
|
||||
[Column(Order = 5), Comment("สถานะการใช้งาน")]
|
||||
public bool IsActive { get; set; } = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,10 +7,13 @@ namespace BMA.EHR.Domain.Models.MetaData
|
|||
{
|
||||
public class PositionType : EntityBase
|
||||
{
|
||||
[Required, MaxLength(100), Column(Order = 1), Comment("ชื่อประเภทตำแหน่ง")]
|
||||
[Column(Order = 1), Comment("ลำดับ")]
|
||||
public int? Order { get; set; }
|
||||
|
||||
[Required, MaxLength(100), Column(Order = 2), Comment("ชื่อประเภทตำแหน่ง")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[Column(Order = 2), Comment("สถานะการใช้งาน")]
|
||||
[Column(Order = 3), Comment("สถานะการใช้งาน")]
|
||||
public bool IsActive { get; set; } = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,10 +8,13 @@ namespace BMA.EHR.Domain.Models.Retirement
|
|||
{
|
||||
[Comment("ครั้งที่")]
|
||||
public int Round { get; set; }
|
||||
[Comment("ประเภทคำสั่ง")]
|
||||
public string? TypeReport { get; set; } = string.Empty;
|
||||
[Comment("ปีงบประมาณ")]
|
||||
public int Year { get; set; }
|
||||
[Comment("ประเภท")]
|
||||
public string Type { get; set; } = string.Empty;
|
||||
public virtual List<RetirementPeriodHistory> RetirementPeriodHistorys { get; set; } = new List<RetirementPeriodHistory>();
|
||||
public virtual List<RetirementProfile> RetirementProfiles { get; set; } = new List<RetirementProfile>();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
23
BMA.EHR.Domain/Models/Retirement/RetirementPeriodHistory.cs
Normal file
23
BMA.EHR.Domain/Models/Retirement/RetirementPeriodHistory.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using BMA.EHR.Domain.Models.Base;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Retirement
|
||||
{
|
||||
public class RetirementPeriodHistory : EntityBase
|
||||
{
|
||||
[Comment("ครั้งที่")]
|
||||
public int Round { get; set; }
|
||||
[Comment("ประเภทคำสั่ง")]
|
||||
public string? TypeReport { get; set; } = string.Empty;
|
||||
[Comment("ปีงบประมาณ")]
|
||||
public int Year { get; set; }
|
||||
[Comment("จำนวนคน")]
|
||||
public int Total { get; set; }
|
||||
[Comment("ประเภท")]
|
||||
public string Type { get; set; } = string.Empty;
|
||||
[Comment("รายชื่อเกษียญ")]
|
||||
public string ProfileFile { get; set; }
|
||||
public RetirementPeriod RetirementPeriod { get; set; }
|
||||
}
|
||||
}
|
||||
11811
BMA.EHR.Infrastructure/Migrations/20230727073704_update Table positionpath add order.Designer.cs
generated
Normal file
11811
BMA.EHR.Infrastructure/Migrations/20230727073704_update Table positionpath add order.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,278 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class updateTablepositionpathaddorder : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Name",
|
||||
table: "PositionTypes",
|
||||
type: "varchar(100)",
|
||||
maxLength: 100,
|
||||
nullable: false,
|
||||
comment: "ชื่อประเภทตำแหน่ง",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "varchar(100)",
|
||||
oldMaxLength: 100,
|
||||
oldComment: "ชื่อประเภทตำแหน่ง")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.Annotation("Relational:ColumnOrder", 2)
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("Relational:ColumnOrder", 1);
|
||||
|
||||
migrationBuilder.AlterColumn<bool>(
|
||||
name: "IsActive",
|
||||
table: "PositionTypes",
|
||||
type: "tinyint(1)",
|
||||
nullable: false,
|
||||
comment: "สถานะการใช้งาน",
|
||||
oldClrType: typeof(bool),
|
||||
oldType: "tinyint(1)",
|
||||
oldComment: "สถานะการใช้งาน")
|
||||
.Annotation("Relational:ColumnOrder", 3)
|
||||
.OldAnnotation("Relational:ColumnOrder", 2);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Order",
|
||||
table: "PositionTypes",
|
||||
type: "int",
|
||||
nullable: true,
|
||||
comment: "ลำดับ")
|
||||
.Annotation("Relational:ColumnOrder", 1);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "ShortName",
|
||||
table: "PositionLevels",
|
||||
type: "varchar(100)",
|
||||
maxLength: 100,
|
||||
nullable: false,
|
||||
comment: "ชื่อย่อระดับตำแหน่ง",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "varchar(100)",
|
||||
oldMaxLength: 100,
|
||||
oldComment: "ชื่อย่อระดับตำแหน่ง")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.Annotation("Relational:ColumnOrder", 3)
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("Relational:ColumnOrder", 2);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Name",
|
||||
table: "PositionLevels",
|
||||
type: "varchar(100)",
|
||||
maxLength: 100,
|
||||
nullable: false,
|
||||
comment: "ชื่อระดับตำแหน่ง",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "varchar(100)",
|
||||
oldMaxLength: 100,
|
||||
oldComment: "ชื่อระดับตำแหน่ง")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.Annotation("Relational:ColumnOrder", 2)
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("Relational:ColumnOrder", 1);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "Level",
|
||||
table: "PositionLevels",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
comment: "ลำดับชั้นของระดับตำแหน่ง",
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int",
|
||||
oldComment: "ลำดับชั้นของระดับตำแหน่ง")
|
||||
.Annotation("Relational:ColumnOrder", 4)
|
||||
.OldAnnotation("Relational:ColumnOrder", 3);
|
||||
|
||||
migrationBuilder.AlterColumn<bool>(
|
||||
name: "IsActive",
|
||||
table: "PositionLevels",
|
||||
type: "tinyint(1)",
|
||||
nullable: false,
|
||||
comment: "สถานะการใช้งาน",
|
||||
oldClrType: typeof(bool),
|
||||
oldType: "tinyint(1)",
|
||||
oldComment: "สถานะการใช้งาน")
|
||||
.Annotation("Relational:ColumnOrder", 5)
|
||||
.OldAnnotation("Relational:ColumnOrder", 4);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Order",
|
||||
table: "PositionLevels",
|
||||
type: "int",
|
||||
nullable: true,
|
||||
comment: "ลำดับ")
|
||||
.Annotation("Relational:ColumnOrder", 1);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Name",
|
||||
table: "PositionEmployeeLevels",
|
||||
type: "varchar(100)",
|
||||
maxLength: 100,
|
||||
nullable: false,
|
||||
comment: "ชื่อระดับชั้นงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "varchar(100)",
|
||||
oldMaxLength: 100,
|
||||
oldComment: "ชื่อระดับชั้นงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.Annotation("Relational:ColumnOrder", 2)
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("Relational:ColumnOrder", 1);
|
||||
|
||||
migrationBuilder.AlterColumn<bool>(
|
||||
name: "IsActive",
|
||||
table: "PositionEmployeeLevels",
|
||||
type: "tinyint(1)",
|
||||
nullable: false,
|
||||
comment: "สถานะการใช้งาน",
|
||||
oldClrType: typeof(bool),
|
||||
oldType: "tinyint(1)",
|
||||
oldComment: "สถานะการใช้งาน")
|
||||
.Annotation("Relational:ColumnOrder", 3)
|
||||
.OldAnnotation("Relational:ColumnOrder", 2);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Order",
|
||||
table: "PositionEmployeeLevels",
|
||||
type: "int",
|
||||
nullable: true,
|
||||
comment: "ลำดับ")
|
||||
.Annotation("Relational:ColumnOrder", 1);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Order",
|
||||
table: "PositionTypes");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Order",
|
||||
table: "PositionLevels");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Order",
|
||||
table: "PositionEmployeeLevels");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Name",
|
||||
table: "PositionTypes",
|
||||
type: "varchar(100)",
|
||||
maxLength: 100,
|
||||
nullable: false,
|
||||
comment: "ชื่อประเภทตำแหน่ง",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "varchar(100)",
|
||||
oldMaxLength: 100,
|
||||
oldComment: "ชื่อประเภทตำแหน่ง")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.Annotation("Relational:ColumnOrder", 1)
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("Relational:ColumnOrder", 2);
|
||||
|
||||
migrationBuilder.AlterColumn<bool>(
|
||||
name: "IsActive",
|
||||
table: "PositionTypes",
|
||||
type: "tinyint(1)",
|
||||
nullable: false,
|
||||
comment: "สถานะการใช้งาน",
|
||||
oldClrType: typeof(bool),
|
||||
oldType: "tinyint(1)",
|
||||
oldComment: "สถานะการใช้งาน")
|
||||
.Annotation("Relational:ColumnOrder", 2)
|
||||
.OldAnnotation("Relational:ColumnOrder", 3);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "ShortName",
|
||||
table: "PositionLevels",
|
||||
type: "varchar(100)",
|
||||
maxLength: 100,
|
||||
nullable: false,
|
||||
comment: "ชื่อย่อระดับตำแหน่ง",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "varchar(100)",
|
||||
oldMaxLength: 100,
|
||||
oldComment: "ชื่อย่อระดับตำแหน่ง")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.Annotation("Relational:ColumnOrder", 2)
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("Relational:ColumnOrder", 3);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Name",
|
||||
table: "PositionLevels",
|
||||
type: "varchar(100)",
|
||||
maxLength: 100,
|
||||
nullable: false,
|
||||
comment: "ชื่อระดับตำแหน่ง",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "varchar(100)",
|
||||
oldMaxLength: 100,
|
||||
oldComment: "ชื่อระดับตำแหน่ง")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.Annotation("Relational:ColumnOrder", 1)
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("Relational:ColumnOrder", 2);
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "Level",
|
||||
table: "PositionLevels",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
comment: "ลำดับชั้นของระดับตำแหน่ง",
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int",
|
||||
oldComment: "ลำดับชั้นของระดับตำแหน่ง")
|
||||
.Annotation("Relational:ColumnOrder", 3)
|
||||
.OldAnnotation("Relational:ColumnOrder", 4);
|
||||
|
||||
migrationBuilder.AlterColumn<bool>(
|
||||
name: "IsActive",
|
||||
table: "PositionLevels",
|
||||
type: "tinyint(1)",
|
||||
nullable: false,
|
||||
comment: "สถานะการใช้งาน",
|
||||
oldClrType: typeof(bool),
|
||||
oldType: "tinyint(1)",
|
||||
oldComment: "สถานะการใช้งาน")
|
||||
.Annotation("Relational:ColumnOrder", 4)
|
||||
.OldAnnotation("Relational:ColumnOrder", 5);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Name",
|
||||
table: "PositionEmployeeLevels",
|
||||
type: "varchar(100)",
|
||||
maxLength: 100,
|
||||
nullable: false,
|
||||
comment: "ชื่อระดับชั้นงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "varchar(100)",
|
||||
oldMaxLength: 100,
|
||||
oldComment: "ชื่อระดับชั้นงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.Annotation("Relational:ColumnOrder", 1)
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("Relational:ColumnOrder", 2);
|
||||
|
||||
migrationBuilder.AlterColumn<bool>(
|
||||
name: "IsActive",
|
||||
table: "PositionEmployeeLevels",
|
||||
type: "tinyint(1)",
|
||||
nullable: false,
|
||||
comment: "สถานะการใช้งาน",
|
||||
oldClrType: typeof(bool),
|
||||
oldType: "tinyint(1)",
|
||||
oldComment: "สถานะการใช้งาน")
|
||||
.Annotation("Relational:ColumnOrder", 2)
|
||||
.OldAnnotation("Relational:ColumnOrder", 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -6534,7 +6534,7 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasColumnOrder(2)
|
||||
.HasColumnOrder(3)
|
||||
.HasComment("สถานะการใช้งาน");
|
||||
|
||||
b.Property<string>("LastUpdateFullName")
|
||||
|
|
@ -6560,9 +6560,14 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)")
|
||||
.HasColumnOrder(1)
|
||||
.HasColumnOrder(2)
|
||||
.HasComment("ชื่อระดับชั้นงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ");
|
||||
|
||||
b.Property<int?>("Order")
|
||||
.HasColumnType("int")
|
||||
.HasColumnOrder(1)
|
||||
.HasComment("ลำดับ");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("PositionEmployeeLevels");
|
||||
|
|
@ -7000,7 +7005,7 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasColumnOrder(4)
|
||||
.HasColumnOrder(5)
|
||||
.HasComment("สถานะการใช้งาน");
|
||||
|
||||
b.Property<string>("LastUpdateFullName")
|
||||
|
|
@ -7024,21 +7029,26 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
b.Property<int>("Level")
|
||||
.HasColumnType("int")
|
||||
.HasColumnOrder(3)
|
||||
.HasColumnOrder(4)
|
||||
.HasComment("ลำดับชั้นของระดับตำแหน่ง");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)")
|
||||
.HasColumnOrder(1)
|
||||
.HasColumnOrder(2)
|
||||
.HasComment("ชื่อระดับตำแหน่ง");
|
||||
|
||||
b.Property<int?>("Order")
|
||||
.HasColumnType("int")
|
||||
.HasColumnOrder(1)
|
||||
.HasComment("ลำดับ");
|
||||
|
||||
b.Property<string>("ShortName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)")
|
||||
.HasColumnOrder(2)
|
||||
.HasColumnOrder(3)
|
||||
.HasComment("ชื่อย่อระดับตำแหน่ง");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
|
@ -7344,7 +7354,7 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasColumnOrder(2)
|
||||
.HasColumnOrder(3)
|
||||
.HasComment("สถานะการใช้งาน");
|
||||
|
||||
b.Property<string>("LastUpdateFullName")
|
||||
|
|
@ -7370,9 +7380,14 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)")
|
||||
.HasColumnOrder(1)
|
||||
.HasColumnOrder(2)
|
||||
.HasComment("ชื่อประเภทตำแหน่ง");
|
||||
|
||||
b.Property<int?>("Order")
|
||||
.HasColumnType("int")
|
||||
.HasColumnOrder(1)
|
||||
.HasComment("ลำดับ");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("PositionTypes");
|
||||
|
|
|
|||
|
|
@ -295,6 +295,8 @@ namespace BMA.EHR.Infrastructure.Persistence
|
|||
|
||||
#region " Retirement "
|
||||
|
||||
public DbSet<RetirementPeriodHistory> RetirementPeriodHistorys { get; set; }
|
||||
|
||||
public DbSet<RetirementPeriod> RetirementPeriods { get; set; }
|
||||
|
||||
public DbSet<RetirementProfile> RetirementProfiles { get; set; }
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
private readonly ApplicationDBContext _context;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly AmazonS3Client _s3Client;
|
||||
private readonly IWebHostEnvironment _hostingEnvironment;
|
||||
private string _bucketName = string.Empty;
|
||||
|
||||
#endregion
|
||||
|
|
@ -25,10 +26,12 @@ namespace BMA.EHR.Application.Repositories
|
|||
#region " Constructors "
|
||||
|
||||
public MinIOService(ApplicationDBContext context,
|
||||
IConfiguration configuration)
|
||||
IConfiguration configuration,
|
||||
IWebHostEnvironment hostingEnvironment)
|
||||
{
|
||||
_context = context;
|
||||
_configuration = configuration;
|
||||
_hostingEnvironment = hostingEnvironment;
|
||||
|
||||
var config = new AmazonS3Config
|
||||
{
|
||||
|
|
@ -252,5 +255,84 @@ namespace BMA.EHR.Application.Repositories
|
|||
return "EMPLOYEE_TEMP";
|
||||
return "EMPLOYEE";
|
||||
}
|
||||
|
||||
public async Task UploadFileAsyncTemp(string fileName, string subFolder)
|
||||
{
|
||||
try
|
||||
{
|
||||
var fileContents = File.ReadAllBytes(fileName);
|
||||
System.IO.MemoryStream filestream = new System.IO.MemoryStream(fileContents);
|
||||
//var fileNameWithoutExt = Path.GetFileNameWithoutExtension(fileName);
|
||||
var fileExt = Path.GetExtension(fileName);
|
||||
// var fileType = MimeTypeMap.GetMimeType(fileExt);
|
||||
var file_name = Path.GetFileName(fileName);
|
||||
|
||||
var request = new PutObjectRequest
|
||||
{
|
||||
BucketName = $"{_bucketName}{subFolder}",
|
||||
Key = file_name,
|
||||
InputStream = filestream,
|
||||
// ContentType = fileType,
|
||||
CannedACL = S3CannedACL.PublicRead
|
||||
};
|
||||
|
||||
await _s3Client.PutObjectAsync(request);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<string> GenerateJsonFile(string json, string path, string fileName)
|
||||
{
|
||||
var tmpFile = "";
|
||||
try
|
||||
{
|
||||
var tmpDir = Path.Combine(_hostingEnvironment.ContentRootPath, "tmp");
|
||||
if (!Directory.Exists(tmpDir))
|
||||
Directory.CreateDirectory(tmpDir);
|
||||
|
||||
tmpFile = Path.Combine(tmpDir, fileName);
|
||||
SaveToJsonFile(tmpFile, json);
|
||||
|
||||
await UploadFileAsyncTemp(tmpFile, path);
|
||||
|
||||
return "EMPLOYEE";
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (tmpFile != "")
|
||||
{
|
||||
if (System.IO.File.Exists(tmpFile))
|
||||
System.IO.File.Delete(tmpFile);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveToJsonFile(string fileName, string data)
|
||||
{
|
||||
TextWriter writer = null;
|
||||
try
|
||||
{
|
||||
writer = new StreamWriter(fileName);
|
||||
writer.Write(data);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (writer != null)
|
||||
writer.Close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -550,10 +550,29 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
[HttpPost("pass/disclaim")]
|
||||
public async Task<ActionResult<ResponseObject>> UpdatePersonDisclaim([FromBody] PersonDisclaimRequest req)
|
||||
{
|
||||
var person = await _context.PlacementProfiles.FindAsync(req.PersonalId);
|
||||
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);
|
||||
|
||||
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;
|
||||
person.PositionSalaryAmount = null;
|
||||
person.RecruitDate = null;
|
||||
person.RejectReason = req.Note;
|
||||
person.PlacementStatus = "DISCLAIM";
|
||||
person.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
|
|
@ -1046,11 +1065,11 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
return Success(position);
|
||||
}
|
||||
|
||||
[HttpPut("position/{placementId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> UpdatePositionDraft([FromBody] List<Guid> items, Guid placementId)
|
||||
[HttpPut("position/{personalId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> UpdatePositionDraft([FromBody] List<Guid> items, Guid personalId)
|
||||
{
|
||||
var placement = await _context.Placements
|
||||
.FirstOrDefaultAsync(x => x.Id == placementId);
|
||||
.FirstOrDefaultAsync(x => x.Id == personalId);
|
||||
if (placement == null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
|
||||
|
|
@ -1066,5 +1085,35 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
return Success();
|
||||
}
|
||||
|
||||
[HttpPost("position/clear/{personalId:length(36)}")]
|
||||
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);
|
||||
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.RecruitDate = null;
|
||||
_context.SaveChanges();
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,47 +51,90 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
#endregion
|
||||
|
||||
#region " จัดลำดับเกษียณ "
|
||||
private async Task GenOrderByYear(string type, int year)
|
||||
private class ObjectOrderRetire
|
||||
{
|
||||
if (type.Trim().ToUpper().Contains("OFFICER"))
|
||||
{
|
||||
var profiles = await _context.RetirementProfiles
|
||||
.Where(x => x.RetirementPeriod.Year == year)
|
||||
.Where(x => x.RetirementPeriod.Type.Trim().ToUpper().Contains(type.Trim().ToUpper()))
|
||||
.OrderBy(x => x.Profile.OrganizationOrganization)
|
||||
.ThenBy(x => x.Profile.PositionType == null ? null : x.Profile.PositionType.Name)
|
||||
.ThenBy(x => x.Profile.PositionLevel == null ? null : x.Profile.PositionLevel.Name)
|
||||
public int Order { get; set; }
|
||||
public int? Order1 { get; set; }
|
||||
public int? Order2 { get; set; }
|
||||
public int? Order3 { get; set; }
|
||||
public string LastUpdateFullName { get; set; }
|
||||
public string LastUpdateUserId { get; set; }
|
||||
public DateTime? LastUpdatedAt { get; set; }
|
||||
public Guid? Id { get; set; }
|
||||
}
|
||||
private async Task GenOrderByYear(Guid id)
|
||||
{
|
||||
var Org = await _context.Organizations.FirstOrDefaultAsync(x => x.OrganizationOrder == null);
|
||||
var ocIdList = await _context.Organizations.Select(x => x.Id).ToListAsync();
|
||||
if (Org != null)
|
||||
ocIdList = _documentService.GetAllIdByRoot(Org.Id);
|
||||
var retire = await _context.RetirementPeriods
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (retire == null)
|
||||
return;
|
||||
var _retireProfile = await _context.RetirementProfiles
|
||||
.Where(x => x.RetirementPeriod == retire)
|
||||
.ToListAsync();
|
||||
var order = 1;
|
||||
foreach (var profile in profiles)
|
||||
{
|
||||
profile.Order = order;
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = DateTime.Now;
|
||||
order++;
|
||||
}
|
||||
}
|
||||
if (type.Trim().ToUpper().Contains("EMPLOYEE"))
|
||||
var profiles = new List<ObjectOrderRetire>();
|
||||
if (retire.Type.Trim().ToUpper().Contains("OFFICER"))
|
||||
{
|
||||
var profiles = await _context.RetirementProfiles
|
||||
.Where(x => x.RetirementPeriod.Year == year)
|
||||
.Where(x => x.RetirementPeriod.Type.Trim().ToUpper().Contains(type.Trim().ToUpper()))
|
||||
.OrderBy(x => x.Profile.OrganizationOrganization)
|
||||
.ThenBy(x => x.Profile.EmployeeType)
|
||||
.ThenBy(x => x.Profile.PositionEmployeeLevel)
|
||||
.ToListAsync();
|
||||
var order = 1;
|
||||
foreach (var profile in profiles)
|
||||
{
|
||||
profile.Order = order;
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = DateTime.Now;
|
||||
order++;
|
||||
}
|
||||
profiles = await (from x in _context.RetirementProfiles
|
||||
where x.RetirementPeriod == retire
|
||||
select new ObjectOrderRetire
|
||||
{
|
||||
Id = x.Id,
|
||||
Order = x.Order,
|
||||
Order1 = x.Profile == null ? 999999999 : ocIdList.IndexOf((Guid)(x.Profile.OcId)),
|
||||
Order2 = x.Profile == null || x.Profile.PositionType == null ? 999999999 : x.Profile.PositionType.Order,
|
||||
Order3 = x.Profile == null || x.Profile.PositionLevel == null ? 999999999 : x.Profile.PositionLevel.Level,
|
||||
LastUpdateFullName = x.LastUpdateFullName,
|
||||
LastUpdateUserId = x.LastUpdateUserId,
|
||||
LastUpdatedAt = x.LastUpdatedAt,
|
||||
}).ToListAsync();
|
||||
}
|
||||
_context.SaveChanges();
|
||||
if (retire.Type.Trim().ToUpper().Contains("EMPLOYEE"))
|
||||
{
|
||||
profiles = await (from x in _context.RetirementProfiles
|
||||
where x.RetirementPeriod == retire
|
||||
// x.Profile.PositionEmployeeLevelId == null ? null : x.Profile.PositionEmployeeLevelId.Order
|
||||
select new ObjectOrderRetire
|
||||
{
|
||||
Id = x.Id,
|
||||
Order = x.Order,
|
||||
Order1 = x.Profile == null ? null : ocIdList.IndexOf((Guid)(x.Profile.OcId)),
|
||||
LastUpdateFullName = x.LastUpdateFullName,
|
||||
LastUpdateUserId = x.LastUpdateUserId,
|
||||
LastUpdatedAt = x.LastUpdatedAt,
|
||||
}).ToListAsync();
|
||||
}
|
||||
var _profiles = profiles.AsQueryable().OrderBy(x => x.Order1).ThenBy(x => x.Order2).ThenBy(x => x.Order3).ToList();
|
||||
var order = 1;
|
||||
foreach (var profile in _profiles)
|
||||
{
|
||||
var retireProfile = _retireProfile.Find(x => x.Id == profile.Id);
|
||||
retireProfile.Order = order;
|
||||
retireProfile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
retireProfile.LastUpdateUserId = UserId ?? "";
|
||||
retireProfile.LastUpdatedAt = DateTime.Now;
|
||||
order++;
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
private int SortOrg(Guid? ocId)
|
||||
{
|
||||
if (ocId == null)
|
||||
return 999999999;
|
||||
var Org = _context.Organizations.Include(x => x.OrganizationOrganization).FirstOrDefault(x => x.OrganizationOrder == null);
|
||||
if (Org != null && Org.OrganizationOrganization != null && Org.OrganizationOrganization.Name.Contains("ปลัด"))
|
||||
return -1;
|
||||
var ocIdList = _context.Organizations.Select(x => x.Id).ToList();
|
||||
if (Org != null)
|
||||
ocIdList = _documentService.GetAllIdByRoot(Org.Id);
|
||||
int index = ocIdList.IndexOf((Guid)ocId);
|
||||
if (index == -1)
|
||||
return 999999999;
|
||||
return index;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
|
@ -110,29 +153,20 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
{
|
||||
if (type.Trim().ToUpper().Contains("OFFICER") || type.Trim().ToUpper().Contains("EMPLOYEE"))
|
||||
{
|
||||
var retire_old = await _context.RetirementPeriods
|
||||
.Include(x => x.RetirementProfiles)
|
||||
var retire_old = await _context.RetirementPeriodHistorys
|
||||
.Where(x => x.Year == year)
|
||||
.Where(x => x.Type.Trim().ToUpper().Contains(type.Trim().ToUpper()))
|
||||
.OrderByDescending(x => x.Round)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
if (retire_old != null)
|
||||
{
|
||||
var data = await _context.RetirementPeriods
|
||||
.Where(x => x.Type.Trim().ToUpper().Contains(type.Trim().ToUpper()))
|
||||
.Where(x => year > 0 ? (x.Year == year) : (x.Year > 0))
|
||||
.Select(x => new
|
||||
{
|
||||
Id = x.Id,
|
||||
CreatedAt = x.CreatedAt,
|
||||
Year = x.Year,
|
||||
Round = x.Round,
|
||||
Total = retire_old.Id == x.Id ? retire_old.RetirementProfiles.Count() : retire_old.RetirementProfiles.Count() - x.RetirementProfiles.Where(x => x.Remove != "pending").Count(),
|
||||
}).OrderByDescending(x => x.CreatedAt)
|
||||
.ToListAsync();
|
||||
return Success(data);
|
||||
}
|
||||
.Select(x => new
|
||||
{
|
||||
Id = x.Id,
|
||||
CreatedAt = x.CreatedAt,
|
||||
Year = x.Year,
|
||||
Round = x.Round,
|
||||
Total = x.Total,
|
||||
})
|
||||
.ToListAsync();
|
||||
return Success(retire_old);
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
|
|
@ -147,61 +181,40 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("profile/{type}/{year}")]
|
||||
public async Task<ActionResult<ResponseObject>> CreateProfileRetirement(string type, int year)
|
||||
[HttpGet("profile/{retire_history_id}/{option}/{type}/{year}")]
|
||||
public async Task<ActionResult<ResponseObject>> CreateProfileRetirement(Guid retire_history_id, string option, string type, int year)
|
||||
{
|
||||
var round = 1;
|
||||
var retire_old = await _context.RetirementPeriods
|
||||
.Include(x => x.RetirementProfiles)
|
||||
.Where(x => x.Year == year)
|
||||
.Where(x => x.Type.Trim().ToUpper().Contains(type.Trim().ToUpper()))
|
||||
.OrderByDescending(x => x.Round)
|
||||
.FirstOrDefaultAsync();
|
||||
if (retire_old != null)
|
||||
round = retire_old.Round + 1;
|
||||
if (!type.Trim().ToUpper().Contains("EMPLOYEE") && !type.Trim().ToUpper().Contains("OFFICER"))
|
||||
return Error("ประเภทพ้นราชการไม่ถูกต้อง");
|
||||
|
||||
var retire = new RetirementPeriod
|
||||
var round = 1;
|
||||
var retire = await _context.RetirementPeriods
|
||||
.Include(x => x.RetirementPeriodHistorys)
|
||||
.Include(x => x.RetirementProfiles)
|
||||
.ThenInclude(x => x.Profile)
|
||||
.Where(x => x.Year == year)
|
||||
.Where(x => x.Type.Trim().ToUpper().Contains(type.Trim().ToUpper()))
|
||||
.FirstOrDefaultAsync();
|
||||
if (retire == null)
|
||||
{
|
||||
Round = round,
|
||||
Type = type.Trim().ToUpper(),
|
||||
Year = year,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
await _context.RetirementPeriods.AddAsync(retire);
|
||||
if (retire_old != null)
|
||||
{
|
||||
var profiles = await _context.RetirementProfiles
|
||||
.Where(x => x.RetirementPeriod == retire_old)
|
||||
.Where(x => x.Remove == "pending")
|
||||
.Where(x => x.RetirementPeriod.Type.Trim().ToUpper().Contains(type.Trim().ToUpper()))
|
||||
.ToListAsync();
|
||||
foreach (var profile in profiles)
|
||||
retire = new RetirementPeriod
|
||||
{
|
||||
profile.RetirementPeriod = retire;
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = DateTime.Now;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Round = round,
|
||||
TypeReport = null,
|
||||
Type = type.Trim().ToUpper(),
|
||||
Year = year,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
await _context.RetirementPeriods.AddAsync(retire);
|
||||
var profiles = await _context.Profiles.AsQueryable()
|
||||
// .Where(x => x.BirthDate.CalculateRetireDate().Year == year)
|
||||
.Where(x => x.ProfileType.Trim().ToUpper().Contains(type.Trim().ToUpper()))
|
||||
// .Where(x => x.CitizenId == "0000000000001")
|
||||
.ToListAsync();
|
||||
|
||||
// var profiles = await (from p in _context.Profiles
|
||||
// where p.BirthDate.CalculateRetireDate().Year == year
|
||||
// select p)
|
||||
// .ToListAsync();
|
||||
profiles = profiles.Where(x => x.BirthDate.CalculateRetireDate().Year == year).ToList();
|
||||
var order = 1;
|
||||
foreach (var profile in profiles)
|
||||
|
|
@ -222,12 +235,52 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
await _context.RetirementProfiles.AddAsync(data);
|
||||
order++;
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
await GenOrderByYear(retire.Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
var file_name = DateTime.Now.ToString();
|
||||
await _documentService.GenerateJsonFile("xxx", "/retire", file_name);
|
||||
var history = new RetirementPeriodHistory
|
||||
{
|
||||
RetirementPeriod = retire,
|
||||
Round = retire.Round,
|
||||
TypeReport = retire.TypeReport,
|
||||
Year = retire.Year,
|
||||
Type = retire.Type,
|
||||
Total = retire.RetirementProfiles.Count(),
|
||||
ProfileFile = file_name,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
await _context.RetirementPeriodHistorys.AddAsync(history);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
retire.Round = retire.Round + 1;
|
||||
retire.TypeReport = option.Trim().ToUpper();
|
||||
retire.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
retire.LastUpdateUserId = UserId ?? "";
|
||||
retire.LastUpdatedAt = DateTime.Now;
|
||||
// retire_history_id
|
||||
////ดึงไฟล์json
|
||||
// foreach (var retire_profile in retire.RetirementProfiles)
|
||||
// {
|
||||
// retire_profile.Remove = retire_profile.Remove.Trim().ToUpper().Contains("CHANGE") ? "PENDING" : retire_profile.Remove;
|
||||
// retire_profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
// retire_profile.LastUpdateUserId = UserId ?? "";
|
||||
// retire_profile.LastUpdatedAt = DateTime.Now;
|
||||
// }
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
_context.SaveChanges();
|
||||
await _context.SaveChangesAsync();
|
||||
var profile_new = await _context.RetirementProfiles
|
||||
.Where(x => x.RetirementPeriod == retire)
|
||||
.Where(x => x.RetirementPeriod.Type.Trim().ToUpper().Contains(retire.Type.Trim().ToUpper()))
|
||||
.Select(x => new
|
||||
{
|
||||
Order = x.Order,
|
||||
|
|
@ -265,44 +318,12 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
[HttpGet("{retireId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetProfileRetirement(Guid retireId)
|
||||
{
|
||||
var retire = await _context.RetirementPeriods
|
||||
var retire = await _context.RetirementPeriodHistorys
|
||||
.FirstOrDefaultAsync(x => x.Id == retireId);
|
||||
if (retire == null)
|
||||
return Error(GlobalMessages.InvalidRetirementRequest, 404);
|
||||
|
||||
var retire_old = await _context.RetirementPeriods
|
||||
.Where(x => x.CreatedAt < retire.CreatedAt)
|
||||
.Where(x => x.Year == retire.Year)
|
||||
.Where(x => x.Type.Trim().ToUpper().Contains(retire.Type.Trim().ToUpper()))
|
||||
.ToListAsync();
|
||||
|
||||
var profile = await _context.RetirementProfiles
|
||||
.Where(x => !retire_old.Contains(x.RetirementPeriod))
|
||||
.Where(x => x.RetirementPeriod.Type.Trim().ToUpper().Contains(retire.Type.Trim().ToUpper()))
|
||||
.Select(x => new
|
||||
{
|
||||
Order = x.Order,
|
||||
Id = x.Id,
|
||||
Reason = x.Reason,
|
||||
Remove = x.Remove,
|
||||
ProfileId = x.Profile.Id,
|
||||
CitizenId = x.Profile.CitizenId,
|
||||
Prefix = x.Profile.Prefix == null ? null : x.Profile.Prefix.Name,
|
||||
FullName = $"{x.Profile.FirstName} {x.Profile.LastName}",
|
||||
OrganizationOrganization = x.Profile.OrganizationOrganization,
|
||||
Oc = x.Profile.Oc,
|
||||
Position = x.Profile.Position == null ? null : x.Profile.Position.Name,
|
||||
PositionType = x.Profile.PositionType == null ? null : x.Profile.PositionType.Name,
|
||||
PositionExecutive = x.Profile.PositionExecutive,
|
||||
PosNo = x.Profile.PosNo == null ? null : x.Profile.PosNo.Name,
|
||||
PositionEmployeePosition = x.Profile.PositionEmployeePosition,
|
||||
PositionEmployeeLevel = x.Profile.PositionEmployeeLevel,
|
||||
PositionEmployeeGroup = x.Profile.PositionEmployeeGroup,
|
||||
PosNoEmployee = x.Profile.PosNoEmployee,
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
return Success(profile);
|
||||
return Success(retire);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -322,10 +343,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
if (profile == null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
|
||||
profile.Remove = "delete";
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
profile.LastUpdatedAt = DateTime.Now;
|
||||
_context.RetirementProfiles.Remove(profile);
|
||||
_context.SaveChanges();
|
||||
|
||||
return Success();
|
||||
|
|
@ -350,30 +368,26 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
|
||||
var retire = await _context.RetirementPeriods
|
||||
.Include(x => x.RetirementPeriodHistorys)
|
||||
.Include(x => x.RetirementProfiles)
|
||||
.ThenInclude(x => x.Profile)
|
||||
.FirstOrDefaultAsync(x => x.Id == retireId);
|
||||
if (retire == null)
|
||||
return Error(GlobalMessages.InvalidRetirementRequest, 404);
|
||||
var order = 1;
|
||||
var retire_old = await _context.RetirementPeriods
|
||||
.Include(x => x.RetirementProfiles)
|
||||
.ThenInclude(x => x.Profile)
|
||||
.Where(x => x.Year == retire.Year)
|
||||
.Where(x => x.Type.Trim().ToUpper().Contains(retire.Type.Trim().ToUpper()))
|
||||
.ToListAsync();
|
||||
if (retire_old.Where(x => x.RetirementProfiles.Where(y => y.Profile == profile).Count() > 0).Count() > 0)
|
||||
if (retire.RetirementProfiles.Where(x => x.Profile == profile).Count() > 0)
|
||||
return Error("บุคคลนี้ได้ทำการเลือกไว้อยู่แล้ว");
|
||||
foreach (var retire_profile in retire.RetirementProfiles)
|
||||
{
|
||||
retire_profile.Order++;
|
||||
retire_profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
retire_profile.LastUpdateUserId = UserId ?? "";
|
||||
retire_profile.LastUpdatedAt = DateTime.Now;
|
||||
}
|
||||
|
||||
var last_order = await _context.RetirementProfiles
|
||||
.Where(x => retire_old.Contains(x.RetirementPeriod))
|
||||
.Where(x => x.RetirementPeriod.Type.Trim().ToUpper().Contains(retire.Type.Trim().ToUpper()))
|
||||
.OrderByDescending(x => x.Order)
|
||||
.FirstOrDefaultAsync();
|
||||
if (last_order != null)
|
||||
order = last_order.Order + 1;
|
||||
var data = new RetirementProfile
|
||||
{
|
||||
Order = order,
|
||||
Remove = "pending",
|
||||
Order = 1,
|
||||
Remove = "PENDING",
|
||||
RetirementPeriod = retire,
|
||||
Profile = profile,
|
||||
CreatedUserId = FullName ?? "",
|
||||
|
|
@ -383,15 +397,18 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
|
||||
_context.RetirementProfiles.Add(data);
|
||||
_context.SaveChanges();
|
||||
await _context.SaveChangesAsync();
|
||||
// if (retire.RetirementPeriodHistorys.Count() <= 1)
|
||||
// {
|
||||
// await GenOrderByYear(retire.Id);
|
||||
// }
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ใส่เหตุผลไม่เกษียณ
|
||||
/// แก้ไขข้อมูลบุคคล
|
||||
/// </summary>
|
||||
/// <param name="retireProfileId">Id ผู้ใช้งานในประกาศ</param>
|
||||
/// <param name="reason">เหตุผล</param>
|
||||
|
|
@ -408,7 +425,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
if (profile == null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
|
||||
profile.Remove = "change";
|
||||
profile.Remove = "EDIT";
|
||||
profile.Reason = req.Reason;
|
||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
profile.LastUpdateUserId = UserId ?? "";
|
||||
|
|
@ -419,7 +436,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// View เหตุผลไม่เกษียณ
|
||||
/// View เหตุผลแก้ไขข้อมูลบุคคล
|
||||
/// </summary>
|
||||
/// <param name="retireProfileId">Id ผู้ใช้งานในประกาศ</param>
|
||||
/// <returns></returns>
|
||||
|
|
@ -444,7 +461,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// View รายชื่อผู้เกษียณอายุราชการในประกาศ
|
||||
/// จัดอันดับเกษียณ
|
||||
/// </summary>
|
||||
/// <param name="retireId">Id ประกาศ</param>
|
||||
/// <returns></returns>
|
||||
|
|
@ -460,7 +477,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
if (retire == null)
|
||||
return Error(GlobalMessages.InvalidRetirementRequest, 404);
|
||||
|
||||
await GenOrderByYear(retire.Type.Trim().ToUpper(), retire.Year);
|
||||
await GenOrderByYear(retire.Id);
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@
|
|||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
|
||||
"DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||
// "DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||
// "DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||
"DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||
},
|
||||
"Jwt": {
|
||||
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue