change round

This commit is contained in:
Suphonchai Phoonsawat 2023-11-23 15:48:09 +07:00
parent 22d9210416
commit 2bf43a52b5
27 changed files with 69774 additions and 7 deletions

View file

@ -45,6 +45,8 @@ namespace BMA.EHR.Application
{
services.AddTransient<DutyTimeRepository>();
services.AddTransient<UserTimeStampRepository>();
services.AddTransient<ProcessUserTimeStampRepository>();
services.AddTransient<UserDutyTimeRepository>();
return services;
}

View file

@ -56,6 +56,40 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
#region " Methods "
public async Task Copy()
{
var userTimeStamps = await _dbContext.Set<UserTimeStamp>().ToListAsync();
foreach(var u in userTimeStamps)
{
var p = new ProcessUserTimeStamp
{
KeycloakUserId = u.KeycloakUserId,
CheckIn = u.CheckIn,
CheckInLat = u.CheckInLat,
CheckInLon = u.CheckInLon,
CheckInPOI = u.CheckInPOI,
CheckInImageUrl = u.CheckInImageUrl,
IsLocationCheckIn = u.IsLocationCheckIn,
CheckInLocationName = u.CheckInLocationName,
CheckInRemark = u.CheckInRemark,
CheckOut = u.CheckOut,
CheckOutLat = u.CheckOutLat,
CheckOutLon = u.CheckOutLon,
CheckOutPOI = u.CheckOutPOI,
CheckOutImageUrl = u.CheckOutImageUrl,
IsLocationCheckOut = u.IsLocationCheckOut,
CheckOutLocationName = u.CheckOutLocationName,
CheckOutRemark = u.CheckOutRemark,
};
_dbContext.Set<ProcessUserTimeStamp>().Add(p);
}
await _dbContext.SaveChangesAsync();
}
public async Task<int> CountRecordAsync()
{
var data = await _dbContext.Set<ProcessUserTimeStamp>().CountAsync();

View file

@ -0,0 +1,56 @@
using BMA.EHR.Application.Common.Interfaces;
using BMA.EHR.Application.Messaging;
using BMA.EHR.Domain.Models.Leave.TimeAttendants;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
{
public class UserDutyTimeRepository : GenericLeaveRepository<Guid, UserDutyTime>
{
#region " Fields "
private readonly ILeaveDbContext _dbContext;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly OrganizationCommonRepository _organizationCommonRepository;
private readonly UserProfileRepository _userProfileRepository;
private readonly IConfiguration _configuration;
private readonly EmailSenderService _emailSenderService;
#endregion
#region " Constructor and Destuctor "
public UserDutyTimeRepository(ILeaveDbContext dbContext,
IHttpContextAccessor httpContextAccessor,
OrganizationCommonRepository organizationCommonRepository,
UserProfileRepository userProfileRepository,
IConfiguration configuration,
EmailSenderService emailSenderService) : base(dbContext, httpContextAccessor)
{
_dbContext = dbContext;
_httpContextAccessor = httpContextAccessor;
_organizationCommonRepository = organizationCommonRepository;
_userProfileRepository = userProfileRepository;
_configuration = configuration;
_emailSenderService = emailSenderService;
}
#endregion
#region " Properties "
protected Guid UserOrganizationId
{
get
{
if (UserId != null || UserId != "")
return _userProfileRepository.GetUserOCId(Guid.Parse(UserId!));
else
return Guid.Empty;
}
}
#endregion
}
}

View file

@ -28,6 +28,32 @@ namespace BMA.EHR.Application.Repositories
#region " Methods "
public async Task<List<Profile>> SearchProfile(string? citizenId, string? firstName, string? lastName)
{
try
{
var data = _dbContext.Set<Profile>().AsQueryable();
if (citizenId != null)
data = data.Where(x => x.CitizenId!.Contains(citizenId));
if (firstName != null)
data = data.Where(x => x.FirstName!.Contains(firstName));
if (lastName != null)
data = data.Where(x => x.LastName!.Contains(lastName));
data = data.Include(x => x.Prefix);
return await data.ToListAsync();
}
catch
{
throw;
}
}
public string GetUserFullName(Guid keycloakId)
{
try

View file

@ -4,6 +4,7 @@ using BMA.EHR.Domain.Models.Base;
using BMA.EHR.Domain.Models.Documents;
using BMA.EHR.Domain.Models.MetaData;
using BMA.EHR.Domain.Models.Organizations;
using BMA.EHR.Domain.Models.Leave.TimeAttendants;
namespace BMA.EHR.Domain.Models.HR
{
@ -326,5 +327,13 @@ namespace BMA.EHR.Domain.Models.HR
public virtual List<ProfileChildren> Childrens { get; set; } = new List<ProfileChildren>();
public virtual List<ProfileChangeName> ChangeNames { get; set; } = new List<ProfileChangeName>();
public virtual List<ProfileEmployment> Employments { get; set; } = new List<ProfileEmployment>();
// รอบการลงเวลา
[Comment("รอบการลงเวลาเข้างาน")]
public Guid? DutyTimeId { get; set; }
[Comment("วันที่รอบการลงเวลามีผล")]
public DateTime? DutyTimeEffectiveDate { get; set; }
}
}

View file

@ -6,13 +6,19 @@ namespace BMA.EHR.Domain.Models.Leave.TimeAttendants
{
public class UserDutyTime : EntityBase
{
[Required, Comment("รหัส User ของ Keycloak")]
public Guid KeycloakUserId { get; set; } = Guid.Empty;
[Required, Comment("รหัส Profile ในระบบทะเบียนประวัติ")]
public Guid ProfileId { get; set; } = Guid.Empty;
[Required, Comment("รหัสรอบการลงเวลา")]
public Guid DutyTimeId { get; set; } = Guid.Empty;
[Comment("วันที่มีผล")]
public DateTime? EffectiveDate { get; set; }
[Comment("ทำการประมวลผลแล้วหรือยัง")]
public bool IsProcess { get; set; } = false;
[Comment("หมายเหตุ")]
public string? Remark { get; set; }
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,87 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class adddutytimetoprofile : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "DutyTimeId",
table: "Profiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.CreateTable(
name: "DutyTime",
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"),
Description = table.Column<string>(type: "longtext", nullable: false, comment: "คำอธิบาย")
.Annotation("MySql:CharSet", "utf8mb4"),
StartTimeMorning = table.Column<string>(type: "longtext", nullable: false, comment: "เวลาเข้างานช่วงเช้า")
.Annotation("MySql:CharSet", "utf8mb4"),
EndTimeMorning = table.Column<string>(type: "longtext", nullable: false, comment: "เวลาออกงานช่วงเช้า")
.Annotation("MySql:CharSet", "utf8mb4"),
StartTimeAfternoon = table.Column<string>(type: "longtext", nullable: false, comment: "เวลาเข้างานช่วงบ่าย")
.Annotation("MySql:CharSet", "utf8mb4"),
EndTimeAfternoon = table.Column<string>(type: "longtext", nullable: false, comment: "เวลาออกงานช่วงบ่าย")
.Annotation("MySql:CharSet", "utf8mb4"),
IsDefault = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะว่ารอบใดเป็นค่า Default ของข้าราชการ (สำหรับทุกคนที่ยังไม่ได้ทำการเลือกรอบ)"),
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการเปิดใช้งาน (เปิด/ปิด)")
},
constraints: table =>
{
table.PrimaryKey("PK_DutyTime", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_Profiles_DutyTimeId",
table: "Profiles",
column: "DutyTimeId");
migrationBuilder.AddForeignKey(
name: "FK_Profiles_DutyTime_DutyTimeId",
table: "Profiles",
column: "DutyTimeId",
principalTable: "DutyTime",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Profiles_DutyTime_DutyTimeId",
table: "Profiles");
migrationBuilder.DropTable(
name: "DutyTime");
migrationBuilder.DropIndex(
name: "IX_Profiles_DutyTimeId",
table: "Profiles");
migrationBuilder.DropColumn(
name: "DutyTimeId",
table: "Profiles");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,87 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class removedutytimetoprofile : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Profiles_DutyTime_DutyTimeId",
table: "Profiles");
migrationBuilder.DropTable(
name: "DutyTime");
migrationBuilder.DropIndex(
name: "IX_Profiles_DutyTimeId",
table: "Profiles");
migrationBuilder.DropColumn(
name: "DutyTimeId",
table: "Profiles");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "DutyTimeId",
table: "Profiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.CreateTable(
name: "DutyTime",
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"),
Description = table.Column<string>(type: "longtext", nullable: false, comment: "คำอธิบาย")
.Annotation("MySql:CharSet", "utf8mb4"),
EndTimeAfternoon = table.Column<string>(type: "longtext", nullable: false, comment: "เวลาออกงานช่วงบ่าย")
.Annotation("MySql:CharSet", "utf8mb4"),
EndTimeMorning = table.Column<string>(type: "longtext", nullable: false, comment: "เวลาออกงานช่วงเช้า")
.Annotation("MySql:CharSet", "utf8mb4"),
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะการเปิดใช้งาน (เปิด/ปิด)"),
IsDefault = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "สถานะว่ารอบใดเป็นค่า Default ของข้าราชการ (สำหรับทุกคนที่ยังไม่ได้ทำการเลือกรอบ)"),
StartTimeAfternoon = table.Column<string>(type: "longtext", nullable: false, comment: "เวลาเข้างานช่วงบ่าย")
.Annotation("MySql:CharSet", "utf8mb4"),
StartTimeMorning = table.Column<string>(type: "longtext", nullable: false, comment: "เวลาเข้างานช่วงเช้า")
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_DutyTime", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_Profiles_DutyTimeId",
table: "Profiles",
column: "DutyTimeId");
migrationBuilder.AddForeignKey(
name: "FK_Profiles_DutyTime_DutyTimeId",
table: "Profiles",
column: "DutyTimeId",
principalTable: "DutyTime",
principalColumn: "Id");
}
}
}

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 adddutytimeidtoprofile : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "DutyTimeId",
table: "Profiles",
type: "char(36)",
nullable: true,
comment: "รอบการลงเวลาเข้างาน",
collation: "ascii_general_ci");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DutyTimeId",
table: "Profiles");
}
}
}

View file

@ -0,0 +1,30 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class adddutytimeeffectivedatatoprofile : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "DutyTimeEffectiveDate",
table: "Profiles",
type: "datetime(6)",
nullable: true,
comment: "วันที่รอบการลงเวลามีผล");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DutyTimeEffectiveDate",
table: "Profiles");
}
}
}

View file

@ -1049,6 +1049,14 @@ namespace BMA.EHR.Infrastructure.Migrations
b.Property<DateTime?>("DateStart")
.HasColumnType("datetime(6)");
b.Property<DateTime?>("DutyTimeEffectiveDate")
.HasColumnType("datetime(6)")
.HasComment("วันที่รอบการลงเวลามีผล");
b.Property<Guid?>("DutyTimeId")
.HasColumnType("char(36)")
.HasComment("รอบการลงเวลาเข้างาน");
b.Property<string>("EmployeeClass")
.HasMaxLength(20)
.HasColumnType("varchar(20)")

View file

@ -0,0 +1,441 @@
// <auto-generated />
using System;
using BMA.EHR.Infrastructure.Persistence;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
{
[DbContext(typeof(LeaveDbContext))]
[Migration("20231123082309_change field from kk_id to profile id")]
partial class changefieldfromkk_idtoprofileid
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.DutyTime", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext")
.HasComment("คำอธิบาย");
b.Property<string>("EndTimeAfternoon")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาออกงานช่วงบ่าย");
b.Property<string>("EndTimeMorning")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาออกงานช่วงเช้า");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasComment("สถานะการเปิดใช้งาน (เปิด/ปิด)");
b.Property<bool>("IsDefault")
.HasColumnType("tinyint(1)")
.HasComment("สถานะว่ารอบใดเป็นค่า Default ของข้าราชการ (สำหรับทุกคนที่ยังไม่ได้ทำการเลือกรอบ)");
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>("StartTimeAfternoon")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาเข้างานช่วงบ่าย");
b.Property<string>("StartTimeMorning")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาเข้างานช่วงเช้า");
b.HasKey("Id");
b.ToTable("DutyTimes");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.ProcessUserTimeStamp", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CheckIn")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา เข้างาน");
b.Property<string>("CheckInImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-In");
b.Property<double>("CheckInLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-In");
b.Property<string>("CheckInLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-In");
b.Property<double>("CheckInLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-In");
b.Property<string>("CheckInPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-In");
b.Property<string>("CheckInRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-In");
b.Property<string>("CheckInStatus")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สถานะ Check-In");
b.Property<DateTime?>("CheckOut")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา ออกงาน");
b.Property<string>("CheckOutImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-Out");
b.Property<double>("CheckOutLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-Out");
b.Property<string>("CheckOutLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-Out");
b.Property<double>("CheckOutLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-Out");
b.Property<string>("CheckOutPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-Out");
b.Property<string>("CheckOutRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-Out");
b.Property<string>("CheckOutStatus")
.HasColumnType("longtext")
.HasComment("สถานะ Check-Out");
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>("IsLocationCheckIn")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-In");
b.Property<bool>("IsLocationCheckOut")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-Out");
b.Property<bool>("IsProcess")
.HasColumnType("tinyint(1)")
.HasComment("นำไปประมวลผลแล้วหรือยัง");
b.Property<Guid>("KeycloakUserId")
.HasColumnType("char(36)")
.HasComment("รหัส User ของ Keycloak");
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.HasKey("Id");
b.ToTable("ProcessUserTimeStamps");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.UserDutyTime", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<Guid>("DutyTimeId")
.HasColumnType("char(36)")
.HasComment("รหัสรอบการลงเวลา");
b.Property<DateTime?>("EffectiveDate")
.HasColumnType("datetime(6)")
.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<Guid>("ProfileId")
.HasColumnType("char(36)")
.HasComment("รหัส Profile ในระบบทะเบียนประวัติ");
b.HasKey("Id");
b.ToTable("UserDutyTimes");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.UserTimeStamp", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CheckIn")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา เข้างาน");
b.Property<string>("CheckInImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-In");
b.Property<double>("CheckInLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-In");
b.Property<string>("CheckInLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-In");
b.Property<double>("CheckInLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-In");
b.Property<string>("CheckInPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-In");
b.Property<string>("CheckInRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-In");
b.Property<DateTime?>("CheckOut")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา ออกงาน");
b.Property<string>("CheckOutImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-Out");
b.Property<double>("CheckOutLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-Out");
b.Property<string>("CheckOutLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-Out");
b.Property<double>("CheckOutLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-Out");
b.Property<string>("CheckOutPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-Out");
b.Property<string>("CheckOutRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-Out");
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>("IsLocationCheckIn")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-In");
b.Property<bool>("IsLocationCheckOut")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-Out");
b.Property<bool>("IsProcess")
.HasColumnType("tinyint(1)")
.HasComment("นำไปประมวลผลแล้วหรือยัง");
b.Property<Guid>("KeycloakUserId")
.HasColumnType("char(36)")
.HasComment("รหัส User ของ Keycloak");
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.HasKey("Id");
b.ToTable("UserTimeStamps");
});
#pragma warning restore 612, 618
}
}
}

View file

@ -0,0 +1,45 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
{
/// <inheritdoc />
public partial class changefieldfromkk_idtoprofileid : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "KeycloakUserId",
table: "UserDutyTimes");
migrationBuilder.AddColumn<Guid>(
name: "ProfileId",
table: "UserDutyTimes",
type: "char(36)",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
comment: "รหัส Profile ในระบบทะเบียนประวัติ",
collation: "ascii_general_ci");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ProfileId",
table: "UserDutyTimes");
migrationBuilder.AddColumn<Guid>(
name: "KeycloakUserId",
table: "UserDutyTimes",
type: "char(36)",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
comment: "รหัส User ของ Keycloak",
collation: "ascii_general_ci");
}
}
}

View file

@ -0,0 +1,445 @@
// <auto-generated />
using System;
using BMA.EHR.Infrastructure.Persistence;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
{
[DbContext(typeof(LeaveDbContext))]
[Migration("20231123082554_add process dutytime status")]
partial class addprocessdutytimestatus
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.DutyTime", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext")
.HasComment("คำอธิบาย");
b.Property<string>("EndTimeAfternoon")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาออกงานช่วงบ่าย");
b.Property<string>("EndTimeMorning")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาออกงานช่วงเช้า");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasComment("สถานะการเปิดใช้งาน (เปิด/ปิด)");
b.Property<bool>("IsDefault")
.HasColumnType("tinyint(1)")
.HasComment("สถานะว่ารอบใดเป็นค่า Default ของข้าราชการ (สำหรับทุกคนที่ยังไม่ได้ทำการเลือกรอบ)");
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>("StartTimeAfternoon")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาเข้างานช่วงบ่าย");
b.Property<string>("StartTimeMorning")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาเข้างานช่วงเช้า");
b.HasKey("Id");
b.ToTable("DutyTimes");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.ProcessUserTimeStamp", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CheckIn")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา เข้างาน");
b.Property<string>("CheckInImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-In");
b.Property<double>("CheckInLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-In");
b.Property<string>("CheckInLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-In");
b.Property<double>("CheckInLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-In");
b.Property<string>("CheckInPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-In");
b.Property<string>("CheckInRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-In");
b.Property<string>("CheckInStatus")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สถานะ Check-In");
b.Property<DateTime?>("CheckOut")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา ออกงาน");
b.Property<string>("CheckOutImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-Out");
b.Property<double>("CheckOutLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-Out");
b.Property<string>("CheckOutLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-Out");
b.Property<double>("CheckOutLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-Out");
b.Property<string>("CheckOutPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-Out");
b.Property<string>("CheckOutRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-Out");
b.Property<string>("CheckOutStatus")
.HasColumnType("longtext")
.HasComment("สถานะ Check-Out");
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>("IsLocationCheckIn")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-In");
b.Property<bool>("IsLocationCheckOut")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-Out");
b.Property<bool>("IsProcess")
.HasColumnType("tinyint(1)")
.HasComment("นำไปประมวลผลแล้วหรือยัง");
b.Property<Guid>("KeycloakUserId")
.HasColumnType("char(36)")
.HasComment("รหัส User ของ Keycloak");
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.HasKey("Id");
b.ToTable("ProcessUserTimeStamps");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.UserDutyTime", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<Guid>("DutyTimeId")
.HasColumnType("char(36)")
.HasComment("รหัสรอบการลงเวลา");
b.Property<DateTime?>("EffectiveDate")
.HasColumnType("datetime(6)")
.HasComment("วันที่มีผล");
b.Property<bool>("IsProcess")
.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<Guid>("ProfileId")
.HasColumnType("char(36)")
.HasComment("รหัส Profile ในระบบทะเบียนประวัติ");
b.HasKey("Id");
b.ToTable("UserDutyTimes");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.UserTimeStamp", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CheckIn")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา เข้างาน");
b.Property<string>("CheckInImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-In");
b.Property<double>("CheckInLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-In");
b.Property<string>("CheckInLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-In");
b.Property<double>("CheckInLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-In");
b.Property<string>("CheckInPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-In");
b.Property<string>("CheckInRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-In");
b.Property<DateTime?>("CheckOut")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา ออกงาน");
b.Property<string>("CheckOutImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-Out");
b.Property<double>("CheckOutLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-Out");
b.Property<string>("CheckOutLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-Out");
b.Property<double>("CheckOutLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-Out");
b.Property<string>("CheckOutPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-Out");
b.Property<string>("CheckOutRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-Out");
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>("IsLocationCheckIn")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-In");
b.Property<bool>("IsLocationCheckOut")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-Out");
b.Property<bool>("IsProcess")
.HasColumnType("tinyint(1)")
.HasComment("นำไปประมวลผลแล้วหรือยัง");
b.Property<Guid>("KeycloakUserId")
.HasColumnType("char(36)")
.HasComment("รหัส User ของ Keycloak");
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.HasKey("Id");
b.ToTable("UserTimeStamps");
});
#pragma warning restore 612, 618
}
}
}

View file

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
{
/// <inheritdoc />
public partial class addprocessdutytimestatus : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsProcess",
table: "UserDutyTimes",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "ทำการประมวลผลแล้วหรือยัง");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsProcess",
table: "UserDutyTimes");
}
}
}

View file

@ -0,0 +1,449 @@
// <auto-generated />
using System;
using BMA.EHR.Infrastructure.Persistence;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
{
[DbContext(typeof(LeaveDbContext))]
[Migration("20231123083034_add user 'dutytime remark")]
partial class adduserdutytimeremark
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.DutyTime", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext")
.HasComment("คำอธิบาย");
b.Property<string>("EndTimeAfternoon")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาออกงานช่วงบ่าย");
b.Property<string>("EndTimeMorning")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาออกงานช่วงเช้า");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasComment("สถานะการเปิดใช้งาน (เปิด/ปิด)");
b.Property<bool>("IsDefault")
.HasColumnType("tinyint(1)")
.HasComment("สถานะว่ารอบใดเป็นค่า Default ของข้าราชการ (สำหรับทุกคนที่ยังไม่ได้ทำการเลือกรอบ)");
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>("StartTimeAfternoon")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาเข้างานช่วงบ่าย");
b.Property<string>("StartTimeMorning")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาเข้างานช่วงเช้า");
b.HasKey("Id");
b.ToTable("DutyTimes");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.ProcessUserTimeStamp", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CheckIn")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา เข้างาน");
b.Property<string>("CheckInImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-In");
b.Property<double>("CheckInLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-In");
b.Property<string>("CheckInLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-In");
b.Property<double>("CheckInLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-In");
b.Property<string>("CheckInPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-In");
b.Property<string>("CheckInRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-In");
b.Property<string>("CheckInStatus")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สถานะ Check-In");
b.Property<DateTime?>("CheckOut")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา ออกงาน");
b.Property<string>("CheckOutImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-Out");
b.Property<double>("CheckOutLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-Out");
b.Property<string>("CheckOutLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-Out");
b.Property<double>("CheckOutLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-Out");
b.Property<string>("CheckOutPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-Out");
b.Property<string>("CheckOutRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-Out");
b.Property<string>("CheckOutStatus")
.HasColumnType("longtext")
.HasComment("สถานะ Check-Out");
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>("IsLocationCheckIn")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-In");
b.Property<bool>("IsLocationCheckOut")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-Out");
b.Property<bool>("IsProcess")
.HasColumnType("tinyint(1)")
.HasComment("นำไปประมวลผลแล้วหรือยัง");
b.Property<Guid>("KeycloakUserId")
.HasColumnType("char(36)")
.HasComment("รหัส User ของ Keycloak");
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.HasKey("Id");
b.ToTable("ProcessUserTimeStamps");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.UserDutyTime", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<Guid>("DutyTimeId")
.HasColumnType("char(36)")
.HasComment("รหัสรอบการลงเวลา");
b.Property<DateTime?>("EffectiveDate")
.HasColumnType("datetime(6)")
.HasComment("วันที่มีผล");
b.Property<bool>("IsProcess")
.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<Guid>("ProfileId")
.HasColumnType("char(36)")
.HasComment("รหัส Profile ในระบบทะเบียนประวัติ");
b.Property<string>("Remark")
.HasColumnType("longtext")
.HasComment("หมายเหตุ");
b.HasKey("Id");
b.ToTable("UserDutyTimes");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.UserTimeStamp", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CheckIn")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา เข้างาน");
b.Property<string>("CheckInImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-In");
b.Property<double>("CheckInLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-In");
b.Property<string>("CheckInLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-In");
b.Property<double>("CheckInLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-In");
b.Property<string>("CheckInPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-In");
b.Property<string>("CheckInRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-In");
b.Property<DateTime?>("CheckOut")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา ออกงาน");
b.Property<string>("CheckOutImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-Out");
b.Property<double>("CheckOutLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-Out");
b.Property<string>("CheckOutLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-Out");
b.Property<double>("CheckOutLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-Out");
b.Property<string>("CheckOutPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-Out");
b.Property<string>("CheckOutRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-Out");
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>("IsLocationCheckIn")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-In");
b.Property<bool>("IsLocationCheckOut")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-Out");
b.Property<bool>("IsProcess")
.HasColumnType("tinyint(1)")
.HasComment("นำไปประมวลผลแล้วหรือยัง");
b.Property<Guid>("KeycloakUserId")
.HasColumnType("char(36)")
.HasComment("รหัส User ของ Keycloak");
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.HasKey("Id");
b.ToTable("UserTimeStamps");
});
#pragma warning restore 612, 618
}
}
}

View file

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
{
/// <inheritdoc />
public partial class adduserdutytimeremark : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Remark",
table: "UserDutyTimes",
type: "longtext",
nullable: true,
comment: "หมายเหตุ")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Remark",
table: "UserDutyTimes");
}
}
}

View file

@ -277,9 +277,9 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
.HasColumnType("datetime(6)")
.HasComment("วันที่มีผล");
b.Property<Guid>("KeycloakUserId")
.HasColumnType("char(36)")
.HasComment("รหัส User ของ Keycloak");
b.Property<bool>("IsProcess")
.HasColumnType("tinyint(1)")
.HasComment("ทำการประมวลผลแล้วหรือยัง");
b.Property<string>("LastUpdateFullName")
.IsRequired()
@ -300,6 +300,14 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<Guid>("ProfileId")
.HasColumnType("char(36)")
.HasComment("รหัส Profile ในระบบทะเบียนประวัติ");
b.Property<string>("Remark")
.HasColumnType("longtext")
.HasComment("หมายเหตุ");
b.HasKey("Id");
b.ToTable("UserDutyTimes");

View file

@ -14,7 +14,11 @@
"AllowedHosts": "*",
"ConnectionStrings": {
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
"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=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=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"ExamConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_exam_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"LeaveConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_leave_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"DisciplineConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_discipline_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
},
"Jwt": {
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",

View file

@ -4,6 +4,7 @@ using BMA.EHR.Domain.Common;
using BMA.EHR.Domain.Models.Leave.TimeAttendants;
using BMA.EHR.Domain.Shared;
using BMA.EHR.Infrastructure.Persistence;
using BMA.EHR.Leave.Service.DTOs.ChangeRound;
using BMA.EHR.Leave.Service.DTOs.CheckIn;
using BMA.EHR.Leave.Service.DTOs.DutyTime;
using Microsoft.AspNetCore.Authorization;
@ -11,6 +12,7 @@ using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using System.ComponentModel.DataAnnotations;
using System.Security.Claims;
using System.Security.Permissions;
namespace BMA.EHR.Leave.Service.Controllers
{
@ -33,6 +35,7 @@ namespace BMA.EHR.Leave.Service.Controllers
private readonly UserTimeStampRepository _userTimeStampRepository;
private readonly MinIOService _minIOService;
private readonly ProcessUserTimeStampRepository _processUserTimeStampRepository;
private readonly UserDutyTimeRepository _userDutyTimeRepository;
private readonly string _bucketName = "check-in";
@ -48,7 +51,8 @@ namespace BMA.EHR.Leave.Service.Controllers
UserProfileRepository userProfileRepository,
UserTimeStampRepository userTimeStampRepository,
MinIOService minIOService,
ProcessUserTimeStampRepository processUserTimeStampRepository)
ProcessUserTimeStampRepository processUserTimeStampRepository,
UserDutyTimeRepository userDutyTimeRepository)
{
_dutyTimeRepository = dutyTimeRepository;
_context = context;
@ -59,6 +63,7 @@ namespace BMA.EHR.Leave.Service.Controllers
_userTimeStampRepository = userTimeStampRepository;
_minIOService = minIOService;
_processUserTimeStampRepository = processUserTimeStampRepository;
_userDutyTimeRepository = userDutyTimeRepository;
}
#endregion
@ -632,6 +637,7 @@ namespace BMA.EHR.Leave.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[AllowAnonymous]
public async Task<ActionResult<ResponseObject>> GetTimeRecordAsync([Required] DateTime startDate, [Required] DateTime endDate, int page = 1, int pageSize = 10,string status = "NORMAL", string keyword = "")
{
if (startDate.Date > endDate.Date)
@ -692,6 +698,82 @@ namespace BMA.EHR.Leave.Service.Controllers
#endregion
#region " เปลี่ยนรอบการทำงาน "
/// <summary>
/// LV1_006 - เช็คเวลาต้องลงเวลาเข้าหรือออกงาน (USER)
/// </summary>
/// <returns>
/// </returns>
/// <response code="200">เมื่อทำรายการสำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("search")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[AllowAnonymous]
public async Task<ActionResult<ResponseObject>> SearchProfileAsync([FromBody] SearchProfileDto req)
{
var profile = await _userProfileRepository.SearchProfile(req.CitizenId, req.FirstName, req.LastName);
var pagedProfile = profile.Skip((req.Page - 1) * req.PageSize).Take(req.PageSize).ToList();
var defaultRound = await _dutyTimeRepository.GetDefaultAsync();
var resultSet = new List<SearchProfileResultDto>();
foreach (var p in pagedProfile)
{
var roundId = p.DutyTimeId ?? Guid.Empty;
var round = await _dutyTimeRepository.GetByIdAsync(roundId);
var res = new SearchProfileResultDto
{
ProfileId = p.Id,
CitizenId = p.CitizenId,
FullName = $"{p.Prefix.Name}{p.FirstName} {p.LastName}",
StartTimeMorning = round != null ? round.StartTimeMorning : defaultRound.StartTimeMorning,
LeaveTimeAfterNoon = round != null ? round.EndTimeAfternoon : defaultRound.EndTimeAfternoon,
EffectiveDate = p.DutyTimeEffectiveDate
};
resultSet.Add(res);
}
return Success(new { data = resultSet, total = profile.Count });
}
// <summary>
/// LV1_014 - เปลี่ยนรอบการลงเวลา (ADMIN)
/// </summary>
/// <returns>
/// </returns>
/// <response code="200">เมื่อทำรายการสำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("round")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[AllowAnonymous]
public async Task<ActionResult<ResponseObject>> CreateChangeRoundAsync([FromBody] CreateChangeRoundDto req)
{
var data = new UserDutyTime
{
ProfileId = req.ProfileId,
DutyTimeId = req.RoundId,
EffectiveDate = req.EffectiveDate,
Remark = req.Remark,
};
await _userDutyTimeRepository.AddAsync(data);
return Success();
}
#endregion
#endregion
}
}

View file

@ -0,0 +1,15 @@
using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal;
namespace BMA.EHR.Leave.Service.DTOs.ChangeRound
{
public class CreateChangeRoundDto
{
public Guid ProfileId { get; set; }
public Guid RoundId { get; set; }
public DateTime EffectiveDate { get; set; }
public string Remark { get; set; }
}
}

View file

@ -0,0 +1,17 @@
namespace BMA.EHR.Leave.Service.DTOs.ChangeRound
{
public class SearchProfileDto
{
public string? CitizenId { get; set; }
public string? FirstName { get; set; }
public string? LastName { get; set; }
public int Page { get; set; } = 1;
public int PageSize { get; set; } = 10;
public string? Keyword { get; set; }
}
}

View file

@ -0,0 +1,17 @@
namespace BMA.EHR.Leave.Service.DTOs.ChangeRound
{
public class SearchProfileResultDto
{
public Guid ProfileId { get; set; }
public string CitizenId { get; set; }
public string FullName { get; set; }
public string StartTimeMorning { get; set; }
public string LeaveTimeAfterNoon { get;set; }
public DateTime? EffectiveDate { get; set; }
}
}