no message

This commit is contained in:
kittapath 2024-10-29 17:48:41 +07:00
parent 248d400666
commit 6f3d6f9d72
12 changed files with 19409 additions and 75 deletions

View file

@ -234,6 +234,18 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
}
}
public async Task PushEmailAsync(string Subject, string Body, string Email = "")
{
try
{
_emailSenderService.SendMail(Subject, Body, Email);
}
catch
{
throw;
}
}
public async Task PushNotificationsAsync(Guid[] ReceiverUserIds, string Subject, string Body, string Payload = "", string NotiLink = "", bool IsSendInbox = false, bool IsSendMail = false)
{
try

View file

@ -136,5 +136,6 @@ namespace BMA.EHR.Domain.Models.Retirement
public virtual List<RetirementResignDoc> RetirementResignDocs { get; set; } = new List<RetirementResignDoc>();
public virtual List<RetirementResignDebtDoc> RetirementResignDebtDocs { get; set; } = new List<RetirementResignDebtDoc>();
public virtual List<RetirementResignCancel> RetirementResignCancels { get; set; } = new List<RetirementResignCancel>();
}
}

View file

@ -0,0 +1,132 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using BMA.EHR.Domain.Models.Base;
namespace BMA.EHR.Domain.Models.Retirement
{
public class RetirementResignCancel : EntityBase
{
[Comment("สถานที่ยื่นขอลาออกราชการ")]
public string? Location { get; set; } = string.Empty;
[Comment("วันที่ยื่นขอออกราชการ")]
public DateTime? SendDate { get; set; }
[Comment("วันที่ขอออกราชการ")]
public DateTime? ActiveDate { get; set; }
[Comment("เหตุผลที่ลาออกจากราชการ")]
public string? Reason { get; set; } = string.Empty;
[Comment("สังกัด")]
public string? OrganizationPositionOld { get; set; }
[Comment("ข้อมูลหน่วยงานเดิม ตำแหน่งประเภท")]
public string? PositionTypeOld { get; set; }
[Comment("ข้อมูลหน่วยงานเดิม ระดับ")]
public string? PositionLevelOld { get; set; }
[Comment("ข้อมูลหน่วยงานเดิม เลขที่")]
public string? PositionNumberOld { get; set; }
[Comment("ข้อมูลหน่วยงานเดิม เงินเดือน")]
public double? AmountOld { get; set; }
[Comment("สถานะลาออก")]
public string? Status { get; set; } = "WAITTING";
[Comment("เหตุผลอนุมัติ")]
public string? ApproveReason { get; set; }
[Comment("เหตุผลไม่อนุมัติ")]
public string? RejectReason { get; set; }
[Comment("เหตุผลยกเลิก")]
public string? CancelReason { get; set; }
[Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true;
[Comment("สถานะไม่เป็นหนี้สหกรณ์")]
public bool IsNoDebt { get; set; } = false;
[Comment("สถานะไม่มีภาระผูกพันค้ำประกันทุนการศึกษา")]
public bool IsNoBurden { get; set; } = false;
[Comment("สถานะพฤติการณ์ทางวินัย")]
public bool IsDiscipline { get; set; } = false;
[Comment("สถานะยับยั้งผู้ดูแล")]
public bool? OligarchReject { get; set; }
[Comment("เหตุผลอนุมัติผู้ดูแล")]
public string? OligarchApproveReason { get; set; }
[Comment("เหตุผลยับยั้งผู้ดูแล")]
public string? OligarchRejectReason { get; set; }
[Comment("วันที่ยับยั้งผู้ดูแล")]
public DateTime? OligarchRejectDate { get; set; }
[Comment("สถานะยับยั้งผู้บังคับบัญชา")]
public bool? CommanderReject { get; set; }
[Comment("เหตุผลอนุมัติผู้บังคับบัญชา")]
public string? CommanderApproveReason { get; set; }
[Comment("เหตุผลยับยั้งผู้บังคับบัญชา")]
public string? CommanderRejectReason { get; set; }
[Comment("วันที่ยับยั้งผู้บังคับบัญชา")]
public DateTime? CommanderRejectDate { get; set; }
[Comment("สถานะยับยั้งการเจ้าหน้าที่")]
public bool? OfficerReject { get; set; }
[Comment("เหตุผลอนุมัติการเจ้าหน้าที่")]
public string? OfficerApproveReason { get; set; }
[Comment("เหตุผลยับยั้งการเจ้าหน้าที่")]
public string? OfficerRejectReason { get; set; }
[Comment("วันที่ยับยั้งการเจ้าหน้าที่")]
public DateTime? OfficerRejectDate { get; set; }
[Comment("หมายเหตุแนวนอน")]
public string? RemarkHorizontal { get; set; }
[Comment("สังกัดเดิม")]
public string? OrganizationOld { get; set; }
[Comment("ตำแหน่งเดิม")]
public string? PositionOld { get; set; }
[Comment("profile Id")]
public string? profileId { get; set; }
[Comment("คำนำหน้า")]
public string? prefix { get; set; }
[Comment("ชื่อ")]
public string? firstName { get; set; }
[Comment("นามสกุล")]
public string? lastName { get; set; }
[Comment("เลขบัตรประชาชน")]
public string? citizenId { get; set; }
[Comment("ชื่อหน่วยงาน root old")]
public string? rootOld { get; set; }
[Comment("id หน่วยงาน root old")]
public string? rootOldId { get; set; }
[Comment("ชื่อย่อหน่วยงาน root old")]
public string? rootShortNameOld { get; set; }
[Comment("ชื่อหน่วยงาน child1 old")]
public string? child1Old { get; set; }
[Comment("id หน่วยงาน child1 old")]
public string? child1OldId { get; set; }
[Comment("ชื่อย่อหน่วยงาน child1 old")]
public string? child1ShortNameOld { get; set; }
[Comment("ชื่อหน่วยงาน child2 old")]
public string? child2Old { get; set; }
[Comment("id หน่วยงาน child2 old")]
public string? child2OldId { get; set; }
[Comment("ชื่อย่อหน่วยงาน child2 old")]
public string? child2ShortNameOld { get; set; }
[Comment("ชื่อหน่วยงาน child3 old")]
public string? child3Old { get; set; }
[Comment("id หน่วยงาน child3 old")]
public string? child3OldId { get; set; }
[Comment("ชื่อย่อหน่วยงาน child3 old")]
public string? child3ShortNameOld { get; set; }
[Comment("ชื่อหน่วยงาน child4 old")]
public string? child4Old { get; set; }
[Comment("id หน่วยงาน child4 old")]
public string? child4OldId { get; set; }
[Comment("ชื่อย่อหน่วยงาน child4 old")]
public string? child4ShortNameOld { get; set; }
[Comment("เลขที่ตำแหน่ง old")]
public int? posMasterNoOld { get; set; }
// [Comment("ชื่อตำแหน่งในสายงาน old")]
// public string? positionOld { get; set; }
[Comment("id ประเภทตำแหน่ง old")]
public string? posTypeOldId { get; set; }
[Comment("ชื่อประเภทตำแหน่ง old")]
public string? posTypeNameOld { get; set; }
[Comment("id ระดับตำแหน่ง old")]
public string? posLevelOldId { get; set; }
[Comment("ชื่อระดับตำแหน่ง old")]
public string? posLevelNameOld { get; set; }
[Required, Comment("อ้างอิงรับย้าย")]
public virtual RetirementResign RetirementResign { get; set; }
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,156 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableRetirementResignCancel : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "RetirementResignCancels",
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"),
Location = table.Column<string>(type: "longtext", nullable: true, comment: "สถานที่ยื่นขอลาออกราชการ")
.Annotation("MySql:CharSet", "utf8mb4"),
SendDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่ยื่นขอออกราชการ"),
ActiveDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่ขอออกราชการ"),
Reason = table.Column<string>(type: "longtext", nullable: true, comment: "เหตุผลที่ลาออกจากราชการ")
.Annotation("MySql:CharSet", "utf8mb4"),
OrganizationPositionOld = table.Column<string>(type: "longtext", nullable: true, comment: "สังกัด")
.Annotation("MySql:CharSet", "utf8mb4"),
PositionTypeOld = table.Column<string>(type: "longtext", nullable: true, comment: "ข้อมูลหน่วยงานเดิม ตำแหน่งประเภท")
.Annotation("MySql:CharSet", "utf8mb4"),
PositionLevelOld = table.Column<string>(type: "longtext", nullable: true, comment: "ข้อมูลหน่วยงานเดิม ระดับ")
.Annotation("MySql:CharSet", "utf8mb4"),
PositionNumberOld = table.Column<string>(type: "longtext", nullable: true, comment: "ข้อมูลหน่วยงานเดิม เลขที่")
.Annotation("MySql:CharSet", "utf8mb4"),
AmountOld = table.Column<double>(type: "double", nullable: true, comment: "ข้อมูลหน่วยงานเดิม เงินเดือน"),
Status = table.Column<string>(type: "longtext", nullable: true, comment: "สถานะลาออก")
.Annotation("MySql:CharSet", "utf8mb4"),
ApproveReason = table.Column<string>(type: "longtext", nullable: true, comment: "เหตุผลอนุมัติ")
.Annotation("MySql:CharSet", "utf8mb4"),
RejectReason = table.Column<string>(type: "longtext", nullable: true, comment: "เหตุผลไม่อนุมัติ")
.Annotation("MySql:CharSet", "utf8mb4"),
CancelReason = table.Column<string>(type: "longtext", nullable: true, comment: "เหตุผลยกเลิก")
.Annotation("MySql:CharSet", "utf8mb4"),
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน"),
IsNoDebt = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะไม่เป็นหนี้สหกรณ์"),
IsNoBurden = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะไม่มีภาระผูกพันค้ำประกันทุนการศึกษา"),
IsDiscipline = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะพฤติการณ์ทางวินัย"),
OligarchReject = table.Column<bool>(type: "tinyint(1)", nullable: true, comment: "สถานะยับยั้งผู้ดูแล"),
OligarchApproveReason = table.Column<string>(type: "longtext", nullable: true, comment: "เหตุผลอนุมัติผู้ดูแล")
.Annotation("MySql:CharSet", "utf8mb4"),
OligarchRejectReason = table.Column<string>(type: "longtext", nullable: true, comment: "เหตุผลยับยั้งผู้ดูแล")
.Annotation("MySql:CharSet", "utf8mb4"),
OligarchRejectDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่ยับยั้งผู้ดูแล"),
CommanderReject = table.Column<bool>(type: "tinyint(1)", nullable: true, comment: "สถานะยับยั้งผู้บังคับบัญชา"),
CommanderApproveReason = table.Column<string>(type: "longtext", nullable: true, comment: "เหตุผลอนุมัติผู้บังคับบัญชา")
.Annotation("MySql:CharSet", "utf8mb4"),
CommanderRejectReason = table.Column<string>(type: "longtext", nullable: true, comment: "เหตุผลยับยั้งผู้บังคับบัญชา")
.Annotation("MySql:CharSet", "utf8mb4"),
CommanderRejectDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่ยับยั้งผู้บังคับบัญชา"),
OfficerReject = table.Column<bool>(type: "tinyint(1)", nullable: true, comment: "สถานะยับยั้งการเจ้าหน้าที่"),
OfficerApproveReason = table.Column<string>(type: "longtext", nullable: true, comment: "เหตุผลอนุมัติการเจ้าหน้าที่")
.Annotation("MySql:CharSet", "utf8mb4"),
OfficerRejectReason = table.Column<string>(type: "longtext", nullable: true, comment: "เหตุผลยับยั้งการเจ้าหน้าที่")
.Annotation("MySql:CharSet", "utf8mb4"),
OfficerRejectDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่ยับยั้งการเจ้าหน้าที่"),
RemarkHorizontal = table.Column<string>(type: "longtext", nullable: true, comment: "หมายเหตุแนวนอน")
.Annotation("MySql:CharSet", "utf8mb4"),
OrganizationOld = table.Column<string>(type: "longtext", nullable: true, comment: "สังกัดเดิม")
.Annotation("MySql:CharSet", "utf8mb4"),
PositionOld = table.Column<string>(type: "longtext", nullable: true, comment: "ตำแหน่งเดิม")
.Annotation("MySql:CharSet", "utf8mb4"),
profileId = table.Column<string>(type: "longtext", nullable: true, comment: "profile Id")
.Annotation("MySql:CharSet", "utf8mb4"),
prefix = table.Column<string>(type: "longtext", nullable: true, comment: "คำนำหน้า")
.Annotation("MySql:CharSet", "utf8mb4"),
firstName = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อ")
.Annotation("MySql:CharSet", "utf8mb4"),
lastName = table.Column<string>(type: "longtext", nullable: true, comment: "นามสกุล")
.Annotation("MySql:CharSet", "utf8mb4"),
citizenId = table.Column<string>(type: "longtext", nullable: true, comment: "เลขบัตรประชาชน")
.Annotation("MySql:CharSet", "utf8mb4"),
rootOld = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อหน่วยงาน root old")
.Annotation("MySql:CharSet", "utf8mb4"),
rootOldId = table.Column<string>(type: "longtext", nullable: true, comment: "id หน่วยงาน root old")
.Annotation("MySql:CharSet", "utf8mb4"),
rootShortNameOld = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อย่อหน่วยงาน root old")
.Annotation("MySql:CharSet", "utf8mb4"),
child1Old = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อหน่วยงาน child1 old")
.Annotation("MySql:CharSet", "utf8mb4"),
child1OldId = table.Column<string>(type: "longtext", nullable: true, comment: "id หน่วยงาน child1 old")
.Annotation("MySql:CharSet", "utf8mb4"),
child1ShortNameOld = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อย่อหน่วยงาน child1 old")
.Annotation("MySql:CharSet", "utf8mb4"),
child2Old = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อหน่วยงาน child2 old")
.Annotation("MySql:CharSet", "utf8mb4"),
child2OldId = table.Column<string>(type: "longtext", nullable: true, comment: "id หน่วยงาน child2 old")
.Annotation("MySql:CharSet", "utf8mb4"),
child2ShortNameOld = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อย่อหน่วยงาน child2 old")
.Annotation("MySql:CharSet", "utf8mb4"),
child3Old = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อหน่วยงาน child3 old")
.Annotation("MySql:CharSet", "utf8mb4"),
child3OldId = table.Column<string>(type: "longtext", nullable: true, comment: "id หน่วยงาน child3 old")
.Annotation("MySql:CharSet", "utf8mb4"),
child3ShortNameOld = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อย่อหน่วยงาน child3 old")
.Annotation("MySql:CharSet", "utf8mb4"),
child4Old = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อหน่วยงาน child4 old")
.Annotation("MySql:CharSet", "utf8mb4"),
child4OldId = table.Column<string>(type: "longtext", nullable: true, comment: "id หน่วยงาน child4 old")
.Annotation("MySql:CharSet", "utf8mb4"),
child4ShortNameOld = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อย่อหน่วยงาน child4 old")
.Annotation("MySql:CharSet", "utf8mb4"),
posMasterNoOld = table.Column<int>(type: "int", nullable: true, comment: "เลขที่ตำแหน่ง old"),
posTypeOldId = table.Column<string>(type: "longtext", nullable: true, comment: "id ประเภทตำแหน่ง old")
.Annotation("MySql:CharSet", "utf8mb4"),
posTypeNameOld = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อประเภทตำแหน่ง old")
.Annotation("MySql:CharSet", "utf8mb4"),
posLevelOldId = table.Column<string>(type: "longtext", nullable: true, comment: "id ระดับตำแหน่ง old")
.Annotation("MySql:CharSet", "utf8mb4"),
posLevelNameOld = table.Column<string>(type: "longtext", nullable: true, comment: "ชื่อระดับตำแหน่ง old")
.Annotation("MySql:CharSet", "utf8mb4"),
RetirementResignId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_RetirementResignCancels", x => x.Id);
table.ForeignKey(
name: "FK_RetirementResignCancels_RetirementResigns_RetirementResignId",
column: x => x.RetirementResignId,
principalTable: "RetirementResigns",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_RetirementResignCancels_RetirementResignId",
table: "RetirementResignCancels",
column: "RetirementResignId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "RetirementResignCancels");
}
}
}

View file

@ -16076,6 +16076,291 @@ namespace BMA.EHR.Infrastructure.Migrations
b.ToTable("RetirementResigns");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementResignCancel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime?>("ActiveDate")
.HasColumnType("datetime(6)")
.HasComment("วันที่ขอออกราชการ");
b.Property<double?>("AmountOld")
.HasColumnType("double")
.HasComment("ข้อมูลหน่วยงานเดิม เงินเดือน");
b.Property<string>("ApproveReason")
.HasColumnType("longtext")
.HasComment("เหตุผลอนุมัติ");
b.Property<string>("CancelReason")
.HasColumnType("longtext")
.HasComment("เหตุผลยกเลิก");
b.Property<string>("CommanderApproveReason")
.HasColumnType("longtext")
.HasComment("เหตุผลอนุมัติผู้บังคับบัญชา");
b.Property<bool?>("CommanderReject")
.HasColumnType("tinyint(1)")
.HasComment("สถานะยับยั้งผู้บังคับบัญชา");
b.Property<DateTime?>("CommanderRejectDate")
.HasColumnType("datetime(6)")
.HasComment("วันที่ยับยั้งผู้บังคับบัญชา");
b.Property<string>("CommanderRejectReason")
.HasColumnType("longtext")
.HasComment("เหตุผลยับยั้งผู้บังคับบัญชา");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasComment("สถานะการใช้งาน");
b.Property<bool>("IsDiscipline")
.HasColumnType("tinyint(1)")
.HasComment("สถานะพฤติการณ์ทางวินัย");
b.Property<bool>("IsNoBurden")
.HasColumnType("tinyint(1)")
.HasComment("สถานะไม่มีภาระผูกพันค้ำประกันทุนการศึกษา");
b.Property<bool>("IsNoDebt")
.HasColumnType("tinyint(1)")
.HasComment("สถานะไม่เป็นหนี้สหกรณ์");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("Location")
.HasColumnType("longtext")
.HasComment("สถานที่ยื่นขอลาออกราชการ");
b.Property<string>("OfficerApproveReason")
.HasColumnType("longtext")
.HasComment("เหตุผลอนุมัติการเจ้าหน้าที่");
b.Property<bool?>("OfficerReject")
.HasColumnType("tinyint(1)")
.HasComment("สถานะยับยั้งการเจ้าหน้าที่");
b.Property<DateTime?>("OfficerRejectDate")
.HasColumnType("datetime(6)")
.HasComment("วันที่ยับยั้งการเจ้าหน้าที่");
b.Property<string>("OfficerRejectReason")
.HasColumnType("longtext")
.HasComment("เหตุผลยับยั้งการเจ้าหน้าที่");
b.Property<string>("OligarchApproveReason")
.HasColumnType("longtext")
.HasComment("เหตุผลอนุมัติผู้ดูแล");
b.Property<bool?>("OligarchReject")
.HasColumnType("tinyint(1)")
.HasComment("สถานะยับยั้งผู้ดูแล");
b.Property<DateTime?>("OligarchRejectDate")
.HasColumnType("datetime(6)")
.HasComment("วันที่ยับยั้งผู้ดูแล");
b.Property<string>("OligarchRejectReason")
.HasColumnType("longtext")
.HasComment("เหตุผลยับยั้งผู้ดูแล");
b.Property<string>("OrganizationOld")
.HasColumnType("longtext")
.HasComment("สังกัดเดิม");
b.Property<string>("OrganizationPositionOld")
.HasColumnType("longtext")
.HasComment("สังกัด");
b.Property<string>("PositionLevelOld")
.HasColumnType("longtext")
.HasComment("ข้อมูลหน่วยงานเดิม ระดับ");
b.Property<string>("PositionNumberOld")
.HasColumnType("longtext")
.HasComment("ข้อมูลหน่วยงานเดิม เลขที่");
b.Property<string>("PositionOld")
.HasColumnType("longtext")
.HasComment("ตำแหน่งเดิม");
b.Property<string>("PositionTypeOld")
.HasColumnType("longtext")
.HasComment("ข้อมูลหน่วยงานเดิม ตำแหน่งประเภท");
b.Property<string>("Reason")
.HasColumnType("longtext")
.HasComment("เหตุผลที่ลาออกจากราชการ");
b.Property<string>("RejectReason")
.HasColumnType("longtext")
.HasComment("เหตุผลไม่อนุมัติ");
b.Property<string>("RemarkHorizontal")
.HasColumnType("longtext")
.HasComment("หมายเหตุแนวนอน");
b.Property<Guid>("RetirementResignId")
.HasColumnType("char(36)");
b.Property<DateTime?>("SendDate")
.HasColumnType("datetime(6)")
.HasComment("วันที่ยื่นขอออกราชการ");
b.Property<string>("Status")
.HasColumnType("longtext")
.HasComment("สถานะลาออก");
b.Property<string>("child1Old")
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน child1 old");
b.Property<string>("child1OldId")
.HasColumnType("longtext")
.HasComment("id หน่วยงาน child1 old");
b.Property<string>("child1ShortNameOld")
.HasColumnType("longtext")
.HasComment("ชื่อย่อหน่วยงาน child1 old");
b.Property<string>("child2Old")
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน child2 old");
b.Property<string>("child2OldId")
.HasColumnType("longtext")
.HasComment("id หน่วยงาน child2 old");
b.Property<string>("child2ShortNameOld")
.HasColumnType("longtext")
.HasComment("ชื่อย่อหน่วยงาน child2 old");
b.Property<string>("child3Old")
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน child3 old");
b.Property<string>("child3OldId")
.HasColumnType("longtext")
.HasComment("id หน่วยงาน child3 old");
b.Property<string>("child3ShortNameOld")
.HasColumnType("longtext")
.HasComment("ชื่อย่อหน่วยงาน child3 old");
b.Property<string>("child4Old")
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน child4 old");
b.Property<string>("child4OldId")
.HasColumnType("longtext")
.HasComment("id หน่วยงาน child4 old");
b.Property<string>("child4ShortNameOld")
.HasColumnType("longtext")
.HasComment("ชื่อย่อหน่วยงาน child4 old");
b.Property<string>("citizenId")
.HasColumnType("longtext")
.HasComment("เลขบัตรประชาชน");
b.Property<string>("firstName")
.HasColumnType("longtext")
.HasComment("ชื่อ");
b.Property<string>("lastName")
.HasColumnType("longtext")
.HasComment("นามสกุล");
b.Property<string>("posLevelNameOld")
.HasColumnType("longtext")
.HasComment("ชื่อระดับตำแหน่ง old");
b.Property<string>("posLevelOldId")
.HasColumnType("longtext")
.HasComment("id ระดับตำแหน่ง old");
b.Property<int?>("posMasterNoOld")
.HasColumnType("int")
.HasComment("เลขที่ตำแหน่ง old");
b.Property<string>("posTypeNameOld")
.HasColumnType("longtext")
.HasComment("ชื่อประเภทตำแหน่ง old");
b.Property<string>("posTypeOldId")
.HasColumnType("longtext")
.HasComment("id ประเภทตำแหน่ง old");
b.Property<string>("prefix")
.HasColumnType("longtext")
.HasComment("คำนำหน้า");
b.Property<string>("profileId")
.HasColumnType("longtext")
.HasComment("profile Id");
b.Property<string>("rootOld")
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน root old");
b.Property<string>("rootOldId")
.HasColumnType("longtext")
.HasComment("id หน่วยงาน root old");
b.Property<string>("rootShortNameOld")
.HasColumnType("longtext")
.HasComment("ชื่อย่อหน่วยงาน root old");
b.HasKey("Id");
b.HasIndex("RetirementResignId");
b.ToTable("RetirementResignCancels");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementResignDebtDoc", b =>
{
b.Property<Guid>("Id")
@ -17794,6 +18079,17 @@ namespace BMA.EHR.Infrastructure.Migrations
b.Navigation("RetirementResign");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementResignCancel", b =>
{
b.HasOne("BMA.EHR.Domain.Models.Retirement.RetirementResign", "RetirementResign")
.WithMany()
.HasForeignKey("RetirementResignId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("RetirementResign");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementResignDebtDoc", b =>
{
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document")

View file

@ -330,6 +330,7 @@ namespace BMA.EHR.Infrastructure.Persistence
public DbSet<RetirementDeceased> RetirementDeceaseds { get; set; }
public DbSet<RetirementDeceasedNoti> RetirementDeceasedNotis { get; set; }
public DbSet<RetirementResign> RetirementResigns { get; set; }
public DbSet<RetirementResignCancel> RetirementResignCancels { get; set; }
public DbSet<RetirementResignDoc> RetirementResignDocs { get; set; }
public DbSet<RetirementResignDebtDoc> RetirementResignDebtDocs { get; set; }
public DbSet<RetirementOut> RetirementOuts { get; set; }

View file

@ -1479,7 +1479,7 @@ namespace BMA.EHR.Leave.Service.Controllers
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
{
refId = id,
sysName = "LEAVE_LIST",
sysName = "SYS_LEAVE_LIST",
posLevelName = profile.PosLevel?.PosLevelName ?? "",
posTypeName = profile.PosType?.PosTypeName ?? "",
});

View file

@ -121,6 +121,17 @@ namespace BMA.EHR.Placement.Service.Controllers
return Success();
}
[HttpPost("email")]
public async Task<ActionResult<ResponseObject>> SendEmail([FromBody] SendEmailRequest req)
{
await _repositoryNoti.PushEmailAsync(
req.Subject,
req.Body,
req.Email
);
return Success();
}
[HttpPost("profiles")]
public async Task<ActionResult<ResponseObject>> UpdatePropertyByUserProfiles([FromBody] NotisRequest req)
{

View file

@ -605,7 +605,7 @@ namespace BMA.EHR.Placement.Service.Controllers
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
{
refId = placementTransfer.Id,
sysName = "PLACEMENT_TRANSFER",
sysName = "SYS_TRANSFER_REQ",
posLevelName = placementTransfer.posLevelNameOld,
posTypeName = placementTransfer.posTypeNameOld,
});
@ -873,7 +873,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
result.Add(r);
string? _null = null;
result.Add(new {
result.Add(new
{
No = _null,
FullName = r.RemarkHorizontal,
OldOc = _null,

View file

@ -0,0 +1,12 @@
using BMA.EHR.Domain.Models.MetaData;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Placement.Service.Requests
{
public class SendEmailRequest
{
public string Subject { get; set; }
public string Body { get; set; }
public string Email { get; set; }
}
}

View file

@ -151,6 +151,55 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.Reason,
p.ApproveReason,
p.RejectReason,
p.CancelReason,
p.Status,
p.RetirementResignCancels,//xxxxxxxxxxxxxxxxxxxxxxxxx
p.IsActive,
})
.ToListAsync();
return Success(retirementResigns);
}
}
/// <summary>
/// list รายการลาออกของ User
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("user-cancel")]
public async Task<ActionResult<ResponseObject>> GetListByProfileCancel()
{
var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
if (org == null || org.result == null)
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
var retirementResigns = await _context.RetirementResignCancels.AsQueryable()
.Where(x => x.profileId == org.result.profileId)
.OrderByDescending(x => x.CreatedAt)
.Select(p => new
{
p.Id,
p.Location,
p.SendDate,
p.ActiveDate,
p.Reason,
p.ApproveReason,
p.RejectReason,
p.CancelReason,
p.Status,
p.IsActive,
})
@ -200,6 +249,56 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.RemarkHorizontal,
p.ApproveReason,
p.RejectReason,
p.CancelReason,
p.IsActive,
p.CreatedAt,
})
.ToListAsync();
return Success(retirementResigns);
}
/// <summary>
/// list รายการลาออกของ Admin
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("cancel")]
public async Task<ActionResult<ResponseObject>> GetListByAdminCancel()
{
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_RESIGN");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200")
{
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
var retirementResigns = await _context.RetirementResignCancels.AsQueryable()
.OrderByDescending(x => x.CreatedAt)
.Select(p => new
{
p.Id,
p.citizenId,
p.profileId,
p.prefix,
p.firstName,
p.lastName,
p.Location,
p.SendDate,
p.ActiveDate,
p.Reason,
p.Status,
salary = p.AmountOld,
p.PositionTypeOld,
p.PositionLevelOld,
p.PositionNumberOld,
p.OrganizationPositionOld,
p.RemarkHorizontal,
p.ApproveReason,
p.RejectReason,
p.CancelReason,
p.IsActive,
p.CreatedAt,
})
@ -224,7 +323,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
var createdUserId = await _context.RetirementResigns.AsQueryable()
.Where(x => x.CreatedUserId == UserId)
.FirstOrDefaultAsync();
if (getWorkflow == false && createdUserId ==null)
if (getWorkflow == false && createdUserId == null)
{
var getPermission = await _permission.GetPermissionAPIAsync("GET", "SYS_RESIGN");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
@ -293,6 +392,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.IsNoDebt,
p.IsNoBurden,
p.IsDiscipline,
p.CancelReason,
// Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
RetirementResignDocs = p.RetirementResignDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
// RetirementResignDebtDocs = p.RetirementResignDebtDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
@ -382,6 +482,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
data.IsNoDebt,
data.IsNoBurden,
data.IsDiscipline,
data.CancelReason,
// Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
Docs = retirementResignDocs,
// DocDebts = retirementResignDebtDocs,
@ -390,6 +491,101 @@ namespace BMA.EHR.Retirement.Service.Controllers
return Success(_data);
}
/// <summary>
/// get รายละเอียดลาออก
/// </summary>
/// <param name="id">Id ลาออก</param>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("cancel/{id:length(36)}")]
public async Task<ActionResult<ResponseObject>> GetDetailByUserCancel(Guid id)
{
var getWorkflow = await _permission.GetPermissionAPIWorkflowAsync(id.ToString(), "RETIREMENT_CANCEL");
var createdUserId = await _context.RetirementResigns.AsQueryable()
.Where(x => x.CreatedUserId == UserId)
.FirstOrDefaultAsync();
if (getWorkflow == false && createdUserId == null)
{
var getPermission = await _permission.GetPermissionAPIAsync("GET", "RETIREMENT_CANCEL");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200")
{
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
}
var data = await _context.RetirementResigns.AsQueryable()
.Where(x => x.Id == id)
.Select(p => new
{
p.Id,
p.prefix,
p.firstName,
p.lastName,
p.profileId,
p.Location,
p.SendDate,
p.ActiveDate,
p.Reason,
p.Status,
salary = p.AmountOld,
p.ApproveReason,
p.RejectReason,
p.IsActive,
p.CreatedAt,
p.PositionTypeOld,
p.PositionLevelOld,
p.PositionNumberOld,
p.OrganizationPositionOld,
p.OligarchReject,
p.OligarchApproveReason,
p.OligarchRejectReason,
p.OligarchRejectDate,
p.CommanderReject,
p.CommanderApproveReason,
p.CommanderRejectReason,
p.CommanderRejectDate,
p.OfficerReject,
p.OfficerApproveReason,
p.OfficerRejectReason,
p.OfficerRejectDate,
p.RemarkHorizontal,
p.rootOld,
p.rootOldId,
p.rootShortNameOld,
p.child1Old,
p.child1OldId,
p.child1ShortNameOld,
p.child2Old,
p.child2OldId,
p.child2ShortNameOld,
p.child3Old,
p.child3OldId,
p.child3ShortNameOld,
p.child4Old,
p.child4OldId,
p.child4ShortNameOld,
p.PositionOld,
p.posMasterNoOld,
p.posTypeOldId,
p.posTypeNameOld,
p.posLevelOldId,
p.posLevelNameOld,
p.IsNoDebt,
p.IsNoBurden,
p.IsDiscipline,
p.CancelReason,
RetirementResignDocs = p.RetirementResignDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
})
.FirstOrDefaultAsync();
if (data == null)
return Error(GlobalMessages.RetirementResignNotFound, 404);
return Success(data);
}
/// <summary>
/// สร้างการลาออก
/// </summary>
@ -513,14 +709,14 @@ namespace BMA.EHR.Retirement.Service.Controllers
}
}
}
await _repositoryNoti.PushNotificationAsync(
Guid.Parse("08dc3db9-257d-470d-8256-3dc24f6fa332"),
$"{retirementResign.prefix}{retirementResign.firstName} {retirementResign.lastName} ได้ทำการยื่นขอลาออก",
$"{retirementResign.prefix}{retirementResign.firstName} {retirementResign.lastName} ได้ทำการยื่นขอลาออก",
"",
"",
true
);
// await _repositoryNoti.PushNotificationAsync(
// Guid.Parse("08dc3db9-257d-470d-8256-3dc24f6fa332"),
// $"{retirementResign.prefix}{retirementResign.firstName} {retirementResign.lastName} ได้ทำการยื่นขอลาออก",
// $"{retirementResign.prefix}{retirementResign.firstName} {retirementResign.lastName} ได้ทำการยื่นขอลาออก",
// "",
// "",
// true
// );
await _context.SaveChangesAsync();
using (var client = new HttpClient())
{
@ -529,7 +725,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
var _res = await client.PostAsJsonAsync($"{_configuration["API"]}/org/workflow/add-workflow", new
{
refId = retirementResign.Id,
sysName = "RETIREMENT_RESIFNATION",
sysName = "SYS_RETIREMENT",
posLevelName = retirementResign.PositionLevelOld,
posTypeName = retirementResign.PositionTypeOld,
});
@ -569,6 +765,38 @@ namespace BMA.EHR.Retirement.Service.Controllers
return Success();
}
/// <summary>
/// แก้ไขการลาออก
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("cancel/{id:length(36)}")]
public async Task<ActionResult<ResponseObject>> PutCancel([FromForm] RetirementResignRequest req, Guid id)
{
var updated = await _context.RetirementResignCancels
.FirstOrDefaultAsync(x => x.Id == id);
if (updated == null)
return Error(GlobalMessages.RetirementResignNotFound, 404);
updated.Location = req.Location;
updated.ActiveDate = req.ActiveDate;
updated.Reason = req.Reason;
updated.OrganizationPositionOld = req.OrganizationPositionOld;
updated.RemarkHorizontal = req.RemarkHorizontal;
updated.PositionTypeOld = req.PositionTypeOld;
updated.PositionLevelOld = req.PositionLevelOld;
updated.PositionNumberOld = req.PositionNumberOld;
updated.AmountOld = req.AmountOld;
updated.LastUpdateFullName = FullName ?? "System Administrator";
updated.LastUpdateUserId = UserId ?? "";
updated.LastUpdatedAt = DateTime.Now;
await _context.SaveChangesAsync();
return Success();
}
/// <summary>
/// แก้ไขรายการตรวจสอบเงื่อนไขต่าง ๆ
@ -665,61 +893,128 @@ namespace BMA.EHR.Retirement.Service.Controllers
.FirstOrDefaultAsync(x => x.Id == id);
if (updated == null)
return Error(GlobalMessages.RetirementResignNotFound, 404);
updated.CancelReason = req.Reason;
if (updated.Status == "DONE")
{
updated.Status = "DONECANCEL";
// using (var client = new HttpClient())
// {
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
// var _res = await client.PostAsJsonAsync($"{_configuration["API"]}/org/workflow/add-workflow", new
// {
// refId = retirementResign.Id,
// sysName = "RETIREMENT_RESIFNATION_CANCEL",
// posLevelName = retirementResign.PositionLevelOld,
// posTypeName = retirementResign.PositionTypeOld,
// });
// }
// updated.Status = "CANCEL";
var retirementResignCancel = new RetirementResignCancel
{
Location = updated.Location,
SendDate = updated.SendDate,
ActiveDate = updated.ActiveDate,
Reason = updated.Reason,
OrganizationPositionOld = updated.OrganizationPositionOld,
PositionTypeOld = updated.PositionTypeOld,
PositionLevelOld = updated.PositionLevelOld,
PositionNumberOld = updated.PositionNumberOld,
AmountOld = updated.AmountOld,
ApproveReason = updated.ApproveReason,
RejectReason = updated.RejectReason,
CancelReason = updated.CancelReason,
IsActive = updated.IsActive,
IsNoDebt = updated.IsNoDebt,
IsNoBurden = updated.IsNoBurden,
IsDiscipline = updated.IsDiscipline,
OligarchReject = updated.OligarchReject,
OligarchApproveReason = updated.OligarchApproveReason,
OligarchRejectReason = updated.OligarchRejectReason,
OligarchRejectDate = updated.OligarchRejectDate,
CommanderReject = updated.CommanderReject,
CommanderApproveReason = updated.CommanderApproveReason,
CommanderRejectReason = updated.CommanderRejectReason,
CommanderRejectDate = updated.CommanderRejectDate,
OfficerReject = updated.OfficerReject,
OfficerApproveReason = updated.OfficerApproveReason,
OfficerRejectReason = updated.OfficerRejectReason,
OfficerRejectDate = updated.OfficerRejectDate,
RemarkHorizontal = updated.RemarkHorizontal,
OrganizationOld = updated.OrganizationOld,
PositionOld = updated.PositionOld,
profileId = updated.profileId,
prefix = updated.prefix,
firstName = updated.firstName,
lastName = updated.lastName,
citizenId = updated.citizenId,
rootOld = updated.rootOld,
rootOldId = updated.rootOldId,
rootShortNameOld = updated.rootShortNameOld,
child1Old = updated.child1Old,
child1OldId = updated.child1OldId,
child1ShortNameOld = updated.child1ShortNameOld,
child2Old = updated.child2Old,
child2OldId = updated.child2OldId,
child2ShortNameOld = updated.child2ShortNameOld,
child3Old = updated.child3Old,
child3OldId = updated.child3OldId,
child3ShortNameOld = updated.child3ShortNameOld,
child4Old = updated.child4Old,
child4OldId = updated.child4OldId,
child4ShortNameOld = updated.child4ShortNameOld,
posMasterNoOld = updated.posMasterNoOld,
posTypeOldId = updated.posTypeOldId,
posTypeNameOld = updated.posTypeNameOld,
posLevelOldId = updated.posLevelOldId,
posLevelNameOld = updated.posLevelNameOld,
RetirementResign = updated,
Status = "PENDING",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
};
await _context.SaveChangesAsync();
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _res = await client.PostAsJsonAsync($"{_configuration["API"]}/org/workflow/add-workflow", new
{
refId = retirementResignCancel.Id,
sysName = "RETIREMENT_CANCEL",
posLevelName = retirementResignCancel.PositionLevelOld,
posTypeName = retirementResignCancel.PositionTypeOld,
});
}
}
else
{
updated.Status = "CANCEL";
}
if (updated.OfficerReject != null)
{
await _repositoryNoti.PushNotificationAsync(
Guid.Parse("08dc3db9-257d-470d-8256-3dc24f6fa332"),
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้ทำการขอยกเลิก",
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้ทำการขอยกเลิก",
"",
"",
true
);
}
if (updated.CommanderReject != null)
{
await _repositoryNoti.PushNotificationAsync(
Guid.Parse("08dc432c-2bc5-4b81-8089-9c057c51192c"),
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้ทำการขอยกเลิก",
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้ทำการขอยกเลิก",
"",
"",
true
);
}
if (updated.OligarchReject != null)
{
await _repositoryNoti.PushNotificationAsync(
Guid.Parse("08dc4307-0adc-4bcd-8213-5479bb010236"),
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้ทำการขอยกเลิก",
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้ทำการขอยกเลิก",
"",
"",
true
);
}
updated.CancelReason = req.Reason;
// else
// {
updated.Status = "CANCEL";
// }
// if (updated.OfficerReject != null)
// {
// await _repositoryNoti.PushNotificationAsync(
// Guid.Parse("08dc3db9-257d-470d-8256-3dc24f6fa332"),
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้ทำการขอยกเลิก",
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้ทำการขอยกเลิก",
// "",
// "",
// true
// );
// }
// if (updated.CommanderReject != null)
// {
// await _repositoryNoti.PushNotificationAsync(
// Guid.Parse("08dc432c-2bc5-4b81-8089-9c057c51192c"),
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้ทำการขอยกเลิก",
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้ทำการขอยกเลิก",
// "",
// "",
// true
// );
// }
// if (updated.OligarchReject != null)
// {
// await _repositoryNoti.PushNotificationAsync(
// Guid.Parse("08dc4307-0adc-4bcd-8213-5479bb010236"),
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้ทำการขอยกเลิก",
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้ทำการขอยกเลิก",
// "",
// "",
// true
// );
// }
updated.LastUpdateFullName = FullName ?? "System Administrator";
updated.LastUpdateUserId = UserId ?? "";
updated.LastUpdatedAt = DateTime.Now;
@ -1764,7 +2059,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
{
result.Add(r);
string? _null = null;
result.Add(new {
result.Add(new
{
No = _null,
FullName = r.RemarkHorizontal,
CitizenId = _null,
@ -1954,7 +2250,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
[HttpPost("leave-cancel/report")]
public async Task<ActionResult<ResponseObject>> PostReportLeaveCancel([FromBody] ReportPersonRequest req)
{
var placementProfiles = await _context.RetirementResigns
var placementProfiles = await _context.RetirementResignCancels
.Where(x => req.refIds.Contains(x.Id.ToString()))
.ToListAsync();
placementProfiles.ForEach(profile => profile.Status = "REPORT");
@ -1973,11 +2269,11 @@ namespace BMA.EHR.Retirement.Service.Controllers
[HttpPost("leave-cancel/report/delete")]
public async Task<ActionResult<ResponseObject>> PostReportDeleteLeaveCancel([FromBody] ReportPersonRequest req)
{
var placementProfiles = await _context.RetirementResigns
var placementProfiles = await _context.RetirementResignCancels
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Where(x => x.Status.ToUpper() == "REPORT")
.ToListAsync();
placementProfiles.ForEach(profile => profile.Status = "DONECANCEL");
placementProfiles.ForEach(profile => profile.Status = "PENDING");
await _context.SaveChangesAsync();
return Success();
}
@ -1999,7 +2295,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
{
try
{
var report_data = (from p in _context.RetirementResigns
var report_data = (from p in _context.RetirementResignCancels
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.ToList()
join r in req.refIds
@ -2028,7 +2324,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
{
result.Add(r);
string? _null = null;
result.Add(new {
result.Add(new
{
No = _null,
FullName = r.RemarkHorizontal,
CitizenId = _null,
@ -2063,9 +2360,10 @@ namespace BMA.EHR.Retirement.Service.Controllers
[HttpPost("leave-cancel/report/excecute")]
public async Task<ActionResult<ResponseObject>> PostReportExecuteLeaveCancel([FromBody] ReportExecuteRequest req)
{
var data = await _context.RetirementResigns
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.ToListAsync();
var data = await _context.RetirementResignCancels
.Include(x => x.RetirementResign)
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.ToListAsync();
string? _null = null;
var resultData = (from p in data
join r in req.refIds
@ -2105,7 +2403,11 @@ namespace BMA.EHR.Retirement.Service.Controllers
var _result = await _res.Content.ReadAsStringAsync();
if (_res.IsSuccessStatusCode)
{
data.ForEach(profile => profile.Status = "DONEREJECT");
data.ForEach(profile => profile.Status = "DONE");
// var _data = await _context.RetirementResigns
// .Where(x => data.Select(x => x.RetirementResign.Id).Contains(x.Id))
// .ToListAsync();
// _data.ForEach(profile => profile.Status = "DONEREJECT");
await _context.SaveChangesAsync();
}
}