From 6a572144abb83b8768be529775f62a68a30fa4c4 Mon Sep 17 00:00:00 2001 From: Kittapath Date: Wed, 19 Jul 2023 10:25:54 +0700 Subject: [PATCH] =?UTF-8?q?api=20=E0=B8=95=E0=B8=B3=E0=B9=81=E0=B8=AB?= =?UTF-8?q?=E0=B8=99=E0=B9=88=E0=B8=87=20draft?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApplicationServicesRegistration.cs | 1 + .../Repositories/InsigniaPeriodsRepository.cs | 5268 +++++++ .../Requests/InsigniaApproveRequest.cs | 7 + BMA.EHR.Application/Requests/InsigniaItem.cs | 15 + .../Requests/InsigniaPeriodRequest.cs | 19 + .../Requests/InsigniaReqApproveItem.cs | 10 + .../Requests/InsigniaRequestDoc.cs | 9 + .../Requests/InsigniaRequestItem.cs | 22 + .../Requests/InsigniaResultSet.cs | 41 + .../Requests/InsigniaResults.cs | 14 + .../Requests/SaveRequsetNote.cs | 9 + .../Requests/SaveToProfileRequest.cs | 44 + .../Models/Insignias/InsigniaPeriod.cs | 27 + .../Models/Insignias/InsigniaRequest.cs | 23 + .../Insignias/InsigniaRequestProfile.cs | 40 + .../Models/Placement/PlacementProfile.cs | 6 + BMA.EHR.Domain/Shared/GlobalMessages.cs | 7 + ...ble PlacementProfile add draft.Designer.cs | 11564 +++++++++++++++ ...Update table PlacementProfile add draft.cs | 191 + ...tProfile add positioncandidate.Designer.cs | 11575 ++++++++++++++++ ... PlacementProfile add positioncandidate.cs | 50 + .../ApplicationDBContextModelSnapshot.cs | 317 + .../Persistence/ApplicationDBContext.cs | 11 + .../BMA.EHR.Insignia.Service.csproj | 41 + .../ConfigureSwaggerOptions.cs | 84 + .../Controllers/InsigniaPeriodController.cs | 150 + .../Controllers/InsigniaReceiveController.cs | 213 + .../Controllers/InsigniaRequestController.cs | 509 + BMA.EHR.Insignia.Service/Dockerfile | 27 + BMA.EHR.Insignia.Service/Program.cs | 161 + .../Properties/launchSettings.json | 48 + .../appsettings.Development.json | 8 + BMA.EHR.Insignia.Service/appsettings.json | 35 + BMA.EHR.Insignia.Service/nuget.config | 9 + BMA.EHR.Insignia.Service/wwwroot/index.html | 184 + BMA.EHR.Insignia.Service/wwwroot/keycloak.js | 1766 +++ .../wwwroot/keycloak.json | 7 + .../OrganizationEmployeeController.cs | 32 + .../Requests/PositionOrgEmployee.cs | 10 + .../Controllers/PlacementController.cs | 41 + .../Requests/PersonEducationRequest.cs | 1 + BMA.EHR.Solution.sln | 9 +- 42 files changed, 32604 insertions(+), 1 deletion(-) create mode 100644 BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs create mode 100644 BMA.EHR.Application/Requests/InsigniaApproveRequest.cs create mode 100644 BMA.EHR.Application/Requests/InsigniaItem.cs create mode 100644 BMA.EHR.Application/Requests/InsigniaPeriodRequest.cs create mode 100644 BMA.EHR.Application/Requests/InsigniaReqApproveItem.cs create mode 100644 BMA.EHR.Application/Requests/InsigniaRequestDoc.cs create mode 100644 BMA.EHR.Application/Requests/InsigniaRequestItem.cs create mode 100644 BMA.EHR.Application/Requests/InsigniaResultSet.cs create mode 100644 BMA.EHR.Application/Requests/InsigniaResults.cs create mode 100644 BMA.EHR.Application/Requests/SaveRequsetNote.cs create mode 100644 BMA.EHR.Application/Requests/SaveToProfileRequest.cs create mode 100644 BMA.EHR.Domain/Models/Insignias/InsigniaPeriod.cs create mode 100644 BMA.EHR.Domain/Models/Insignias/InsigniaRequest.cs create mode 100644 BMA.EHR.Domain/Models/Insignias/InsigniaRequestProfile.cs create mode 100644 BMA.EHR.Infrastructure/Migrations/20230718145427_Update table PlacementProfile add draft.Designer.cs create mode 100644 BMA.EHR.Infrastructure/Migrations/20230718145427_Update table PlacementProfile add draft.cs create mode 100644 BMA.EHR.Infrastructure/Migrations/20230719025522_Update table PlacementProfile add positioncandidate.Designer.cs create mode 100644 BMA.EHR.Infrastructure/Migrations/20230719025522_Update table PlacementProfile add positioncandidate.cs create mode 100644 BMA.EHR.Insignia.Service/BMA.EHR.Insignia.Service.csproj create mode 100644 BMA.EHR.Insignia.Service/ConfigureSwaggerOptions.cs create mode 100644 BMA.EHR.Insignia.Service/Controllers/InsigniaPeriodController.cs create mode 100644 BMA.EHR.Insignia.Service/Controllers/InsigniaReceiveController.cs create mode 100644 BMA.EHR.Insignia.Service/Controllers/InsigniaRequestController.cs create mode 100644 BMA.EHR.Insignia.Service/Dockerfile create mode 100644 BMA.EHR.Insignia.Service/Program.cs create mode 100644 BMA.EHR.Insignia.Service/Properties/launchSettings.json create mode 100644 BMA.EHR.Insignia.Service/appsettings.Development.json create mode 100644 BMA.EHR.Insignia.Service/appsettings.json create mode 100644 BMA.EHR.Insignia.Service/nuget.config create mode 100644 BMA.EHR.Insignia.Service/wwwroot/index.html create mode 100644 BMA.EHR.Insignia.Service/wwwroot/keycloak.js create mode 100644 BMA.EHR.Insignia.Service/wwwroot/keycloak.json create mode 100644 BMA.EHR.OrganizationEmployee.Service/Requests/PositionOrgEmployee.cs diff --git a/BMA.EHR.Application/ApplicationServicesRegistration.cs b/BMA.EHR.Application/ApplicationServicesRegistration.cs index e77b671e..d278780c 100644 --- a/BMA.EHR.Application/ApplicationServicesRegistration.cs +++ b/BMA.EHR.Application/ApplicationServicesRegistration.cs @@ -14,6 +14,7 @@ namespace BMA.EHR.Application services.AddTransient(); services.AddTransient(); services.AddTransient(); + // services.AddTransient(); return services; } diff --git a/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs b/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs new file mode 100644 index 00000000..40b99dff --- /dev/null +++ b/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs @@ -0,0 +1,5268 @@ +// using BMA.EHR.Application.Common.Interfaces; +// using BMA.EHR.Application.Requests; +// using BMA.EHR.Domain.Models.HR; +// using BMA.EHR.Domain.Models.Insignias; +// using BMA.EHR.Domain.Models.MetaData; +// using BMA.EHR.Domain.Models.OrganizationEmployee; +// using BMA.EHR.Domain.Shared; +// using Microsoft.AspNetCore.Http; +// using Microsoft.EntityFrameworkCore; +// using Newtonsoft.Json; + +// namespace BMA.EHR.Application.Repositories +// { +// public class InsigniaPeriodsRepository : GenericRepository +// { +// private readonly IApplicationDBContext _dbContext; +// private readonly IHttpContextAccessor _httpContextAccessor; +// public InsigniaPeriodsRepository(IApplicationDBContext dbContext, IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor) +// { +// _dbContext = dbContext; +// _httpContextAccessor = httpContextAccessor; +// } + +// public async Task> FindByNameAsync(string name) +// { +// var data = await _dbContext.Set().Where(x => x.Name == name).ToListAsync(); + +// return data; +// } + +// #region " Private " + +// private async Task GetInsigniaByName(string name) +// { +// try +// { +// var insignia = await _dbContext.Set() +// .Include(x => x.InsigniaType) +// .Where(x => x.Name == name) +// .Select(i => new InsigniaItem +// { +// Id = i.Id, +// Name = i.Name, +// ShortName = i.ShortName, +// Level = i.InsigniaType.Name, +// LevelId = i.InsigniaType.Id +// }) +// .FirstOrDefaultAsync(); + +// return insignia; +// } +// catch +// { +// throw; +// } +// } + +// // private bool IsHigherLevel2(string last, string request) +// // { +// // try +// // { +// // var last_ins = await _dbContext.Set().FirstOrDefault(x => x.Name.ToLower().Trim() == last.ToLower().Trim()); + +// // if (last_ins == null) +// // return true; + +// // var req_ins = await _dbContext.Set().FirstOrDefault(x => x.Name.ToLower().Trim() == request.ToLower().Trim()); + +// // if (req_ins == null) +// // throw new Exception("Invalid Request Insignia!!"); + +// // return req_ins.Level > last_ins.Level; +// // } +// // catch +// // { +// // throw; +// // } +// // } + +// private static bool IsHigherLevel(string last, string request) +// { +// if (request.Contains("ตริตาภรณ์ช้างเผือก")) +// return (last.Contains("ตริตาภรณ์มงกุฎไทย")) ? false : true; +// else if (request.Contains("ทวีติยาภรณ์มงกุฎไทย")) +// return (last.Contains("ตริตาภรณ์มงกุฎไทย") || +// last.Contains("ตริตาภรณ์ช้างเผือก")) ? false : true; +// else if (request.Contains("ทวีติยาภรณ์ช้างเผือก")) +// return (last.Contains("ตริตาภรณ์มงกุฎไทย") || +// last.Contains("ตริตาภรณ์ช้างเผือก") || +// last.Contains("ทวีติยาภรณ์มงกุฎไทย")) ? false : true; +// else if (request.Contains("ประถมาภรณ์มงกุฎไทย")) +// return (last.Contains("ตริตาภรณ์มงกุฎไทย") || +// last.Contains("ตริตาภรณ์ช้างเผือก") || +// last.Contains("ทวีติยาภรณ์มงกุฎไทย") || +// last.Contains("ทวีติยาภรณ์ช้างเผือก")) ? false : true; +// else if (request.Contains("ประถมาภรณ์ช้างเผือก")) +// return (last.Contains("ตริตาภรณ์มงกุฎไทย") || +// last.Contains("ตริตาภรณ์ช้างเผือก") || +// last.Contains("ทวีติยาภรณ์มงกุฎไทย") || +// last.Contains("ทวีติยาภรณ์ช้างเผือก") || +// last.Contains("ประถมาภรณ์มงกุฎไทย")) ? false : true; +// else if (request.Contains("มหาวชิรมงกุฎ")) +// return (last.Contains("ตริตาภรณ์มงกุฎไทย") || +// last.Contains("ตริตาภรณ์ช้างเผือก") || +// last.Contains("ทวีติยาภรณ์มงกุฎไทย") || +// last.Contains("ทวีติยาภรณ์ช้างเผือก") || +// last.Contains("ประถมาภรณ์มงกุฎไทย") || +// last.Contains("ประถมาภรณ์ช้างเผือก")) ? false : true; + +// else return false; +// } + +// // private InsigniaItem GetNextInsignia(string name) +// // { +// // if (name.Contains("ตริตาภรณ์มงกุฎไทย")) +// // return GetInsigniaByName("ตริตาภรณ์ช้างเผือก"); +// // else if (name.Contains("ตริตาภรณ์ช้างเผือก")) +// // return GetInsigniaByName("ทวีติยาภรณ์มงกุฎไทย"); +// // else if (name.Contains("ทวีติยาภรณ์มงกุฎไทย")) +// // return GetInsigniaByName("ทวีติยาภรณ์ช้างเผือก"); +// // else if (name.Contains("ทวีติยาภรณ์ช้างเผือก")) +// // return GetInsigniaByName("ประถมาภรณ์มงกุฎไทย"); +// // else if (name.Contains("ประถมาภรณ์มงกุฎไทย")) +// // return GetInsigniaByName("ประถมาภรณ์ช้างเผือก"); +// // else if (name.Contains("ประถมาภรณ์ช้างเผือก")) +// // return GetInsigniaByName("มหาวชิรมงกุฎ"); +// // else return null; +// // } + +// // private async bool CanRequestInsignia(string profileId, int year) +// // { +// // try +// // { +// // var ce_year = year; + +// // var insignia = await _dbContext.Set() +// // .Where(x => x.Profile.Id == profileId) +// // .Where(x => x.Year == ce_year - 1) +// // .FirstOrDefaultAsync(); + +// // if (insignia != null) +// // return false; +// // else +// // { +// // var prev_period = await _dbContext.Set().FirstOrDefault(x => x.Year == ce_year - 1); + +// // if (prev_period == null) +// // return true; +// // else +// // { +// // var req = await _dbContext.Set() +// // .FirstOrDefault(x => x.Request.Period.Id == prev_period.Id && x.Profile.Id == profileId); + +// // if (req != null) +// // return false; +// // else +// // return true; +// // } +// // } +// // } +// // catch +// // { +// // throw; +// // } +// // } + +// #region " ทั่วไป " + +// /// +// /// Gets the insignia candidate ประเภททั่วไป ระดับปฎิบัติงาน. +// /// +// /// The period identifier. +// /// The oc identifier. +// /// +// // public async List GetInsigniaCandidate_Type1_Level1(int periodId, int ocId) +// // { +// // try +// // { +// // var allOc = profileService.GetAllIdByRoot(ocId); + +// // var period = await _dbContext.Set().FirstOrDefault(p => p.Id == periodId); + +// // if (period == null) +// // throw new Exception(GlobalMessages.InvalidCoinPeriod); + +// // var oc = await _dbContext.Set().FirstOrDefault(x => x.OCId == ocId); + +// // if (oc == null) +// // throw new Exception(GlobalMessages.InvalidOC); + +// // var CurrentRetireDate = new DateTime(period.Year, 9, 30); + +// // var inst_profile = await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // .Where(p => +// // allOc.Contains(p.OrganizationChart.OCId) && +// // p.IsActive == true && +// // p.IsLeave == false && +// // p.DateAppoint != null && +// // p.PositionType.Id == 1 // ประเภททั่วไป +// // ) +// // .Select(p => new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // Rank = p.AcademicStanding.Name, +// // ProfileDateAppoint = p.DateAppoint.Value, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // PosNo = p.PositionNumber.Id, +// // PositionLevelId = p.PositionLevel.Id, +// // PositionLevelName = p.PositionLevel.Name, +// // PositionTypeId = p.PositionType.Id, +// // PositionTypeName = p.PositionType.Name, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Count == 0 ? -1 : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // PostionSalaryAmount = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // }); + +// // // check วันที่บรรจะต้องน้อยกว่า 29/5/ปี-5 +// // var s1 = ((from p in inst_profile +// // //where p.CanRequestInsignia == true +// // where p.ProfileDateAppoint <= new DateTime(period.Year - 5, 5, 29) +// // && p.LastInsigniaId == -1 +// // && p.PositionLevelId == 1 // ปฎิบัติงาน +// // select p) +// // .ToList() +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("เบญจมาภรณ์มงกุฎไทย"), +// // Seq = 1, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.รับราชการก่อน { new DateTime(period.Year - 5, 5, 29).ToThaiFullDate3() }", +// // Result = $"วันที่บรรจุเข้ารับราชการ { p.ProfileDateAppoint.ToThaiFullDate3() }" +// // } +// // } +// // })).ToList(); + +// // var s2 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 1 // ทั่วไป +// // && p.PositionLevel.Id == 1 // ปฎิบัติงาน +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("เบญจมาภรณ์ช้างเผือก") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "เบญจมาภรณ์ช้างเผือก"), +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(x => x.SalaryCondition < 10190 && !x.IsHigherLevel) +// // .Where(x => x.ProfileDateAppoint <= new DateTime(period.Year - 10, 5, 29)) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("เบญจมาภรณ์ช้างเผือก"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.ได้รับเงินเดือนต่ำกว่าขั้นต่ำของระดับชำนาญงาน (เงินเดือนน้อยกว่า 10,190 บาท)", +// // Result = $"ได้รับเงินเดือน { p.SalaryCondition } บาท" +// // }, +// // new MatchingCondition +// // { +// // Condition = $"2.ดำรงตำแหน่งมาแล้วไม่น้อยกว่า 10 ปี บริบูรณ์ (รับราชการก่อน { new DateTime(period.Year - 10, 5, 29).ToThaiFullDate3() })", +// // Result = $"วันที่บรรจุเข้ารับราชการ { p.ProfileDateAppoint.ToThaiFullDate3() }" +// // } +// // } +// // }) +// // .ToList(); + +// // var s3 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 1 // ทั่วไป +// // && p.PositionLevel.Id == 1 // ปฎิบัติงาน +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("จัตุรถาภรณ์มงกุฎไทย") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "จัตุรถาภรณ์มงกุฎไทย"), +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(x => x.SalaryCondition >= 10190 && !x.IsHigherLevel) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("จัตุรถาภรณ์มงกุฎไทย"), +// // Seq = 3, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.ได้รับเงินเดือนไม่ต่ำกว่าขั้นต่ำของระดับชำนาญงาน (เงินเดือน ณ วันที่ { (new DateTime(period.Year, 4, 29)).ToThaiFullDate3() } 10,190 บาทขึ้นไป)", +// // Result = $"ได้รับเงินเดือน { p.SalaryCondition } บาท" +// // } +// // } +// // }) +// // .ToList(); + +// // var s4 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 1 // ทั่วไป +// // && p.PositionLevel.Id == 1 // ปฎิบัติงาน +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("จัตุรถาภรณ์ช้างเผือก") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "จัตุรถาภรณ์ช้างเผือก"), +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(x => x.SalaryCondition >= 10190 && !x.IsHigherLevel) +// // .Where(x => x.ProfileDateAppoint <= new DateTime(period.Year - 10, 5, 29)) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("จัตุรถาภรณ์ช้างเผือก"), +// // Seq = 4, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.ได้รับเงินเดือนไม่ต่ำกว่าขั้นต่ำของระดับชำนาญงาน (เงินเดือน ณ วันที่ { (new DateTime(period.Year, 4, 29)).ToThaiFullDate3() } 10,190 บาทขึ้นไป)", +// // Result = $"ได้รับเงินเดือน { p.SalaryCondition } บาท" +// // }, +// // new MatchingCondition +// // { +// // Condition = $"2.ดำรงตำแหน่งมาแล้วไม่น้อยกว่า 10 ปี บริบูรณ์ (รับราชการก่อน { new DateTime(period.Year - 10, 5, 29).ToThaiFullDate3() })", +// // Result = $"วันที่บรรจุเข้ารับราชการ { p.ProfileDateAppoint.ToThaiFullDate3() }" +// // } +// // } +// // }) +// // .ToList(); + +// // var result_candidate = new List(); + +// // foreach (var r in s4) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // foreach (var r in s3) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // foreach (var r in s2) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // foreach (var r in s1) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // return result_candidate; +// // } +// // catch +// // { +// // throw; +// // } +// // } + +// /// +// /// Gets the insignia candidate ประเภททั่วไป ระดับชำนาญงาน. +// /// +// /// The period identifier. +// /// The oc identifier. +// /// +// /// +// // public async List GetInsigniaCandidate_Type1_Level2(int periodId, int ocId) +// // { +// // try +// // { +// // var allOc = profileService.GetAllIdByRoot(ocId); + +// // var period = await _dbContext.Set().FirstOrDefault(p => p.Id == periodId); + +// // if (period == null) +// // throw new Exception(GlobalMessages.InvalidCoinPeriod); + +// // var oc = await _dbContext.Set().FirstOrDefault(x => x.OCId == ocId); + +// // if (oc == null) +// // throw new Exception(GlobalMessages.InvalidOC); + +// // var CurrentRetireDate = new DateTime(period.Year, 9, 30); + +// // var s1 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 1 // ทั่วไป +// // && p.PositionLevel.Id == 2 // ชำนาญงาน +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("ตริตาภรณ์มงกุฎไทย") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "ตริตาภรณ์มงกุฎไทย"), +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.เป็นระดับชำนาญงาน", +// // Result = $"ตำแหน่ง { p.Position } ประเภท { p.PositionType } ระดับ { p.PositionLevel }" +// // }, + +// // } +// // }) +// // .ToList(); + +// // var s2 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // .ThenInclude(p => p.SalaryPositionLevel) +// // .ThenInclude(p => p.PositionLevel) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 1 // ทั่วไป +// // && p.PositionLevel.Id == 2 // ชำนาญงาน +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("ตริตาภรณ์ช้างเผือก") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "ตริตาภรณ์ช้างเผือก"), + +// // FirstPositonLevelDate = p.Salaries.Count == 0 ? null : +// // p.Salaries.Where(x => x.SalaryPositionLevel.PositionLevel.Id == 2).OrderBy(p => p.SalaryDateAnnounce).FirstOrDefault().SalaryDateAnnounce +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(x => x.FirstPositonLevelDate < new DateTime(period.Year - 5, 5, 29)) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("ตริตาภรณ์ช้างเผือก"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.ดำรงตำแหน่งมาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (เป็นระดับชำนาญงาน ก่อนวันที่ {(new DateTime(period.Year - 5, 5, 29)).ToThaiFullDate3()})", +// // Result = $"ดำรงตำแหน่ง { p.Position } ประเภท { p.PositionType } ระดับ { p.PositionLevel } ตั้งแต่วันที่ { (p.FirstPositonLevelDate == null ? "-" : p.FirstPositonLevelDate.Value.ToThaiFullDate3()) }" +// // }, + +// // } +// // }) +// // .ToList(); + +// // var result_candidate = new List(); + +// // foreach (var r in s2) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // foreach (var r in s1) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // return result_candidate; +// // } +// // catch +// // { +// // throw; +// // } +// // } + +// /// +// /// Gets the insignia candidate ประเภททั่วไป ระดับอาวุโส. +// /// +// /// The period identifier. +// /// The oc identifier. +// /// +// /// +// // public async List GetInsigniaCandidate_Type1_Level3(int periodId, int ocId) +// // { +// // try +// // { +// // var allOc = profileService.GetAllIdByRoot(ocId); + +// // var period = await _dbContext.Set().FirstOrDefault(p => p.Id == periodId); + +// // if (period == null) +// // throw new Exception(GlobalMessages.InvalidCoinPeriod); + +// // var oc = await _dbContext.Set().FirstOrDefault(x => x.OCId == ocId); + +// // if (oc == null) +// // throw new Exception(GlobalMessages.InvalidOC); + +// // var CurrentRetireDate = new DateTime(period.Year, 9, 30); + +// // var s1 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 1 // ทั่วไป +// // && p.PositionLevel.Id == 3 // อาวุโส +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์มงกุฎไทย") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "ทวีติยาภรณ์มงกุฎไทย"), +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("ทวีติยาภรณ์มงกุฎไทย"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.เป็นระดับอาวุโส", +// // Result = $"ตำแหน่ง { p.Position } ประเภท { p.PositionType } ระดับ { p.PositionLevel }" +// // }, + +// // } +// // }) +// // .ToList(); + +// // var s2 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // .ThenInclude(p => p.SalaryPositionLevel) +// // .ThenInclude(p => p.PositionLevel) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 1 // ทั่วไป +// // && p.PositionLevel.Id == 3 // อาวุโส +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "ทวีติยาภรณ์ช้างเผือก"), + +// // FirstPositonLevelDate = p.Salaries.Count == 0 ? null : +// // p.Salaries.Where(x => x.SalaryPositionLevel.PositionLevel.Id == 3).OrderBy(p => p.SalaryDateAnnounce).FirstOrDefault().SalaryDateAnnounce +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(x => x.FirstPositonLevelDate < new DateTime(period.Year - 5, 5, 29)) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("ทวีติยาภรณ์ช้างเผือก"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.ดำรงตำแหน่งมาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (เป็นระดับอาวุโส ก่อนวันที่ {(new DateTime(period.Year - 5, 5, 29)).ToThaiFullDate3()})", +// // Result = $"ดำรงตำแหน่ง { p.Position } ประเภท { p.PositionType } ระดับ { p.PositionLevel } ตั้งแต่วันที่ { (p.FirstPositonLevelDate == null ? "-" : p.FirstPositonLevelDate.Value.ToThaiFullDate3()) }" +// // }, + +// // } +// // }) +// // .ToList(); + +// // var result_candidate = new List(); + +// // foreach (var r in s2) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // foreach (var r in s1) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // return result_candidate; +// // } +// // catch +// // { +// // throw; +// // } +// // } + +// /// +// /// Gets the insignia candidate ประเภททั่วไป ระดับทักษะพิเศษ. +// /// +// /// The period identifier. +// /// The oc identifier. +// /// +// /// +// // public async List GetInsigniaCandidate_Type1_Level4(int periodId, int ocId) +// // { +// // try +// // { +// // var allOc = profileService.GetAllIdByRoot(ocId); + +// // var period = await _dbContext.Set().FirstOrDefault(p => p.Id == periodId); + +// // if (period == null) +// // throw new Exception(GlobalMessages.InvalidCoinPeriod); + +// // var oc = await _dbContext.Set().FirstOrDefault(x => x.OCId == ocId); + +// // if (oc == null) +// // throw new Exception(GlobalMessages.InvalidOC); + +// // var CurrentRetireDate = new DateTime(period.Year, 9, 30); + +// // var s1 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 1 // ทั่วไป +// // && (p.PositionLevel.Id == 3 || p.PositionLevel.Id == 13) // อาวุโส +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "ทวีติยาภรณ์ช้างเผือก"), +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("ทวีติยาภรณ์ช้างเผือก"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.เป็นระดับทักษะพิเศษ", +// // Result = $"ตำแหน่ง { p.Position } ประเภท { p.PositionType } ระดับ { p.PositionLevel }" +// // }, + +// // } +// // }) +// // .ToList(); + +// // var s2 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // .ThenInclude(p => p.SalaryPositionLevel) +// // .ThenInclude(p => p.PositionLevel) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 1 // ทั่วไป +// // && (p.PositionLevel.Id == 3 || p.PositionLevel.Id == 13) // อาวุโส +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "ประถมาภรณ์มงกุฎไทย"), +// // FirstRecvInsigniaYear = p.Insignias.Count == 0 ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ทวีติยาภรณ์ช้างเผือก").OrderBy(x => x.Year).FirstOrDefault() == null ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ทวีติยาภรณ์ช้างเผือก").OrderBy(x => x.Year).FirstOrDefault().Year, +// // FirstPositonLevelDate = p.Salaries.Count == 0 ? null : +// // p.Salaries.Where(x => x.SalaryPositionLevel.PositionLevel.Id == 3).OrderBy(p => p.SalaryDateAnnounce).FirstOrDefault().SalaryDateAnnounce +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(x => x.FirstRecvInsigniaYear != 0 && x.FirstRecvInsigniaYear <= period.Year - 3) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("ประถมาภรณ์มงกุฎไทย"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.ได้ ท.ช. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้รับ ท.ช. ก่อนวันที่ {(new DateTime(period.Year - 3, 7, 28)).ToThaiFullDate3()})", +// // Result = $"ได้รับ ท.ช. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }" +// // }, + +// // } +// // }) +// // .ToList(); + +// // var s3 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // .ThenInclude(p => p.SalaryPositionLevel) +// // .ThenInclude(p => p.PositionLevel) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 1 // ทั่วไป +// // && (p.PositionLevel.Id == 3 || p.PositionLevel.Id == 13) // อาวุโส +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์ช้างเผือก") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "ประถมาภรณ์ช้างเผือก"), +// // FirstRecvInsigniaYear = p.Insignias.Count == 0 ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ประถมาภรณ์มงกุฎไทย").OrderBy(x => x.Year).FirstOrDefault() == null ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ประถมาภรณ์มงกุฎไทย").OrderBy(x => x.Year).FirstOrDefault().Year, +// // FirstPositonLevelDate = p.Salaries.Count == 0 ? null : +// // p.Salaries.Where(x => x.SalaryPositionLevel.PositionLevel.Id == 3).OrderBy(p => p.SalaryDateAnnounce).FirstOrDefault().SalaryDateAnnounce +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(x => x.FirstRecvInsigniaYear != 0 && x.FirstRecvInsigniaYear <= period.Year - 5) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("ประถมาภรณ์ช้างเผือก"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.ได้ ป.ม. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้รับ ป.ม. ก่อนวันที่ {(new DateTime(period.Year - 5, 7, 28)).ToThaiFullDate3()})", +// // Result = $"ได้รับ ป.ม. ในปี { p.FirstRecvInsigniaYear }" +// // }, + +// // } +// // }) +// // .ToList(); + +// // var result_candidate = new List(); + +// // foreach (var r in s3) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // foreach (var r in s2) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // foreach (var r in s1) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // return result_candidate; +// // } +// // catch +// // { +// // throw; +// // } +// // } + +// #endregion + +// #region " วิชาการ " + + +// /// +// /// Gets the insignia candidate ประเภทวิชาการ ระดับปฎิบัติการ. +// /// +// /// The period identifier. +// /// The oc identifier. +// /// +// // public async List GetInsigniaCandidate_Type2_Level5(int periodId, int ocId) +// // { +// // try +// // { +// // var allOc = profileService.GetAllIdByRoot(ocId); + +// // var period = await _dbContext.Set().FirstOrDefault(p => p.Id == periodId); + +// // if (period == null) +// // throw new Exception(GlobalMessages.InvalidCoinPeriod); + +// // var oc = await _dbContext.Set().FirstOrDefault(x => x.OCId == ocId); + +// // if (oc == null) +// // throw new Exception(GlobalMessages.InvalidOC); + +// // var CurrentRetireDate = new DateTime(period.Year, 9, 30); + +// // var inst_profile = await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // .Where(p => +// // allOc.Contains(p.OrganizationChart.OCId) && +// // p.IsActive == true && +// // p.IsLeave == false && +// // p.DateAppoint != null && +// // p.PositionType.Id == 2 // ประเภทวิชาการ +// // ) +// // .Select(p => new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // Rank = p.AcademicStanding.Name, +// // ProfileDateAppoint = p.DateAppoint.Value, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // PosNo = p.PositionNumber.Id, +// // PositionLevelId = p.PositionLevel.Id, +// // PositionLevelName = p.PositionLevel.Name, +// // PositionTypeId = p.PositionType.Id, +// // PositionTypeName = p.PositionType.Name, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Count == 0 ? -1 : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // PostionSalaryAmount = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // }); + +// // // check วันที่บรรจะต้องน้อยกว่า 29/5/ปี-5 +// // var s1 = ((from p in inst_profile +// // //where p.CanRequestInsignia == true +// // where p.ProfileDateAppoint <= new DateTime(period.Year - 5, 5, 29) +// // && p.LastInsigniaId == -1 +// // && p.PositionLevelId == 5 // ปฎิบัติการ +// // select p) +// // .ToList() +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย"), +// // Seq = 1, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.รับราชการก่อน { new DateTime(period.Year - 5, 5, 29).ToThaiFullDate3() }", +// // Result = $"วันที่บรรจุเข้ารับราชการ { p.ProfileDateAppoint.ToThaiFullDate3() }" +// // } +// // } +// // })).ToList(); + + + +// // var result_candidate = new List(); + +// // foreach (var r in s1) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // return result_candidate; +// // } +// // catch +// // { +// // throw; +// // } +// // } + +// /// +// /// Gets the insignia candidate ประเภทวิชาการ ระดับชำนาญการ. +// /// +// /// The period identifier. +// /// The oc identifier. +// /// +// // public async List GetInsigniaCandidate_Type2_Level6(int periodId, int ocId) +// // { +// // try +// // { +// // var allOc = profileService.GetAllIdByRoot(ocId); + +// // var period = await _dbContext.Set().FirstOrDefault(p => p.Id == periodId); + +// // if (period == null) +// // throw new Exception(GlobalMessages.InvalidCoinPeriod); + +// // var oc = await _dbContext.Set().FirstOrDefault(x => x.OCId == ocId); + +// // if (oc == null) +// // throw new Exception(GlobalMessages.InvalidOC); + +// // var CurrentRetireDate = new DateTime(period.Year, 9, 30); + +// // var s1 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 2 // วิชาการ +// // && p.PositionLevel.Id == 6 // ชำนาญการ +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("ตริตาภรณ์ช้างเผือก") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "ตริตาภรณ์ช้างเผือก"), +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("ตริตาภรณ์ช้างเผือก"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.เป็นระดับชำนาญการ", +// // Result = $"ตำแหน่ง { p.Position } ประเภท { p.PositionType } ระดับ { p.PositionLevel }" +// // }, + +// // } +// // }) +// // .ToList(); + +// // var s2 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 2 // วิชาการ +// // && p.PositionLevel.Id == 6 // ชำนาญการ +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์มงกุฎไทย") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "ทวีติยาภรณ์มงกุฎไทย"), +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(p => p.SalaryCondition >= 22140) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("ทวีติยาภรณ์มงกุฎไทย"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.ได้รับเงินเดือนไม่ต่ำกว่าขั้นต่ำของระดับชำนาญการพิเศษ (เงินเดือน ณ วันที่ { (new DateTime(period.Year, 4, 29)).ToThaiFullDate3() } 22,140 บาท)", +// // Result = $"เงินเดือน ณ วันที่ { (new DateTime(period.Year, 4, 29)).ToThaiFullDate3() } เป็นเงิน { p.SalaryCondition.ToNumericText() } บาท" +// // }, + +// // } +// // }) +// // .ToList(); + +// // var s3 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 2 // วิชาการ +// // && p.PositionLevel.Id == 6 // ชำนาญการ +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate < new DateTime(period.Year - 5, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "ทวีติยาภรณ์ช้างเผือก"), +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(p => p.SalaryCondition >= 22140) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("ทวีติยาภรณ์ช้างเผือก"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.ได้รับเงินเดือนไม่ต่ำกว่าขั้นต่ำของระดับชำนาญการพิเศษมาแล้วไม่น้อยกว่า 5 ปี (เงินเดือนก่อนวันที่ { (new DateTime(period.Year-5, 4, 29)).ToThaiFullDate3() } 22,140 บาท)", +// // Result = $"เงินเดือนก่อนวันที่ { (new DateTime(period.Year-5, 4, 29)).ToThaiFullDate3() } เป็นเงิน { p.SalaryCondition.ToNumericText() } บาท" +// // }, + +// // } +// // }) +// // .ToList(); + +// // var result_candidate = new List(); + +// // foreach (var r in s3) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // foreach (var r in s2) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // foreach (var r in s1) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // return result_candidate; +// // } +// // catch +// // { +// // throw; +// // } +// // } + + +// /// +// /// Gets the insignia candidate ประเภทวิชาการ ระดับชำนาญการพิเศษ. +// /// +// /// The period identifier. +// /// The oc identifier. +// /// +// // public async List GetInsigniaCandidate_Type2_Level7(int periodId, int ocId) +// // { +// // try +// // { +// // var allOc = profileService.GetAllIdByRoot(ocId); + +// // var period = await _dbContext.Set().FirstOrDefault(p => p.Id == periodId); + +// // if (period == null) +// // throw new Exception(GlobalMessages.InvalidCoinPeriod); + +// // var oc = await _dbContext.Set().FirstOrDefault(x => x.OCId == ocId); + +// // if (oc == null) +// // throw new Exception(GlobalMessages.InvalidOC); + +// // var CurrentRetireDate = new DateTime(period.Year, 9, 30); + +// // var s1 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 2 // วิชาการ +// // && p.PositionLevel.Id == 7 // ชำนาญการพิเศษ +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "ทวีติยาภรณ์ช้างเผือก"), +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("ทวีติยาภรณ์ช้างเผือก"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.เป็นระดับชำนาญการพิเศษ", +// // Result = $"ตำแหน่ง { p.Position } ประเภท { p.PositionType } ระดับ { p.PositionLevel }" +// // }, + +// // } +// // }) +// // .ToList(); + +// // var s2 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 2 // วิชาการ +// // && p.PositionLevel.Id == 7 // ชำนาญการพิเศษ +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "ประถมาภรณ์มงกุฎไทย"), +// // FirstRecvInsigniaYear = p.Insignias.Count == 0 ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ทวีติยาภรณ์ช้างเผือก").OrderBy(x => x.Year).FirstOrDefault() == null ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ทวีติยาภรณ์ช้างเผือก").OrderBy(x => x.Year).FirstOrDefault().Year +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(p => p.SalaryCondition >= 58390) +// // .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 5) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("ประถมาภรณ์มงกุฎไทย"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.ได้รับเงินเดือนขั้นสูง (เงินเดือน ณ วันที่ { (new DateTime(period.Year, 4, 29)).ToThaiFullDate3() } 58,390 บาท)", +// // Result = $"เงินเดือน ณ วันที่ { (new DateTime(period.Year, 4, 29)).ToThaiFullDate3() } เป็นเงิน { p.SalaryCondition.ToNumericText() } บาท" +// // }, +// // new MatchingCondition +// // { +// // Condition = $"2.ได้ ท.ช. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้ ท.ช. วันที่ { (new DateTime(period.Year-5, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)", +// // Result = $"ได้รับ ท.ช. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }" +// // }, + +// // } +// // }) +// // .ToList(); + + + +// // var result_candidate = new List(); + +// // foreach (var r in s2) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // foreach (var r in s1) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // return result_candidate; +// // } +// // catch +// // { +// // throw; +// // } +// // } + +// /// +// /// Gets the insignia candidate ประเภทวิชาการ ระดับเชี่ยวชาญ. +// /// +// /// The period identifier. +// /// The oc identifier. +// /// +// // public async List GetInsigniaCandidate_Type2_Level8(int periodId, int ocId) +// // { +// // try +// // { +// // var allOc = profileService.GetAllIdByRoot(ocId); + +// // var period = await _dbContext.Set().FirstOrDefault(p => p.Id == periodId); + +// // if (period == null) +// // throw new Exception(GlobalMessages.InvalidCoinPeriod); + +// // var oc = await _dbContext.Set().FirstOrDefault(x => x.OCId == ocId); + +// // if (oc == null) +// // throw new Exception(GlobalMessages.InvalidOC); + +// // var CurrentRetireDate = new DateTime(period.Year, 9, 30); + +// // var s1 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 2 // วิชาการ +// // && p.PositionLevel.Id == 8 // เชี่ยวชสญ +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "ทวีติยาภรณ์ช้างเผือก"), +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("ทวีติยาภรณ์ช้างเผือก"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.เป็นระดับเชี่ยวชาญ", +// // Result = $"ตำแหน่ง { p.Position } ประเภท { p.PositionType } ระดับ { p.PositionLevel }" +// // }, + +// // } +// // }) +// // .ToList(); + +// // var s2 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 2 // วิชาการ +// // && p.PositionLevel.Id == 8 // เชี่ยวชาญ +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "ประถมาภรณ์มงกุฎไทย"), +// // FirstRecvInsigniaYear = p.Insignias.Count == 0 ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ทวีติยาภรณ์ช้างเผือก").OrderBy(x => x.Year).FirstOrDefault() == null ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ทวีติยาภรณ์ช้างเผือก").OrderBy(x => x.Year).FirstOrDefault().Year +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 3) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("ประถมาภรณ์มงกุฎไทย"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { + +// // new MatchingCondition +// // { +// // Condition = $"1.ได้ ท.ช. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ท.ช. ก่อนวันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() })", +// // Result = $"ได้รับ ท.ช. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }" +// // }, + +// // } +// // }) +// // .ToList(); + +// // var s3 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 2 // วิชาการ +// // && p.PositionLevel.Id == 8 // เชี่ยวชาญ +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์ช้างเผือก") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "ประถมาภรณ์ช้างเผือก"), +// // FirstRecvInsigniaYear = p.Insignias.Count == 0 ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ประถมาภรณ์มงกุฎไทย").OrderBy(x => x.Year).FirstOrDefault() == null ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ประถมาภรณ์มงกุฎไทย").OrderBy(x => x.Year).FirstOrDefault().Year +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 5) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("ประถมาภรณ์ช้างเผือก"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { + +// // new MatchingCondition +// // { +// // Condition = $"1.ได้ ป.ม. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้ ท.ช. ก่อนวันที่ { (new DateTime(period.Year-5, 7, 28)).ToThaiFullDate3() })", +// // Result = $"ได้รับ ป.ม. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }" +// // }, + +// // } +// // }) +// // .ToList(); + + +// // var result_candidate = new List(); + +// // foreach (var r in s3) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // foreach (var r in s2) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // foreach (var r in s1) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // return result_candidate; +// // } +// // catch +// // { +// // throw; +// // } +// // } + +// /// +// /// Gets the insignia candidate ประเภทวิชาการ ระดับทรงคุณวุฒิ ได้เงินตำแหน้ง 13000. +// /// +// /// The period identifier. +// /// The oc identifier. +// /// +// // public async List GetInsigniaCandidate_Type2_Level9_1(int periodId, int ocId) +// // { +// // try +// // { +// // var allOc = profileService.GetAllIdByRoot(ocId); + +// // var period = await _dbContext.Set().FirstOrDefault(p => p.Id == periodId); + +// // if (period == null) +// // throw new Exception(GlobalMessages.InvalidCoinPeriod); + +// // var oc = await _dbContext.Set().FirstOrDefault(x => x.OCId == ocId); + +// // if (oc == null) +// // throw new Exception(GlobalMessages.InvalidOC); + +// // var CurrentRetireDate = new DateTime(period.Year, 9, 30); + +// // var s1 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 2 // วิชาการ +// // && (p.PositionLevel.Id == 9 || p.PositionLevel.Id == 12) // ทรงคุณวุฒิ + +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์ช้างเผือก") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "ประถมาภรณ์ช้างเผือก"), +// // FirstRecvInsigniaYear = p.Insignias.Count == 0 ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ประถมาภรณ์มงกุฎไทย").OrderBy(x => x.Year).FirstOrDefault() == null ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ประถมาภรณ์มงกุฎไทย").OrderBy(x => x.Year).FirstOrDefault().Year, +// // SalaryPosition = p.Salaries.Count == 0 ? 0 : +// // p.Salaries.AsQueryable().OrderBy(x => x.Order).LastOrDefault().PositionSalaryAmount == null ? 0 : +// // p.Salaries.AsQueryable().OrderBy(x => x.Order).LastOrDefault().PositionSalaryAmount.ToInteger() +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(x => x.FirstRecvInsigniaYear != 0 && x.FirstRecvInsigniaYear <= period.Year - 3) +// // .Where(x => x.SalaryPosition == 13000) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("ประถมาภรณ์ช้างเผือก"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.ได้ ป.ม. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ป.ม. ก่อนวันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() })", +// // Result = $"ได้รับ ป.ม. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }" +// // }, +// // new MatchingCondition +// // { +// // Condition = $"ได้รับเงินประจำตำแหน่ง 13,000 บาท", +// // Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition.ToNumericText() } บาท" +// // } +// // } +// // }) +// // .ToList(); + +// // var s2 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 2 // วิชาการ +// // && (p.PositionLevel.Id == 9 || p.PositionLevel.Id == 12) // ทรงคุณวุฒิ + +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("มหาวชิรมงกุฎ") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "มหาวชิรมงกุฎ"), +// // FirstRecvInsigniaYear = p.Insignias.Count == 0 ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ประถมาภรณ์ช้างเผือก").OrderBy(x => x.Year).FirstOrDefault() == null ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ประถมาภรณ์ช้างเผือก").OrderBy(x => x.Year).FirstOrDefault().Year, +// // SalaryPosition = p.Salaries.Count == 0 ? 0 : +// // p.Salaries.AsQueryable().OrderBy(x => x.Order).LastOrDefault().PositionSalaryAmount == null ? 0 : +// // p.Salaries.AsQueryable().OrderBy(x => x.Order).LastOrDefault().PositionSalaryAmount.ToInteger() +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 3) +// // .Where(p => p.SalaryPosition == 13000) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("มหาวชิรมงกุฎ"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { + +// // new MatchingCondition +// // { +// // Condition = $"1.ได้ ป.ช. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ป.ช. ก่อนวันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() })", +// // Result = $"ได้รับ ป.ช. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }" +// // }, +// // new MatchingCondition +// // { +// // Condition = $"ได้รับเงินประจำตำแหน่ง 13,000 บาท", +// // Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition.ToNumericText() } บาท" +// // } + +// // } +// // }) +// // .ToList(); + +// // var s3 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 2 // วิชาการ +// // && (p.PositionLevel.Id == 9 || p.PositionLevel.Id == 12) // ทรงคุณวุฒิ +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("มหาปรมาภรณ์ช้างเผือก") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "มหาปรมาภรณ์ช้างเผือก"), +// // FirstRecvInsigniaYear = p.Insignias.Count == 0 ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "มหาวชิรมงกุฎ").OrderBy(x => x.Year).FirstOrDefault() == null ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "มหาวชิรมงกุฎ").OrderBy(x => x.Year).FirstOrDefault().Year, +// // SalaryPosition = p.Salaries.Count == 0 ? 0 : +// // p.Salaries.AsQueryable().OrderBy(x => x.Order).LastOrDefault().PositionSalaryAmount == null ? 0 : +// // p.Salaries.AsQueryable().OrderBy(x => x.Order).LastOrDefault().PositionSalaryAmount.ToInteger() +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 5) +// // .Where(p => p.SalaryPosition == 13000) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("มหาปรมาภรณ์ช้างเผือก"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { + +// // new MatchingCondition +// // { +// // Condition = $"1.ได้ ม.ว.ม. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้ ม.ว.ม. ก่อนวันที่ { (new DateTime(period.Year-5, 7, 28)).ToThaiFullDate3() })", +// // Result = $"ได้รับ ม.ว.ม. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }" +// // }, +// // new MatchingCondition +// // { +// // Condition = $"ได้รับเงินประจำตำแหน่ง 13,000 บาท", +// // Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition.ToNumericText() } บาท" +// // } + +// // } +// // }) +// // .ToList(); + + +// // var result_candidate = new List(); + +// // foreach (var r in s3) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // foreach (var r in s2) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // foreach (var r in s1) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // return result_candidate; +// // } +// // catch +// // { +// // throw; +// // } +// // } + +// /// +// /// Gets the insignia candidate ประเภทวิชาการ ระดับทรงคุณวุฒิ ได้เงินตำแหน้ง 15600. +// /// +// /// The period identifier. +// /// The oc identifier. +// /// +// // public async List GetInsigniaCandidate_Type2_Level9_2(int periodId, int ocId) +// // { +// // try +// // { +// // var allOc = profileService.GetAllIdByRoot(ocId); + +// // var period = await _dbContext.Set().FirstOrDefault(p => p.Id == periodId); + +// // if (period == null) +// // throw new Exception(GlobalMessages.InvalidCoinPeriod); + +// // var oc = await _dbContext.Set().FirstOrDefault(x => x.OCId == ocId); + +// // if (oc == null) +// // throw new Exception(GlobalMessages.InvalidOC); + +// // var CurrentRetireDate = new DateTime(period.Year, 9, 30); + +// // var s1 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 2 // วิชาการ +// // && (p.PositionLevel.Id == 9 || p.PositionLevel.Id == 12) // ทรงคุณวุฒิ + +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์ช้างเผือก") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "ประถมาภรณ์ช้างเผือก"), +// // FirstRecvInsigniaYear = p.Insignias.Count == 0 ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ประถมาภรณ์มงกุฎไทย").OrderBy(x => x.Year).FirstOrDefault() == null ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ประถมาภรณ์มงกุฎไทย").OrderBy(x => x.Year).FirstOrDefault().Year, +// // SalaryPosition = p.Salaries.Count == 0 ? 0 : +// // p.Salaries.AsQueryable().OrderBy(x => x.Order).LastOrDefault().PositionSalaryAmount == null ? 0 : +// // p.Salaries.AsQueryable().OrderBy(x => x.Order).LastOrDefault().PositionSalaryAmount.ToInteger() +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(x => x.FirstRecvInsigniaYear != 0 && x.FirstRecvInsigniaYear <= period.Year - 3) +// // .Where(x => x.SalaryPosition == 15600) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("ประถมาภรณ์ช้างเผือก"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.ได้ ป.ม. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ป.ม. ก่อนวันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() })", +// // Result = $"ได้รับ ป.ม. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }" +// // }, +// // new MatchingCondition +// // { +// // Condition = $"ได้รับเงินประจำตำแหน่ง 15,600 บาท", +// // Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition.ToNumericText() } บาท" +// // } +// // } +// // }) +// // .ToList(); + +// // var s2 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 2 // วิชาการ +// // && (p.PositionLevel.Id == 9 || p.PositionLevel.Id == 12) // ทรงคุณวุฒิ + +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("มหาวชิรมงกุฎ") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "มหาวชิรมงกุฎ"), +// // FirstRecvInsigniaYear = p.Insignias.Count == 0 ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ประถมาภรณ์ช้างเผือก").OrderBy(x => x.Year).FirstOrDefault() == null ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ประถมาภรณ์ช้างเผือก").OrderBy(x => x.Year).FirstOrDefault().Year, +// // SalaryPosition = p.Salaries.Count == 0 ? 0 : +// // p.Salaries.AsQueryable().OrderBy(x => x.Order).LastOrDefault().PositionSalaryAmount == null ? 0 : +// // p.Salaries.AsQueryable().OrderBy(x => x.Order).LastOrDefault().PositionSalaryAmount.ToInteger() +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 3) +// // .Where(p => p.SalaryPosition == 15600) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("มหาวชิรมงกุฎ"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { + +// // new MatchingCondition +// // { +// // Condition = $"1.ได้ ป.ช. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ป.ช. ก่อนวันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() })", +// // Result = $"ได้รับ ป.ช. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }" +// // }, +// // new MatchingCondition +// // { +// // Condition = $"ได้รับเงินประจำตำแหน่ง 15,600 บาท", +// // Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition.ToNumericText() } บาท" +// // } +// // } +// // }) +// // .ToList(); + +// // var s3 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 2 // วิชาการ +// // && (p.PositionLevel.Id == 9 || p.PositionLevel.Id == 12) // ทรงคุณวุฒิ +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("มหาปรมาภรณ์ช้างเผือก") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "มหาปรมาภรณ์ช้างเผือก"), +// // FirstRecvInsigniaYear = p.Insignias.Count == 0 ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "มหาวชิรมงกุฎ").OrderBy(x => x.Year).FirstOrDefault() == null ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "มหาวชิรมงกุฎ").OrderBy(x => x.Year).FirstOrDefault().Year, +// // SalaryPosition = p.Salaries.Count == 0 ? 0 : +// // p.Salaries.AsQueryable().OrderBy(x => x.Order).LastOrDefault().PositionSalaryAmount == null ? 0 : +// // p.Salaries.AsQueryable().OrderBy(x => x.Order).LastOrDefault().PositionSalaryAmount.ToInteger() +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 3) +// // .Where(p => p.SalaryPosition == 15600) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("มหาปรมาภรณ์ช้างเผือก"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.ได้ ม.ว.ม. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ม.ว.ม. ก่อนวันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() })", +// // Result = $"ได้รับ ม.ว.ม. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }" +// // }, +// // new MatchingCondition +// // { +// // Condition = $"ได้รับเงินประจำตำแหน่ง 15,600 บาท", +// // Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition.ToNumericText() } บาท" +// // } +// // } +// // }) +// // .ToList(); + + +// // var result_candidate = new List(); + +// // foreach (var r in s3) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // foreach (var r in s2) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // foreach (var r in s1) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // return result_candidate; +// // } +// // catch +// // { +// // throw; +// // } +// // } + +// #endregion + +// #region " อำนวยการ " + +// // public async List GetInsigniaCandidate_Type3_Level10(int periodId, int ocId) +// // { +// // try +// // { +// // var allOc = profileService.GetAllIdByRoot(ocId); + +// // var period = await _dbContext.Set().FirstOrDefault(p => p.Id == periodId); + +// // if (period == null) +// // throw new Exception(GlobalMessages.InvalidCoinPeriod); + +// // var oc = await _dbContext.Set().FirstOrDefault(x => x.OCId == ocId); + +// // if (oc == null) +// // throw new Exception(GlobalMessages.InvalidOC); + +// // var CurrentRetireDate = new DateTime(period.Year, 9, 30); + +// // var s1 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 3 // ทั่วไป +// // && p.PositionLevel.Id == 10 // ระดับต้น +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "ทวีติยาภรณ์ช้างเผือก"), +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("ทวีติยาภรณ์ช้างเผือก"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.เป็นระดับอำนวยการ/ต้น", +// // Result = $"ตำแหน่ง { p.Position } ประเภท { p.PositionType } ระดับ { p.PositionLevel }" +// // }, + +// // } +// // }) +// // .ToList(); + +// // var s2 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 2 // วิชาการ +// // && p.PositionLevel.Id == 7 // ชำนาญการพิเศษ +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "ประถมาภรณ์มงกุฎไทย"), +// // FirstRecvInsigniaYear = p.Insignias.Count == 0 ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ทวีติยาภรณ์ช้างเผือก").OrderBy(x => x.Year).FirstOrDefault() == null ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ทวีติยาภรณ์ช้างเผือก").OrderBy(x => x.Year).FirstOrDefault().Year +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(p => p.SalaryCondition >= 58390) +// // .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 5) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("ประถมาภรณ์มงกุฎไทย"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.ได้รับเงินเดือนขั้นสูง (เงินเดือน ณ วันที่ { (new DateTime(period.Year, 4, 29)).ToThaiFullDate3() } 58,390 บาท)", +// // Result = $"เงินเดือน ณ วันที่ { (new DateTime(period.Year, 4, 29)).ToThaiFullDate3() } เป็นเงิน { p.SalaryCondition.ToNumericText() } บาท" +// // }, +// // new MatchingCondition +// // { +// // Condition = $"2.ได้ ท.ช. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้ ท.ช. วันที่ { (new DateTime(period.Year-5, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)", +// // Result = $"ได้รับ ท.ช. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }" +// // }, + +// // } +// // }) +// // .ToList(); + +// // var result_candidate = new List(); + + +// // foreach (var r in s2) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // foreach (var r in s1) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // return result_candidate; +// // } +// // catch +// // { +// // throw; +// // } +// // } + +// // public async List GetInsigniaCandidate_Type3_Level11(int periodId, int ocId) +// // { +// // try +// // { +// // var allOc = profileService.GetAllIdByRoot(ocId); + +// // var period = await _dbContext.Set().FirstOrDefault(p => p.Id == periodId); + +// // if (period == null) +// // throw new Exception(GlobalMessages.InvalidCoinPeriod); + +// // var oc = await _dbContext.Set().FirstOrDefault(x => x.OCId == ocId); + +// // if (oc == null) +// // throw new Exception(GlobalMessages.InvalidOC); + +// // var CurrentRetireDate = new DateTime(period.Year, 9, 30); + +// // var s1 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 3 // ทั่วไป +// // && p.PositionLevel.Id == 11 // ระดับสูง +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "ประถมาภรณ์มงกุฎไทย"), +// // FirstRecvInsigniaYear = p.Insignias.Count == 0 ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ทวีติยาภรณ์ช้างเผือก").OrderBy(x => x.Year).FirstOrDefault() == null ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ทวีติยาภรณ์ช้างเผือก").OrderBy(x => x.Year).FirstOrDefault().Year +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 3) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("ประถมาภรณ์มงกุฎไทย"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.ได้ ท.ช. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ท.ช. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)", +// // Result = $"ได้รับ ท.ช. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }" +// // }, + +// // } +// // }) +// // .ToList(); + +// // var s2 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 3 // ทั่วไป +// // && p.PositionLevel.Id == 11 // ระดับสูง +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์ช้างเผือก") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "ประถมาภรณ์ช้างเผือก"), +// // FirstRecvInsigniaYear = p.Insignias.Count == 0 ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ประถมาภรณ์มงกุฎไทย").OrderBy(x => x.Year).FirstOrDefault() == null ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ประถมาภรณ์มงกุฎไทย").OrderBy(x => x.Year).FirstOrDefault().Year +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 3) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("ประถมาภรณ์ช้างเผือก"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.ได้ ป.ม. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ป.ม. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)", +// // Result = $"ได้รับ ป.ม. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }" +// // }, + +// // } +// // }) +// // .ToList(); + +// // var s3 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 3 // ทั่วไป +// // && p.PositionLevel.Id == 11 // ระดับสูง +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("มหาวชิรมงกุฎ") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "มหาวชิรมงกุฎ"), +// // FirstRecvInsigniaYear = p.Insignias.Count == 0 ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ประถมาภรณ์ช้างเผือก").OrderBy(x => x.Year).FirstOrDefault() == null ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ประถมาภรณ์ช้างเผือก").OrderBy(x => x.Year).FirstOrDefault().Year +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 5) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("มหาวชิรมงกุฎ"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.ได้ ป.ช. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้ ป.ช. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)", +// // Result = $"ได้รับ ป.ช. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }" +// // }, + +// // } +// // }) +// // .ToList(); + + + +// // var result_candidate = new List(); + +// // foreach (var r in s3) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // foreach (var r in s2) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // foreach (var r in s1) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? +// // if (!CanRequestInsignia(r.ProfileId, period.Year)) +// // continue; + +// // // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? +// // if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) +// // continue; + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // return result_candidate; +// // } +// // catch +// // { +// // throw; +// // } +// // } + +// #endregion + +// #region " บริหาร " + +// // public async List GetInsigniaCandidate_Type4_Level10(int periodId, int ocId) +// // { +// // try +// // { +// // var allOc = profileService.GetAllIdByRoot(ocId); + +// // var period = await _dbContext.Set().FirstOrDefault(p => p.Id == periodId); + +// // if (period == null) +// // throw new Exception(GlobalMessages.InvalidCoinPeriod); + +// // var oc = await _dbContext.Set().FirstOrDefault(x => x.OCId == ocId); + +// // if (oc == null) +// // throw new Exception(GlobalMessages.InvalidOC); + +// // var CurrentRetireDate = new DateTime(period.Year, 9, 30); + +// // var s1 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 4 // ทั่วไป +// // && p.PositionLevel.Id == 10 // ระดับสูง +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "ประถมาภรณ์มงกุฎไทย"), +// // FirstRecvInsigniaYear = p.Insignias.Count == 0 ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ทวีติยาภรณ์ช้างเผือก").OrderBy(x => x.Year).FirstOrDefault() == null ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ทวีติยาภรณ์ช้างเผือก").OrderBy(x => x.Year).FirstOrDefault().Year +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 3) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("ประถมาภรณ์มงกุฎไทย"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.ได้ ท.ช. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ท.ช. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)", +// // Result = $"ได้รับ ท.ช. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }" +// // }, + +// // } +// // }) +// // .ToList(); + +// // var s2 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 4 // ทั่วไป +// // && p.PositionLevel.Id == 10 // ระดับสูง +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์ช้างเผือก") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "ประถมาภรณ์ช้างเผือก"), +// // FirstRecvInsigniaYear = p.Insignias.Count == 0 ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ประถมาภรณ์มงกุฎไทย").OrderBy(x => x.Year).FirstOrDefault() == null ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ประถมาภรณ์มงกุฎไทย").OrderBy(x => x.Year).FirstOrDefault().Year +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 3) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("ประถมาภรณ์ช้างเผือก"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.ได้ ป.ม. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ป.ม. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)", +// // Result = $"ได้รับ ป.ม. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }" +// // }, + +// // } +// // }) +// // .ToList(); + +// // var s3 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 4 // ทั่วไป +// // && p.PositionLevel.Id == 10 // ระดับสูง +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("มหาวชิรมงกุฎ") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "มหาวชิรมงกุฎ"), +// // FirstRecvInsigniaYear = p.Insignias.Count == 0 ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ประถมาภรณ์ช้างเผือก").OrderBy(x => x.Year).FirstOrDefault() == null ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ประถมาภรณ์ช้างเผือก").OrderBy(x => x.Year).FirstOrDefault().Year +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 5) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("มหาวชิรมงกุฎ"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.ได้ ป.ช. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้ ป.ช. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)", +// // Result = $"ได้รับ ป.ช. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }" +// // }, + +// // } +// // }) +// // .ToList(); + + + +// // var result_candidate = new List(); + +// // foreach (var r in s3) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // foreach (var r in s2) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // foreach (var r in s1) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // return result_candidate; +// // } +// // catch +// // { +// // throw; +// // } +// // } + +// // public async List GetInsigniaCandidate_Type4_Level11(int periodId, int ocId) +// // { +// // try +// // { +// // var allOc = profileService.GetAllIdByRoot(ocId); + +// // var period = await _dbContext.Set().FirstOrDefault(p => p.Id == periodId); + +// // if (period == null) +// // throw new Exception(GlobalMessages.InvalidCoinPeriod); + +// // var oc = await _dbContext.Set().FirstOrDefault(x => x.OCId == ocId); + +// // if (oc == null) +// // throw new Exception(GlobalMessages.InvalidOC); + +// // var CurrentRetireDate = new DateTime(period.Year, 9, 30); + +// // var s1 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 4 // ทั่วไป +// // && p.PositionLevel.Id == 11 // ระดับสูง +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์ช้างเผือก") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "ประถมาภรณ์ช้างเผือก"), +// // FirstRecvInsigniaYear = p.Insignias.Count == 0 ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ประถมาภรณ์มงกุฎไทย").OrderBy(x => x.Year).FirstOrDefault() == null ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ประถมาภรณ์มงกุฎไทย").OrderBy(x => x.Year).FirstOrDefault().Year, +// // SalaryPosition = p.Salaries.Count == 0 ? 0 : +// // p.Salaries.AsQueryable().OrderBy(x => x.Order).LastOrDefault().PositionSalaryAmount == null ? 0 : +// // p.Salaries.AsQueryable().OrderBy(x => x.Order).LastOrDefault().PositionSalaryAmount.ToInteger() +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 3) +// // .Where(x => x.SalaryPosition == 14500) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("ประถมาภรณ์ช้างเผือก"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.ได้ ป.ม. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ป.ม. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)", +// // Result = $"ได้รับ ป.ม. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }" +// // }, +// // new MatchingCondition +// // { +// // Condition = $"ได้รับเงินประจำตำแหน่ง 14,500 บาท", +// // Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition.ToNumericText() } บาท" +// // } +// // } +// // }) +// // .ToList(); + +// // var s2 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 4 // ทั่วไป +// // && p.PositionLevel.Id == 11 // ระดับสูง +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("มหาวชิรมงกุฎ") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "มหาวชิรมงกุฎ"), +// // FirstRecvInsigniaYear = p.Insignias.Count == 0 ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ประถมาภรณ์ช้างเผือก").OrderBy(x => x.Year).FirstOrDefault() == null ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "ประถมาภรณ์ช้างเผือก").OrderBy(x => x.Year).FirstOrDefault().Year, +// // SalaryPosition = p.Salaries.Count == 0 ? 0 : +// // p.Salaries.AsQueryable().OrderBy(x => x.Order).LastOrDefault().PositionSalaryAmount == null ? 0 : +// // p.Salaries.AsQueryable().OrderBy(x => x.Order).LastOrDefault().PositionSalaryAmount.ToInteger() +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 3) +// // .Where(x => x.SalaryPosition == 14500) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("มหาวชิรมงกุฎ"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.ได้ ป.ช. มาแล้วไม่น้อยกว่า 3 ปี บริบูรณ์ (ได้ ป.ช. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)", +// // Result = $"ได้รับ ป.ช. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }" +// // }, +// // new MatchingCondition +// // { +// // Condition = $"ได้รับเงินประจำตำแหน่ง 14,500 บาท", +// // Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition.ToNumericText() } บาท" +// // } +// // } +// // }) +// // .ToList(); + +// // var s3 = (from p in await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.PositionType) +// // .Include(p => p.PositionLevel) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // where p.OrganizationChart != null +// // && allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsActive == true +// // && p.IsLeave == false +// // && p.DateAppoint != null +// // && p.PositionType.Id == 4 // ทั่วไป +// // && p.PositionLevel.Id == 11 // ระดับสูง +// // && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name.Contains("มหาปรมาภรณ์ช้างเผือก") +// // //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// // //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// // select new +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // PositionLevel = p.PositionLevel.Name, +// // PositionType = p.PositionType.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // ProfileDateAppoint = p.DateAppoint.Value, +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// // PosNo = p.PositionNumber.Id, +// // Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// // IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias +// // .Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")) +// // .OrderByDescending(x => x.Year) +// // .FirstOrDefault().Insignia.Name, +// // "มหาปรมาภรณ์ช้างเผือก"), +// // FirstRecvInsigniaYear = p.Insignias.Count == 0 ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "มหาวชิรมงกุฎ").OrderBy(x => x.Year).FirstOrDefault() == null ? 0 : +// // p.Insignias.Where(x => x.Insignia.Name == "มหาวชิรมงกุฎ").OrderBy(x => x.Year).FirstOrDefault().Year, +// // SalaryPosition = p.Salaries.Count == 0 ? 0 : +// // p.Salaries.AsQueryable().OrderBy(x => x.Order).LastOrDefault().PositionSalaryAmount == null ? 0 : +// // p.Salaries.AsQueryable().OrderBy(x => x.Order).LastOrDefault().PositionSalaryAmount.ToInteger() +// // //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// // //RequestInsignia = GetInsigniaByName("ตริตาภรณ์มงกุฎไทย") +// // }) +// // .ToList() +// // .Where(p => p.FirstRecvInsigniaYear != 0 && p.FirstRecvInsigniaYear <= period.Year - 5) +// // .Where(x => x.SalaryPosition == 14500) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.ProfileId, +// // Prefix = p.Prefix, +// // FullName = p.FullName, +// // Position = p.Position, +// // PosNo = p.PosNo, +// // Rank = p.Rank, +// // GovAge = p.GovAge, +// // LastInsignia = p.LastInsignia, +// // LastInsigniaId = p.LastInsigniaId, +// // Salary = p.Salary, +// // RequestInsignia = GetInsigniaByName("มหาปรมาภรณ์ช้างเผือก"), +// // Seq = 2, +// // Gender = p.Gender, +// // MatchingConditions = new List +// // { +// // new MatchingCondition +// // { +// // Condition = $"1.ได้ ม.ว.ม. มาแล้วไม่น้อยกว่า 5 ปี บริบูรณ์ (ได้ ม.ว.ม. วันที่ { (new DateTime(period.Year-3, 7, 28)).ToThaiFullDate3() } หรือก่อนหน้านั้น)", +// // Result = $"ได้รับ ม.ว.ม. ในปี { p.FirstRecvInsigniaYear.ToThaiYear() }" +// // }, +// // new MatchingCondition +// // { +// // Condition = $"ได้รับเงินประจำตำแหน่ง 14,500 บาท", +// // Result = $"ได้รับเงินประจำตำแหน่ง { p.SalaryPosition.ToNumericText() } บาท" +// // } +// // } +// // }) +// // .ToList(); + + +// // var result_candidate = new List(); + +// // foreach (var r in s3) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // foreach (var r in s2) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // foreach (var r in s1) +// // { +// // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + +// // if (old == null) +// // { +// // result_candidate.Add(r); +// // } +// // } + +// // return result_candidate; +// // } +// // catch +// // { +// // throw; +// // } +// // } + +// #endregion + + +// #endregion + +// #region " Public " + +// /// +// /// กรองรายชื่อผู้มิสิทธิ์ยื่นขอเครื่องราช +// /// +// /// รหัสของรอบการขอ +// /// รหัสโรงเรียน +// /// +// public async Task> GetInsigniaCandidate(Guid periodId, Guid ocId) +// { +// try +// { +// var allOc = profileService.GetAllIdByRoot(ocId); + +// var period = await _dbContext.Set().FirstOrDefaultAsync(p => p.Id == periodId); + +// if (period == null) +// throw new Exception(GlobalMessages.DataNotFound); + +// var oc = await _dbContext.Set().FirstOrDefaultAsync(x => x.Id == ocId); + +// if (oc == null) +// throw new Exception(GlobalMessages.DataNotFound); + +// var CurrentRetireDate = new DateTime(period.Year, 9, 30); + +// var inst_profile = await _dbContext.Set() +// .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// .Include(p => p.Insignias) +// .ThenInclude(i => i.Insignia) +// .Include(p => p.Salaries) +// .Where(p => +// // allOc.Contains(p.OrganizationOrganization.Id) && +// p.IsActive == true && +// p.IsLeave == false && +// p.DateAppoint != null +// ) +// .Select(p => new +// { +// ProfileId = p.Id, +// Prefix = p.Prefix, +// FullName = $"{p.FirstName} {p.LastName}", +// Position = p.Position.Name, +// // Rank = p.AcademicStanding.Name, +// ProfileDateAppoint = p.DateAppoint.Value, +// GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // PosNo = p.PositionNumber.Id, +// Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// LastInsigniaId = p.Insignias.Count == 0 ? -1 : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// //CanRequestInsignia = CanRequestInsignia(p.Id, period.Year.ToString()) +// }); + +// // check วันที่บรรจะต้องน้อยกว่า 29/5/ปี-5 +// var s1 = ((from p in inst_profile +// //where p.CanRequestInsignia == true +// where p.ProfileDateAppoint <= new DateTime(period.Year - 5, 5, 29) +// && p.LastInsigniaId == -1 +// select p) +// .ToList() +// .Select(p => new InsigniaResultSet +// { +// ProfileId = p.ProfileId, +// Prefix = p.Prefix, +// FullName = p.FullName, +// Position = p.Position, +// PosNo = p.PosNo, +// Rank = p.Rank, +// GovAge = p.GovAge, +// LastInsignia = p.LastInsignia, +// LastInsigniaId = p.LastInsigniaId, +// Salary = p.Salary, +// RequestInsignia = await GetInsigniaByName("ตริตาภรณ์มงกุฎไทย"), +// Seq = 1, +// Gender = p.Gender +// })).ToList(); + +// var s2 = (from p in _dbContext.Set() +// .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// .Include(p => p.Insignias) +// .ThenInclude(i => i.Insignia) +// .Include(p => p.Salaries) +// where p.OrganizationOrganization != null +// // && allOc.Contains(p.OrganizationOrganization.Id) +// && p.IsActive == true +// && p.IsLeave == false +// && p.DateAppoint != null +// // && p.AcademicStanding.Name == "ชำนาญการ" +// && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name.Contains("ตริตาภรณ์ช้างเผือก") +// //&& !IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก") +// //&& CanRequestInsignia(p.Id, period.Year.ToString()) +// select new +// { +// ProfileId = p.Id, +// Prefix = p.Prefix, +// FullName = $"{p.FirstName} {p.LastName}", +// Position = p.Position.Name, +// Rank = p.AcademicStanding.Name, +// GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// PosNo = p.PositionNumber.Id, +// Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// IsHigherLevel = InsigniaService.IsHigherLevel(p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, "ตริตาภรณ์ช้างเผือก"), +// }) +// .ToList() +// .Where(x => x.SalaryCondition < 22140 && !x.IsHigherLevel) +// .Select(p => new InsigniaResultSet +// { +// ProfileId = p.ProfileId, +// Prefix = p.Prefix, +// FullName = p.FullName, +// Position = p.Position, +// PosNo = p.PosNo, +// Rank = p.Rank, +// GovAge = p.GovAge, +// LastInsignia = p.LastInsignia, +// LastInsigniaId = p.LastInsigniaId, +// Salary = p.Salary, +// RequestInsignia = GetInsigniaByName("ตริตาภรณ์ช้างเผือก"), +// Seq = 2, +// Gender = p.Gender +// }) +// .ToList(); + +// // คศ2 ขอ ทม +// var s3 = (from p in _dbContext.Set() +// .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// .Include(p => p.Insignias) +// .ThenInclude(i => i.Insignia) +// .Include(p => p.Salaries) +// where p.IsActive == true +// // && allOc.Contains(p.OrganizationChart.OCId) +// && p.IsLeave == false +// && p.DateAppoint != null +// // && p.AcademicStanding.Name == "ชำนาญการ" +// && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์มงกุฎไทย") +// select new +// { +// ProfileId = p.Id, +// Prefix = p.Prefix, +// FullName = $"{p.FirstName} {p.LastName}", +// Position = p.Position.Name, +// Rank = p.AcademicStanding.Name, +// GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// PosNo = p.PositionNumber.Id, +// Gender = p.Gendor.IsNull("") == "male" ? "1" : "2" +// }) +// .ToList() +// .Where(x => x.SalaryCondition >= 22140) +// .Select(p => new InsigniaResultSet +// { +// ProfileId = p.ProfileId, +// Prefix = p.Prefix, +// FullName = p.FullName, +// Position = p.Position, +// PosNo = p.PosNo, +// Rank = p.Rank, +// GovAge = p.GovAge, +// LastInsignia = p.LastInsignia, +// LastInsigniaId = p.LastInsigniaId, +// Salary = p.Salary, +// RequestInsignia = GetInsigniaByName("ทวีติยาภรณ์มงกุฎไทย"), +// Seq = 3, +// Gender = p.Gender +// }) +// .ToList(); + +// // คศ2 ขอ ทช +// var s4 = (from p in _dbContext.Set() +// .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// .Include(p => p.Insignias) +// .ThenInclude(i => i.Insignia) +// .Include(p => p.Salaries) +// where p.IsActive == true +// // && allOc.Contains(p.OrganizationOrganization.OCId) +// && p.IsLeave == false +// && p.DateAppoint != null +// && p.AcademicStanding.Name == "ชำนาญการ" +// && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก") +// select new +// { +// ProfileId = p.Id, +// Prefix = p.Prefix, +// FullName = $"{p.FirstName} {p.LastName}", +// Position = p.Position.Name, +// Rank = p.AcademicStanding.Name, +// GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate < new DateTime(period.Year - 5, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// PosNo = p.PositionNumber.Id, +// Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// SalaryCondition2 = p.Salaries.Count() == 0 ? null : p.Salaries.Where(x => x.SalaryDate < new DateTime(period.Year - 5, 4, 29)).Select(x => new { order = x.Order, AsId = x.SalaryAcademicStanding.Id, salary = x.Amount.Replace(".00", "").Replace(",", "").ToInteger() }) +// }) +// .ToList() +// .Where(x => x.SalaryCondition2 != null && (x.SalaryCondition2.Where(x => x.AsId == 1).Count() > 0 && x.SalaryCondition2.Where(x => x.AsId == 1).OrderByDescending(x => x.order).FirstOrDefault().salary >= 22140)) +// .Select(p => new InsigniaResultSet +// { +// ProfileId = p.ProfileId, +// Prefix = p.Prefix, +// FullName = p.FullName, +// Position = p.Position, +// PosNo = p.PosNo, +// Rank = p.Rank, +// GovAge = p.GovAge, +// LastInsignia = p.LastInsignia, +// LastInsigniaId = p.LastInsigniaId, +// Salary = p.Salary, +// RequestInsignia = GetInsigniaByName("ทวีติยาภรณ์ช้างเผือก"), +// Seq = 4, +// Gender = p.Gender +// }) +// .ToList(); + +// // คศ3 ขอ ทช +// var s5 = ((from p in _dbContext.Set() +// .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// .Include(p => p.Insignias) +// .ThenInclude(i => i.Insignia) +// .Include(p => p.Salaries) +// where p.IsActive == true +// // && allOc.Contains(p.OrganizationOrganization.OCId) +// && p.IsLeave == false +// && p.DateAppoint != null +// && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก") +// select p) +// .ToList() +// .Select(p => new InsigniaResultSet +// { +// ProfileId = p.Id, +// Prefix = p.Prefix, +// FullName = $"{p.FirstName} {p.LastName}", +// Position = p.Position.Name, +// PosNo = p.PositionNumber.Id, +// Rank = p.AcademicStanding.Name, +// GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// RequestInsignia = GetInsigniaByName("ทวีติยาภรณ์ช้างเผือก"), +// Seq = 4, +// Gender = p.Gendor.IsNull("") == "male" ? "1" : "2" +// })) +// .ToList(); + +// // คศ3 ขอ ปม +// var s6 = (from p in _dbContext.Set() +// .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// .Include(p => p.Insignias) +// .ThenInclude(i => i.Insignia) +// .Include(p => p.Salaries) +// where p.IsActive == true +// // && allOc.Contains(p.OrganizationOrganization.OCId) +// && p.IsLeave == false +// && p.DateAppoint != null +// // && p.AcademicStanding.Name == "ชำนาญการพิเศษ" +// && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย") +// select new +// { +// ProfileId = p.Id, +// Prefix = p.Prefix, +// FullName = $"{p.FirstName} {p.LastName}", +// Position = p.Position.Name, +// Rank = p.AcademicStanding.Name, +// GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// PosNo = p.PositionNumber.Id, +// Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// InsigniaConditionYear = p.Insignias.Where(x => x.Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก")).Count() > 0 ? p.Insignias.Where(x => x.Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก")).FirstOrDefault() != null ? p.Insignias.Where(x => x.Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก")).FirstOrDefault().Year : 9999 : 9999, +// RetireDate = p.BirthDate.CalculateRetireDate() +// }) +// .ToList() +// .Where(x => x.RetireDate == CurrentRetireDate && x.SalaryCondition >= 58390 && x.InsigniaConditionYear <= period.Year - 5) +// .Select(p => new InsigniaResultSet +// { +// ProfileId = p.ProfileId, +// Prefix = p.Prefix, +// FullName = p.FullName, +// Position = p.Position, +// PosNo = p.PosNo, +// Rank = p.Rank, +// GovAge = p.GovAge, +// LastInsignia = p.LastInsignia, +// LastInsigniaId = p.LastInsigniaId, +// Salary = p.Salary, +// RequestInsignia = GetInsigniaByName("ประถมาภรณ์มงกุฎไทย"), +// Seq = 5, +// Gender = p.Gender +// }) +// .ToList(); + +// // คศ4 ขอ ปม +// var s7 = (from p in _dbContext.Set() +// .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// .Include(p => p.Insignias) +// .ThenInclude(i => i.Insignia) +// .Include(p => p.Salaries) +// where p.IsActive == true +// // && allOc.Contains(p.OrganizationOrganization.OCId) +// && p.IsLeave == false +// && p.DateAppoint != null +// // && p.AcademicStanding.Name == "เชี่ยวชาญ" +// && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย") +// select new +// { +// ProfileId = p.Id, +// Prefix = p.Prefix, +// FullName = $"{p.FirstName} {p.LastName}", +// Position = p.Position.Name, +// Rank = p.AcademicStanding.Name, +// GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// PosNo = p.PositionNumber.Id, +// Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// InsigniaConditionYear = p.Insignias.Where(x => x.Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก")).Count() > 0 ? p.Insignias.Where(x => x.Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก")).FirstOrDefault() != null ? p.Insignias.Where(x => x.Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก")).FirstOrDefault().Year : 9999 : 9999 +// }) +// .ToList() +// .Where(x => x.InsigniaConditionYear <= period.Year - 3) +// .Select(p => new InsigniaResultSet +// { +// ProfileId = p.ProfileId, +// Prefix = p.Prefix, +// FullName = p.FullName, +// Position = p.Position, +// PosNo = p.PosNo, +// Rank = p.Rank, +// GovAge = p.GovAge, +// LastInsignia = p.LastInsignia, +// LastInsigniaId = p.LastInsigniaId, +// Salary = p.Salary, +// RequestInsignia = GetInsigniaByName("ประถมาภรณ์มงกุฎไทย"), +// Seq = 5, +// Gender = p.Gender +// }) +// .ToList(); + +// // คศ4 ขอ ปชa +// var s8 = (from p in _dbContext.Set() +// .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// .Include(p => p.Insignias) +// .ThenInclude(i => i.Insignia) +// .Include(p => p.Salaries) +// where p.IsActive == true +// // && allOc.Contains(p.OrganizationOrganization.OCId) +// && p.IsLeave == false +// && p.DateAppoint != null +// // && p.AcademicStanding.Name == "เชี่ยวชาญ" +// && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์ช้างเผือก") +// select new +// { +// ProfileId = p.Id, +// Prefix = p.Prefix, +// FullName = $"{p.FirstName} {p.LastName}", +// Position = p.Position.Name, +// Rank = p.AcademicStanding.Name, +// GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// PosNo = p.PositionNumber.Id, +// Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// InsigniaConditionYear = p.Insignias.Where(x => x.Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย")).Count() > 0 ? p.Insignias.Where(x => x.Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย")).FirstOrDefault() != null ? p.Insignias.Where(x => x.Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย")).FirstOrDefault().Year : 9999 : 9999 +// }) +// .ToList() +// .Where(x => x.InsigniaConditionYear <= period.Year - 3) +// .Select(p => new InsigniaResultSet +// { +// ProfileId = p.ProfileId, +// Prefix = p.Prefix, +// FullName = p.FullName, +// Position = p.Position, +// PosNo = p.PosNo, +// Rank = p.Rank, +// GovAge = p.GovAge, +// LastInsignia = p.LastInsignia, +// LastInsigniaId = p.LastInsigniaId, +// Salary = p.Salary, +// RequestInsignia = GetInsigniaByName("ประถมาภรณ์ช้างเผือก"), +// Seq = 6, +// Gender = p.Gender +// }) +// .ToList(); + +// // คศ4 ขอ มวม +// var s9 = (from p in _dbContext.Set() +// .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// .Include(p => p.Insignias) +// .ThenInclude(i => i.Insignia) +// .Include(p => p.Salaries) +// where p.IsActive == true +// // && allOc.Contains(p.OrganizationOrganization.OCId) +// && p.IsLeave == false +// && p.DateAppoint != null +// // && p.AcademicStanding.Name == "เชี่ยวชาญ" +// && !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name.Contains("มหาวชิรมงกุฎ") +// select new +// { +// ProfileId = p.Id, +// Prefix = p.Prefix, +// FullName = $"{p.FirstName} {p.LastName}", +// Position = p.Position.Name, +// Rank = p.AcademicStanding.Name, +// GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// LastInsigniaId = p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id, +// Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// SalaryCondition = p.Salaries.Count() == 0 ? 0 : p.Salaries.Where(x => x.SalaryDate <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount.Replace(".00", "").Replace(",", "").ToInteger(), +// PosNo = p.PositionNumber.Id, +// Gender = p.Gendor.IsNull("") == "male" ? "1" : "2", +// InsigniaConditionYear = p.Insignias.Where(x => x.Insignia.Name.Contains("ประถมาภรณ์ช้างเผือก")).Count() > 0 ? p.Insignias.Where(x => x.Insignia.Name.Contains("ประถมาภรณ์ช้างเผือก")).FirstOrDefault() != null ? p.Insignias.Where(x => x.Insignia.Name.Contains("ประถมาภรณ์ช้างเผือก")).FirstOrDefault().Year : 9999 : 9999 + +// }) +// .ToList() +// .Where(x => x.InsigniaConditionYear <= period.Year - 5) +// .Select(p => new InsigniaResultSet +// { +// ProfileId = p.ProfileId, +// Prefix = p.Prefix, +// FullName = p.FullName, +// Position = p.Position, +// PosNo = p.PosNo, +// Rank = p.Rank, +// GovAge = p.GovAge, +// LastInsignia = p.LastInsignia, +// LastInsigniaId = p.LastInsigniaId, +// Salary = p.Salary, +// RequestInsignia = GetInsigniaByName("มหาวชิรมงกุฎ"), +// Seq = 7, +// Gender = p.Gender +// }) +// .ToList(); + +// // คัดรายชื่อซ้ำออก +// var s2_criteria = s4.Select(p => p.ProfileId).Union(s3.Select(p => p.ProfileId)); +// var s3_criteria = s4.Select(p => p.ProfileId).Union(s6.Select(p => p.ProfileId)); +// var s5_criteria = s4.Select(p => p.ProfileId); +// var s7_criteria = s9.Select(p => p.ProfileId).Union(s8.Select(p => p.ProfileId)); +// var s8_criteria = s9.Select(p => p.ProfileId); + + +// var s2_1 = s2.Where(x => s2_criteria.Contains(x.ProfileId)).ToList(); +// var s3_1 = s3.Where(x => s3_criteria.Contains(x.ProfileId)).ToList(); +// var s5_1 = s5.Where(x => s5_criteria.Contains(x.ProfileId)).ToList(); +// var s7_1 = s7.Where(x => s7_criteria.Contains(x.ProfileId)).ToList(); +// var s8_1 = s8.Where(x => s8_criteria.Contains(x.ProfileId)).ToList(); + +// var ret = new List(); +// if (s1.Count > 0) +// ret.AddRange(s1); +// if (s2_1.Count > 0) +// ret.AddRange(s2_1); +// if (s3_1.Count > 0) +// ret.AddRange(s3_1); +// if (s4.Count > 0) +// ret.AddRange(s4); +// if (s5_1.Count > 0) +// ret.AddRange(s5_1); +// if (s6.Count > 0) +// ret.AddRange(s6); +// if (s7_1.Count > 0) +// ret.AddRange(s7_1); +// if (s8_1.Count > 0) +// ret.AddRange(s8_1); +// if (s9.Count > 0) +// ret.AddRange(s9); + +// return ret.OrderBy(x => x.Seq).ThenBy(x => x.Gender).ThenBy(x => x.ProfileId).ToList(); + +// } +// catch +// { +// throw; +// } +// } + +// public async Task> GetInsigniaCandidateBKK(Guid periodId, Guid ocId) +// { +// try +// { +// var result_candidate = new List(); + +// var type1_level1 = GetInsigniaCandidate_Type1_Level1(periodId, ocId); +// var type1_level2 = GetInsigniaCandidate_Type1_Level2(periodId, ocId); +// var type1_level3 = GetInsigniaCandidate_Type1_Level3(periodId, ocId); +// var type1_level4 = GetInsigniaCandidate_Type1_Level4(periodId, ocId); +// var type2_level5 = GetInsigniaCandidate_Type2_Level5(periodId, ocId); +// var type2_level6 = GetInsigniaCandidate_Type2_Level6(periodId, ocId); +// var type2_level7 = GetInsigniaCandidate_Type2_Level7(periodId, ocId); +// var type2_level8 = GetInsigniaCandidate_Type2_Level8(periodId, ocId); +// var type2_level9_1 = GetInsigniaCandidate_Type2_Level9_1(periodId, ocId); +// var type2_level9_2 = GetInsigniaCandidate_Type2_Level9_2(periodId, ocId); +// var type3_level10 = GetInsigniaCandidate_Type3_Level10(periodId, ocId); +// var type3_level11 = GetInsigniaCandidate_Type3_Level11(periodId, ocId); +// var type4_level10 = GetInsigniaCandidate_Type4_Level10(periodId, ocId); +// var type4_level11 = GetInsigniaCandidate_Type4_Level11(periodId, ocId); + + +// // union result +// result_candidate.AddRange(type1_level1); +// result_candidate.AddRange(type1_level2); +// result_candidate.AddRange(type1_level3); +// result_candidate.AddRange(type1_level4); +// result_candidate.AddRange(type2_level5); +// result_candidate.AddRange(type2_level6); +// result_candidate.AddRange(type2_level7); +// result_candidate.AddRange(type2_level8); +// result_candidate.AddRange(type2_level9_1); +// result_candidate.AddRange(type2_level9_2); +// result_candidate.AddRange(type3_level10); +// result_candidate.AddRange(type3_level11); +// result_candidate.AddRange(type4_level10); +// result_candidate.AddRange(type4_level11); + +// return result_candidate.OrderBy(x => x.Seq).ThenBy(x => x.Gender).ThenBy(x => x.ProfileId).ToList(); +// } +// catch +// { +// throw; +// } +// } + + +// // +// /// กรองรายชื่อผู้มิสิทธิ์ยื่นขอเหรียญจักรพรรดิมาลา +// /// +// /// รหัสของรอบการขอ +// /// รหัสโรงเรียน +// /// +// // public async List GetCoinCandidate(Guid periodId, Guid ocId) +// // { +// // try +// // { + +// // var allOc = profileService.GetAllIdByRoot(ocId); + +// // var period = await _dbContext.Set().FirstOrDefault(p => p.Id == periodId); + +// // if (period == null) +// // throw new Exception(GlobalMessages.InvalidCoinPeriod); + +// // var oc = await _dbContext.Set().FirstOrDefault(x => x.OCId == ocId); + +// // if (oc == null) +// // throw new Exception(GlobalMessages.InvalidOC); + +// // var result = await _dbContext.Set().AsQueryable() +// // .Include(p => p.Position) +// // .Include(p => p.PositionNumber) +// // .Include(p => p.AcademicStanding) +// // .Include(p => p.Insignias) +// // .ThenInclude(i => i.Insignia) +// // .Include(p => p.Salaries) +// // .Where(p => allOc.Contains(p.OrganizationChart.OCId) +// // && p.IsLeave == false +// // && p.IsActive == true +// // && p.DateAppoint != null +// // && p.DateAppoint.Value.CalculateGovAgeInYear(0, 0).ToInteger() >= 25) +// // .Select(p => new InsigniaResultSet +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // Rank = p.AcademicStanding.Name, +// // GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), +// // LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // PosNo = p.PositionNumber.Id, +// // RequestInsignia = GetInsigniaByName("เหรียญจักรพรรดิมาลา") +// // }); + +// // result = result.Where(x => !x.LastInsignia.Contains("เหรียญจักรพรรดิมาลา")); + +// // return result.ToList(); +// // } +// // catch +// // { +// // throw; +// // } +// // } + +// #endregion + +// #region " From Ming " + +// // คำนวณระยะเวลาของรอบการยืนขอ +// // public async string CalStatusByDate(DateTime start, DateTime end, string year) +// // { +// // var nowDate = DateTime.Now; + +// // if (nowDate.Year < Int32.Parse(year) || nowDate.Year > Int32.Parse(year)) return "ไม่ใช้งาน"; + +// // if (nowDate.Date >= start.Date && nowDate.Date <= end.Date) return "ใช้งาน"; + +// // return "ไม่ใช้งาน"; +// // } + +// public async Task GetRequestId(Guid period, Guid ocId) +// { +// try +// { +// var req = await _dbContext.Set() +// .Where(x => x.OrganizationOrganization != null) +// .FirstOrDefaultAsync(x => x.Period.Id == period && x.OrganizationOrganization.Id == ocId); +// if (req == null) +// return null; +// return req.Id; +// } +// catch +// { +// throw; +// } +// } + +// // Save Aprove +// public async Task SaveAprove(Guid period, Guid ocId, InsigniaApproveRequest prm) +// { +// try +// { +// var req = await GetRequestId(period, ocId); + +// if (req != null) +// { +// foreach (var item in prm.Items) +// { +// var approve = await _dbContext.Set() +// .FirstOrDefaultAsync(x => x.Profile.Id == item.ProfileId && x.Request.Id == req); +// approve.IsApprove = item.IsApprove; +// } +// } + +// // await _dbContext.Set < SaveChanges(); +// } +// catch +// { +// throw; +// } +// } + +// // เช็คข้อมูล ใน table insignia_request_new +// public async Task GetInsigniaRequest(string type, Guid ocId) +// { +// try +// { +// var period = await _dbContext.Set() +// .Select(p => new +// { +// Id = p.Id, +// Name = p.Name, +// Type = p.Type, +// Year = p.Year, +// //Status = CalStatusByDate(p.StartDate.Date, p.EndDate.Date, p.Year.ToString()) +// }) +// .FirstOrDefaultAsync(x => x.Type == type && x.Year == DateTime.Now.Year + 1); + +// if (period == null) +// return null; +// else +// { +// var request = await _dbContext.Set() +// .Include(x => x.OrganizationOrganization) +// .Where(x => x.OrganizationOrganization != null) +// .FirstOrDefaultAsync(x => x.Period.Id == period.Id && x.OrganizationOrganization.Id == ocId); + +// return new InsigniaResults +// { +// PeriodId = period.Id, +// Year = period.Year.ToString(), +// Name = period.Name, +// RequestStatus = request != null ? request.RequestStatus : null, +// OrganizationName = request == null ? "" : request.OrganizationOrganization.Name +// }; + +// } +// } +// catch +// { +// throw; +// } +// } + +// // public async InsigniaItem GetInsigniaLast(Guid? id) +// // { +// // try +// // { +// // var insignia = await _dbContext.Set().AsQueryable() +// // .Include(x => x.InsigniaType) +// // .Where(x => id != null ? x.Id == id : x.Name.Contains("ตริตาภรณ์มงกุฎไทย")) +// // .Select(i => new InsigniaItem +// // { +// // Id = i.Id, +// // Name = i.Name, +// // ShortName = i.ShortName, +// // Level = i.InsigniaType.Description, +// // LevelId = i.InsigniaType.Id +// // }).FirstOrDefault(); + +// // return insignia; +// // } +// // catch +// // { +// // throw; +// // } +// // } + +// // ดึงข้อมูลเอกสารแนบ +// // TODO: return empty for POC Only. +// // public async List GetDocFile(string profile) +// // { +// // // return empty for POC Only. +// // return new List(); +// // } + +// // Get Profile +// // public async List GetProfileByInstitute(Guid ocId) +// // { +// // try +// // { +// // var profiles = (await _dbContext.Set().AsQueryable() +// // .Include(x => x.Salaries) +// // .Include(x => x.AcademicStanding) +// // .Include(x => x.Position) +// // .Include(x => x.PositionNumber) +// // .Include(x => x.OrganizationChart) +// // .Where(x => x.OrganizationChart.OCId == ocId) +// // .Select(p => new InsigniaProfileResult +// // { +// // ProfileId = p.Id, +// // Prefix = p.Prefix, +// // FullName = $"{p.Prefix}{p.FirstName} {p.LastName}", +// // Position = p.Position.Name, +// // Rank = p.AcademicStanding.Name, +// // Salary = p.Salaries.Count() == 0 ? "0" : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount, +// // PosNo = p.PositionNumber.Id, +// // Organization = p.OrganizationChart.OrganizationName +// // })).ToList(); + +// // return profiles; +// // } +// // catch +// // { +// // throw; +// // } +// // } + +// // Get Data Table insignai_has_profile +// public async Task> InsigniaHasProfile(Guid period, Guid ocId) +// { +// try +// { +// var id = await GetRequestId(period, ocId); +// if (id != null) +// { +// var result = (_dbContext.Set() +// .Include(x => x.Request) +// .Include(x => x.RequestInsignia) +// .ThenInclude(x => x.InsigniaType) +// .Include(x => x.Profile) +// .ThenInclude(x => x.Salaries) +// .Include(x => x.Profile) +// .ThenInclude(x => x.Position) +// .Include(x => x.Profile) +// // .ThenInclude(x => x.PositionNumber) +// .Include(x => x.Profile) +// .ThenInclude(x => x.PositionLevel) +// .Include(x => x.Profile) +// .ThenInclude(x => x.PositionType) +// .Include(x => x.Profile) +// .ThenInclude(x => x.OrganizationOrganization) +// .Include(x => x.Profile) +// // .ThenInclude(x => x.AcademicStanding) +// .Include(x => x.Profile) +// .ThenInclude(x => x.Insignias) +// .ThenInclude(x => x.Insignia) +// .Where(h => h.Request.Id == id) +// .ToList() +// .Select(h => new InsigniaRequestItem +// { +// ProfileId = h.Profile.Id, +// FullName = $"{h.Profile.FirstName} {h.Profile.LastName}", +// // Position = h.Profile.Position.Name, +// // PosNo = h.Profile.PositionNumber.Id, +// // Rank = $"{h.Profile.PositionType.Name}/{h.Profile.PositionLevel.Name}", +// Salary = h.Salary.ToString(), +// // LastInsignia = h.Profile.Insignias.Count == 0 ? "" : h.Profile.Insignias.OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name, +// RequestInsignia = h.RequestInsignia.Name, +// RequestInsigniaShortName = h.RequestInsignia.ShortName, +// Level = h.RequestInsignia.InsigniaType.Name, +// IsApprove = h.IsApprove, +// RequestDate = h.RequestDate, +// RequestNote = "", +// // Docs = GetDocFile(h.Profile.Id), +// MatchingConditions = JsonConvert.DeserializeObject>(h.MatchingConditions) +// })).ToList(); + +// return result; +// } +// else +// { +// return null; +// } + +// } +// catch +// { +// throw; +// } +// } + +// // เช็คข้อมูลนำเข้า กับข้อมูลที่อยู่ใน database +// // public async List GetDuplicate(List income, Guid period, Guid ocId, bool Duplicate = false) +// // { +// // try +// // { +// // var id = GetRequestId(period, ocId); + +// // var req = await _dbContext.Set().FirstOrDefault(x => x.Id == id); + +// // if (req == null) +// // throw new Exception(GlobalMessages.InvalidInsigniaRequest); + +// // var profile = await _dbContext.Set().AsQueryable() +// // .Include(x => x.RequestInsignia) +// // .ThenInclude(x => x.InsigniaType) +// // .Include(x => x.Profile) +// // .ThenInclude(x => x.Insignias) +// // .Where(x => x.Request.Id == id) +// // .Select(h => new DuplicateProfile +// // { +// // ProfileId = h.Profile.Id, +// // IsApprove = h.IsApprove, +// // RequestQualificationStatus = h.QualificationStatus, +// // RequestDocumentStatus = h.DocumentStatus, +// // Special = h.Special +// // }); + +// // var newIncome = income.GroupJoin(profile, +// // pdb => pdb.Profile.Id, +// // dp => dp.ProfileId, +// // (pdb, dp) => new +// // { +// // Profile = pdb.Profile, +// // pdb.Profile.Insignias, +// // pdb.RequestInsignia, +// // //pdb.RequestInsignia.InsigniaType, +// // pdb.Salary, +// // pdb.RequestDate, +// // ProfileDB = dp +// // }) +// // .ToList() +// // .Where(d => !Duplicate ? d.ProfileDB.Count() == 0 : d.ProfileDB.Count() != 0) +// // .Select(d => !Duplicate ? new InsigniaRequestProfile +// // { +// // Request = req, +// // Profile = d.Profile, +// // RequestInsignia = d.RequestInsignia, +// // Salary = d.Salary, +// // RequestDate = d.RequestDate, +// // } : new InsigniaRequestProfile +// // { +// // Request = req, +// // Profile = d.Profile, +// // RequestInsignia = d.RequestInsignia, +// // Salary = d.Salary, +// // RequestDate = d.RequestDate, +// // IsApprove = d.ProfileDB.First().IsApprove, +// // QualificationStatus = d.ProfileDB.First().RequestQualificationStatus, +// // DocumentStatus = d.ProfileDB.First().RequestDocumentStatus, +// // Special = d.ProfileDB.First().Special +// // }) +// // .ToList(); + +// // return newIncome; +// // } +// // catch +// // { +// // throw; +// // } +// // } + +// // ลบข้อมูลใน db ที่ไม่เท่ากับ income +// // public async List DeleteProfile(List income, Guid period, Guid ocId) +// // { +// // try +// // { +// // var id = GetRequestId(period, ocId); + +// // var incomProfileId = income.Select(i => i.Profile.Id).ToList(); + +// // var arrayData = await _dbContext.Set().AsQueryable() +// // .Where(i => !(incomProfileId.Contains(i.Profile.Id)) && i.Request.Id == id) +// // .ToList(); + +// // return arrayData; +// // } +// // catch +// // { +// // throw; +// // } +// // } + +// // insert candidate list +// public async Task InsertCandidate(Guid periodId, Guid ocId, List items) +// { +// try +// { +// var period = await _dbContext.Set().FirstOrDefaultAsync(x => x.Id == periodId); + +// if (period == null) +// throw new Exception(GlobalMessages.InvalidInsigniaPeriod); + +// var oc = await _dbContext.Set().FirstOrDefaultAsync(x => x.Id == ocId); + +// if (oc == null) +// throw new Exception(GlobalMessages.DataNotFound); + +// var req = new InsigniaRequest +// { +// Period = period, +// OrganizationOrganization = oc, +// RequestStatus = "st1" +// }; + +// foreach (var item in items) +// { +// var pf = await _dbContext.Set().FirstOrDefaultAsync(p => p.Id == item.ProfileId); +// var req_insignia = await _dbContext.Set().FirstOrDefaultAsync(i => i.Id == item.RequestInsignia.Id); + +// if (pf != null) +// { +// req.RequestProfiles.Add(new InsigniaRequestProfile +// { +// Profile = pf, +// RequestInsignia = req_insignia, +// Salary = item.Salary == null ? 0 : Decimal.Parse(item.Salary), +// RequestDate = DateTime.Now, +// MatchingConditions = System.Text.Json.JsonSerializer.Serialize(item.MatchingConditions) // serialize to string + +// }); +// } +// } + +// await _dbContext.Set().AddAsync(req); +// await _dbContext.SaveChangesAsync(); +// } +// catch +// { +// throw; +// } +// } + +// // เช็คข้อมูลใน kp7insignia +// // public async ProfileInsignia ListKp7Insignia(string name, string profile, int year) +// // { +// // try +// // { +// // var item = await _dbContext.Set().AsQueryable() +// // .Include(x => x.Insignia) +// // .Include(x => x.Profile) +// // .FirstOrDefault(x => x.Profile.Id == profile && +// // x.Year == year && +// // x.Insignia.Name.Contains(name)); + +// // return item; +// // } +// // catch +// // { +// // throw; +// // } +// // } + +// // บันทึกข้อมูลลง กพ.7 +// // public async ProfileInsignia InsertKp7Insignia(InsigniaKp7Item kp7, InsigniaProfile profile) +// // { +// // try +// // { +// // var pf = await _dbContext.Set().FirstOrDefault(x => x.Id == profile.FkProfileId); +// // var insignia = await _dbContext.Set().FirstOrDefault(x => x.Name == profile.InsigniaName); + +// // var kp7Insignia = new ProfileInsignia +// // { +// // Profile = pf, +// // Year = DateTime.Now.Year, +// // DateReceive = kp7.InsigniaDatereceive.Value, +// // Insignia = insignia, +// // Level = kp7.InsigniaLevel, +// // No = profile.InsigniaNo, +// // Issue = kp7.InsigniaIssue, +// // VolumeNo = kp7.InsigniaVolumeno.Value.ToString(), +// // Volume = kp7.InsigniaVolume, +// // Section = kp7.InsigniaSection, +// // DateStamp = DateTime.Now, +// // DateAnnounce = kp7.InsigniaDateannounce.Value, +// // Page = profile.InsigniaPage, +// // }; + +// // return kp7Insignia; +// // } +// // catch +// // { +// // throw; +// // } +// // } + +// // update กพ.7 +// // public async ProfileInsignia UpdateKp7Insignia(Guid id) +// // { +// // try +// // { +// // var item = await _dbContext.Set().FirstOrDefaultAsync(x => x.Id == id); + +// // return item; +// // } +// // catch +// // { +// // throw; +// // } +// // } + +// #endregion +// } +// } diff --git a/BMA.EHR.Application/Requests/InsigniaApproveRequest.cs b/BMA.EHR.Application/Requests/InsigniaApproveRequest.cs new file mode 100644 index 00000000..37f57565 --- /dev/null +++ b/BMA.EHR.Application/Requests/InsigniaApproveRequest.cs @@ -0,0 +1,7 @@ +namespace BMA.EHR.Application.Requests +{ + public class InsigniaApproveRequest + { + public List Items { get; set; } + } +} diff --git a/BMA.EHR.Application/Requests/InsigniaItem.cs b/BMA.EHR.Application/Requests/InsigniaItem.cs new file mode 100644 index 00000000..23b43995 --- /dev/null +++ b/BMA.EHR.Application/Requests/InsigniaItem.cs @@ -0,0 +1,15 @@ +namespace BMA.EHR.Application.Requests +{ + public class InsigniaItem + { + public Guid Id { get; set; } + + public string Name { get; set; } + + public string ShortName { get; set; } + + public string Level { get; set; } + + public Guid? LevelId { get; set; } + } +} diff --git a/BMA.EHR.Application/Requests/InsigniaPeriodRequest.cs b/BMA.EHR.Application/Requests/InsigniaPeriodRequest.cs new file mode 100644 index 00000000..a5e05d7d --- /dev/null +++ b/BMA.EHR.Application/Requests/InsigniaPeriodRequest.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore; + +namespace BMA.EHR.Application.Requests +{ + public class InsigniaPeriodRequest + { + public string Name { get; set; } + + public int Year { get; set; } + + public DateTime StartDate { get; set; } + + public DateTime EndDate { get; set; } + + public string Amount { get; set; } + + public string Type { get; set; } + } +} diff --git a/BMA.EHR.Application/Requests/InsigniaReqApproveItem.cs b/BMA.EHR.Application/Requests/InsigniaReqApproveItem.cs new file mode 100644 index 00000000..3ba6233a --- /dev/null +++ b/BMA.EHR.Application/Requests/InsigniaReqApproveItem.cs @@ -0,0 +1,10 @@ +namespace BMA.EHR.Application.Requests +{ + public class InsigniaReqApproveItem + { + public Guid ProfileId { get; set; } + + public bool IsApprove { get; set; } = false; + + } +} diff --git a/BMA.EHR.Application/Requests/InsigniaRequestDoc.cs b/BMA.EHR.Application/Requests/InsigniaRequestDoc.cs new file mode 100644 index 00000000..d4481c65 --- /dev/null +++ b/BMA.EHR.Application/Requests/InsigniaRequestDoc.cs @@ -0,0 +1,9 @@ +namespace BMA.EHR.Application.Requests +{ + public class InsigniaRequestDoc + { + public int FileId { get; set; } + public int DocId { get; set; } + public string DocName { get; set; } + } +} diff --git a/BMA.EHR.Application/Requests/InsigniaRequestItem.cs b/BMA.EHR.Application/Requests/InsigniaRequestItem.cs new file mode 100644 index 00000000..328aac07 --- /dev/null +++ b/BMA.EHR.Application/Requests/InsigniaRequestItem.cs @@ -0,0 +1,22 @@ +namespace BMA.EHR.Application.Requests +{ + public class InsigniaRequestItem + { + public Guid ProfileId { get; set; } + public string FullName { get; set; } + public string Position { get; set; } + public string PosNo { get; set; } + public string Rank { get; set; } + public string Salary { get; set; } + public string LastInsignia { get; set; } + public string RequestInsignia { get; set; } + public string RequestInsigniaShortName { get; set; } + public string Level { get; set; } + public bool IsApprove { get; set; } + public DateTime? RequestDate { get; set; } + public string RequestNote { get; set; } + public List Docs { get; set; } + + public List MatchingConditions { get; set; } = new List(); + } +} diff --git a/BMA.EHR.Application/Requests/InsigniaResultSet.cs b/BMA.EHR.Application/Requests/InsigniaResultSet.cs new file mode 100644 index 00000000..1eac9429 --- /dev/null +++ b/BMA.EHR.Application/Requests/InsigniaResultSet.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; + +namespace BMA.EHR.Application.Requests +{ + public class InsigniaResultSet + { + public Guid ProfileId { get; set; } + + public string Prefix { get; set; } + + public string FullName { get; set; } + + public string Position { get; set; } + + public string Rank { get; set; } + + public string GovAge { get; set; } + + public string Salary { get; set; } + + public string LastInsignia { get; set; } + public int? LastInsigniaId { get; set; } + + public string PosNo { get; set; } + + public InsigniaItem RequestInsignia { get; set; } + + public string Gender { get; set; } + + public int Seq { get; set; } + + public List MatchingConditions { get; set; } = new List(); + } + + public class MatchingCondition + { + public string Condition { get; set; } = ""; + + public string Result { get; set; } = ""; + } +} diff --git a/BMA.EHR.Application/Requests/InsigniaResults.cs b/BMA.EHR.Application/Requests/InsigniaResults.cs new file mode 100644 index 00000000..b704d7f0 --- /dev/null +++ b/BMA.EHR.Application/Requests/InsigniaResults.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; + +namespace BMA.EHR.Application.Requests +{ + public class InsigniaResults + { + public Guid PeriodId { get; set; } + public string Name { get; set; } + public string Year { get; set; } + public string RequestStatus { get; set; } + public string OrganizationName { get; set; } + public List Items { get; set; } + } +} diff --git a/BMA.EHR.Application/Requests/SaveRequsetNote.cs b/BMA.EHR.Application/Requests/SaveRequsetNote.cs new file mode 100644 index 00000000..98708c49 --- /dev/null +++ b/BMA.EHR.Application/Requests/SaveRequsetNote.cs @@ -0,0 +1,9 @@ +namespace BMA.EHR.Application.Requests +{ + public class SaveRequsetNote + { + public Guid PeriodId { get; set; } + public Guid OcId { get; set; } + public string Note { get; set; } + } +} diff --git a/BMA.EHR.Application/Requests/SaveToProfileRequest.cs b/BMA.EHR.Application/Requests/SaveToProfileRequest.cs new file mode 100644 index 00000000..98438ca0 --- /dev/null +++ b/BMA.EHR.Application/Requests/SaveToProfileRequest.cs @@ -0,0 +1,44 @@ +using Microsoft.EntityFrameworkCore; + +namespace BMA.EHR.Application.Requests +{ + public class SaveToProfileRequest + { + public int OCId { get; set; } + public DateTime? InsigniaDatereceive { get; set; } + public string InsigniaLevel { get; set; } + public string InsigniaIssue { get; set; } + public int? InsigniaVolumeno { get; set; } + public string InsigniaVolume { get; set; } + public string InsigniaSection { get; set; } + public DateTime? InsigniaDateannounce { get; set; } + public List Profile { get; set; } + public List Docs { get; set; } + } + + public class ProfileInsignias + { + public string FkProfileId { get; set; } + public string InsigniaName { get; set; } + public string InsigniaPage { get; set; } + public string InsigniaNo { get; set; } + public int? Kp7InsigniaId { get; set; } + } + public class DocReceive + { + public int DocId { get; set; } + public int InsigniaType { get; set; } + public int Type { get; set; } + } + + public class Kp7Item + { + public DateTime? InsigniaDatereceive { get; set; } + public string InsigniaLevel { get; set; } + public string InsigniaIssue { get; set; } + public int? InsigniaVolumeno { get; set; } + public string InsigniaVolume { get; set; } + public string InsigniaSection { get; set; } + public DateTime? InsigniaDateannounce { get; set; } + } +} \ No newline at end of file diff --git a/BMA.EHR.Domain/Models/Insignias/InsigniaPeriod.cs b/BMA.EHR.Domain/Models/Insignias/InsigniaPeriod.cs new file mode 100644 index 00000000..c4ffd51f --- /dev/null +++ b/BMA.EHR.Domain/Models/Insignias/InsigniaPeriod.cs @@ -0,0 +1,27 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using BMA.EHR.Domain.Models.Base; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.Domain.Models.Insignias +{ + public class InsigniaPeriod : EntityBase + { + [Required, MaxLength(200)] + public string Name { get; set; } + + public int Year { get; set; } + + public DateTime StartDate { get; set; } + + public DateTime EndDate { get; set; } + + [MaxLength(50)] + public string Amount { get; set; } + + [MaxLength(10)] + public string Type { get; set; } + + public virtual List InsigniaRequests { get; set; } + } +} diff --git a/BMA.EHR.Domain/Models/Insignias/InsigniaRequest.cs b/BMA.EHR.Domain/Models/Insignias/InsigniaRequest.cs new file mode 100644 index 00000000..f71d38fe --- /dev/null +++ b/BMA.EHR.Domain/Models/Insignias/InsigniaRequest.cs @@ -0,0 +1,23 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using BMA.EHR.Domain.Models.Base; +using System.ComponentModel.DataAnnotations.Schema; +using BMA.EHR.Domain.Models.MetaData; + +namespace BMA.EHR.Domain.Models.Insignias +{ + public class InsigniaRequest : EntityBase + { + [Required, MaxLength(50)] + public string RequestStatus { get; set; } + + [Column(TypeName = "text")] + public string RequestNote { get; set; } + + public InsigniaPeriod Period { get; set; } + + public OrganizationOrganization OrganizationOrganization { get; set; } + + public virtual List RequestProfiles { get; set; } = new List(); + } +} diff --git a/BMA.EHR.Domain/Models/Insignias/InsigniaRequestProfile.cs b/BMA.EHR.Domain/Models/Insignias/InsigniaRequestProfile.cs new file mode 100644 index 00000000..fa11108c --- /dev/null +++ b/BMA.EHR.Domain/Models/Insignias/InsigniaRequestProfile.cs @@ -0,0 +1,40 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using BMA.EHR.Domain.Models.Base; +using System.ComponentModel.DataAnnotations.Schema; +using BMA.EHR.Domain.Models.MetaData; +using BMA.EHR.Domain.Models.HR; + +namespace BMA.EHR.Domain.Models.Insignias +{ + public class InsigniaRequestProfile : EntityBase + { + [Required] + public DateTime RequestDate { get; set; } + + public decimal? Salary { get; set; } + + public bool IsApprove { get; set; } = false; + + [MaxLength(50)] + public string QualificationStatus { get; set; } + + [MaxLength(50)] + public string DocumentStatus { get; set; } + + [Column(TypeName = "text")] + public string Note { get; set; } + + [MaxLength(50)] + public string Special { get; set; } + + [Column(TypeName = "text")] + public string MatchingConditions { get; set; } + + public Profile Profile { get; set; } + + public Insignia RequestInsignia { get; set; } + + public InsigniaRequest Request { get; set; } + } +} diff --git a/BMA.EHR.Domain/Models/Placement/PlacementProfile.cs b/BMA.EHR.Domain/Models/Placement/PlacementProfile.cs index 390b0960..80abfcaa 100644 --- a/BMA.EHR.Domain/Models/Placement/PlacementProfile.cs +++ b/BMA.EHR.Domain/Models/Placement/PlacementProfile.cs @@ -22,6 +22,9 @@ namespace BMA.EHR.Domain.Models.Placement public Gender? Gender { get; set; } [Comment("ลำดับที่สอบได้")] public int? Number { get; set; } + + [Comment("Id ตำแหน่งที่สอบได้")] + public PositionPath? PositionCandidate { get; set; } [Comment("Id เลขที่ตำแหน่ง")] public OrganizationPositionEntity? OrganizationPosition { get; set; } [Comment("วันที่บรรจุ")] @@ -236,6 +239,9 @@ namespace BMA.EHR.Domain.Models.Placement [Comment("ผลสมัครสอบ")] public string? Pass { get; set; } + + [Comment("ข้อมูลตำแหน่ง Draft")] + public bool? Draft { get; set; } public virtual List PlacementCertificates { get; set; } = new List(); public virtual List PlacementEducations { get; set; } = new List(); } diff --git a/BMA.EHR.Domain/Shared/GlobalMessages.cs b/BMA.EHR.Domain/Shared/GlobalMessages.cs index 78373439..d9468b32 100644 --- a/BMA.EHR.Domain/Shared/GlobalMessages.cs +++ b/BMA.EHR.Domain/Shared/GlobalMessages.cs @@ -63,5 +63,12 @@ #region " OrganizationEmployee " public static readonly string OrganizationEmployeeNotFound = "ไม่พบข้อมูลโครงสร้างตำแหน่งลูกจ้าง"; #endregion + + #region " Insignia " + public static readonly string InvalidInsigniaRequest = "ไม่พบข้อมูลการยื่นขอพระราชทานเครื่องราชย์ของหน่วยงานที่ระบุ!!"; + + public static readonly string InvalidInsigniaPeriod = "ไม่พบรอบการยื่นขอพระราชทานเครื่องราชย์อิสริยาภรณ์"; + #endregion + } } diff --git a/BMA.EHR.Infrastructure/Migrations/20230718145427_Update table PlacementProfile add draft.Designer.cs b/BMA.EHR.Infrastructure/Migrations/20230718145427_Update table PlacementProfile add draft.Designer.cs new file mode 100644 index 00000000..71fc9b47 --- /dev/null +++ b/BMA.EHR.Infrastructure/Migrations/20230718145427_Update table PlacementProfile add draft.Designer.cs @@ -0,0 +1,11564 @@ +// +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 +{ + [DbContext(typeof(ApplicationDBContext))] + [Migration("20230718145427_Update table PlacementProfile add draft")] + partial class UpdatetablePlacementProfileadddraft + { + /// + 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.Commands.Core.Command", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("AuthorizedUserFullName") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ชื่อผู้มีอำนาจลงนาม"); + + b.Property("AuthorizedUserId") + .HasColumnType("char(36)") + .HasComment("รหัสอ้างอิงผู้มีอำนาจลงนาม"); + + b.Property("CommandNo") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("varchar(10)") + .HasComment("เลขที่คำสั่ง"); + + b.Property("CommandStatusId") + .HasColumnType("char(36)") + .HasComment("รหัสอ้างอิงสถานะคำสั่ง"); + + b.Property("CommandTypeId") + .HasColumnType("char(36)") + .HasComment("รหัสอ้างอิงประเภทคำสั่ง"); + + b.Property("CommandYear") + .IsRequired() + .HasMaxLength(4) + .HasColumnType("varchar(4)") + .HasComment("ปีที่ออกคำสั่ง"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Discriminator") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IssuerOrganizationId") + .HasColumnType("char(36)") + .HasComment("รหัสอ้างอิงหน่วยงานที่ออกคำสั่ง"); + + b.Property("IssuerOrganizationName") + .IsRequired() + .HasColumnType("longtext") + .HasComment("หน่วยงานที่ออกคำสั่ง"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("CommandStatusId"); + + b.HasIndex("CommandTypeId"); + + b.ToTable("Command"); + + b.HasDiscriminator("Discriminator").HasValue("Command"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandDocument", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Category") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ประเภทเอกสาร"); + + b.Property("CommandId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("CommandId"); + + b.HasIndex("DocumentId"); + + b.ToTable("CommandDocuments"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("สถานะของคำสั่ง"); + + b.HasKey("Id"); + + b.ToTable("CommandStatuses"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Category") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ประเภทคำสั่ง"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("ชื่อคำสั่ง"); + + b.HasKey("Id"); + + b.ToTable("CommandTypes"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.DeploymentChannel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsSendEmail") + .HasColumnType("tinyint(1)"); + + b.Property("IsSendInbox") + .HasColumnType("tinyint(1)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.ToTable("DeploymentChannels"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Documents.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Detail") + .IsRequired() + .HasColumnType("text"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("FileSize") + .HasColumnType("int"); + + b.Property("FileType") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ObjectRefId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitLeave", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .HasColumnType("longtext") + .HasComment("ยังไม่ชัวใช้อะไรเป็นkey"); + + b.HasKey("Id"); + + b.ToTable("LimitLeaves"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitTypeLeave", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("LimitLeaveId") + .HasColumnType("char(36)"); + + b.Property("NumLeave") + .HasColumnType("double") + .HasComment("จำนวนที่ลาได้"); + + b.Property("TypeLeaveId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("LimitLeaveId"); + + b.HasIndex("TypeLeaveId"); + + b.ToTable("LimitTypeLeaves"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.Profile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Ability") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("AvatarId") + .HasColumnType("char(36)"); + + b.Property("AvatarRef") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)") + .HasComment("วันเกิด"); + + b.Property("BloodGroupId") + .HasColumnType("char(36)") + .HasComment("Id กลุ่มเลือด"); + + b.Property("CitizenId") + .HasMaxLength(13) + .HasColumnType("varchar(13)") + .HasComment("รหัสบัตรประชาชน"); + + b.Property("Couple") + .HasColumnType("tinyint(1)") + .HasComment("คู่สมรส"); + + b.Property("CoupleCareer") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("อาชีพคู่สมรส"); + + b.Property("CoupleFirstName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อคู่สมรส"); + + b.Property("CoupleLastName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุลคู่สมรส"); + + b.Property("CoupleLastNameOld") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุลคู่สมรส(เดิม)"); + + b.Property("CouplePrefixId") + .HasColumnType("char(36)") + .HasComment("Id คำนำหน้าคู่สมรส"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUser") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("CurrentAddress") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("ที่อยู่ปัจจุบัน"); + + b.Property("CurrentDistrictId") + .HasColumnType("char(36)") + .HasComment("Id เขตปัจจุบัน"); + + b.Property("CurrentProvinceId") + .HasColumnType("char(36)") + .HasComment("Id จังหวัดปัจจุบัน"); + + b.Property("CurrentSubDistrictId") + .HasColumnType("char(36)") + .HasComment("Id แขวงปัจจุบัน"); + + b.Property("CurrentZipCode") + .HasMaxLength(5) + .HasColumnType("varchar(5)") + .HasComment("รหัสไปรษณีย์ปัจจุบัน"); + + b.Property("DateAppoint") + .HasColumnType("datetime(6)"); + + b.Property("DateRetire") + .HasColumnType("datetime(6)"); + + b.Property("DateStart") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeClass") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("ประเภทลูกจ้าง"); + + b.Property("EmployeeType") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("ประเภทการจ้าง"); + + b.Property("EntryStatus") + .IsRequired() + .HasMaxLength(5) + .HasColumnType("varchar(5)"); + + b.Property("FatherCareer") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("อาชีพบิดา"); + + b.Property("FatherFirstName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อบิดา"); + + b.Property("FatherLastName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุลบิดา"); + + b.Property("FatherPrefixId") + .HasColumnType("char(36)") + .HasComment("Id คำนำหน้าบิดา"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อ"); + + b.Property("FirstNameOld") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อ(เดิม)"); + + b.Property("GenderId") + .HasColumnType("char(36)") + .HasComment("Id เพศ"); + + b.Property("GovAgeAbsent") + .HasColumnType("int"); + + b.Property("GovAgePlus") + .HasColumnType("int"); + + b.Property("GovernmentCode") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsLeave") + .HasColumnType("tinyint(1)"); + + b.Property("IsProbation") + .HasColumnType("tinyint(1)"); + + b.Property("IsTransfer") + .HasColumnType("tinyint(1)"); + + b.Property("IsVerified") + .HasColumnType("tinyint(1)"); + + b.Property("KeycloakId") + .HasColumnType("char(36)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุล"); + + b.Property("LastNameOld") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุล(เดิม)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("LeaveDate") + .HasColumnType("datetime(6)"); + + b.Property("LeaveDateOrder") + .HasColumnType("datetime(6)"); + + b.Property("LeaveDetail") + .HasColumnType("longtext"); + + b.Property("LeaveNumberOrder") + .HasColumnType("longtext"); + + b.Property("LeaveReason") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)"); + + b.Property("LimitLeaveId") + .HasColumnType("char(36)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("MotherCareer") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("อาชีพมารดา"); + + b.Property("MotherFirstName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อมารดา"); + + b.Property("MotherLastName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุลมารดา"); + + b.Property("MotherPrefixId") + .HasColumnType("char(36)") + .HasComment("Id คำนำหน้ามารดา"); + + b.Property("Nationality") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("สัญชาติ"); + + b.Property("Oc") + .HasColumnType("longtext") + .HasComment("สังกัด"); + + b.Property("OcId") + .HasColumnType("char(36)") + .HasComment("Id สังกัด"); + + b.Property("OrganizationOrganization") + .HasColumnType("longtext"); + + b.Property("OrganizationOrganizationId") + .HasColumnType("char(36)"); + + b.Property("OrganizationShortName") + .HasColumnType("longtext"); + + b.Property("OrganizationShortNameId") + .HasColumnType("char(36)"); + + b.Property("Physical") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("สถานภาพทางกาย"); + + b.Property("PosNo") + .HasColumnType("longtext") + .HasComment("เลขที่ตำแหน่ง"); + + b.Property("PosNoEmployee") + .HasColumnType("longtext") + .HasComment("เลขที่ตำแหน่งลูกจ้าง"); + + b.Property("PosNoId") + .HasColumnType("char(36)") + .HasComment("Id เลขที่ตำแหน่ง"); + + b.Property("Position") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("PositionEmployeeGroup") + .HasColumnType("longtext") + .HasComment("กลุ่มงาน"); + + b.Property("PositionEmployeeGroupId") + .HasColumnType("char(36)") + .HasComment("Id กลุ่มงาน"); + + b.Property("PositionEmployeeLevel") + .HasColumnType("longtext") + .HasComment("ระดับชั้นงาน"); + + b.Property("PositionEmployeeLevelId") + .HasColumnType("char(36)") + .HasComment(" Id ระดับชั้นงาน"); + + b.Property("PositionEmployeePosition") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("PositionEmployeePositionId") + .HasColumnType("char(36)") + .HasComment("Id ตำแหน่ง"); + + b.Property("PositionEmployeePositionSide") + .HasColumnType("longtext") + .HasComment("ด้านของตำแหน่ง"); + + b.Property("PositionEmployeePositionSideId") + .HasColumnType("char(36)") + .HasComment("Id ด้านของตำแหน่ง"); + + b.Property("PositionExecutive") + .HasColumnType("longtext") + .HasComment("ตำแหน่งทางการบริหาร"); + + b.Property("PositionExecutiveId") + .HasColumnType("char(36)") + .HasComment("Id ตำแหน่งทางการบริหาร"); + + b.Property("PositionExecutiveSide") + .HasColumnType("longtext") + .HasComment("ด้านทางการบริหาร"); + + b.Property("PositionExecutiveSideId") + .HasColumnType("char(36)") + .HasComment("Id ด้านทางการบริหาร"); + + b.Property("PositionId") + .HasColumnType("char(36)") + .HasComment("Id ตำแหน่ง"); + + b.Property("PositionLevel") + .HasColumnType("longtext") + .HasComment("ระดับ"); + + b.Property("PositionLevelId") + .HasColumnType("char(36)") + .HasComment(" Id ระดับ"); + + b.Property("PositionLine") + .HasColumnType("longtext") + .HasComment("สายงาน"); + + b.Property("PositionLineId") + .HasColumnType("char(36)") + .HasComment("Id สายงาน"); + + b.Property("PositionPathSide") + .HasColumnType("longtext") + .HasComment("ด้าน/สาขา"); + + b.Property("PositionPathSideId") + .HasColumnType("char(36)") + .HasComment("Id ด้าน/สาขา"); + + b.Property("PositionType") + .HasColumnType("longtext") + .HasComment("ประเภทตำแหน่ง"); + + b.Property("PositionTypeId") + .HasColumnType("char(36)") + .HasComment("Id ประเภทตำแหน่ง"); + + b.Property("PrefixId") + .HasColumnType("char(36)") + .HasComment("Id คำนำหน้า"); + + b.Property("PrefixOldId") + .HasColumnType("char(36)") + .HasComment("Id คำนำหน้า(เดิม)"); + + b.Property("ProfileType") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Race") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("เชื้อชาติ"); + + b.Property("ReasonSameDate") + .HasColumnType("longtext"); + + b.Property("RegistrationAddress") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("Id แขวงตามทะเบียนบ้าน"); + + b.Property("RegistrationDistrictId") + .HasColumnType("char(36)") + .HasComment("Id เขตตามทะเบียนบ้าน"); + + b.Property("RegistrationProvinceId") + .HasColumnType("char(36)") + .HasComment("Id จังหวัดตามทะเบียนบ้าน"); + + b.Property("RegistrationSame") + .HasColumnType("tinyint(1)") + .HasComment("ที่อยู่ปัจจุบันตรงกับที่อยู่ตามทะเบียนบ้านหรือไม่"); + + b.Property("RegistrationSubDistrictId") + .HasColumnType("char(36)") + .HasComment("แขวงตามทะเบียนบ้าน"); + + b.Property("RegistrationZipCode") + .HasMaxLength(5) + .HasColumnType("varchar(5)") + .HasComment("รหัสไปรษณีย์ตามทะเบียนบ้าน"); + + b.Property("RelationshipId") + .HasColumnType("char(36)") + .HasComment("Id สถานะภาพ"); + + b.Property("ReligionId") + .HasColumnType("char(36)") + .HasComment("Id ศาสนา"); + + b.Property("TelephoneNumber") + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasComment("เบอร์โทร"); + + b.Property("TransferDate") + .HasColumnType("datetime(6)"); + + b.Property("VerifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("VerifiedUser") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.HasKey("Id"); + + b.HasIndex("AvatarId"); + + b.HasIndex("LimitLeaveId"); + + b.ToTable("Profiles"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAbility", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateEnd") + .HasColumnType("datetime(6)") + .HasComment("วันที่สิ้นสุด"); + + b.Property("DateStart") + .HasColumnType("datetime(6)") + .HasComment("วันที่เริ่มต้น"); + + b.Property("Detail") + .HasColumnType("longtext") + .HasComment("รายละเอียด"); + + b.Property("Field") + .HasColumnType("longtext") + .HasComment("ด้าน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("Reference") + .HasColumnType("longtext") + .HasComment("เอกสารอ้างอิง"); + + b.Property("Remark") + .HasColumnType("longtext") + .HasComment("หมายเหตุ"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileAbilitys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAbilityHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateEnd") + .HasColumnType("datetime(6)") + .HasComment("วันที่สิ้นสุด"); + + b.Property("DateStart") + .HasColumnType("datetime(6)") + .HasComment("วันที่เริ่มต้น"); + + b.Property("Detail") + .HasColumnType("longtext") + .HasComment("รายละเอียด"); + + b.Property("Field") + .HasColumnType("longtext") + .HasComment("ด้าน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileAbilityId") + .HasColumnType("char(36)"); + + b.Property("Reference") + .HasColumnType("longtext") + .HasComment("เอกสารอ้างอิง"); + + b.Property("Remark") + .HasColumnType("longtext") + .HasComment("หมายเหตุ"); + + b.HasKey("Id"); + + b.HasIndex("ProfileAbilityId"); + + b.ToTable("ProfileAbilityHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAddressHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("CurrentAddress") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("ที่อยู่ปัจจุบัน"); + + b.Property("CurrentDistrict") + .HasColumnType("longtext") + .HasComment("เขตปัจจุบัน"); + + b.Property("CurrentDistrictId") + .HasColumnType("char(36)") + .HasComment("Id เขตปัจจุบัน"); + + b.Property("CurrentProvince") + .HasColumnType("longtext") + .HasComment("จังหวัดปัจจุบัน"); + + b.Property("CurrentProvinceId") + .HasColumnType("char(36)") + .HasComment("Id จังหวัดปัจจุบัน"); + + b.Property("CurrentSubDistrict") + .HasColumnType("longtext") + .HasComment("แขวงปัจจุบัน"); + + b.Property("CurrentSubDistrictId") + .HasColumnType("char(36)") + .HasComment("Id แขวงปัจจุบัน"); + + b.Property("CurrentZipCode") + .HasMaxLength(5) + .HasColumnType("varchar(5)") + .HasComment("รหัสไปรษณีย์ปัจจุบัน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("RegistrationAddress") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("ที่อยู่ตามทะเบียนบ้าน"); + + b.Property("RegistrationDistrict") + .HasColumnType("longtext") + .HasComment("เขตตามทะเบียนบ้าน"); + + b.Property("RegistrationDistrictId") + .HasColumnType("char(36)") + .HasComment("Id เขตตามทะเบียนบ้าน"); + + b.Property("RegistrationProvince") + .HasColumnType("longtext") + .HasComment("จังหวัดตามทะเบียนบ้าน"); + + b.Property("RegistrationProvinceId") + .HasColumnType("char(36)") + .HasComment("Id จังหวัดตามทะเบียนบ้าน"); + + b.Property("RegistrationSame") + .HasColumnType("tinyint(1)") + .HasComment("ที่อยู่ปัจจุบันตรงกับที่อยู่ตามทะเบียนบ้านหรือไม่"); + + b.Property("RegistrationSubDistrict") + .HasColumnType("longtext") + .HasComment("แขวงตามทะเบียนบ้าน"); + + b.Property("RegistrationSubDistrictId") + .HasColumnType("char(36)") + .HasComment("Id แขวงตามทะเบียนบ้าน"); + + b.Property("RegistrationZipCode") + .HasMaxLength(5) + .HasColumnType("varchar(5)") + .HasComment("รหัสไปรษณีย์ตามทะเบียนบ้าน"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileAddressHistories"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAssessment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Date") + .HasColumnType("datetime(6)") + .HasComment("วันที่ได้รับ"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .HasColumnType("longtext") + .HasComment("ชื่อแบบประเมิน"); + + b.Property("Point1") + .HasColumnType("double") + .HasComment("ผลประเมินส่วนที่1 (คะแนน)"); + + b.Property("Point1Total") + .HasColumnType("double") + .HasComment("ส่วนที่1 (คะแนน)"); + + b.Property("Point2") + .HasColumnType("double") + .HasComment("ผลประเมินส่วนที่2 (คะแนน)"); + + b.Property("Point2Total") + .HasColumnType("double") + .HasComment("ส่วนที่2 (คะแนน)"); + + b.Property("PointSum") + .HasColumnType("double") + .HasComment("ผลประเมินรวม (คะแนน)"); + + b.Property("PointSumTotal") + .HasColumnType("double") + .HasComment("ผลรวม (คะแนน)"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileAssessments"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAssessmentHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Date") + .HasColumnType("datetime(6)") + .HasComment("วันที่ได้รับ"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .HasColumnType("longtext") + .HasComment("ชื่อแบบประเมิน"); + + b.Property("Point1") + .HasColumnType("double") + .HasComment("ผลประเมินส่วนที่1 (คะแนน)"); + + b.Property("Point1Total") + .HasColumnType("double") + .HasComment("ส่วนที่1 (คะแนน)"); + + b.Property("Point2") + .HasColumnType("double") + .HasComment("ผลประเมินส่วนที่2 (คะแนน)"); + + b.Property("Point2Total") + .HasColumnType("double") + .HasComment("ส่วนที่2 (คะแนน)"); + + b.Property("PointSum") + .HasColumnType("double") + .HasComment("ผลประเมินรวม (คะแนน)"); + + b.Property("PointSumTotal") + .HasColumnType("double") + .HasComment("ผลรวม (คะแนน)"); + + b.Property("ProfileAssessmentId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileAssessmentId"); + + b.ToTable("ProfileAssessmentHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAvatarHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("AvatarFileId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AvatarFileId"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileAvatarHistories"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCertificate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CertificateNo") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("เลขที่ใบอนุญาต"); + + b.Property("CertificateType") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อใบอนุญาต"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("ExpireDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่หมดอายุ"); + + b.Property("IssueDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่ออกใบอนุญาต"); + + b.Property("Issuer") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("หน่วยงานผู้ออกใบอนุญาต"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileCertificates"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCertificateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CertificateNo") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("เลขที่ใบอนุญาต"); + + b.Property("CertificateType") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อใบอนุญาต"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("ExpireDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่หมดอายุ"); + + b.Property("IssueDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่ออกใบอนุญาต"); + + b.Property("Issuer") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("หน่วยงานผู้ออกใบอนุญาต"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileCertificateId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileCertificateId"); + + b.ToTable("ProfileCertificateHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChangeName", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("FirstName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อ"); + + b.Property("LastName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Prefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้า"); + + b.Property("PrefixId") + .HasColumnType("char(36)") + .HasComment("Id คำนำหน้า"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("Status") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("สถานะ"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileChangeNames"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChangeNameHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("FirstName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อ"); + + b.Property("LastName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Prefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้า"); + + b.Property("PrefixId") + .HasColumnType("char(36)") + .HasComment("Id คำนำหน้า"); + + b.Property("ProfileChangeNameId") + .HasColumnType("char(36)"); + + b.Property("Status") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("สถานะ"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("ProfileChangeNameId"); + + b.ToTable("ProfileChangeNameHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChildren", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("ChildrenCareer") + .HasColumnType("longtext") + .HasComment("อาชีพบุตร"); + + b.Property("ChildrenFirstName") + .HasColumnType("longtext") + .HasComment("ชื่อบุตร"); + + b.Property("ChildrenLastName") + .HasColumnType("longtext") + .HasComment("นามสกุลบุตร"); + + b.Property("ChildrenPrefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้าบุตร"); + + b.Property("ChildrenPrefixId") + .HasColumnType("char(36)") + .HasComment("Id คำนำหน้าบุตร"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileChildrens"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChildrenHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("ChildrenCareer") + .HasColumnType("longtext") + .HasComment("อาชีพบุตร"); + + b.Property("ChildrenFirstName") + .HasColumnType("longtext") + .HasComment("ชื่อบุตร"); + + b.Property("ChildrenLastName") + .HasColumnType("longtext") + .HasComment("นามสกุลบุตร"); + + b.Property("ChildrenPrefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้าบุตร"); + + b.Property("ChildrenPrefixId") + .HasColumnType("char(36)") + .HasComment("Id คำนำหน้าบุตร"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileChildrenId") + .HasColumnType("char(36)"); + + b.Property("ProfileFamilyHistoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileChildrenId"); + + b.HasIndex("ProfileFamilyHistoryId"); + + b.ToTable("ProfileChildrenHistories"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCoupleHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasComment("ไม่ใช้"); + + b.Property("Career") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("Prefix") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileCoupleHistory"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCurrentAddressHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasComment("ไม่ใช้"); + + b.Property("Address") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("DistrictId") + .HasColumnType("char(36)"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("ProvinceId") + .HasColumnType("char(36)"); + + b.Property("SubDistrictId") + .HasColumnType("char(36)"); + + b.Property("ZipCode") + .IsRequired() + .HasMaxLength(5) + .HasColumnType("varchar(5)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileCurrentAddressHistories"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDiscipline", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Date") + .HasColumnType("datetime(6)") + .HasComment("วัน เดือน ปี"); + + b.Property("Detail") + .HasColumnType("text") + .HasComment("รายละเอียด"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Level") + .HasColumnType("longtext") + .HasComment("ระดับความผิด"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("RefCommandDate") + .HasColumnType("datetime(6)") + .HasComment("เอกสารอ้างอิง (ลงวันที่)"); + + b.Property("RefCommandNo") + .HasColumnType("longtext") + .HasComment("เอกสารอ้างอิง (เลขที่คำสั่ง)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileDisciplines"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDisciplineHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Date") + .HasColumnType("datetime(6)") + .HasComment("วัน เดือน ปี"); + + b.Property("Detail") + .HasColumnType("text") + .HasComment("รายละเอียด"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Level") + .HasColumnType("longtext") + .HasComment("ระดับความผิด"); + + b.Property("ProfileDisciplineId") + .HasColumnType("char(36)"); + + b.Property("RefCommandDate") + .HasColumnType("datetime(6)") + .HasComment("เอกสารอ้างอิง (ลงวันที่)"); + + b.Property("RefCommandNo") + .HasColumnType("longtext") + .HasComment("เอกสารอ้างอิง (เลขที่คำสั่ง)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileDisciplineId"); + + b.ToTable("ProfileDisciplineHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDuty", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateEnd") + .HasColumnType("datetime(6)") + .HasComment("สิ้นสุด"); + + b.Property("DateStart") + .HasColumnType("datetime(6)") + .HasComment("เริ่มต้น"); + + b.Property("Detail") + .HasColumnType("longtext") + .HasComment("รายละเอียด"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("Reference") + .HasColumnType("longtext") + .HasComment("เอกสารอ้างอิง"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileDutys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDutyHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateEnd") + .HasColumnType("datetime(6)") + .HasComment("สิ้นสุด"); + + b.Property("DateStart") + .HasColumnType("datetime(6)") + .HasComment("เริ่มต้น"); + + b.Property("Detail") + .HasColumnType("longtext") + .HasComment("รายละเอียด"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileDutyId") + .HasColumnType("char(36)"); + + b.Property("Reference") + .HasColumnType("longtext") + .HasComment("เอกสารอ้างอิง"); + + b.HasKey("Id"); + + b.HasIndex("ProfileDutyId"); + + b.ToTable("ProfileDutyHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileEducation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Country") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("ประเทศ"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Degree") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("วุฒิการศึกษา"); + + b.Property("Duration") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("ระยะเวลา"); + + b.Property("DurationYear") + .HasColumnType("int") + .HasComment("ระยะเวลาหลักสูตร"); + + b.Property("EducationLevel") + .HasColumnType("longtext") + .HasComment("ระดับศึกษา"); + + b.Property("EducationLevelId") + .HasColumnType("char(36)") + .HasComment("Id ระดับศึกษา"); + + b.Property("EndDate") + .HasColumnType("datetime(6)") + .HasComment("ถึง"); + + b.Property("Field") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("สาขาวิชา/ทาง"); + + b.Property("FinishDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่สำเร็จการศึกษา"); + + b.Property("FundName") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("ทุน"); + + b.Property("Gpa") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("เกรดเฉลี่ย"); + + b.Property("Institute") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("สถานศึกษา"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Other") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("ข้อมูลการติดต่อ"); + + b.Property("PositionPath") + .HasColumnType("longtext") + .HasComment("เป็นวุฒิการศึกษาในตำแหน่ง"); + + b.Property("PositionPathId") + .HasColumnType("char(36)") + .HasComment("Id เป็นวุฒิการศึกษาในตำแหน่ง"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)") + .HasComment("ตั้งแต่"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileEducations"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileEducationHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Country") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("ประเทศ"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Degree") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("วุฒิการศึกษา"); + + b.Property("Duration") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("ระยะเวลา"); + + b.Property("DurationYear") + .HasColumnType("int") + .HasComment("ระยะเวลาหลักสูตร"); + + b.Property("EducationLevel") + .HasColumnType("longtext") + .HasComment("ระดับศึกษา"); + + b.Property("EducationLevelId") + .HasColumnType("char(36)") + .HasComment("Id ระดับศึกษา"); + + b.Property("EndDate") + .HasColumnType("datetime(6)") + .HasComment("ถึง"); + + b.Property("Field") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("สาขาวิชา/ทาง"); + + b.Property("FinishDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่สำเร็จการศึกษา"); + + b.Property("FundName") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("ทุน"); + + b.Property("Gpa") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("เกรดเฉลี่ย"); + + b.Property("Institute") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("สถานศึกษา"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Other") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("ข้อมูลการติดต่อ"); + + b.Property("PositionPath") + .HasColumnType("longtext") + .HasComment("เป็นวุฒิการศึกษาในตำแหน่ง"); + + b.Property("PositionPathId") + .HasColumnType("char(36)") + .HasComment("Id เป็นวุฒิการศึกษาในตำแหน่ง"); + + b.Property("ProfileEducationId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)") + .HasComment("ตั้งแต่"); + + b.HasKey("Id"); + + b.HasIndex("ProfileEducationId"); + + b.ToTable("ProfileEducationHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileFamilyHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Couple") + .HasColumnType("tinyint(1)") + .HasComment("คู่สมรส"); + + b.Property("CoupleCareer") + .HasColumnType("longtext") + .HasComment("อาชีพคู่สมรส"); + + b.Property("CoupleFirstName") + .HasColumnType("longtext") + .HasComment("ชื่อคู่สมรส"); + + b.Property("CoupleLastName") + .HasColumnType("longtext") + .HasComment("นามสกุลคู่สมรส"); + + b.Property("CoupleLastNameOld") + .HasColumnType("longtext") + .HasComment("นามสกุลคู่สมรส(เดิม)"); + + b.Property("CouplePrefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้าคู่สมรส"); + + b.Property("CouplePrefixId") + .HasColumnType("char(36)") + .HasComment("Id คำนำหน้าคู่สมรส"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("FatherCareer") + .HasColumnType("longtext") + .HasComment("อาชีพบิดา"); + + b.Property("FatherFirstName") + .HasColumnType("longtext") + .HasComment("ชื่อบิดา"); + + b.Property("FatherLastName") + .HasColumnType("longtext") + .HasComment("นามสกุลบิดา"); + + b.Property("FatherPrefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้าบิดา"); + + b.Property("FatherPrefixId") + .HasColumnType("char(36)") + .HasComment("Id คำนำหน้าบิดา"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("MotherCareer") + .HasColumnType("longtext") + .HasComment("อาชีพมารดา"); + + b.Property("MotherFirstName") + .HasColumnType("longtext") + .HasComment("ชื่อมารดา"); + + b.Property("MotherLastName") + .HasColumnType("longtext") + .HasComment("นามสกุลมารดา"); + + b.Property("MotherPrefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้ามารดา"); + + b.Property("MotherPrefixId") + .HasColumnType("char(36)") + .HasComment("Id คำนำหน้ามารดา"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileFamilyHistory"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileFatherHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasComment("ไม่ใช้"); + + b.Property("Career") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("Prefix") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileFatherHistory"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileGovernmentHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateAppoint") + .HasColumnType("datetime(6)") + .HasComment("วันที่สั่งบรรจุ"); + + b.Property("DateStart") + .HasColumnType("datetime(6)") + .HasComment("เริ่มปฎิบัติราชการ"); + + b.Property("GovAge") + .HasColumnType("longtext") + .HasComment("อายุราชการ"); + + b.Property("GovAgeAbsent") + .HasColumnType("int") + .HasComment("ขาดราชการ"); + + b.Property("GovAgePlus") + .HasColumnType("int") + .HasComment("อายุราชการเกื้อกูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Oc") + .HasColumnType("longtext") + .HasComment("สังกัด"); + + b.Property("OcId") + .HasColumnType("char(36)") + .HasComment("Id สังกัด"); + + b.Property("PosNo") + .HasColumnType("longtext") + .HasComment("เลขที่ตำแหน่ง"); + + b.Property("PosNoId") + .HasColumnType("char(36)") + .HasComment("Id เลขที่ตำแหน่ง"); + + b.Property("Position") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("PositionEmployeeGroup") + .HasColumnType("longtext") + .HasComment("กลุ่มงาน"); + + b.Property("PositionEmployeeLevel") + .HasColumnType("longtext") + .HasComment("ระดับชั้นงาน"); + + b.Property("PositionEmployeePosition") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("PositionEmployeePositionSide") + .HasColumnType("longtext") + .HasComment("ด้านของตำแหน่ง"); + + b.Property("PositionExecutive") + .HasColumnType("longtext") + .HasComment("ตำแหน่งทางการบริหาร"); + + b.Property("PositionId") + .HasColumnType("char(36)") + .HasComment("Id ตำแหน่ง"); + + b.Property("PositionLevel") + .HasColumnType("longtext") + .HasComment("ระดับตำแหน่ง"); + + b.Property("PositionLine") + .HasColumnType("longtext") + .HasComment("สายงาน"); + + b.Property("PositionType") + .HasColumnType("longtext") + .HasComment("ประเภทตำแหน่ง"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("ReasonSameDate") + .HasColumnType("longtext") + .HasComment("เหตุผลกรณีไม่ตรงวัน"); + + b.Property("RetireDate") + .HasColumnType("longtext") + .HasComment("วันเกษียณอายุ"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileGovernmentHistory"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)") + .HasComment("วันเกิด"); + + b.Property("BloodGroup") + .HasColumnType("longtext") + .HasComment("กลุ่มเลือด"); + + b.Property("BloodGroupId") + .HasColumnType("char(36)") + .HasComment("Id กลุ่มเลือด"); + + b.Property("CitizenId") + .HasMaxLength(13) + .HasColumnType("varchar(13)") + .HasComment("รหัสบัตรประชาชน"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("EmployeeClass") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("ประเภทลูกจ้าง"); + + b.Property("EmployeeType") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("ประเภทการจ้าง"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อ"); + + b.Property("Gender") + .HasColumnType("longtext") + .HasComment("เพศ"); + + b.Property("GenderId") + .HasColumnType("char(36)") + .HasComment("Id เพศ"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Nationality") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("สัญชาติ"); + + b.Property("Prefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้า"); + + b.Property("PrefixId") + .HasColumnType("char(36)") + .HasComment("Id คำนำหน้า"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("Race") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("เชื้อชาติ"); + + b.Property("Relationship") + .HasColumnType("longtext") + .HasComment("สถานะภาพ"); + + b.Property("RelationshipId") + .HasColumnType("char(36)") + .HasComment("Id สถานะภาพ"); + + b.Property("Religion") + .HasColumnType("longtext") + .HasComment("ศาสนา"); + + b.Property("ReligionId") + .HasColumnType("char(36)") + .HasComment("Id ศาสนา"); + + b.Property("TelephoneNumber") + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasComment("เบอร์โทร"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileHistory"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHonor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Detail") + .HasMaxLength(2000) + .HasColumnType("varchar(2000)") + .HasComment("รายละเอียด"); + + b.Property("IssueDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่ได้รับ"); + + b.Property("Issuer") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("หน่วยงานที่ออก"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileHonors"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHonorHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Detail") + .HasMaxLength(2000) + .HasColumnType("varchar(2000)") + .HasComment("รายละเอียด"); + + b.Property("IssueDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่ได้รับ"); + + b.Property("Issuer") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("หน่วยงานที่ออก"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileHonorId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileHonorId"); + + b.ToTable("ProfileHonorHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileInsignia", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateAnnounce") + .HasColumnType("datetime(6)") + .HasComment("วันที่ประกาศในราชกิจจาฯ"); + + b.Property("Insignia") + .HasColumnType("longtext") + .HasComment("ชื่อเครื่องราชฯ"); + + b.Property("InsigniaId") + .HasColumnType("char(36)"); + + b.Property("InsigniaType") + .HasColumnType("longtext") + .HasComment("ประเภท"); + + b.Property("Issue") + .HasMaxLength(300) + .HasColumnType("varchar(300)") + .HasComment("ราชกิจจาฯ ฉบับที่"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("No") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("ลำดับที่"); + + b.Property("Page") + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasComment("หน้า"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("ReceiveDate") + .HasColumnType("datetime(6)") + .HasComment("ลงวันที่"); + + b.Property("Section") + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasComment("ตอน"); + + b.Property("Volume") + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasComment("เล่ม"); + + b.Property("VolumeNo") + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasComment("เล่มที่"); + + b.Property("Year") + .HasColumnType("int") + .HasComment("ปีที่ยื่นขอ"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileInsignias"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileInsigniaHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateAnnounce") + .HasColumnType("datetime(6)") + .HasComment("วันที่ประกาศในราชกิจจาฯ"); + + b.Property("Insignia") + .HasColumnType("longtext") + .HasComment("ชื่อเครื่องราชฯ"); + + b.Property("InsigniaId") + .HasColumnType("char(36)"); + + b.Property("InsigniaType") + .HasColumnType("longtext") + .HasComment("ประเภท"); + + b.Property("Issue") + .HasMaxLength(300) + .HasColumnType("varchar(300)") + .HasComment("ราชกิจจาฯ ฉบับที่"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("No") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("ลำดับที่"); + + b.Property("Page") + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasComment("หน้า"); + + b.Property("ProfileInsigniaId") + .HasColumnType("char(36)"); + + b.Property("ReceiveDate") + .HasColumnType("datetime(6)") + .HasComment("ลงวันที่"); + + b.Property("Section") + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasComment("ตอน"); + + b.Property("Volume") + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasComment("เล่ม"); + + b.Property("VolumeNo") + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasComment("เล่มที่"); + + b.Property("Year") + .HasColumnType("int") + .HasComment("ปีที่ยื่นขอ"); + + b.HasKey("Id"); + + b.HasIndex("ProfileInsigniaId"); + + b.ToTable("ProfileInsigniaHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileLeave", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateEndLeave") + .HasColumnType("datetime(6)") + .HasComment("วัน เดือน ปี ที่สิ้นสุดลา"); + + b.Property("DateStartLeave") + .HasColumnType("datetime(6)") + .HasComment("วัน เดือน ปี ที่เริ่มลา"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("NumLeave") + .HasColumnType("double") + .HasComment("ลาครั้งที่"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("Reason") + .HasColumnType("longtext") + .HasComment("เหตุผล"); + + b.Property("Status") + .HasColumnType("longtext") + .HasComment("สถานะ"); + + b.Property("SumLeave") + .HasColumnType("double") + .HasComment("ลามาแล้ว"); + + b.Property("TotalLeave") + .HasColumnType("double") + .HasComment("รวมเป็น"); + + b.Property("TypeLeaveId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.HasIndex("TypeLeaveId"); + + b.ToTable("ProfileLeaves"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileLeaveHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateEndLeave") + .HasColumnType("datetime(6)") + .HasComment("วัน เดือน ปี ที่สิ้นสุดลา"); + + b.Property("DateStartLeave") + .HasColumnType("datetime(6)") + .HasComment("วัน เดือน ปี ที่เริ่มลา"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("NumLeave") + .HasColumnType("double") + .HasComment("ลาครั้งที่"); + + b.Property("ProfileLeaveId") + .HasColumnType("char(36)"); + + b.Property("Reason") + .HasColumnType("longtext") + .HasComment("เหตุผล"); + + b.Property("Status") + .HasColumnType("longtext") + .HasComment("สถานะ"); + + b.Property("SumLeave") + .HasColumnType("double") + .HasComment("ลามาแล้ว"); + + b.Property("TotalLeave") + .HasColumnType("double") + .HasComment("รวมเป็น"); + + b.Property("TypeLeaveId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileLeaveId"); + + b.HasIndex("TypeLeaveId"); + + b.ToTable("ProfileLeaveHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileMotherHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasComment("ไม่ใช้"); + + b.Property("Career") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("Prefix") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileMotherHistory"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileNopaid", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Date") + .HasColumnType("datetime(6)") + .HasComment("วัน เดือน ปี"); + + b.Property("Detail") + .HasColumnType("longtext") + .HasComment("รายละเอียด"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("Reference") + .HasColumnType("longtext") + .HasComment("เอกสารอ้างอิง"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileNopaids"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileNopaidHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Date") + .HasColumnType("datetime(6)") + .HasComment("วัน เดือน ปี"); + + b.Property("Detail") + .HasColumnType("longtext") + .HasComment("รายละเอียด"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileNopaidId") + .HasColumnType("char(36)"); + + b.Property("Reference") + .HasColumnType("longtext") + .HasComment("เอกสารอ้างอิง"); + + b.HasKey("Id"); + + b.HasIndex("ProfileNopaidId"); + + b.ToTable("ProfileNopaidHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileOrganization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("OrganizationId") + .HasColumnType("char(36)") + .HasComment("Id หน่วยงานที่สังกัด"); + + b.Property("UserId") + .HasColumnType("char(36)") + .HasComment("User Id KeyCloak"); + + b.HasKey("Id"); + + b.ToTable("ProfileOrganizations"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileOther", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Date") + .HasColumnType("datetime(6)") + .HasComment("วันที่"); + + b.Property("Detail") + .HasColumnType("longtext") + .HasComment("รายละเอียด"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileOthers"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileOtherHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Date") + .HasColumnType("datetime(6)") + .HasComment("วันที่"); + + b.Property("Detail") + .HasColumnType("longtext") + .HasComment("รายละเอียด"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileOtherId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileOtherId"); + + b.ToTable("ProfileOtherHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfilePaper", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CategoryName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasComment("ประเภทไฟล์-ไม่ใช้"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Detail") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasComment("ชื่อไฟล์"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfilePapers"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileRegistrationAddressHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasComment("ไม่ใช้"); + + b.Property("Address") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("DistrictId") + .HasColumnType("char(36)"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("ProvinceId") + .HasColumnType("char(36)"); + + b.Property("SubDistrictId") + .HasColumnType("char(36)"); + + b.Property("ZipCode") + .IsRequired() + .HasMaxLength(5) + .HasColumnType("varchar(5)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileRegistrationAddressHistories"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalary", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Amount") + .HasColumnType("double") + .HasComment("เงินเดือน"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Date") + .HasColumnType("datetime(6)") + .HasComment("วัน เดือน ปี รับตำแหน่ง"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("MouthSalaryAmount") + .HasColumnType("double") + .HasComment("เงินค่าตอบแทนรายเดือน"); + + b.Property("OcId") + .HasColumnType("char(36)") + .HasComment("Id สังกัด"); + + b.Property("OrganizationShortNameId") + .HasColumnType("char(36)") + .HasComment("Id ชื่อย่อหน่วยงาน"); + + b.Property("PosNoEmployee") + .HasColumnType("longtext") + .HasComment("เลขที่ตำแหน่งลูกจ้าง"); + + b.Property("PosNoId") + .HasColumnType("char(36)") + .HasComment("Id เลขที่ตำแหน่ง"); + + b.Property("PositionEmployeeGroupId") + .HasColumnType("char(36)") + .HasComment("Id กลุ่มงาน"); + + b.Property("PositionEmployeeLevelId") + .HasColumnType("char(36)") + .HasComment(" Id ระดับชั้นงาน"); + + b.Property("PositionEmployeePositionId") + .HasColumnType("char(36)") + .HasComment("Id ตำแหน่ง"); + + b.Property("PositionEmployeePositionSideId") + .HasColumnType("char(36)") + .HasComment("Id ด้านของตำแหน่ง"); + + b.Property("PositionExecutiveId") + .HasColumnType("char(36)") + .HasComment("Id ตำแหน่งทางการบริหาร"); + + b.Property("PositionExecutiveSideId") + .HasColumnType("char(36)") + .HasComment("Id ด้านทางการบริหาร"); + + b.Property("PositionId") + .HasColumnType("char(36)") + .HasComment("Id ตำแหน่ง"); + + b.Property("PositionLevelId") + .HasColumnType("char(36)") + .HasComment("Id ระดับ"); + + b.Property("PositionLineId") + .HasColumnType("char(36)") + .HasComment("Id สายงาน"); + + b.Property("PositionPathSideId") + .HasColumnType("char(36)") + .HasComment("Id ด้าน/สาขา"); + + b.Property("PositionSalaryAmount") + .HasColumnType("double") + .HasComment("เงินประจำตำแหน่ง"); + + b.Property("PositionTypeId") + .HasColumnType("char(36)") + .HasComment("Id ประเภทตำแหน่ง"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("SalaryClass") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง (รายละเอียด)"); + + b.Property("SalaryRef") + .HasColumnType("longtext") + .HasComment("เอกสารอ้างอิง"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileSalaries"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Amount") + .HasColumnType("double") + .HasComment("เงินเดือน"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Date") + .HasColumnType("datetime(6)") + .HasComment("วัน เดือน ปี รับตำแหน่ง"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("MouthSalaryAmount") + .HasColumnType("double") + .HasComment("เงินค่าตอบแทนรายเดือน"); + + b.Property("Oc") + .HasColumnType("longtext") + .HasComment("สังกัด"); + + b.Property("OcId") + .HasColumnType("char(36)") + .HasComment("Id สังกัด"); + + b.Property("OrganizationShortName") + .HasColumnType("longtext"); + + b.Property("OrganizationShortNameId") + .HasColumnType("char(36)"); + + b.Property("PosNo") + .HasColumnType("longtext") + .HasComment("เลขที่ตำแหน่ง"); + + b.Property("PosNoEmployee") + .HasColumnType("longtext") + .HasComment("เลขที่ตำแหน่งลูกจ้าง"); + + b.Property("PosNoId") + .HasColumnType("char(36)") + .HasComment("Id เลขที่ตำแหน่ง"); + + b.Property("Position") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("PositionEmployeeGroup") + .HasColumnType("longtext") + .HasComment("กลุ่มงาน"); + + b.Property("PositionEmployeeGroupId") + .HasColumnType("char(36)") + .HasComment("Id กลุ่มงาน"); + + b.Property("PositionEmployeeLevel") + .HasColumnType("longtext") + .HasComment("ระดับชั้นงาน"); + + b.Property("PositionEmployeeLevelId") + .HasColumnType("char(36)") + .HasComment(" Id ระดับชั้นงาน"); + + b.Property("PositionEmployeePosition") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("PositionEmployeePositionId") + .HasColumnType("char(36)") + .HasComment("Id ตำแหน่ง"); + + b.Property("PositionEmployeePositionSide") + .HasColumnType("longtext") + .HasComment("ด้านของตำแหน่ง"); + + b.Property("PositionEmployeePositionSideId") + .HasColumnType("char(36)") + .HasComment("Id ด้านของตำแหน่ง"); + + b.Property("PositionExecutive") + .HasColumnType("longtext") + .HasComment("ตำแหน่งทางการบริหาร"); + + b.Property("PositionExecutiveId") + .HasColumnType("char(36)") + .HasComment("Id ด้านทางการบริหาร"); + + b.Property("PositionExecutiveSide") + .HasColumnType("longtext") + .HasComment("ด้านทางการบริหาร"); + + b.Property("PositionExecutiveSideId") + .HasColumnType("char(36)") + .HasComment("Id ด้านทางการบริหาร"); + + b.Property("PositionId") + .HasColumnType("char(36)") + .HasComment("Id ตำแหน่ง"); + + b.Property("PositionLevel") + .HasColumnType("longtext") + .HasComment("ระดับ"); + + b.Property("PositionLevelId") + .HasColumnType("char(36)") + .HasComment(" Id ระดับ"); + + b.Property("PositionLine") + .HasColumnType("longtext") + .HasComment("สายงาน"); + + b.Property("PositionLineId") + .HasColumnType("char(36)") + .HasComment("Id สายงาน"); + + b.Property("PositionPathSide") + .HasColumnType("longtext") + .HasComment("ด้าน/สาขา"); + + b.Property("PositionPathSideId") + .HasColumnType("char(36)") + .HasComment("Id ด้าน/สาขา"); + + b.Property("PositionSalaryAmount") + .HasColumnType("double") + .HasComment("เงินประจำตำแหน่ง"); + + b.Property("PositionType") + .HasColumnType("longtext") + .HasComment("ประเภทตำแหน่ง"); + + b.Property("PositionTypeId") + .HasColumnType("char(36)") + .HasComment("Id ประเภทตำแหน่ง"); + + b.Property("ProfileSalaryId") + .HasColumnType("char(36)"); + + b.Property("SalaryClass") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง (รายละเอียด)"); + + b.Property("SalaryRef") + .HasColumnType("longtext") + .HasComment("เอกสารอ้างอิง"); + + b.HasKey("Id"); + + b.HasIndex("ProfileSalaryId"); + + b.ToTable("ProfileSalaryHistories"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryOrganization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasComment("ไม่ใช้"); + + b.Property("Comment") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.HasKey("Id"); + + b.ToTable("ProfileSalaryOrganizations"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryPosition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasComment("ไม่ใช้"); + + b.Property("Comment") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("PositionId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PositionId"); + + b.ToTable("ProfileSalaryPositions"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryPositionLevel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasComment("ไม่ใช้"); + + b.Property("Comment") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.HasKey("Id"); + + b.ToTable("ProfileSalaryPositionLevels"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryPositionNumber", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasComment("ไม่ใช้"); + + b.Property("Comment") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.HasKey("Id"); + + b.ToTable("ProfileSalaryPositionsNumbers"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryPositionType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasComment("ไม่ใช้"); + + b.Property("Comment") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.HasKey("Id"); + + b.ToTable("ProfileSalaryPositionTypes"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileTraining", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateOrder") + .HasColumnType("datetime(6)") + .HasComment("คำสั่งลงวันที่/หนังสืออนุมัติลงวันที่"); + + b.Property("Department") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("หน่วยงานที่รับผิดชอบจัดการฝึกอบรม/ดูงาน"); + + b.Property("Duration") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("รวมระยะเวลาในการฝึกอบรม/ดูงาน"); + + b.Property("EndDate") + .HasColumnType("datetime(6)") + .HasComment("วันสิ้นสุดการฝึกอบรม/ดูงาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("ชื่อโครงการ/หลักสูตรการฝึกอบรม"); + + b.Property("NumberOrder") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("เลขที่คำสั่ง/เลขที่หนังสืออนุมัติ"); + + b.Property("Place") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("สถานที่ฝึกอบรม/ดูงาน"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)") + .HasComment("วันเริ่มต้นการฝึกอบรม/ดูงาน"); + + b.Property("Topic") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("หัวข้อการฝึกอบรม/ดูงาน"); + + b.Property("Yearly") + .HasMaxLength(200) + .HasColumnType("int") + .HasComment("ปีที่อบรม (พ.ศ.)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileTrainings"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileTrainingHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateOrder") + .HasColumnType("datetime(6)") + .HasComment("คำสั่งลงวันที่/หนังสืออนุมัติลงวันที่"); + + b.Property("Department") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("หน่วยงานที่รับผิดชอบจัดการฝึกอบรม/ดูงาน"); + + b.Property("Duration") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("รวมระยะเวลาในการฝึกอบรม/ดูงาน"); + + b.Property("EndDate") + .HasColumnType("datetime(6)") + .HasComment("วันสิ้นสุดการฝึกอบรม/ดูงาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("ชื่อโครงการ/หลักสูตรการฝึกอบรม"); + + b.Property("NumberOrder") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("เลขที่คำสั่ง/เลขที่หนังสืออนุมัติ"); + + b.Property("Place") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("สถานที่ฝึกอบรม/ดูงาน"); + + b.Property("ProfileTrainingId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)") + .HasComment("วันเริ่มต้นการฝึกอบรม/ดูงาน"); + + b.Property("Topic") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("หัวข้อการฝึกอบรม/ดูงาน"); + + b.Property("Yearly") + .HasMaxLength(200) + .HasColumnType("int") + .HasComment("ปีที่อบรม (พ.ศ.)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileTrainingId"); + + b.ToTable("ProfileTrainingHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.TypeLeave", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .HasColumnType("longtext") + .HasComment("ประเภทการลา"); + + b.HasKey("Id"); + + b.ToTable("TypeLeaves"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaPeriod", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Amount") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("varchar(10)"); + + b.Property("Year") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("InsigniaPeriods"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaRequest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("OrganizationOrganizationId") + .HasColumnType("char(36)"); + + b.Property("PeriodId") + .HasColumnType("char(36)"); + + b.Property("RequestNote") + .IsRequired() + .HasColumnType("text"); + + b.Property("RequestStatus") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationOrganizationId"); + + b.HasIndex("PeriodId"); + + b.ToTable("InsigniaRequests"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaRequestProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DocumentStatus") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("IsApprove") + .HasColumnType("tinyint(1)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("MatchingConditions") + .IsRequired() + .HasColumnType("text"); + + b.Property("Note") + .IsRequired() + .HasColumnType("text"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("QualificationStatus") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("RequestDate") + .HasColumnType("datetime(6)"); + + b.Property("RequestId") + .HasColumnType("char(36)"); + + b.Property("RequestInsigniaId") + .HasColumnType("char(36)"); + + b.Property("Salary") + .HasColumnType("decimal(65,30)"); + + b.Property("Special") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.HasIndex("RequestId"); + + b.HasIndex("RequestInsigniaId"); + + b.ToTable("InsigniaRequestProfiles"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.BloodGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(2) + .HasColumnType("varchar(2)") + .HasColumnOrder(1) + .HasComment("ชื่อหมู่โลหิต"); + + b.HasKey("Id"); + + b.ToTable("BloodGroups"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.District", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("varchar(150)") + .HasColumnOrder(1) + .HasComment("เขต/อำเภอ"); + + b.Property("ProvinceId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProvinceId"); + + b.ToTable("Districts"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.EducationLevel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ระดับการศึกษา"); + + b.HasKey("Id"); + + b.ToTable("EducationLevels"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Gender", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasColumnOrder(1) + .HasComment("เพศ"); + + b.HasKey("Id"); + + b.ToTable("Genders"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Holiday", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Category") + .IsRequired() + .HasColumnType("longtext") + .HasColumnOrder(6) + .HasComment("ประเภทของวันหยุดสำหรับ ทำงาน 5 วัน=`NORMAL`,ทำงาน 6 วัน=`6DAYS`"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("HolidayDate") + .HasColumnType("datetime(6)") + .HasColumnOrder(2) + .HasComment("วันหยุด"); + + b.Property("IsSpecial") + .HasColumnType("tinyint(1)") + .HasColumnOrder(5) + .HasComment("เป็นวันหยุดพิเศษหรือไม่"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)") + .HasColumnOrder(4) + .HasComment("ชื่อวันหยุด"); + + b.Property("OriginalDate") + .HasColumnType("datetime(6)") + .HasColumnOrder(3) + .HasComment("วันหยุด(Original)"); + + b.Property("Year") + .HasColumnType("int") + .HasColumnOrder(1) + .HasComment("ประจำปี"); + + b.HasKey("Id"); + + b.ToTable("Holidays"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Insignia", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("InsigniaTypeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(3) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Level") + .HasColumnType("int") + .HasColumnOrder(4) + .HasComment("ลำดับชั้นของเครื่องราชย์ เอาไว้ตรวจสอบเวลาขอว่าต้องได้ชั้นที่สูงกว่าที่เคยได้รับแล้วเท่านั้น"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อเครื่องราชย์"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext") + .HasColumnOrder(5) + .HasComment("หมายเหตุ"); + + b.Property("ShortName") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasColumnOrder(2) + .HasComment("ชื่อย่อเครื่องราชย์"); + + b.HasKey("Id"); + + b.HasIndex("InsigniaTypeId"); + + b.ToTable("Insignias"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.InsigniaType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasColumnOrder(1) + .HasComment("ชื่อประเภทเครื่องราชย์"); + + b.HasKey("Id"); + + b.ToTable("InsigniaTypes"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationAgency", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ หน่วยงานต้นสังกัด"); + + b.HasKey("Id"); + + b.ToTable("OrganizationAgencys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationFax", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ เบอร์โทรสาร"); + + b.HasKey("Id"); + + b.ToTable("OrganizationFaxs"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationGovernmentAgency", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ ส่วนราชการต้นสังกัด"); + + b.HasKey("Id"); + + b.ToTable("OrganizationGovernmentAgencys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationLevel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ ระดับ"); + + b.HasKey("Id"); + + b.ToTable("OrganizationLevels"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationOrganization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ หน่วยงาน"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext") + .HasColumnOrder(3) + .HasComment("หมายเหตุ"); + + b.HasKey("Id"); + + b.ToTable("OrganizationOrganizations"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationShortName", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("AgencyCode") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ รหัสหน่วยงาน"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("GovernmentCode") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(2) + .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ รหัสส่วนราชการ"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(4) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(3) + .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ ตัวย่อหน่วยงาน"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext") + .HasColumnOrder(5) + .HasComment("หมายเหตุ"); + + b.HasKey("Id"); + + b.ToTable("OrganizationShortNames"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ สถานะ"); + + b.HasKey("Id"); + + b.ToTable("OrganizationStatuses"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationTelExternal", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ เบอร์ติดต่อภายนอก"); + + b.HasKey("Id"); + + b.ToTable("OrganizationTelExternals"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationTelInternal", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ เบอร์ติดต่อภายใน"); + + b.HasKey("Id"); + + b.ToTable("OrganizationTelInternals"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ ประเภท"); + + b.HasKey("Id"); + + b.ToTable("OrganizationTypes"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PhysicalStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("สถานภาพทางกาย"); + + b.HasKey("Id"); + + b.ToTable("PhysicalStatuses"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Position", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("ExecutiveName") + .IsRequired() + .HasMaxLength(300) + .HasColumnType("varchar(300)") + .HasColumnOrder(3) + .HasComment("ชื่อตำแหน่งทางการบริหาร"); + + b.Property("ExecutiveSideId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(9) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(300) + .HasColumnType("varchar(300)") + .HasColumnOrder(1) + .HasComment("ชื่อตำแหน่ง"); + + b.Property("PathSideId") + .HasColumnType("char(36)"); + + b.Property("PositionCategory") + .IsRequired() + .HasColumnType("longtext") + .HasColumnOrder(8) + .HasComment("ตำแหน่งสำหรับข้าราชการหรือลูกจ้าง officer/employee"); + + b.Property("PositionLevelId") + .HasColumnType("char(36)"); + + b.Property("PositionPathId") + .HasColumnType("char(36)"); + + b.Property("PositionTypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ExecutiveSideId"); + + b.HasIndex("PathSideId"); + + b.HasIndex("PositionLevelId"); + + b.HasIndex("PositionPathId"); + + b.HasIndex("PositionTypeId"); + + b.ToTable("Positions"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionEmployeeGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อกลุ่มงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ"); + + b.HasKey("Id"); + + b.ToTable("PositionEmployeeGroups"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionEmployeeLevel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อระดับชั้นงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ"); + + b.HasKey("Id"); + + b.ToTable("PositionEmployeeLevels"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionEmployeeLine", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อสายงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ"); + + b.HasKey("Id"); + + b.ToTable("PositionEmployeeLines"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionEmployeePosition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อตำแหน่งข้อมูลตำแหน่งของลูกจ้างกรุงเทพ"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext") + .HasColumnOrder(3) + .HasComment("หมายเหตุ"); + + b.HasKey("Id"); + + b.ToTable("PositionEmployeePositions"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionEmployeePositionSide", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อด้านของตำแหน่งข้อมูลตำแหน่งของลูกจ้างกรุงเทพ"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext") + .HasColumnOrder(3) + .HasComment("หมายเหตุ"); + + b.HasKey("Id"); + + b.ToTable("PositionEmployeePositionSides"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionEmployeeStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อสถานะของตำแหน่งข้อมูลตำแหน่งของลูกจ้างกรุงเทพ"); + + b.HasKey("Id"); + + b.ToTable("PositionEmployeeStatuses"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionExecutive", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อตำแหน่งทางการบริหารของข้อมูลตำแหน่งของข้าราชการ"); + + b.HasKey("Id"); + + b.ToTable("PositionExecutives"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionExecutiveSide", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อด้านทางการบริหาร"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext") + .HasColumnOrder(3) + .HasComment("หมายเหตุ"); + + b.HasKey("Id"); + + b.ToTable("PositionExecutiveSides"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionLevel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(4) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Level") + .HasColumnType("int") + .HasColumnOrder(3) + .HasComment("ลำดับชั้นของระดับตำแหน่ง"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อระดับตำแหน่ง"); + + b.Property("ShortName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(2) + .HasComment("ชื่อย่อระดับตำแหน่ง"); + + b.HasKey("Id"); + + b.ToTable("PositionLevels"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionLine", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อสายงานของข้อมูลตำแหน่งของข้าราชการ"); + + b.HasKey("Id"); + + b.ToTable("PositionLines"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionPath", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อสายงาน"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext") + .HasColumnOrder(3) + .HasComment("หมายเหตุ"); + + b.HasKey("Id"); + + b.ToTable("PositionPaths"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionPathSide", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อด้าน/สาขา"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext") + .HasColumnOrder(3) + .HasComment("หมายเหตุ"); + + b.HasKey("Id"); + + b.ToTable("PositionPathSides"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อสถานะของตำแหน่งของข้อมูลตำแหน่งของข้าราชการ"); + + b.HasKey("Id"); + + b.ToTable("PositionStatuss"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อประเภทตำแหน่ง"); + + b.HasKey("Id"); + + b.ToTable("PositionTypes"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Prefix", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(3) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasColumnOrder(2) + .HasComment("รายละเอียดคำนำหน้า"); + + b.HasKey("Id"); + + b.ToTable("Prefixes"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Province", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("varchar(150)") + .HasColumnOrder(1) + .HasComment("จังหวัด"); + + b.HasKey("Id"); + + b.ToTable("Provinces"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Relationship", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasColumnOrder(1) + .HasComment("ชื่อความสัมพันธ์"); + + b.HasKey("Id"); + + b.ToTable("Relationships"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Religion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ศาสนา"); + + b.HasKey("Id"); + + b.ToTable("Religions"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Royal", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(3) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อประเภทข้อมูลเหรียญตรา"); + + b.Property("ShortName") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("varchar(10)") + .HasColumnOrder(2) + .HasComment("ชื่อย่อเหรียญตรา"); + + b.HasKey("Id"); + + b.ToTable("Royals"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.RoyalHierarchy", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อลำดับชั้นข้อมูลเครื่องราชฯ"); + + b.HasKey("Id"); + + b.ToTable("RoyalHierarchys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.RoyalType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อประเภทข้อมูลเครื่องราชฯ"); + + b.HasKey("Id"); + + b.ToTable("RoyalTypes"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.SubDistrict", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DistrictId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(3) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("varchar(150)") + .HasColumnOrder(1) + .HasComment("เขต/อำเภอ"); + + b.Property("ZipCode") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("varchar(10)") + .HasColumnOrder(2) + .HasComment("รหัสไปรษณีย์"); + + b.HasKey("Id"); + + b.HasIndex("DistrictId"); + + b.ToTable("SubDistricts"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Notifications.MessageQueueEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsSend") + .HasColumnType("tinyint(1)") + .HasComment("ทำการส่งข้อความแล้วหรือยัง?"); + + b.Property("IsSendEmail") + .HasColumnType("tinyint(1)") + .HasComment("ส่งอีเมลล์หรือไม่?"); + + b.Property("IsSendInbox") + .HasColumnType("tinyint(1)") + .HasComment("ส่งไปที่กล่องข้อความหรือไม่?"); + + b.Property("IsSendNotification") + .HasColumnType("tinyint(1)") + .HasComment("ส่งการแจ้งเตือนหรือไม่?"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("MessageContent") + .IsRequired() + .HasColumnType("longtext") + .HasComment("รายละเอียดข้อความ"); + + b.Property("MessagePayLoad") + .IsRequired() + .HasColumnType("longtext") + .HasComment("สิ่งที่แนบมาด้วย"); + + b.Property("ReceiverEmailAddress") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("varchar(500)") + .HasComment("อีเมล์ของผู้รับ"); + + b.Property("ReceiverUserId") + .HasColumnType("char(36)") + .HasComment("รหัสของผู้รับข้อความ"); + + b.Property("SenderSystem") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("ส่งจากระบบงาน"); + + b.Property("Subject") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("หัวเรื่อง"); + + b.HasKey("Id"); + + b.ToTable("MessageQueues"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Agency") + .HasColumnType("longtext"); + + b.Property("ConditionNote") + .HasColumnType("longtext"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Department") + .HasColumnType("longtext"); + + b.Property("Government") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsCondition") + .HasColumnType("tinyint(1)"); + + b.Property("IsDirector") + .HasColumnType("tinyint(1)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("OrganizationAgencyId") + .HasColumnType("char(36)"); + + b.Property("OrganizationFaxId") + .HasColumnType("char(36)"); + + b.Property("OrganizationGovernmentAgencyId") + .HasColumnType("char(36)"); + + b.Property("OrganizationLevelId") + .HasColumnType("char(36)"); + + b.Property("OrganizationOrder") + .HasColumnType("longtext"); + + b.Property("OrganizationOrganizationId") + .HasColumnType("char(36)"); + + b.Property("OrganizationShortNameId") + .HasColumnType("char(36)"); + + b.Property("OrganizationTelExternalId") + .HasColumnType("char(36)"); + + b.Property("OrganizationTelInternalId") + .HasColumnType("char(36)"); + + b.Property("OrganizationTypeId") + .HasColumnType("char(36)"); + + b.Property("OrganizationUserNote") + .HasColumnType("longtext"); + + b.Property("Pile") + .HasColumnType("longtext"); + + b.Property("PosNo") + .HasColumnType("longtext"); + + b.Property("PositionCondition") + .HasColumnType("longtext"); + + b.Property("PositionEmployeeLineId") + .HasColumnType("char(36)"); + + b.Property("PositionEmployeePositionId") + .HasColumnType("char(36)"); + + b.Property("PositionEmployeeStatusId") + .HasColumnType("char(36)"); + + b.Property("PositionMasterUserNote") + .HasColumnType("longtext"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("Qualification") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationAgencyId"); + + b.HasIndex("OrganizationFaxId"); + + b.HasIndex("OrganizationGovernmentAgencyId"); + + b.HasIndex("OrganizationLevelId"); + + b.HasIndex("OrganizationOrganizationId"); + + b.HasIndex("OrganizationShortNameId"); + + b.HasIndex("OrganizationTelExternalId"); + + b.HasIndex("OrganizationTelInternalId"); + + b.HasIndex("OrganizationTypeId"); + + b.HasIndex("PositionEmployeeLineId"); + + b.HasIndex("PositionEmployeePositionId"); + + b.HasIndex("PositionEmployeeStatusId"); + + b.HasIndex("ProfileId"); + + b.ToTable("OrganizationEmployees"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeeLevel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("OrganizationEmployeeId") + .HasColumnType("char(36)"); + + b.Property("PositionEmployeeLevelId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationEmployeeId"); + + b.HasIndex("PositionEmployeeLevelId"); + + b.ToTable("OrganizationPositionEmployeeLevels"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeePositionSide", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("OrganizationEmployeeId") + .HasColumnType("char(36)"); + + b.Property("PositionEmployeePositionSideId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationEmployeeId"); + + b.HasIndex("PositionEmployeePositionSideId"); + + b.ToTable("OrganizationPositionEmployeePositionSides"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.AvailablePositionLevelEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("PositionLevelId") + .HasColumnType("char(36)"); + + b.Property("PositionMasterId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PositionLevelId"); + + b.HasIndex("PositionMasterId"); + + b.ToTable("AvailablePositionLevels"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Agency") + .HasColumnType("longtext") + .HasColumnOrder(14) + .HasComment("หน่วยงาน"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Department") + .HasColumnType("longtext") + .HasColumnOrder(16) + .HasComment("ฝ่าย/ส่วน"); + + b.Property("Government") + .HasColumnType("longtext") + .HasColumnOrder(15) + .HasComment("ส่วนราชการ"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("OrganizationFaxId") + .HasColumnType("char(36)"); + + b.Property("OrganizationLevelId") + .HasColumnType("char(36)"); + + b.Property("OrganizationOrder") + .HasColumnType("int") + .HasColumnOrder(12) + .HasComment("OrganizationOrder"); + + b.Property("OrganizationOrganizationId") + .HasColumnType("char(36)"); + + b.Property("OrganizationShortNameId") + .HasColumnType("char(36)"); + + b.Property("OrganizationStatusId") + .HasColumnType("char(36)"); + + b.Property("OrganizationTelExternalId") + .HasColumnType("char(36)"); + + b.Property("OrganizationTelInternalId") + .HasColumnType("char(36)"); + + b.Property("OrganizationTypeId") + .HasColumnType("char(36)"); + + b.Property("OrganizationUserNote") + .HasColumnType("longtext") + .HasColumnOrder(13) + .HasComment("OrganizationUserNote"); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("Pile") + .HasColumnType("longtext") + .HasColumnOrder(17) + .HasComment("กอง"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationFaxId"); + + b.HasIndex("OrganizationLevelId"); + + b.HasIndex("OrganizationOrganizationId"); + + b.HasIndex("OrganizationShortNameId"); + + b.HasIndex("OrganizationStatusId"); + + b.HasIndex("OrganizationTelExternalId"); + + b.HasIndex("OrganizationTelInternalId"); + + b.HasIndex("OrganizationTypeId"); + + b.HasIndex("ParentId"); + + b.ToTable("Organizations"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationPositionEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsDirector") + .HasColumnType("tinyint(1)") + .HasColumnOrder(3) + .HasComment("Is Director"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("OrganizationId") + .HasColumnType("char(36)"); + + b.Property("PositionMasterId") + .HasColumnType("char(36)"); + + b.Property("PositionNumberId") + .HasColumnType("char(36)"); + + b.Property("PositionUserNote") + .HasColumnType("longtext") + .HasColumnOrder(4) + .HasComment("positionUserNote"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PositionMasterId"); + + b.HasIndex("PositionNumberId"); + + b.ToTable("OrganizationPositions"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationPublishHistoryEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Detail") + .IsRequired() + .HasColumnType("longtext") + .HasColumnOrder(1) + .HasComment("รายละเอียดการแก้ไข"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ObjectValue") + .IsRequired() + .HasColumnType("longtext") + .HasColumnOrder(2) + .HasComment("เก็บ Object ที่มีการอัพเดตในระบบ"); + + b.HasKey("Id"); + + b.ToTable("OrganizationPublishHistories"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsDirector") + .HasColumnType("tinyint(1)") + .HasColumnOrder(14) + .HasComment("IsDirector"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("PositionCondition") + .HasColumnType("longtext") + .HasColumnOrder(11) + .HasComment("PositionCondition"); + + b.Property("PositionExecutiveId") + .HasColumnType("char(36)"); + + b.Property("PositionExecutiveSideId") + .HasColumnType("char(36)"); + + b.Property("PositionExecutiveSideObject") + .HasColumnType("longtext"); + + b.Property("PositionId") + .HasColumnType("char(36)") + .HasColumnOrder(2) + .HasComment("PositionId"); + + b.Property("PositionLineId") + .HasColumnType("char(36)"); + + b.Property("PositionMasterUserNote") + .HasColumnType("longtext") + .HasColumnOrder(13) + .HasComment("PositionMasterUserNote"); + + b.Property("PositionPathId") + .HasColumnType("char(36)"); + + b.Property("PositionPathSideId") + .HasColumnType("char(36)"); + + b.Property("PositionPathSideObject") + .HasColumnType("longtext"); + + b.Property("PositionStatusId") + .HasColumnType("char(36)"); + + b.Property("PositionTypeId") + .HasColumnType("char(36)"); + + b.Property("Qualification") + .HasColumnType("longtext") + .HasColumnOrder(15) + .HasComment("คุณวุฒิ"); + + b.HasKey("Id"); + + b.HasIndex("PositionExecutiveId"); + + b.HasIndex("PositionExecutiveSideId"); + + b.HasIndex("PositionLineId"); + + b.HasIndex("PositionPathId"); + + b.HasIndex("PositionPathSideId"); + + b.HasIndex("PositionStatusId"); + + b.HasIndex("PositionTypeId"); + + b.ToTable("PositionMasters"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionMasterHistoryEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsDirector") + .HasColumnType("tinyint(1)") + .HasColumnOrder(14) + .HasComment("IsDirector"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Position") + .HasColumnType("longtext") + .HasColumnOrder(2) + .HasComment("Position"); + + b.Property("PositionCondition") + .HasColumnType("longtext") + .HasColumnOrder(11) + .HasComment("PositionCondition"); + + b.Property("PositionExecutive") + .HasColumnType("longtext") + .HasColumnOrder(5) + .HasComment("PositionExecutive"); + + b.Property("PositionExecutiveSide") + .HasColumnType("longtext") + .HasColumnOrder(6) + .HasComment("PositionExecutiveSide"); + + b.Property("PositionExecutiveSideObject") + .HasColumnType("longtext"); + + b.Property("PositionLevel") + .HasColumnType("longtext") + .HasColumnOrder(12) + .HasComment("PositionLevel"); + + b.Property("PositionLine") + .HasColumnType("longtext") + .HasColumnOrder(8) + .HasComment("PositionLine"); + + b.Property("PositionMasterEntityId") + .HasColumnType("char(36)"); + + b.Property("PositionMasterUserNote") + .HasColumnType("longtext") + .HasColumnOrder(13) + .HasComment("PositionMasterUserNote"); + + b.Property("PositionPath") + .HasColumnType("longtext") + .HasColumnOrder(3) + .HasComment("PositionPath"); + + b.Property("PositionPathSide") + .HasColumnType("longtext") + .HasColumnOrder(7) + .HasComment("PositionPathSide"); + + b.Property("PositionPathSideObject") + .HasColumnType("longtext"); + + b.Property("PositionStatus") + .HasColumnType("longtext") + .HasColumnOrder(10) + .HasComment("PositionStatus"); + + b.Property("PositionType") + .HasColumnType("longtext") + .HasColumnOrder(4) + .HasComment("PositionType"); + + b.Property("Qualification") + .HasColumnType("longtext") + .HasColumnOrder(15) + .HasComment("คุณวุฒิ"); + + b.HasKey("Id"); + + b.HasIndex("PositionMasterEntityId"); + + b.ToTable("PositionMasterHistoryEntity"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionNumberEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .HasMaxLength(300) + .HasColumnType("varchar(300)") + .HasColumnOrder(2) + .HasComment("ชื่อ"); + + b.Property("OrganizationShortNameId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationShortNameId"); + + b.ToTable("PositionNumbers"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.ProfilePosition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("OrganizationPositionId") + .HasColumnType("char(36)"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationPositionId"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfilePositions"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.Report2.Report2", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("GovernmentCode") + .HasColumnType("longtext"); + + b.Property("GovernmentCodeOld") + .HasColumnType("longtext"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("OrganizationOrganization") + .HasColumnType("longtext"); + + b.Property("OrganizationOrganizationId") + .HasColumnType("char(36)") + .HasComment("ชื่อหน่วยงาน"); + + b.Property("OrganizationOrganizationOld") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงานเดิม"); + + b.Property("OrganizationPositionId") + .HasColumnType("char(36)"); + + b.Property("OrganizationShortName") + .HasColumnType("longtext"); + + b.Property("OrganizationShortNameId") + .HasColumnType("char(36)") + .HasComment("รหัสส่วนราชการ"); + + b.Property("OrganizationShortNameOld") + .HasColumnType("longtext") + .HasComment("รหัสส่วนราชการเดิม"); + + b.Property("PositionExecutive") + .HasColumnType("longtext"); + + b.Property("PositionExecutiveId") + .HasColumnType("char(36)") + .HasComment("ตำแหน่งทางการบริหาร"); + + b.Property("PositionExecutiveOld") + .HasColumnType("longtext") + .HasComment("ตำแหน่งทางการบริหารเดิม"); + + b.Property("PositionExecutiveSide") + .HasColumnType("longtext"); + + b.Property("PositionExecutiveSideId") + .HasColumnType("char(36)") + .HasComment("ด้านทางบริหาร"); + + b.Property("PositionExecutiveSideOld") + .HasColumnType("longtext") + .HasComment("ด้านทางบริหารเดิม"); + + b.Property("PositionLevel") + .HasColumnType("longtext"); + + b.Property("PositionLevelId") + .HasColumnType("char(36)") + .HasComment("ระดับตำแหน่ง"); + + b.Property("PositionLevelOld") + .HasColumnType("longtext") + .HasComment("ระดับตำแหน่งเดิม"); + + b.Property("PositionNum") + .HasColumnType("longtext"); + + b.Property("PositionNumId") + .HasColumnType("char(36)") + .HasComment("ตำแหน่งเลขที่"); + + b.Property("PositionNumOld") + .HasColumnType("longtext") + .HasComment("ตำแหน่งเลขที่เดิม"); + + b.Property("PositionPath") + .HasColumnType("longtext"); + + b.Property("PositionPathId") + .HasColumnType("char(36)") + .HasComment("ตำแหน่งในสายงาน"); + + b.Property("PositionPathOld") + .HasColumnType("longtext") + .HasComment("ตำแหน่งในสายงานเดิม"); + + b.Property("PositionPathSide") + .HasColumnType("longtext"); + + b.Property("PositionPathSideId") + .HasColumnType("char(36)") + .HasComment("ด้าน/สาขา"); + + b.Property("PositionPathSideOld") + .HasColumnType("longtext") + .HasComment("ด้าน/สาขาเดิม"); + + b.Property("PositionType") + .HasColumnType("longtext"); + + b.Property("PositionTypeId") + .HasColumnType("char(36)") + .HasComment("ประเภทตำแหน่ง"); + + b.Property("PositionTypeOld") + .HasColumnType("longtext") + .HasComment("ประเภทตำแหน่งเดิม"); + + b.Property("ProfilePositionId") + .HasColumnType("char(36)") + .HasComment("สังกัดที่ถือครอง"); + + b.Property("Status") + .HasColumnType("longtext") + .HasComment("สถานะการเปลี่ยนแปลง"); + + b.HasKey("Id"); + + b.ToTable("Report2s"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.Report2.Report2DetailHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Detail") + .HasColumnType("longtext"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.ToTable("Report2DetailHistories"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.Report2.Report2History", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Education") + .HasColumnType("longtext") + .HasComment("คุณวุฒิ"); + + b.Property("FullName") + .HasColumnType("longtext") + .HasComment("ชื่อ-สกุล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("NewGovernmentCode") + .HasColumnType("longtext"); + + b.Property("NewOrganizationOrganization") + .HasColumnType("longtext"); + + b.Property("NewOrganizationOrganizationId") + .HasColumnType("char(36)") + .HasComment("ชื่อหน่วยงาน กำหนดใหม่"); + + b.Property("NewOrganizationShortName") + .HasColumnType("longtext"); + + b.Property("NewOrganizationShortNameId") + .HasColumnType("char(36)") + .HasComment("รหัสส่วนราชการ กำหนดใหม่"); + + b.Property("NewPositionExecutive") + .HasColumnType("longtext"); + + b.Property("NewPositionExecutiveId") + .HasColumnType("char(36)") + .HasComment("ตำแหน่งทางการบริหาร กำหนดใหม่"); + + b.Property("NewPositionExecutiveSide") + .HasColumnType("longtext"); + + b.Property("NewPositionExecutiveSideId") + .HasColumnType("char(36)") + .HasComment("ด้านทางบริหาร กำหนดใหม่"); + + b.Property("NewPositionLevel") + .HasColumnType("longtext"); + + b.Property("NewPositionLevelId") + .HasColumnType("char(36)") + .HasComment("ระดับตำแหน่ง กำหนดใหม่"); + + b.Property("NewPositionNum") + .HasColumnType("longtext"); + + b.Property("NewPositionNumId") + .HasColumnType("char(36)") + .HasComment("ตำแหน่งเลขที่ กำหนดใหม่"); + + b.Property("NewPositionPath") + .HasColumnType("longtext"); + + b.Property("NewPositionPathId") + .HasColumnType("char(36)") + .HasComment("ตำแหน่งในสายงาน กำหนดใหม่"); + + b.Property("NewPositionPathSide") + .HasColumnType("longtext"); + + b.Property("NewPositionPathSideId") + .HasColumnType("char(36)") + .HasComment("ด้าน/สาขา กำหนดใหม่"); + + b.Property("NewPositionType") + .HasColumnType("longtext"); + + b.Property("NewPositionTypeId") + .HasColumnType("char(36)") + .HasComment("ประเภทตำแหน่ง กำหนดใหม่"); + + b.Property("OldGovernmentCode") + .HasColumnType("longtext"); + + b.Property("OldOrganizationOrganization") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน กำหนดเดิม"); + + b.Property("OldOrganizationShortName") + .HasColumnType("longtext") + .HasComment("รหัสส่วนราชการ กำหนดเดิม"); + + b.Property("OldPositionExecutive") + .HasColumnType("longtext") + .HasComment("ตำแหน่งทางการบริหาร กำหนดเดิม"); + + b.Property("OldPositionExecutiveSide") + .HasColumnType("longtext") + .HasComment("ด้านทางบริหาร กำหนดเดิม"); + + b.Property("OldPositionLevel") + .HasColumnType("longtext") + .HasComment("ระดับตำแหน่ง กำหนดเดิม"); + + b.Property("OldPositionNum") + .HasColumnType("longtext") + .HasComment("ตำแหน่งเลขที่ กำหนดเดิม"); + + b.Property("OldPositionPath") + .HasColumnType("longtext") + .HasComment("ตำแหน่งในสายงาน กำหนดเดิม"); + + b.Property("OldPositionPathSide") + .HasColumnType("longtext") + .HasComment("ด้าน/สาขา กำหนดเดิม"); + + b.Property("OldPositionType") + .HasColumnType("longtext") + .HasComment("ประเภทตำแหน่ง กำหนดเดิม"); + + b.Property("OrganizationPositionId") + .HasColumnType("char(36)"); + + b.Property("ProfilePositionId") + .HasColumnType("char(36)") + .HasComment("สังกัดที่ถือครอง"); + + b.Property("Report2DetailHistoryId") + .HasColumnType("char(36)"); + + b.Property("Salary") + .HasColumnType("double") + .HasComment("เงินเดือน"); + + b.Property("SalaryMonth") + .HasColumnType("double") + .HasComment("เงินตอบแทนรายเดือน"); + + b.Property("SalaryPosition") + .HasColumnType("double") + .HasComment("เงินประจำตำแหน่ง"); + + b.Property("Status") + .HasColumnType("longtext") + .HasComment("สถานะการเปลี่ยนแปลง"); + + b.HasKey("Id"); + + b.HasIndex("Report2DetailHistoryId"); + + b.ToTable("Report2Histories"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.Placement", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("EndDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่สิ้นสุดบัญชี"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext") + .HasComment("รอบการสอบ"); + + b.Property("Number") + .HasMaxLength(10) + .HasColumnType("int") + .HasComment("จำนวนผู้สอบได้"); + + b.Property("PlacementTypeId") + .HasColumnType("char(36)"); + + b.Property("Round") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ครั้งที่"); + + b.Property("StartDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่เริ่มบัญชีบัญชี"); + + b.Property("Year") + .HasMaxLength(5) + .HasColumnType("int") + .HasComment("ปีงบประมาณ"); + + b.HasKey("Id"); + + b.HasIndex("PlacementTypeId"); + + b.ToTable("Placements"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementCertificate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CertificateNo") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("เลขที่ใบอนุญาต"); + + b.Property("CertificateType") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อใบอนุญาต"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("ExpireDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่หมดอายุ"); + + b.Property("IssueDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่ออกใบอนุญาต"); + + b.Property("Issuer") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("หน่วยงานผู้ออกใบอนุญาต"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("PlacementProfileId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PlacementProfileId"); + + b.ToTable("PlacementCertificates"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementEducation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Country") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("ประเทศ"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Degree") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("วุฒิการศึกษา"); + + b.Property("Duration") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("ระยะเวลา"); + + b.Property("DurationYear") + .HasColumnType("int") + .HasComment("ระยะเวลาหลักสูตร"); + + b.Property("EducationLevelId") + .HasColumnType("char(36)"); + + b.Property("EndDate") + .HasColumnType("datetime(6)") + .HasComment("ถึง"); + + b.Property("Field") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("สาขาวิชา/ทาง"); + + b.Property("FinishDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่สำเร็จการศึกษา"); + + b.Property("FundName") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("ทุน"); + + b.Property("Gpa") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("เกรดเฉลี่ย"); + + b.Property("Institute") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("สถานศึกษา"); + + b.Property("IsDate") + .HasColumnType("tinyint(1)") + .HasComment("ประเภทช่วงเวลาการศึกษา"); + + b.Property("IsEducation") + .HasColumnType("tinyint(1)") + .HasComment("เป็นวุฒิศึกษาในตำแหน่ง"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Other") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("ข้อมูลการติดต่อ"); + + b.Property("PlacementProfileId") + .HasColumnType("char(36)"); + + b.Property("PositionPathId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)") + .HasComment("ตั้งแต่"); + + b.HasKey("Id"); + + b.HasIndex("EducationLevelId"); + + b.HasIndex("PlacementProfileId"); + + b.HasIndex("PositionPathId"); + + b.ToTable("PlacementEducations"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementIsProperty", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ชื่อคุณสมบัติ"); + + b.HasKey("Id"); + + b.ToTable("PlacementIsProperties"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Amount") + .HasColumnType("double") + .HasComment("เงินเดือน"); + + b.Property("BloodGroupId") + .HasColumnType("char(36)"); + + b.Property("CitizenDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่ออกบัตร"); + + b.Property("CitizenDistrictId") + .HasColumnType("char(36)"); + + b.Property("CitizenId") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("เลขประจำตัวประชาชน"); + + b.Property("CitizenProvinceId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("CurrentAddress") + .HasColumnType("longtext") + .HasComment("ที่อยู่ปัจจุบัน"); + + b.Property("CurrentDistrictId") + .HasColumnType("char(36)"); + + b.Property("CurrentProvinceId") + .HasColumnType("char(36)"); + + b.Property("CurrentSubDistrictId") + .HasColumnType("char(36)"); + + b.Property("CurrentZipCode") + .HasMaxLength(10) + .HasColumnType("varchar(10)") + .HasComment("รหัสไปรษณีย์ที่อยู่ปัจจุบัน"); + + b.Property("DateOfBirth") + .HasMaxLength(40) + .HasColumnType("datetime(6)") + .HasComment("วันเกิด"); + + b.Property("Draft") + .HasColumnType("tinyint(1)") + .HasComment("ข้อมูลตำแหน่ง Draft"); + + b.Property("Email") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("อีเมล"); + + b.Property("ExamNumber") + .HasColumnType("int") + .HasComment("ลำดับที่สอบได้"); + + b.Property("ExamRound") + .HasColumnType("int") + .HasComment("จำนวนครั้งที่สมัครสอบ"); + + b.Property("FatherFirstName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อจริงบิดา"); + + b.Property("FatherLastName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุลบิดา"); + + b.Property("FatherNationality") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("สัญชาติบิดา"); + + b.Property("FatherOccupation") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("อาชีพบิดา"); + + b.Property("FatherPrefixId") + .HasColumnType("char(36)"); + + b.Property("Firstname") + .HasColumnType("longtext") + .HasComment("ชื่อ"); + + b.Property("GenderId") + .HasColumnType("char(36)"); + + b.Property("IsOfficer") + .HasColumnType("tinyint(1)") + .HasComment("ข้าราชการฯ กทม."); + + b.Property("IsProperty") + .HasColumnType("longtext") + .HasComment("การคัดกรองคุณสมบัติ"); + + b.Property("IsRelief") + .HasColumnType("tinyint(1)") + .HasComment("ผ่อนผัน"); + + b.Property("Knowledge") + .HasColumnType("longtext") + .HasComment("ความสามารถพิเศษ"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Lastname") + .HasColumnType("longtext") + .HasComment("นามสกุล"); + + b.Property("Marry") + .HasColumnType("tinyint(1)") + .HasComment("คู่สมรส"); + + b.Property("MarryFirstName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อจริงคู่สมรส"); + + b.Property("MarryLastName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุลคู่สมรส"); + + b.Property("MarryNationality") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("สัญชาติคู่สมรส"); + + b.Property("MarryOccupation") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("อาชีพคู่สมรส"); + + b.Property("MarryPrefixId") + .HasColumnType("char(36)"); + + b.Property("MobilePhone") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("โทรศัพท์มือถือ"); + + b.Property("MotherFirstName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อจริงมารดา"); + + b.Property("MotherLastName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุลมารดา"); + + b.Property("MotherNationality") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("สัญชาติมารดา"); + + b.Property("MotherOccupation") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("อาชีพมารดา"); + + b.Property("MotherPrefixId") + .HasColumnType("char(36)"); + + b.Property("MouthSalaryAmount") + .HasColumnType("double") + .HasComment("เงินค่าตอบแทนรายเดือน"); + + b.Property("Nationality") + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasComment("สัญชาติ"); + + b.Property("Number") + .HasColumnType("int") + .HasComment("ลำดับที่สอบได้"); + + b.Property("OccupationCompany") + .HasColumnType("longtext") + .HasComment("สำนัก/บริษัท บริษัท"); + + b.Property("OccupationDepartment") + .HasColumnType("longtext") + .HasComment("กอง/ฝ่าย บริษัท"); + + b.Property("OccupationEmail") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("อีเมล บริษัท"); + + b.Property("OccupationPosition") + .HasColumnType("longtext") + .HasComment("ตำแหน่งอาชีพ"); + + b.Property("OccupationTelephone") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("โทรศัพท์ บริษัท"); + + b.Property("OccupationType") + .HasColumnType("longtext") + .HasComment("ประเภทอาชีพที่ทำงานมาก่อน"); + + b.Property("OrganizationPositionId") + .HasColumnType("char(36)"); + + b.Property("Pass") + .HasColumnType("longtext") + .HasComment("ผลสมัครสอบ"); + + b.Property("PlacementId") + .HasColumnType("char(36)"); + + b.Property("PlacementStatus") + .IsRequired() + .HasColumnType("longtext") + .HasComment("สถานะการบรรจุ"); + + b.Property("PointA") + .HasColumnType("double") + .HasComment("คะแนนภาค ก"); + + b.Property("PointB") + .HasColumnType("double") + .HasComment("คะแนนภาค ข"); + + b.Property("PointC") + .HasColumnType("double") + .HasComment("คะแนนภาค ค"); + + b.Property("PointTotalA") + .HasColumnType("double") + .HasComment("คะแนนเต็มภาค ก"); + + b.Property("PointTotalB") + .HasColumnType("double") + .HasComment("คะแนนเต็มภาค ข"); + + b.Property("PointTotalC") + .HasColumnType("double") + .HasComment("คะแนนเต็มภาค ค"); + + b.Property("PositionLevelId") + .HasColumnType("char(36)"); + + b.Property("PositionLineId") + .HasColumnType("char(36)"); + + b.Property("PositionNumberId") + .HasColumnType("char(36)"); + + b.Property("PositionPathId") + .HasColumnType("char(36)"); + + b.Property("PositionPathSideId") + .HasColumnType("char(36)"); + + b.Property("PositionSalaryAmount") + .HasColumnType("double") + .HasComment("เงินประจำตำแหน่ง"); + + b.Property("PositionTypeId") + .HasColumnType("char(36)"); + + b.Property("PrefixId") + .HasColumnType("char(36)"); + + b.Property("Race") + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasComment("เชื้อชาติ"); + + b.Property("RecruitDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่บรรจุ"); + + b.Property("RegistAddress") + .HasColumnType("longtext") + .HasComment("ที่อยู่ตามทะเบียนบ้าน"); + + b.Property("RegistDistrictId") + .HasColumnType("char(36)"); + + b.Property("RegistProvinceId") + .HasColumnType("char(36)"); + + b.Property("RegistSame") + .HasColumnType("tinyint(1)") + .HasComment("ที่อยู่ปัจจุบันเหมือนที่อยู่ตามทะเบียนบ้าน"); + + b.Property("RegistSubDistrictId") + .HasColumnType("char(36)"); + + b.Property("RegistZipCode") + .HasMaxLength(10) + .HasColumnType("varchar(10)") + .HasComment("รหัสไปรษณีย์ที่อยู่ตามทะเบียนบ้าน"); + + b.Property("RejectReason") + .HasColumnType("longtext") + .HasComment("เหตุผลสละสิทธิ์"); + + b.Property("RelationshipId") + .HasColumnType("char(36)"); + + b.Property("ReliefDocId") + .HasColumnType("char(36)"); + + b.Property("ReliefReason") + .HasColumnType("longtext") + .HasComment("เหตุผลผ่อนผัน"); + + b.Property("ReligionId") + .HasColumnType("char(36)"); + + b.Property("ReportingDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่รายงานตัว"); + + b.Property("SalaryClass") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง (รายละเอียด)"); + + b.Property("SalaryRef") + .HasColumnType("longtext") + .HasComment("เอกสารอ้างอิง"); + + b.Property("Telephone") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("โทรศัพท์"); + + b.HasKey("Id"); + + b.HasIndex("BloodGroupId"); + + b.HasIndex("CitizenDistrictId"); + + b.HasIndex("CitizenProvinceId"); + + b.HasIndex("CurrentDistrictId"); + + b.HasIndex("CurrentProvinceId"); + + b.HasIndex("CurrentSubDistrictId"); + + b.HasIndex("FatherPrefixId"); + + b.HasIndex("GenderId"); + + b.HasIndex("MarryPrefixId"); + + b.HasIndex("MotherPrefixId"); + + b.HasIndex("OrganizationPositionId"); + + b.HasIndex("PlacementId"); + + b.HasIndex("PositionLevelId"); + + b.HasIndex("PositionLineId"); + + b.HasIndex("PositionNumberId"); + + b.HasIndex("PositionPathId"); + + b.HasIndex("PositionPathSideId"); + + b.HasIndex("PositionTypeId"); + + b.HasIndex("PrefixId"); + + b.HasIndex("RegistDistrictId"); + + b.HasIndex("RegistProvinceId"); + + b.HasIndex("RegistSubDistrictId"); + + b.HasIndex("RelationshipId"); + + b.HasIndex("ReliefDocId"); + + b.HasIndex("ReligionId"); + + b.ToTable("PlacementProfiles"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ชื่อประเภทบรรจุ"); + + b.HasKey("Id"); + + b.ToTable("PlacementTypes"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.PlacementCommand", b => + { + b.HasBaseType("BMA.EHR.Domain.Models.Commands.Core.Command"); + + b.Property("ConclusionRegisterDate") + .HasColumnType("datetime(6)") + .HasComment("ลงวันที่ (เรื่อง รับสมัครสอบฯ)"); + + b.Property("ConclusionRegisterNo") + .IsRequired() + .HasColumnType("longtext") + .HasComment("มติ กก. ครั้งที่ (เรื่อง รับสมัครสอบฯ)"); + + b.Property("ConclusionResultDate") + .HasColumnType("datetime(6)") + .HasComment("ลงวันที่ (เรื่อง ผลการสอบแข่งขัน)"); + + b.Property("ConclusionResultNo") + .IsRequired() + .HasColumnType("longtext") + .HasComment("มติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)"); + + b.Property("ExamRoundId") + .HasColumnType("char(36)") + .HasComment("อ้างอิงรอบการสอบ"); + + b.Property("PositionName") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ตำแหน่งที่บรรจุ"); + + b.HasDiscriminator().HasValue("PlacementCommand"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.Command", b => + { + b.HasOne("BMA.EHR.Domain.Models.Commands.Core.CommandStatus", "CommandStatus") + .WithMany() + .HasForeignKey("CommandStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Commands.Core.CommandType", "CommandType") + .WithMany() + .HasForeignKey("CommandTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CommandStatus"); + + b.Navigation("CommandType"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandDocument", b => + { + b.HasOne("BMA.EHR.Domain.Models.Commands.Core.Command", "Command") + .WithMany("Documents") + .HasForeignKey("CommandId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Command"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitTypeLeave", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.LimitLeave", "LimitLeave") + .WithMany("LimitTypeLeaves") + .HasForeignKey("LimitLeaveId"); + + b.HasOne("BMA.EHR.Domain.Models.HR.TypeLeave", "TypeLeave") + .WithMany("LimitTypeLeaves") + .HasForeignKey("TypeLeaveId"); + + b.Navigation("LimitLeave"); + + b.Navigation("TypeLeave"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.Profile", b => + { + b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Avatar") + .WithMany() + .HasForeignKey("AvatarId"); + + b.HasOne("BMA.EHR.Domain.Models.HR.LimitLeave", "LimitLeave") + .WithMany("Profiles") + .HasForeignKey("LimitLeaveId"); + + b.Navigation("Avatar"); + + b.Navigation("LimitLeave"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAbility", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Abilitys") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAbilityHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileAbility", "ProfileAbility") + .WithMany("ProfileAbilityHistorys") + .HasForeignKey("ProfileAbilityId"); + + b.Navigation("ProfileAbility"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAddressHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("AddressHistory") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAssessment", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Assessments") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAssessmentHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileAssessment", "ProfileAssessment") + .WithMany("ProfileAssessmentHistorys") + .HasForeignKey("ProfileAssessmentId"); + + b.Navigation("ProfileAssessment"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAvatarHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "AvatarFile") + .WithMany() + .HasForeignKey("AvatarFileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("AvatarHistory") + .HasForeignKey("ProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AvatarFile"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCertificate", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Certificates") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCertificateHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileCertificate", "ProfileCertificate") + .WithMany("ProfileCertificateHistorys") + .HasForeignKey("ProfileCertificateId"); + + b.Navigation("ProfileCertificate"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChangeName", b => + { + b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("ChangeNames") + .HasForeignKey("ProfileId"); + + b.Navigation("Document"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChangeNameHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileChangeName", "ProfileChangeName") + .WithMany("ProfileChangeNameHistorys") + .HasForeignKey("ProfileChangeNameId"); + + b.Navigation("Document"); + + b.Navigation("ProfileChangeName"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChildren", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Childrens") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChildrenHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileChildren", null) + .WithMany("ProfileChildrenHistorys") + .HasForeignKey("ProfileChildrenId"); + + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileFamilyHistory", null) + .WithMany("Childrens") + .HasForeignKey("ProfileFamilyHistoryId"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCoupleHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("CoupleHistory") + .HasForeignKey("ProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCurrentAddressHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("CurrentAddressHistory") + .HasForeignKey("ProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDiscipline", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Disciplines") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDisciplineHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileDiscipline", "ProfileDiscipline") + .WithMany("ProfileDisciplineHistorys") + .HasForeignKey("ProfileDisciplineId"); + + b.Navigation("ProfileDiscipline"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDuty", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Dutys") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDutyHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileDuty", "ProfileDuty") + .WithMany("ProfileDutyHistorys") + .HasForeignKey("ProfileDutyId"); + + b.Navigation("ProfileDuty"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileEducation", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Educations") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileEducationHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileEducation", "ProfileEducation") + .WithMany("ProfileEducationHistorys") + .HasForeignKey("ProfileEducationId"); + + b.Navigation("ProfileEducation"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileFamilyHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("FamilyHistory") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileFatherHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("FatherHistory") + .HasForeignKey("ProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileGovernmentHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("GovernmentHistory") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("ProfileHistory") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHonor", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Honors") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHonorHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileHonor", "ProfileHonor") + .WithMany("ProfileHonorHistorys") + .HasForeignKey("ProfileHonorId"); + + b.Navigation("ProfileHonor"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileInsignia", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Insignias") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileInsigniaHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileInsignia", "ProfileInsignia") + .WithMany("ProfileInsigniaHistorys") + .HasForeignKey("ProfileInsigniaId"); + + b.Navigation("ProfileInsignia"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileLeave", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Leaves") + .HasForeignKey("ProfileId"); + + b.HasOne("BMA.EHR.Domain.Models.HR.TypeLeave", "TypeLeave") + .WithMany() + .HasForeignKey("TypeLeaveId"); + + b.Navigation("Profile"); + + b.Navigation("TypeLeave"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileLeaveHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileLeave", "ProfileLeave") + .WithMany("ProfileLeaveHistorys") + .HasForeignKey("ProfileLeaveId"); + + b.HasOne("BMA.EHR.Domain.Models.HR.TypeLeave", "TypeLeave") + .WithMany() + .HasForeignKey("TypeLeaveId"); + + b.Navigation("ProfileLeave"); + + b.Navigation("TypeLeave"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileMotherHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("MotherHistory") + .HasForeignKey("ProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileNopaid", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Nopaids") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileNopaidHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileNopaid", "ProfileNopaid") + .WithMany("ProfileNopaidHistorys") + .HasForeignKey("ProfileNopaidId"); + + b.Navigation("ProfileNopaid"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileOther", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Others") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileOtherHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileOther", "ProfileOther") + .WithMany("ProfileOtherHistorys") + .HasForeignKey("ProfileOtherId"); + + b.Navigation("ProfileOther"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfilePaper", b => + { + b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Papers") + .HasForeignKey("ProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileRegistrationAddressHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("RegistrationAddressHistory") + .HasForeignKey("ProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalary", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Salaries") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileSalary", "ProfileSalary") + .WithMany("ProfileSalaryHistorys") + .HasForeignKey("ProfileSalaryId"); + + b.Navigation("ProfileSalary"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryPosition", b => + { + b.HasOne("BMA.EHR.Domain.Models.MetaData.Position", "Position") + .WithMany() + .HasForeignKey("PositionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Position"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileTraining", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Trainings") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileTrainingHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileTraining", "ProfileTraining") + .WithMany("ProfileTrainingHistorys") + .HasForeignKey("ProfileTrainingId"); + + b.Navigation("ProfileTraining"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaRequest", b => + { + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationOrganization", "OrganizationOrganization") + .WithMany() + .HasForeignKey("OrganizationOrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Insignias.InsigniaPeriod", "Period") + .WithMany("InsigniaRequests") + .HasForeignKey("PeriodId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OrganizationOrganization"); + + b.Navigation("Period"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaRequestProfile", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany() + .HasForeignKey("ProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Insignias.InsigniaRequest", "Request") + .WithMany("RequestProfiles") + .HasForeignKey("RequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.Insignia", "RequestInsignia") + .WithMany() + .HasForeignKey("RequestInsigniaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Profile"); + + b.Navigation("Request"); + + b.Navigation("RequestInsignia"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.District", b => + { + b.HasOne("BMA.EHR.Domain.Models.MetaData.Province", "Province") + .WithMany("Districts") + .HasForeignKey("ProvinceId"); + + b.Navigation("Province"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Insignia", b => + { + b.HasOne("BMA.EHR.Domain.Models.MetaData.InsigniaType", "InsigniaType") + .WithMany() + .HasForeignKey("InsigniaTypeId"); + + b.Navigation("InsigniaType"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Position", b => + { + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionExecutiveSide", "ExecutiveSide") + .WithMany() + .HasForeignKey("ExecutiveSideId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPathSide", "PathSide") + .WithMany() + .HasForeignKey("PathSideId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLevel", "PositionLevel") + .WithMany() + .HasForeignKey("PositionLevelId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPath", "PositionPath") + .WithMany() + .HasForeignKey("PositionPathId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionType", "PositionType") + .WithMany() + .HasForeignKey("PositionTypeId"); + + b.Navigation("ExecutiveSide"); + + b.Navigation("PathSide"); + + b.Navigation("PositionLevel"); + + b.Navigation("PositionPath"); + + b.Navigation("PositionType"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.SubDistrict", b => + { + b.HasOne("BMA.EHR.Domain.Models.MetaData.District", "District") + .WithMany("SubDistricts") + .HasForeignKey("DistrictId"); + + b.Navigation("District"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", b => + { + b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", "OrganizationAgency") + .WithMany() + .HasForeignKey("OrganizationAgencyId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationFax", "OrganizationFax") + .WithMany() + .HasForeignKey("OrganizationFaxId"); + + b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", "OrganizationGovernmentAgency") + .WithMany() + .HasForeignKey("OrganizationGovernmentAgencyId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationLevel", "OrganizationLevel") + .WithMany() + .HasForeignKey("OrganizationLevelId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationOrganization", "OrganizationOrganization") + .WithMany() + .HasForeignKey("OrganizationOrganizationId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationShortName", "OrganizationShortName") + .WithMany() + .HasForeignKey("OrganizationShortNameId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationTelExternal", "OrganizationTelExternal") + .WithMany() + .HasForeignKey("OrganizationTelExternalId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationTelInternal", "OrganizationTelInternal") + .WithMany() + .HasForeignKey("OrganizationTelInternalId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationType", "OrganizationType") + .WithMany() + .HasForeignKey("OrganizationTypeId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionEmployeeLine", "PositionEmployeeLine") + .WithMany() + .HasForeignKey("PositionEmployeeLineId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionEmployeePosition", "PositionEmployeePosition") + .WithMany() + .HasForeignKey("PositionEmployeePositionId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionEmployeeStatus", "PositionEmployeeStatus") + .WithMany() + .HasForeignKey("PositionEmployeeStatusId"); + + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany() + .HasForeignKey("ProfileId"); + + b.Navigation("OrganizationAgency"); + + b.Navigation("OrganizationFax"); + + b.Navigation("OrganizationGovernmentAgency"); + + b.Navigation("OrganizationLevel"); + + b.Navigation("OrganizationOrganization"); + + b.Navigation("OrganizationShortName"); + + b.Navigation("OrganizationTelExternal"); + + b.Navigation("OrganizationTelInternal"); + + b.Navigation("OrganizationType"); + + b.Navigation("PositionEmployeeLine"); + + b.Navigation("PositionEmployeePosition"); + + b.Navigation("PositionEmployeeStatus"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeeLevel", b => + { + b.HasOne("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", "OrganizationEmployee") + .WithMany("OrganizationPositionEmployeeLevels") + .HasForeignKey("OrganizationEmployeeId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionEmployeeLevel", "PositionEmployeeLevel") + .WithMany() + .HasForeignKey("PositionEmployeeLevelId"); + + b.Navigation("OrganizationEmployee"); + + b.Navigation("PositionEmployeeLevel"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeePositionSide", b => + { + b.HasOne("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", "OrganizationEmployee") + .WithMany("OrganizationPositionEmployeePositionSides") + .HasForeignKey("OrganizationEmployeeId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionEmployeePositionSide", "PositionEmployeePositionSide") + .WithMany() + .HasForeignKey("PositionEmployeePositionSideId"); + + b.Navigation("OrganizationEmployee"); + + b.Navigation("PositionEmployeePositionSide"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.AvailablePositionLevelEntity", b => + { + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLevel", "PositionLevel") + .WithMany() + .HasForeignKey("PositionLevelId"); + + b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", "PositionMaster") + .WithMany() + .HasForeignKey("PositionMasterId"); + + b.Navigation("PositionLevel"); + + b.Navigation("PositionMaster"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", b => + { + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationFax", "OrganizationFax") + .WithMany() + .HasForeignKey("OrganizationFaxId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationLevel", "OrganizationLevel") + .WithMany() + .HasForeignKey("OrganizationLevelId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationOrganization", "OrganizationOrganization") + .WithMany() + .HasForeignKey("OrganizationOrganizationId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationShortName", "OrganizationShortName") + .WithMany() + .HasForeignKey("OrganizationShortNameId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationStatus", "OrganizationStatus") + .WithMany() + .HasForeignKey("OrganizationStatusId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationTelExternal", "OrganizationTelExternal") + .WithMany() + .HasForeignKey("OrganizationTelExternalId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationTelInternal", "OrganizationTelInternal") + .WithMany() + .HasForeignKey("OrganizationTelInternalId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationType", "OrganizationType") + .WithMany() + .HasForeignKey("OrganizationTypeId"); + + b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", "Parent") + .WithMany("Organizations") + .HasForeignKey("ParentId"); + + b.Navigation("OrganizationFax"); + + b.Navigation("OrganizationLevel"); + + b.Navigation("OrganizationOrganization"); + + b.Navigation("OrganizationShortName"); + + b.Navigation("OrganizationStatus"); + + b.Navigation("OrganizationTelExternal"); + + b.Navigation("OrganizationTelInternal"); + + b.Navigation("OrganizationType"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationPositionEntity", b => + { + b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", "Organization") + .WithMany() + .HasForeignKey("OrganizationId"); + + b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", "PositionMaster") + .WithMany() + .HasForeignKey("PositionMasterId"); + + b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionNumberEntity", "PositionNumber") + .WithMany() + .HasForeignKey("PositionNumberId"); + + b.Navigation("Organization"); + + b.Navigation("PositionMaster"); + + b.Navigation("PositionNumber"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", b => + { + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionExecutive", "PositionExecutive") + .WithMany() + .HasForeignKey("PositionExecutiveId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionExecutiveSide", "PositionExecutiveSide") + .WithMany() + .HasForeignKey("PositionExecutiveSideId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLine", "PositionLine") + .WithMany() + .HasForeignKey("PositionLineId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPath", "PositionPath") + .WithMany() + .HasForeignKey("PositionPathId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPathSide", "PositionPathSide") + .WithMany() + .HasForeignKey("PositionPathSideId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionStatus", "PositionStatus") + .WithMany() + .HasForeignKey("PositionStatusId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionType", "PositionType") + .WithMany() + .HasForeignKey("PositionTypeId"); + + b.Navigation("PositionExecutive"); + + b.Navigation("PositionExecutiveSide"); + + b.Navigation("PositionLine"); + + b.Navigation("PositionPath"); + + b.Navigation("PositionPathSide"); + + b.Navigation("PositionStatus"); + + b.Navigation("PositionType"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionMasterHistoryEntity", b => + { + b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", "PositionMasterEntity") + .WithMany("PositionMasterHistorys") + .HasForeignKey("PositionMasterEntityId"); + + b.Navigation("PositionMasterEntity"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionNumberEntity", b => + { + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationShortName", "OrganizationShortName") + .WithMany() + .HasForeignKey("OrganizationShortNameId"); + + b.Navigation("OrganizationShortName"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.ProfilePosition", b => + { + b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationPositionEntity", "OrganizationPosition") + .WithMany() + .HasForeignKey("OrganizationPositionId"); + + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany() + .HasForeignKey("ProfileId"); + + b.Navigation("OrganizationPosition"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.Report2.Report2History", b => + { + b.HasOne("BMA.EHR.Domain.Models.Organizations.Report2.Report2DetailHistory", "Report2DetailHistory") + .WithMany() + .HasForeignKey("Report2DetailHistoryId"); + + b.Navigation("Report2DetailHistory"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.Placement", b => + { + b.HasOne("BMA.EHR.Domain.Models.Placement.PlacementType", "PlacementType") + .WithMany() + .HasForeignKey("PlacementTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PlacementType"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementCertificate", b => + { + b.HasOne("BMA.EHR.Domain.Models.Placement.PlacementProfile", "PlacementProfile") + .WithMany("PlacementCertificates") + .HasForeignKey("PlacementProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PlacementProfile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementEducation", b => + { + b.HasOne("BMA.EHR.Domain.Models.MetaData.EducationLevel", "EducationLevel") + .WithMany() + .HasForeignKey("EducationLevelId"); + + b.HasOne("BMA.EHR.Domain.Models.Placement.PlacementProfile", "PlacementProfile") + .WithMany("PlacementEducations") + .HasForeignKey("PlacementProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPath", "PositionPath") + .WithMany() + .HasForeignKey("PositionPathId"); + + b.Navigation("EducationLevel"); + + b.Navigation("PlacementProfile"); + + b.Navigation("PositionPath"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementProfile", b => + { + b.HasOne("BMA.EHR.Domain.Models.MetaData.BloodGroup", "BloodGroup") + .WithMany() + .HasForeignKey("BloodGroupId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.District", "CitizenDistrict") + .WithMany() + .HasForeignKey("CitizenDistrictId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.Province", "CitizenProvince") + .WithMany() + .HasForeignKey("CitizenProvinceId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.District", "CurrentDistrict") + .WithMany() + .HasForeignKey("CurrentDistrictId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.Province", "CurrentProvince") + .WithMany() + .HasForeignKey("CurrentProvinceId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.SubDistrict", "CurrentSubDistrict") + .WithMany() + .HasForeignKey("CurrentSubDistrictId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.Prefix", "FatherPrefix") + .WithMany() + .HasForeignKey("FatherPrefixId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.Gender", "Gender") + .WithMany() + .HasForeignKey("GenderId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.Prefix", "MarryPrefix") + .WithMany() + .HasForeignKey("MarryPrefixId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.Prefix", "MotherPrefix") + .WithMany() + .HasForeignKey("MotherPrefixId"); + + b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationPositionEntity", "OrganizationPosition") + .WithMany() + .HasForeignKey("OrganizationPositionId"); + + b.HasOne("BMA.EHR.Domain.Models.Placement.Placement", "Placement") + .WithMany("PlacementProfiles") + .HasForeignKey("PlacementId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLevel", "PositionLevel") + .WithMany() + .HasForeignKey("PositionLevelId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLine", "PositionLine") + .WithMany() + .HasForeignKey("PositionLineId"); + + b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionNumberEntity", "PositionNumber") + .WithMany() + .HasForeignKey("PositionNumberId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPath", "PositionPath") + .WithMany() + .HasForeignKey("PositionPathId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPathSide", "PositionPathSide") + .WithMany() + .HasForeignKey("PositionPathSideId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionType", "PositionType") + .WithMany() + .HasForeignKey("PositionTypeId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.Prefix", "Prefix") + .WithMany() + .HasForeignKey("PrefixId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.District", "RegistDistrict") + .WithMany() + .HasForeignKey("RegistDistrictId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.Province", "RegistProvince") + .WithMany() + .HasForeignKey("RegistProvinceId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.SubDistrict", "RegistSubDistrict") + .WithMany() + .HasForeignKey("RegistSubDistrictId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.Relationship", "Relationship") + .WithMany() + .HasForeignKey("RelationshipId"); + + b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "ReliefDoc") + .WithMany() + .HasForeignKey("ReliefDocId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.Religion", "Religion") + .WithMany() + .HasForeignKey("ReligionId"); + + b.Navigation("BloodGroup"); + + b.Navigation("CitizenDistrict"); + + b.Navigation("CitizenProvince"); + + b.Navigation("CurrentDistrict"); + + b.Navigation("CurrentProvince"); + + b.Navigation("CurrentSubDistrict"); + + b.Navigation("FatherPrefix"); + + b.Navigation("Gender"); + + b.Navigation("MarryPrefix"); + + b.Navigation("MotherPrefix"); + + b.Navigation("OrganizationPosition"); + + b.Navigation("Placement"); + + b.Navigation("PositionLevel"); + + b.Navigation("PositionLine"); + + b.Navigation("PositionNumber"); + + b.Navigation("PositionPath"); + + b.Navigation("PositionPathSide"); + + b.Navigation("PositionType"); + + b.Navigation("Prefix"); + + b.Navigation("RegistDistrict"); + + b.Navigation("RegistProvince"); + + b.Navigation("RegistSubDistrict"); + + b.Navigation("Relationship"); + + b.Navigation("ReliefDoc"); + + b.Navigation("Religion"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.Command", b => + { + b.Navigation("Documents"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitLeave", b => + { + b.Navigation("LimitTypeLeaves"); + + b.Navigation("Profiles"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.Profile", b => + { + b.Navigation("Abilitys"); + + b.Navigation("AddressHistory"); + + b.Navigation("Assessments"); + + b.Navigation("AvatarHistory"); + + b.Navigation("Certificates"); + + b.Navigation("ChangeNames"); + + b.Navigation("Childrens"); + + b.Navigation("CoupleHistory"); + + b.Navigation("CurrentAddressHistory"); + + b.Navigation("Disciplines"); + + b.Navigation("Dutys"); + + b.Navigation("Educations"); + + b.Navigation("FamilyHistory"); + + b.Navigation("FatherHistory"); + + b.Navigation("GovernmentHistory"); + + b.Navigation("Honors"); + + b.Navigation("Insignias"); + + b.Navigation("Leaves"); + + b.Navigation("MotherHistory"); + + b.Navigation("Nopaids"); + + b.Navigation("Others"); + + b.Navigation("Papers"); + + b.Navigation("ProfileHistory"); + + b.Navigation("RegistrationAddressHistory"); + + b.Navigation("Salaries"); + + b.Navigation("Trainings"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAbility", b => + { + b.Navigation("ProfileAbilityHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAssessment", b => + { + b.Navigation("ProfileAssessmentHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCertificate", b => + { + b.Navigation("ProfileCertificateHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChangeName", b => + { + b.Navigation("ProfileChangeNameHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChildren", b => + { + b.Navigation("ProfileChildrenHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDiscipline", b => + { + b.Navigation("ProfileDisciplineHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDuty", b => + { + b.Navigation("ProfileDutyHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileEducation", b => + { + b.Navigation("ProfileEducationHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileFamilyHistory", b => + { + b.Navigation("Childrens"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHonor", b => + { + b.Navigation("ProfileHonorHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileInsignia", b => + { + b.Navigation("ProfileInsigniaHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileLeave", b => + { + b.Navigation("ProfileLeaveHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileNopaid", b => + { + b.Navigation("ProfileNopaidHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileOther", b => + { + b.Navigation("ProfileOtherHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalary", b => + { + b.Navigation("ProfileSalaryHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileTraining", b => + { + b.Navigation("ProfileTrainingHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.TypeLeave", b => + { + b.Navigation("LimitTypeLeaves"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaPeriod", b => + { + b.Navigation("InsigniaRequests"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaRequest", b => + { + b.Navigation("RequestProfiles"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.District", b => + { + b.Navigation("SubDistricts"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Province", b => + { + b.Navigation("Districts"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", b => + { + b.Navigation("OrganizationPositionEmployeeLevels"); + + b.Navigation("OrganizationPositionEmployeePositionSides"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", b => + { + b.Navigation("Organizations"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", b => + { + b.Navigation("PositionMasterHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.Placement", b => + { + b.Navigation("PlacementProfiles"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementProfile", b => + { + b.Navigation("PlacementCertificates"); + + b.Navigation("PlacementEducations"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/BMA.EHR.Infrastructure/Migrations/20230718145427_Update table PlacementProfile add draft.cs b/BMA.EHR.Infrastructure/Migrations/20230718145427_Update table PlacementProfile add draft.cs new file mode 100644 index 00000000..c9ad48f7 --- /dev/null +++ b/BMA.EHR.Infrastructure/Migrations/20230718145427_Update table PlacementProfile add draft.cs @@ -0,0 +1,191 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace BMA.EHR.Infrastructure.Migrations +{ + /// + public partial class UpdatetablePlacementProfileadddraft : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Draft", + table: "PlacementProfiles", + type: "tinyint(1)", + nullable: true, + comment: "ข้อมูลตำแหน่ง Draft"); + + migrationBuilder.CreateTable( + name: "InsigniaPeriods", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"), + CreatedUserId = table.Column(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล") + .Annotation("MySql:CharSet", "utf8mb4"), + LastUpdatedAt = table.Column(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"), + LastUpdateUserId = table.Column(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด") + .Annotation("MySql:CharSet", "utf8mb4"), + CreatedFullName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล") + .Annotation("MySql:CharSet", "utf8mb4"), + LastUpdateFullName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด") + .Annotation("MySql:CharSet", "utf8mb4"), + Name = table.Column(type: "varchar(200)", maxLength: 200, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Year = table.Column(type: "int", nullable: false), + StartDate = table.Column(type: "datetime(6)", nullable: false), + EndDate = table.Column(type: "datetime(6)", nullable: false), + Amount = table.Column(type: "varchar(50)", maxLength: 50, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Type = table.Column(type: "varchar(10)", maxLength: 10, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_InsigniaPeriods", x => x.Id); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "InsigniaRequests", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"), + CreatedUserId = table.Column(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล") + .Annotation("MySql:CharSet", "utf8mb4"), + LastUpdatedAt = table.Column(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"), + LastUpdateUserId = table.Column(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด") + .Annotation("MySql:CharSet", "utf8mb4"), + CreatedFullName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล") + .Annotation("MySql:CharSet", "utf8mb4"), + LastUpdateFullName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด") + .Annotation("MySql:CharSet", "utf8mb4"), + RequestStatus = table.Column(type: "varchar(50)", maxLength: 50, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + RequestNote = table.Column(type: "text", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + PeriodId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + OrganizationOrganizationId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_InsigniaRequests", x => x.Id); + table.ForeignKey( + name: "FK_InsigniaRequests_InsigniaPeriods_PeriodId", + column: x => x.PeriodId, + principalTable: "InsigniaPeriods", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_InsigniaRequests_OrganizationOrganizations_OrganizationOrgan~", + column: x => x.OrganizationOrganizationId, + principalTable: "OrganizationOrganizations", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "InsigniaRequestProfiles", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"), + CreatedAt = table.Column(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"), + CreatedUserId = table.Column(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล") + .Annotation("MySql:CharSet", "utf8mb4"), + LastUpdatedAt = table.Column(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"), + LastUpdateUserId = table.Column(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด") + .Annotation("MySql:CharSet", "utf8mb4"), + CreatedFullName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล") + .Annotation("MySql:CharSet", "utf8mb4"), + LastUpdateFullName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด") + .Annotation("MySql:CharSet", "utf8mb4"), + RequestDate = table.Column(type: "datetime(6)", nullable: false), + Salary = table.Column(type: "decimal(65,30)", nullable: true), + IsApprove = table.Column(type: "tinyint(1)", nullable: false), + QualificationStatus = table.Column(type: "varchar(50)", maxLength: 50, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + DocumentStatus = table.Column(type: "varchar(50)", maxLength: 50, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Note = table.Column(type: "text", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Special = table.Column(type: "varchar(50)", maxLength: 50, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + MatchingConditions = table.Column(type: "text", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ProfileId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + RequestInsigniaId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + RequestId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_InsigniaRequestProfiles", x => x.Id); + table.ForeignKey( + name: "FK_InsigniaRequestProfiles_InsigniaRequests_RequestId", + column: x => x.RequestId, + principalTable: "InsigniaRequests", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_InsigniaRequestProfiles_Insignias_RequestInsigniaId", + column: x => x.RequestInsigniaId, + principalTable: "Insignias", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_InsigniaRequestProfiles_Profiles_ProfileId", + column: x => x.ProfileId, + principalTable: "Profiles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_InsigniaRequestProfiles_ProfileId", + table: "InsigniaRequestProfiles", + column: "ProfileId"); + + migrationBuilder.CreateIndex( + name: "IX_InsigniaRequestProfiles_RequestId", + table: "InsigniaRequestProfiles", + column: "RequestId"); + + migrationBuilder.CreateIndex( + name: "IX_InsigniaRequestProfiles_RequestInsigniaId", + table: "InsigniaRequestProfiles", + column: "RequestInsigniaId"); + + migrationBuilder.CreateIndex( + name: "IX_InsigniaRequests_OrganizationOrganizationId", + table: "InsigniaRequests", + column: "OrganizationOrganizationId"); + + migrationBuilder.CreateIndex( + name: "IX_InsigniaRequests_PeriodId", + table: "InsigniaRequests", + column: "PeriodId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "InsigniaRequestProfiles"); + + migrationBuilder.DropTable( + name: "InsigniaRequests"); + + migrationBuilder.DropTable( + name: "InsigniaPeriods"); + + migrationBuilder.DropColumn( + name: "Draft", + table: "PlacementProfiles"); + } + } +} diff --git a/BMA.EHR.Infrastructure/Migrations/20230719025522_Update table PlacementProfile add positioncandidate.Designer.cs b/BMA.EHR.Infrastructure/Migrations/20230719025522_Update table PlacementProfile add positioncandidate.Designer.cs new file mode 100644 index 00000000..6cace052 --- /dev/null +++ b/BMA.EHR.Infrastructure/Migrations/20230719025522_Update table PlacementProfile add positioncandidate.Designer.cs @@ -0,0 +1,11575 @@ +// +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 +{ + [DbContext(typeof(ApplicationDBContext))] + [Migration("20230719025522_Update table PlacementProfile add positioncandidate")] + partial class UpdatetablePlacementProfileaddpositioncandidate + { + /// + 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.Commands.Core.Command", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("AuthorizedUserFullName") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ชื่อผู้มีอำนาจลงนาม"); + + b.Property("AuthorizedUserId") + .HasColumnType("char(36)") + .HasComment("รหัสอ้างอิงผู้มีอำนาจลงนาม"); + + b.Property("CommandNo") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("varchar(10)") + .HasComment("เลขที่คำสั่ง"); + + b.Property("CommandStatusId") + .HasColumnType("char(36)") + .HasComment("รหัสอ้างอิงสถานะคำสั่ง"); + + b.Property("CommandTypeId") + .HasColumnType("char(36)") + .HasComment("รหัสอ้างอิงประเภทคำสั่ง"); + + b.Property("CommandYear") + .IsRequired() + .HasMaxLength(4) + .HasColumnType("varchar(4)") + .HasComment("ปีที่ออกคำสั่ง"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Discriminator") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IssuerOrganizationId") + .HasColumnType("char(36)") + .HasComment("รหัสอ้างอิงหน่วยงานที่ออกคำสั่ง"); + + b.Property("IssuerOrganizationName") + .IsRequired() + .HasColumnType("longtext") + .HasComment("หน่วยงานที่ออกคำสั่ง"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("CommandStatusId"); + + b.HasIndex("CommandTypeId"); + + b.ToTable("Command"); + + b.HasDiscriminator("Discriminator").HasValue("Command"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandDocument", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Category") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ประเภทเอกสาร"); + + b.Property("CommandId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.HasIndex("CommandId"); + + b.HasIndex("DocumentId"); + + b.ToTable("CommandDocuments"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("สถานะของคำสั่ง"); + + b.HasKey("Id"); + + b.ToTable("CommandStatuses"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Category") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ประเภทคำสั่ง"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("ชื่อคำสั่ง"); + + b.HasKey("Id"); + + b.ToTable("CommandTypes"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.DeploymentChannel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsSendEmail") + .HasColumnType("tinyint(1)"); + + b.Property("IsSendInbox") + .HasColumnType("tinyint(1)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.ToTable("DeploymentChannels"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Documents.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("Detail") + .IsRequired() + .HasColumnType("text"); + + b.Property("FileName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("FileSize") + .HasColumnType("int"); + + b.Property("FileType") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ObjectRefId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitLeave", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .HasColumnType("longtext") + .HasComment("ยังไม่ชัวใช้อะไรเป็นkey"); + + b.HasKey("Id"); + + b.ToTable("LimitLeaves"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitTypeLeave", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("LimitLeaveId") + .HasColumnType("char(36)"); + + b.Property("NumLeave") + .HasColumnType("double") + .HasComment("จำนวนที่ลาได้"); + + b.Property("TypeLeaveId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("LimitLeaveId"); + + b.HasIndex("TypeLeaveId"); + + b.ToTable("LimitTypeLeaves"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.Profile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Ability") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("AvatarId") + .HasColumnType("char(36)"); + + b.Property("AvatarRef") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)") + .HasComment("วันเกิด"); + + b.Property("BloodGroupId") + .HasColumnType("char(36)") + .HasComment("Id กลุ่มเลือด"); + + b.Property("CitizenId") + .HasMaxLength(13) + .HasColumnType("varchar(13)") + .HasComment("รหัสบัตรประชาชน"); + + b.Property("Couple") + .HasColumnType("tinyint(1)") + .HasComment("คู่สมรส"); + + b.Property("CoupleCareer") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("อาชีพคู่สมรส"); + + b.Property("CoupleFirstName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อคู่สมรส"); + + b.Property("CoupleLastName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุลคู่สมรส"); + + b.Property("CoupleLastNameOld") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุลคู่สมรส(เดิม)"); + + b.Property("CouplePrefixId") + .HasColumnType("char(36)") + .HasComment("Id คำนำหน้าคู่สมรส"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUser") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("CurrentAddress") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("ที่อยู่ปัจจุบัน"); + + b.Property("CurrentDistrictId") + .HasColumnType("char(36)") + .HasComment("Id เขตปัจจุบัน"); + + b.Property("CurrentProvinceId") + .HasColumnType("char(36)") + .HasComment("Id จังหวัดปัจจุบัน"); + + b.Property("CurrentSubDistrictId") + .HasColumnType("char(36)") + .HasComment("Id แขวงปัจจุบัน"); + + b.Property("CurrentZipCode") + .HasMaxLength(5) + .HasColumnType("varchar(5)") + .HasComment("รหัสไปรษณีย์ปัจจุบัน"); + + b.Property("DateAppoint") + .HasColumnType("datetime(6)"); + + b.Property("DateRetire") + .HasColumnType("datetime(6)"); + + b.Property("DateStart") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeClass") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("ประเภทลูกจ้าง"); + + b.Property("EmployeeType") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("ประเภทการจ้าง"); + + b.Property("EntryStatus") + .IsRequired() + .HasMaxLength(5) + .HasColumnType("varchar(5)"); + + b.Property("FatherCareer") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("อาชีพบิดา"); + + b.Property("FatherFirstName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อบิดา"); + + b.Property("FatherLastName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุลบิดา"); + + b.Property("FatherPrefixId") + .HasColumnType("char(36)") + .HasComment("Id คำนำหน้าบิดา"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อ"); + + b.Property("FirstNameOld") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อ(เดิม)"); + + b.Property("GenderId") + .HasColumnType("char(36)") + .HasComment("Id เพศ"); + + b.Property("GovAgeAbsent") + .HasColumnType("int"); + + b.Property("GovAgePlus") + .HasColumnType("int"); + + b.Property("GovernmentCode") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsLeave") + .HasColumnType("tinyint(1)"); + + b.Property("IsProbation") + .HasColumnType("tinyint(1)"); + + b.Property("IsTransfer") + .HasColumnType("tinyint(1)"); + + b.Property("IsVerified") + .HasColumnType("tinyint(1)"); + + b.Property("KeycloakId") + .HasColumnType("char(36)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุล"); + + b.Property("LastNameOld") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุล(เดิม)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("LeaveDate") + .HasColumnType("datetime(6)"); + + b.Property("LeaveDateOrder") + .HasColumnType("datetime(6)"); + + b.Property("LeaveDetail") + .HasColumnType("longtext"); + + b.Property("LeaveNumberOrder") + .HasColumnType("longtext"); + + b.Property("LeaveReason") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)"); + + b.Property("LimitLeaveId") + .HasColumnType("char(36)"); + + b.Property("ModifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("MotherCareer") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("อาชีพมารดา"); + + b.Property("MotherFirstName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อมารดา"); + + b.Property("MotherLastName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุลมารดา"); + + b.Property("MotherPrefixId") + .HasColumnType("char(36)") + .HasComment("Id คำนำหน้ามารดา"); + + b.Property("Nationality") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("สัญชาติ"); + + b.Property("Oc") + .HasColumnType("longtext") + .HasComment("สังกัด"); + + b.Property("OcId") + .HasColumnType("char(36)") + .HasComment("Id สังกัด"); + + b.Property("OrganizationOrganization") + .HasColumnType("longtext"); + + b.Property("OrganizationOrganizationId") + .HasColumnType("char(36)"); + + b.Property("OrganizationShortName") + .HasColumnType("longtext"); + + b.Property("OrganizationShortNameId") + .HasColumnType("char(36)"); + + b.Property("Physical") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("สถานภาพทางกาย"); + + b.Property("PosNo") + .HasColumnType("longtext") + .HasComment("เลขที่ตำแหน่ง"); + + b.Property("PosNoEmployee") + .HasColumnType("longtext") + .HasComment("เลขที่ตำแหน่งลูกจ้าง"); + + b.Property("PosNoId") + .HasColumnType("char(36)") + .HasComment("Id เลขที่ตำแหน่ง"); + + b.Property("Position") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("PositionEmployeeGroup") + .HasColumnType("longtext") + .HasComment("กลุ่มงาน"); + + b.Property("PositionEmployeeGroupId") + .HasColumnType("char(36)") + .HasComment("Id กลุ่มงาน"); + + b.Property("PositionEmployeeLevel") + .HasColumnType("longtext") + .HasComment("ระดับชั้นงาน"); + + b.Property("PositionEmployeeLevelId") + .HasColumnType("char(36)") + .HasComment(" Id ระดับชั้นงาน"); + + b.Property("PositionEmployeePosition") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("PositionEmployeePositionId") + .HasColumnType("char(36)") + .HasComment("Id ตำแหน่ง"); + + b.Property("PositionEmployeePositionSide") + .HasColumnType("longtext") + .HasComment("ด้านของตำแหน่ง"); + + b.Property("PositionEmployeePositionSideId") + .HasColumnType("char(36)") + .HasComment("Id ด้านของตำแหน่ง"); + + b.Property("PositionExecutive") + .HasColumnType("longtext") + .HasComment("ตำแหน่งทางการบริหาร"); + + b.Property("PositionExecutiveId") + .HasColumnType("char(36)") + .HasComment("Id ตำแหน่งทางการบริหาร"); + + b.Property("PositionExecutiveSide") + .HasColumnType("longtext") + .HasComment("ด้านทางการบริหาร"); + + b.Property("PositionExecutiveSideId") + .HasColumnType("char(36)") + .HasComment("Id ด้านทางการบริหาร"); + + b.Property("PositionId") + .HasColumnType("char(36)") + .HasComment("Id ตำแหน่ง"); + + b.Property("PositionLevel") + .HasColumnType("longtext") + .HasComment("ระดับ"); + + b.Property("PositionLevelId") + .HasColumnType("char(36)") + .HasComment(" Id ระดับ"); + + b.Property("PositionLine") + .HasColumnType("longtext") + .HasComment("สายงาน"); + + b.Property("PositionLineId") + .HasColumnType("char(36)") + .HasComment("Id สายงาน"); + + b.Property("PositionPathSide") + .HasColumnType("longtext") + .HasComment("ด้าน/สาขา"); + + b.Property("PositionPathSideId") + .HasColumnType("char(36)") + .HasComment("Id ด้าน/สาขา"); + + b.Property("PositionType") + .HasColumnType("longtext") + .HasComment("ประเภทตำแหน่ง"); + + b.Property("PositionTypeId") + .HasColumnType("char(36)") + .HasComment("Id ประเภทตำแหน่ง"); + + b.Property("PrefixId") + .HasColumnType("char(36)") + .HasComment("Id คำนำหน้า"); + + b.Property("PrefixOldId") + .HasColumnType("char(36)") + .HasComment("Id คำนำหน้า(เดิม)"); + + b.Property("ProfileType") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Race") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("เชื้อชาติ"); + + b.Property("ReasonSameDate") + .HasColumnType("longtext"); + + b.Property("RegistrationAddress") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("Id แขวงตามทะเบียนบ้าน"); + + b.Property("RegistrationDistrictId") + .HasColumnType("char(36)") + .HasComment("Id เขตตามทะเบียนบ้าน"); + + b.Property("RegistrationProvinceId") + .HasColumnType("char(36)") + .HasComment("Id จังหวัดตามทะเบียนบ้าน"); + + b.Property("RegistrationSame") + .HasColumnType("tinyint(1)") + .HasComment("ที่อยู่ปัจจุบันตรงกับที่อยู่ตามทะเบียนบ้านหรือไม่"); + + b.Property("RegistrationSubDistrictId") + .HasColumnType("char(36)") + .HasComment("แขวงตามทะเบียนบ้าน"); + + b.Property("RegistrationZipCode") + .HasMaxLength(5) + .HasColumnType("varchar(5)") + .HasComment("รหัสไปรษณีย์ตามทะเบียนบ้าน"); + + b.Property("RelationshipId") + .HasColumnType("char(36)") + .HasComment("Id สถานะภาพ"); + + b.Property("ReligionId") + .HasColumnType("char(36)") + .HasComment("Id ศาสนา"); + + b.Property("TelephoneNumber") + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasComment("เบอร์โทร"); + + b.Property("TransferDate") + .HasColumnType("datetime(6)"); + + b.Property("VerifiedDate") + .HasColumnType("datetime(6)"); + + b.Property("VerifiedUser") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.HasKey("Id"); + + b.HasIndex("AvatarId"); + + b.HasIndex("LimitLeaveId"); + + b.ToTable("Profiles"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAbility", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateEnd") + .HasColumnType("datetime(6)") + .HasComment("วันที่สิ้นสุด"); + + b.Property("DateStart") + .HasColumnType("datetime(6)") + .HasComment("วันที่เริ่มต้น"); + + b.Property("Detail") + .HasColumnType("longtext") + .HasComment("รายละเอียด"); + + b.Property("Field") + .HasColumnType("longtext") + .HasComment("ด้าน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("Reference") + .HasColumnType("longtext") + .HasComment("เอกสารอ้างอิง"); + + b.Property("Remark") + .HasColumnType("longtext") + .HasComment("หมายเหตุ"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileAbilitys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAbilityHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateEnd") + .HasColumnType("datetime(6)") + .HasComment("วันที่สิ้นสุด"); + + b.Property("DateStart") + .HasColumnType("datetime(6)") + .HasComment("วันที่เริ่มต้น"); + + b.Property("Detail") + .HasColumnType("longtext") + .HasComment("รายละเอียด"); + + b.Property("Field") + .HasColumnType("longtext") + .HasComment("ด้าน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileAbilityId") + .HasColumnType("char(36)"); + + b.Property("Reference") + .HasColumnType("longtext") + .HasComment("เอกสารอ้างอิง"); + + b.Property("Remark") + .HasColumnType("longtext") + .HasComment("หมายเหตุ"); + + b.HasKey("Id"); + + b.HasIndex("ProfileAbilityId"); + + b.ToTable("ProfileAbilityHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAddressHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("CurrentAddress") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("ที่อยู่ปัจจุบัน"); + + b.Property("CurrentDistrict") + .HasColumnType("longtext") + .HasComment("เขตปัจจุบัน"); + + b.Property("CurrentDistrictId") + .HasColumnType("char(36)") + .HasComment("Id เขตปัจจุบัน"); + + b.Property("CurrentProvince") + .HasColumnType("longtext") + .HasComment("จังหวัดปัจจุบัน"); + + b.Property("CurrentProvinceId") + .HasColumnType("char(36)") + .HasComment("Id จังหวัดปัจจุบัน"); + + b.Property("CurrentSubDistrict") + .HasColumnType("longtext") + .HasComment("แขวงปัจจุบัน"); + + b.Property("CurrentSubDistrictId") + .HasColumnType("char(36)") + .HasComment("Id แขวงปัจจุบัน"); + + b.Property("CurrentZipCode") + .HasMaxLength(5) + .HasColumnType("varchar(5)") + .HasComment("รหัสไปรษณีย์ปัจจุบัน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("RegistrationAddress") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("ที่อยู่ตามทะเบียนบ้าน"); + + b.Property("RegistrationDistrict") + .HasColumnType("longtext") + .HasComment("เขตตามทะเบียนบ้าน"); + + b.Property("RegistrationDistrictId") + .HasColumnType("char(36)") + .HasComment("Id เขตตามทะเบียนบ้าน"); + + b.Property("RegistrationProvince") + .HasColumnType("longtext") + .HasComment("จังหวัดตามทะเบียนบ้าน"); + + b.Property("RegistrationProvinceId") + .HasColumnType("char(36)") + .HasComment("Id จังหวัดตามทะเบียนบ้าน"); + + b.Property("RegistrationSame") + .HasColumnType("tinyint(1)") + .HasComment("ที่อยู่ปัจจุบันตรงกับที่อยู่ตามทะเบียนบ้านหรือไม่"); + + b.Property("RegistrationSubDistrict") + .HasColumnType("longtext") + .HasComment("แขวงตามทะเบียนบ้าน"); + + b.Property("RegistrationSubDistrictId") + .HasColumnType("char(36)") + .HasComment("Id แขวงตามทะเบียนบ้าน"); + + b.Property("RegistrationZipCode") + .HasMaxLength(5) + .HasColumnType("varchar(5)") + .HasComment("รหัสไปรษณีย์ตามทะเบียนบ้าน"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileAddressHistories"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAssessment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Date") + .HasColumnType("datetime(6)") + .HasComment("วันที่ได้รับ"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .HasColumnType("longtext") + .HasComment("ชื่อแบบประเมิน"); + + b.Property("Point1") + .HasColumnType("double") + .HasComment("ผลประเมินส่วนที่1 (คะแนน)"); + + b.Property("Point1Total") + .HasColumnType("double") + .HasComment("ส่วนที่1 (คะแนน)"); + + b.Property("Point2") + .HasColumnType("double") + .HasComment("ผลประเมินส่วนที่2 (คะแนน)"); + + b.Property("Point2Total") + .HasColumnType("double") + .HasComment("ส่วนที่2 (คะแนน)"); + + b.Property("PointSum") + .HasColumnType("double") + .HasComment("ผลประเมินรวม (คะแนน)"); + + b.Property("PointSumTotal") + .HasColumnType("double") + .HasComment("ผลรวม (คะแนน)"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileAssessments"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAssessmentHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Date") + .HasColumnType("datetime(6)") + .HasComment("วันที่ได้รับ"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .HasColumnType("longtext") + .HasComment("ชื่อแบบประเมิน"); + + b.Property("Point1") + .HasColumnType("double") + .HasComment("ผลประเมินส่วนที่1 (คะแนน)"); + + b.Property("Point1Total") + .HasColumnType("double") + .HasComment("ส่วนที่1 (คะแนน)"); + + b.Property("Point2") + .HasColumnType("double") + .HasComment("ผลประเมินส่วนที่2 (คะแนน)"); + + b.Property("Point2Total") + .HasColumnType("double") + .HasComment("ส่วนที่2 (คะแนน)"); + + b.Property("PointSum") + .HasColumnType("double") + .HasComment("ผลประเมินรวม (คะแนน)"); + + b.Property("PointSumTotal") + .HasColumnType("double") + .HasComment("ผลรวม (คะแนน)"); + + b.Property("ProfileAssessmentId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileAssessmentId"); + + b.ToTable("ProfileAssessmentHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAvatarHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("AvatarFileId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("AvatarFileId"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileAvatarHistories"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCertificate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CertificateNo") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("เลขที่ใบอนุญาต"); + + b.Property("CertificateType") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อใบอนุญาต"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("ExpireDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่หมดอายุ"); + + b.Property("IssueDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่ออกใบอนุญาต"); + + b.Property("Issuer") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("หน่วยงานผู้ออกใบอนุญาต"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileCertificates"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCertificateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CertificateNo") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("เลขที่ใบอนุญาต"); + + b.Property("CertificateType") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อใบอนุญาต"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("ExpireDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่หมดอายุ"); + + b.Property("IssueDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่ออกใบอนุญาต"); + + b.Property("Issuer") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("หน่วยงานผู้ออกใบอนุญาต"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileCertificateId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileCertificateId"); + + b.ToTable("ProfileCertificateHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChangeName", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("FirstName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อ"); + + b.Property("LastName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Prefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้า"); + + b.Property("PrefixId") + .HasColumnType("char(36)") + .HasComment("Id คำนำหน้า"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("Status") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("สถานะ"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileChangeNames"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChangeNameHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("FirstName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อ"); + + b.Property("LastName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Prefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้า"); + + b.Property("PrefixId") + .HasColumnType("char(36)") + .HasComment("Id คำนำหน้า"); + + b.Property("ProfileChangeNameId") + .HasColumnType("char(36)"); + + b.Property("Status") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("สถานะ"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("ProfileChangeNameId"); + + b.ToTable("ProfileChangeNameHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChildren", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("ChildrenCareer") + .HasColumnType("longtext") + .HasComment("อาชีพบุตร"); + + b.Property("ChildrenFirstName") + .HasColumnType("longtext") + .HasComment("ชื่อบุตร"); + + b.Property("ChildrenLastName") + .HasColumnType("longtext") + .HasComment("นามสกุลบุตร"); + + b.Property("ChildrenPrefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้าบุตร"); + + b.Property("ChildrenPrefixId") + .HasColumnType("char(36)") + .HasComment("Id คำนำหน้าบุตร"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileChildrens"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChildrenHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("ChildrenCareer") + .HasColumnType("longtext") + .HasComment("อาชีพบุตร"); + + b.Property("ChildrenFirstName") + .HasColumnType("longtext") + .HasComment("ชื่อบุตร"); + + b.Property("ChildrenLastName") + .HasColumnType("longtext") + .HasComment("นามสกุลบุตร"); + + b.Property("ChildrenPrefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้าบุตร"); + + b.Property("ChildrenPrefixId") + .HasColumnType("char(36)") + .HasComment("Id คำนำหน้าบุตร"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileChildrenId") + .HasColumnType("char(36)"); + + b.Property("ProfileFamilyHistoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileChildrenId"); + + b.HasIndex("ProfileFamilyHistoryId"); + + b.ToTable("ProfileChildrenHistories"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCoupleHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasComment("ไม่ใช้"); + + b.Property("Career") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("Prefix") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileCoupleHistory"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCurrentAddressHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasComment("ไม่ใช้"); + + b.Property("Address") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("DistrictId") + .HasColumnType("char(36)"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("ProvinceId") + .HasColumnType("char(36)"); + + b.Property("SubDistrictId") + .HasColumnType("char(36)"); + + b.Property("ZipCode") + .IsRequired() + .HasMaxLength(5) + .HasColumnType("varchar(5)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileCurrentAddressHistories"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDiscipline", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Date") + .HasColumnType("datetime(6)") + .HasComment("วัน เดือน ปี"); + + b.Property("Detail") + .HasColumnType("text") + .HasComment("รายละเอียด"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Level") + .HasColumnType("longtext") + .HasComment("ระดับความผิด"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("RefCommandDate") + .HasColumnType("datetime(6)") + .HasComment("เอกสารอ้างอิง (ลงวันที่)"); + + b.Property("RefCommandNo") + .HasColumnType("longtext") + .HasComment("เอกสารอ้างอิง (เลขที่คำสั่ง)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileDisciplines"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDisciplineHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Date") + .HasColumnType("datetime(6)") + .HasComment("วัน เดือน ปี"); + + b.Property("Detail") + .HasColumnType("text") + .HasComment("รายละเอียด"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Level") + .HasColumnType("longtext") + .HasComment("ระดับความผิด"); + + b.Property("ProfileDisciplineId") + .HasColumnType("char(36)"); + + b.Property("RefCommandDate") + .HasColumnType("datetime(6)") + .HasComment("เอกสารอ้างอิง (ลงวันที่)"); + + b.Property("RefCommandNo") + .HasColumnType("longtext") + .HasComment("เอกสารอ้างอิง (เลขที่คำสั่ง)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileDisciplineId"); + + b.ToTable("ProfileDisciplineHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDuty", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateEnd") + .HasColumnType("datetime(6)") + .HasComment("สิ้นสุด"); + + b.Property("DateStart") + .HasColumnType("datetime(6)") + .HasComment("เริ่มต้น"); + + b.Property("Detail") + .HasColumnType("longtext") + .HasComment("รายละเอียด"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("Reference") + .HasColumnType("longtext") + .HasComment("เอกสารอ้างอิง"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileDutys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDutyHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateEnd") + .HasColumnType("datetime(6)") + .HasComment("สิ้นสุด"); + + b.Property("DateStart") + .HasColumnType("datetime(6)") + .HasComment("เริ่มต้น"); + + b.Property("Detail") + .HasColumnType("longtext") + .HasComment("รายละเอียด"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileDutyId") + .HasColumnType("char(36)"); + + b.Property("Reference") + .HasColumnType("longtext") + .HasComment("เอกสารอ้างอิง"); + + b.HasKey("Id"); + + b.HasIndex("ProfileDutyId"); + + b.ToTable("ProfileDutyHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileEducation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Country") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("ประเทศ"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Degree") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("วุฒิการศึกษา"); + + b.Property("Duration") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("ระยะเวลา"); + + b.Property("DurationYear") + .HasColumnType("int") + .HasComment("ระยะเวลาหลักสูตร"); + + b.Property("EducationLevel") + .HasColumnType("longtext") + .HasComment("ระดับศึกษา"); + + b.Property("EducationLevelId") + .HasColumnType("char(36)") + .HasComment("Id ระดับศึกษา"); + + b.Property("EndDate") + .HasColumnType("datetime(6)") + .HasComment("ถึง"); + + b.Property("Field") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("สาขาวิชา/ทาง"); + + b.Property("FinishDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่สำเร็จการศึกษา"); + + b.Property("FundName") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("ทุน"); + + b.Property("Gpa") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("เกรดเฉลี่ย"); + + b.Property("Institute") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("สถานศึกษา"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Other") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("ข้อมูลการติดต่อ"); + + b.Property("PositionPath") + .HasColumnType("longtext") + .HasComment("เป็นวุฒิการศึกษาในตำแหน่ง"); + + b.Property("PositionPathId") + .HasColumnType("char(36)") + .HasComment("Id เป็นวุฒิการศึกษาในตำแหน่ง"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)") + .HasComment("ตั้งแต่"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileEducations"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileEducationHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Country") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("ประเทศ"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Degree") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("วุฒิการศึกษา"); + + b.Property("Duration") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("ระยะเวลา"); + + b.Property("DurationYear") + .HasColumnType("int") + .HasComment("ระยะเวลาหลักสูตร"); + + b.Property("EducationLevel") + .HasColumnType("longtext") + .HasComment("ระดับศึกษา"); + + b.Property("EducationLevelId") + .HasColumnType("char(36)") + .HasComment("Id ระดับศึกษา"); + + b.Property("EndDate") + .HasColumnType("datetime(6)") + .HasComment("ถึง"); + + b.Property("Field") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("สาขาวิชา/ทาง"); + + b.Property("FinishDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่สำเร็จการศึกษา"); + + b.Property("FundName") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("ทุน"); + + b.Property("Gpa") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("เกรดเฉลี่ย"); + + b.Property("Institute") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("สถานศึกษา"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Other") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("ข้อมูลการติดต่อ"); + + b.Property("PositionPath") + .HasColumnType("longtext") + .HasComment("เป็นวุฒิการศึกษาในตำแหน่ง"); + + b.Property("PositionPathId") + .HasColumnType("char(36)") + .HasComment("Id เป็นวุฒิการศึกษาในตำแหน่ง"); + + b.Property("ProfileEducationId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)") + .HasComment("ตั้งแต่"); + + b.HasKey("Id"); + + b.HasIndex("ProfileEducationId"); + + b.ToTable("ProfileEducationHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileFamilyHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Couple") + .HasColumnType("tinyint(1)") + .HasComment("คู่สมรส"); + + b.Property("CoupleCareer") + .HasColumnType("longtext") + .HasComment("อาชีพคู่สมรส"); + + b.Property("CoupleFirstName") + .HasColumnType("longtext") + .HasComment("ชื่อคู่สมรส"); + + b.Property("CoupleLastName") + .HasColumnType("longtext") + .HasComment("นามสกุลคู่สมรส"); + + b.Property("CoupleLastNameOld") + .HasColumnType("longtext") + .HasComment("นามสกุลคู่สมรส(เดิม)"); + + b.Property("CouplePrefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้าคู่สมรส"); + + b.Property("CouplePrefixId") + .HasColumnType("char(36)") + .HasComment("Id คำนำหน้าคู่สมรส"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("FatherCareer") + .HasColumnType("longtext") + .HasComment("อาชีพบิดา"); + + b.Property("FatherFirstName") + .HasColumnType("longtext") + .HasComment("ชื่อบิดา"); + + b.Property("FatherLastName") + .HasColumnType("longtext") + .HasComment("นามสกุลบิดา"); + + b.Property("FatherPrefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้าบิดา"); + + b.Property("FatherPrefixId") + .HasColumnType("char(36)") + .HasComment("Id คำนำหน้าบิดา"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("MotherCareer") + .HasColumnType("longtext") + .HasComment("อาชีพมารดา"); + + b.Property("MotherFirstName") + .HasColumnType("longtext") + .HasComment("ชื่อมารดา"); + + b.Property("MotherLastName") + .HasColumnType("longtext") + .HasComment("นามสกุลมารดา"); + + b.Property("MotherPrefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้ามารดา"); + + b.Property("MotherPrefixId") + .HasColumnType("char(36)") + .HasComment("Id คำนำหน้ามารดา"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileFamilyHistory"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileFatherHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasComment("ไม่ใช้"); + + b.Property("Career") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("Prefix") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileFatherHistory"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileGovernmentHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateAppoint") + .HasColumnType("datetime(6)") + .HasComment("วันที่สั่งบรรจุ"); + + b.Property("DateStart") + .HasColumnType("datetime(6)") + .HasComment("เริ่มปฎิบัติราชการ"); + + b.Property("GovAge") + .HasColumnType("longtext") + .HasComment("อายุราชการ"); + + b.Property("GovAgeAbsent") + .HasColumnType("int") + .HasComment("ขาดราชการ"); + + b.Property("GovAgePlus") + .HasColumnType("int") + .HasComment("อายุราชการเกื้อกูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Oc") + .HasColumnType("longtext") + .HasComment("สังกัด"); + + b.Property("OcId") + .HasColumnType("char(36)") + .HasComment("Id สังกัด"); + + b.Property("PosNo") + .HasColumnType("longtext") + .HasComment("เลขที่ตำแหน่ง"); + + b.Property("PosNoId") + .HasColumnType("char(36)") + .HasComment("Id เลขที่ตำแหน่ง"); + + b.Property("Position") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("PositionEmployeeGroup") + .HasColumnType("longtext") + .HasComment("กลุ่มงาน"); + + b.Property("PositionEmployeeLevel") + .HasColumnType("longtext") + .HasComment("ระดับชั้นงาน"); + + b.Property("PositionEmployeePosition") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("PositionEmployeePositionSide") + .HasColumnType("longtext") + .HasComment("ด้านของตำแหน่ง"); + + b.Property("PositionExecutive") + .HasColumnType("longtext") + .HasComment("ตำแหน่งทางการบริหาร"); + + b.Property("PositionId") + .HasColumnType("char(36)") + .HasComment("Id ตำแหน่ง"); + + b.Property("PositionLevel") + .HasColumnType("longtext") + .HasComment("ระดับตำแหน่ง"); + + b.Property("PositionLine") + .HasColumnType("longtext") + .HasComment("สายงาน"); + + b.Property("PositionType") + .HasColumnType("longtext") + .HasComment("ประเภทตำแหน่ง"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("ReasonSameDate") + .HasColumnType("longtext") + .HasComment("เหตุผลกรณีไม่ตรงวัน"); + + b.Property("RetireDate") + .HasColumnType("longtext") + .HasComment("วันเกษียณอายุ"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileGovernmentHistory"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)") + .HasComment("วันเกิด"); + + b.Property("BloodGroup") + .HasColumnType("longtext") + .HasComment("กลุ่มเลือด"); + + b.Property("BloodGroupId") + .HasColumnType("char(36)") + .HasComment("Id กลุ่มเลือด"); + + b.Property("CitizenId") + .HasMaxLength(13) + .HasColumnType("varchar(13)") + .HasComment("รหัสบัตรประชาชน"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("EmployeeClass") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("ประเภทลูกจ้าง"); + + b.Property("EmployeeType") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("ประเภทการจ้าง"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อ"); + + b.Property("Gender") + .HasColumnType("longtext") + .HasComment("เพศ"); + + b.Property("GenderId") + .HasColumnType("char(36)") + .HasComment("Id เพศ"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Nationality") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("สัญชาติ"); + + b.Property("Prefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้า"); + + b.Property("PrefixId") + .HasColumnType("char(36)") + .HasComment("Id คำนำหน้า"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("Race") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("เชื้อชาติ"); + + b.Property("Relationship") + .HasColumnType("longtext") + .HasComment("สถานะภาพ"); + + b.Property("RelationshipId") + .HasColumnType("char(36)") + .HasComment("Id สถานะภาพ"); + + b.Property("Religion") + .HasColumnType("longtext") + .HasComment("ศาสนา"); + + b.Property("ReligionId") + .HasColumnType("char(36)") + .HasComment("Id ศาสนา"); + + b.Property("TelephoneNumber") + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasComment("เบอร์โทร"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileHistory"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHonor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Detail") + .HasMaxLength(2000) + .HasColumnType("varchar(2000)") + .HasComment("รายละเอียด"); + + b.Property("IssueDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่ได้รับ"); + + b.Property("Issuer") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("หน่วยงานที่ออก"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileHonors"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHonorHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Detail") + .HasMaxLength(2000) + .HasColumnType("varchar(2000)") + .HasComment("รายละเอียด"); + + b.Property("IssueDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่ได้รับ"); + + b.Property("Issuer") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("หน่วยงานที่ออก"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileHonorId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileHonorId"); + + b.ToTable("ProfileHonorHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileInsignia", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateAnnounce") + .HasColumnType("datetime(6)") + .HasComment("วันที่ประกาศในราชกิจจาฯ"); + + b.Property("Insignia") + .HasColumnType("longtext") + .HasComment("ชื่อเครื่องราชฯ"); + + b.Property("InsigniaId") + .HasColumnType("char(36)"); + + b.Property("InsigniaType") + .HasColumnType("longtext") + .HasComment("ประเภท"); + + b.Property("Issue") + .HasMaxLength(300) + .HasColumnType("varchar(300)") + .HasComment("ราชกิจจาฯ ฉบับที่"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("No") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("ลำดับที่"); + + b.Property("Page") + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasComment("หน้า"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("ReceiveDate") + .HasColumnType("datetime(6)") + .HasComment("ลงวันที่"); + + b.Property("Section") + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasComment("ตอน"); + + b.Property("Volume") + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasComment("เล่ม"); + + b.Property("VolumeNo") + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasComment("เล่มที่"); + + b.Property("Year") + .HasColumnType("int") + .HasComment("ปีที่ยื่นขอ"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileInsignias"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileInsigniaHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateAnnounce") + .HasColumnType("datetime(6)") + .HasComment("วันที่ประกาศในราชกิจจาฯ"); + + b.Property("Insignia") + .HasColumnType("longtext") + .HasComment("ชื่อเครื่องราชฯ"); + + b.Property("InsigniaId") + .HasColumnType("char(36)"); + + b.Property("InsigniaType") + .HasColumnType("longtext") + .HasComment("ประเภท"); + + b.Property("Issue") + .HasMaxLength(300) + .HasColumnType("varchar(300)") + .HasComment("ราชกิจจาฯ ฉบับที่"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("No") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("ลำดับที่"); + + b.Property("Page") + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasComment("หน้า"); + + b.Property("ProfileInsigniaId") + .HasColumnType("char(36)"); + + b.Property("ReceiveDate") + .HasColumnType("datetime(6)") + .HasComment("ลงวันที่"); + + b.Property("Section") + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasComment("ตอน"); + + b.Property("Volume") + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasComment("เล่ม"); + + b.Property("VolumeNo") + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasComment("เล่มที่"); + + b.Property("Year") + .HasColumnType("int") + .HasComment("ปีที่ยื่นขอ"); + + b.HasKey("Id"); + + b.HasIndex("ProfileInsigniaId"); + + b.ToTable("ProfileInsigniaHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileLeave", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateEndLeave") + .HasColumnType("datetime(6)") + .HasComment("วัน เดือน ปี ที่สิ้นสุดลา"); + + b.Property("DateStartLeave") + .HasColumnType("datetime(6)") + .HasComment("วัน เดือน ปี ที่เริ่มลา"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("NumLeave") + .HasColumnType("double") + .HasComment("ลาครั้งที่"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("Reason") + .HasColumnType("longtext") + .HasComment("เหตุผล"); + + b.Property("Status") + .HasColumnType("longtext") + .HasComment("สถานะ"); + + b.Property("SumLeave") + .HasColumnType("double") + .HasComment("ลามาแล้ว"); + + b.Property("TotalLeave") + .HasColumnType("double") + .HasComment("รวมเป็น"); + + b.Property("TypeLeaveId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.HasIndex("TypeLeaveId"); + + b.ToTable("ProfileLeaves"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileLeaveHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateEndLeave") + .HasColumnType("datetime(6)") + .HasComment("วัน เดือน ปี ที่สิ้นสุดลา"); + + b.Property("DateStartLeave") + .HasColumnType("datetime(6)") + .HasComment("วัน เดือน ปี ที่เริ่มลา"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("NumLeave") + .HasColumnType("double") + .HasComment("ลาครั้งที่"); + + b.Property("ProfileLeaveId") + .HasColumnType("char(36)"); + + b.Property("Reason") + .HasColumnType("longtext") + .HasComment("เหตุผล"); + + b.Property("Status") + .HasColumnType("longtext") + .HasComment("สถานะ"); + + b.Property("SumLeave") + .HasColumnType("double") + .HasComment("ลามาแล้ว"); + + b.Property("TotalLeave") + .HasColumnType("double") + .HasComment("รวมเป็น"); + + b.Property("TypeLeaveId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileLeaveId"); + + b.HasIndex("TypeLeaveId"); + + b.ToTable("ProfileLeaveHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileMotherHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasComment("ไม่ใช้"); + + b.Property("Career") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("Prefix") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileMotherHistory"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileNopaid", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Date") + .HasColumnType("datetime(6)") + .HasComment("วัน เดือน ปี"); + + b.Property("Detail") + .HasColumnType("longtext") + .HasComment("รายละเอียด"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("Reference") + .HasColumnType("longtext") + .HasComment("เอกสารอ้างอิง"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileNopaids"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileNopaidHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Date") + .HasColumnType("datetime(6)") + .HasComment("วัน เดือน ปี"); + + b.Property("Detail") + .HasColumnType("longtext") + .HasComment("รายละเอียด"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileNopaidId") + .HasColumnType("char(36)"); + + b.Property("Reference") + .HasColumnType("longtext") + .HasComment("เอกสารอ้างอิง"); + + b.HasKey("Id"); + + b.HasIndex("ProfileNopaidId"); + + b.ToTable("ProfileNopaidHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileOrganization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("OrganizationId") + .HasColumnType("char(36)") + .HasComment("Id หน่วยงานที่สังกัด"); + + b.Property("UserId") + .HasColumnType("char(36)") + .HasComment("User Id KeyCloak"); + + b.HasKey("Id"); + + b.ToTable("ProfileOrganizations"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileOther", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Date") + .HasColumnType("datetime(6)") + .HasComment("วันที่"); + + b.Property("Detail") + .HasColumnType("longtext") + .HasComment("รายละเอียด"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileOthers"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileOtherHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Date") + .HasColumnType("datetime(6)") + .HasComment("วันที่"); + + b.Property("Detail") + .HasColumnType("longtext") + .HasComment("รายละเอียด"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileOtherId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileOtherId"); + + b.ToTable("ProfileOtherHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfilePaper", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CategoryName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasComment("ประเภทไฟล์-ไม่ใช้"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Detail") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasComment("ชื่อไฟล์"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfilePapers"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileRegistrationAddressHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasComment("ไม่ใช้"); + + b.Property("Address") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("CreatedDate") + .HasColumnType("datetime(6)"); + + b.Property("DistrictId") + .HasColumnType("char(36)"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("ProvinceId") + .HasColumnType("char(36)"); + + b.Property("SubDistrictId") + .HasColumnType("char(36)"); + + b.Property("ZipCode") + .IsRequired() + .HasMaxLength(5) + .HasColumnType("varchar(5)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileRegistrationAddressHistories"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalary", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Amount") + .HasColumnType("double") + .HasComment("เงินเดือน"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Date") + .HasColumnType("datetime(6)") + .HasComment("วัน เดือน ปี รับตำแหน่ง"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("MouthSalaryAmount") + .HasColumnType("double") + .HasComment("เงินค่าตอบแทนรายเดือน"); + + b.Property("OcId") + .HasColumnType("char(36)") + .HasComment("Id สังกัด"); + + b.Property("OrganizationShortNameId") + .HasColumnType("char(36)") + .HasComment("Id ชื่อย่อหน่วยงาน"); + + b.Property("PosNoEmployee") + .HasColumnType("longtext") + .HasComment("เลขที่ตำแหน่งลูกจ้าง"); + + b.Property("PosNoId") + .HasColumnType("char(36)") + .HasComment("Id เลขที่ตำแหน่ง"); + + b.Property("PositionEmployeeGroupId") + .HasColumnType("char(36)") + .HasComment("Id กลุ่มงาน"); + + b.Property("PositionEmployeeLevelId") + .HasColumnType("char(36)") + .HasComment(" Id ระดับชั้นงาน"); + + b.Property("PositionEmployeePositionId") + .HasColumnType("char(36)") + .HasComment("Id ตำแหน่ง"); + + b.Property("PositionEmployeePositionSideId") + .HasColumnType("char(36)") + .HasComment("Id ด้านของตำแหน่ง"); + + b.Property("PositionExecutiveId") + .HasColumnType("char(36)") + .HasComment("Id ตำแหน่งทางการบริหาร"); + + b.Property("PositionExecutiveSideId") + .HasColumnType("char(36)") + .HasComment("Id ด้านทางการบริหาร"); + + b.Property("PositionId") + .HasColumnType("char(36)") + .HasComment("Id ตำแหน่ง"); + + b.Property("PositionLevelId") + .HasColumnType("char(36)") + .HasComment("Id ระดับ"); + + b.Property("PositionLineId") + .HasColumnType("char(36)") + .HasComment("Id สายงาน"); + + b.Property("PositionPathSideId") + .HasColumnType("char(36)") + .HasComment("Id ด้าน/สาขา"); + + b.Property("PositionSalaryAmount") + .HasColumnType("double") + .HasComment("เงินประจำตำแหน่ง"); + + b.Property("PositionTypeId") + .HasColumnType("char(36)") + .HasComment("Id ประเภทตำแหน่ง"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("SalaryClass") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง (รายละเอียด)"); + + b.Property("SalaryRef") + .HasColumnType("longtext") + .HasComment("เอกสารอ้างอิง"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileSalaries"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Amount") + .HasColumnType("double") + .HasComment("เงินเดือน"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Date") + .HasColumnType("datetime(6)") + .HasComment("วัน เดือน ปี รับตำแหน่ง"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("MouthSalaryAmount") + .HasColumnType("double") + .HasComment("เงินค่าตอบแทนรายเดือน"); + + b.Property("Oc") + .HasColumnType("longtext") + .HasComment("สังกัด"); + + b.Property("OcId") + .HasColumnType("char(36)") + .HasComment("Id สังกัด"); + + b.Property("OrganizationShortName") + .HasColumnType("longtext"); + + b.Property("OrganizationShortNameId") + .HasColumnType("char(36)"); + + b.Property("PosNo") + .HasColumnType("longtext") + .HasComment("เลขที่ตำแหน่ง"); + + b.Property("PosNoEmployee") + .HasColumnType("longtext") + .HasComment("เลขที่ตำแหน่งลูกจ้าง"); + + b.Property("PosNoId") + .HasColumnType("char(36)") + .HasComment("Id เลขที่ตำแหน่ง"); + + b.Property("Position") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("PositionEmployeeGroup") + .HasColumnType("longtext") + .HasComment("กลุ่มงาน"); + + b.Property("PositionEmployeeGroupId") + .HasColumnType("char(36)") + .HasComment("Id กลุ่มงาน"); + + b.Property("PositionEmployeeLevel") + .HasColumnType("longtext") + .HasComment("ระดับชั้นงาน"); + + b.Property("PositionEmployeeLevelId") + .HasColumnType("char(36)") + .HasComment(" Id ระดับชั้นงาน"); + + b.Property("PositionEmployeePosition") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("PositionEmployeePositionId") + .HasColumnType("char(36)") + .HasComment("Id ตำแหน่ง"); + + b.Property("PositionEmployeePositionSide") + .HasColumnType("longtext") + .HasComment("ด้านของตำแหน่ง"); + + b.Property("PositionEmployeePositionSideId") + .HasColumnType("char(36)") + .HasComment("Id ด้านของตำแหน่ง"); + + b.Property("PositionExecutive") + .HasColumnType("longtext") + .HasComment("ตำแหน่งทางการบริหาร"); + + b.Property("PositionExecutiveId") + .HasColumnType("char(36)") + .HasComment("Id ด้านทางการบริหาร"); + + b.Property("PositionExecutiveSide") + .HasColumnType("longtext") + .HasComment("ด้านทางการบริหาร"); + + b.Property("PositionExecutiveSideId") + .HasColumnType("char(36)") + .HasComment("Id ด้านทางการบริหาร"); + + b.Property("PositionId") + .HasColumnType("char(36)") + .HasComment("Id ตำแหน่ง"); + + b.Property("PositionLevel") + .HasColumnType("longtext") + .HasComment("ระดับ"); + + b.Property("PositionLevelId") + .HasColumnType("char(36)") + .HasComment(" Id ระดับ"); + + b.Property("PositionLine") + .HasColumnType("longtext") + .HasComment("สายงาน"); + + b.Property("PositionLineId") + .HasColumnType("char(36)") + .HasComment("Id สายงาน"); + + b.Property("PositionPathSide") + .HasColumnType("longtext") + .HasComment("ด้าน/สาขา"); + + b.Property("PositionPathSideId") + .HasColumnType("char(36)") + .HasComment("Id ด้าน/สาขา"); + + b.Property("PositionSalaryAmount") + .HasColumnType("double") + .HasComment("เงินประจำตำแหน่ง"); + + b.Property("PositionType") + .HasColumnType("longtext") + .HasComment("ประเภทตำแหน่ง"); + + b.Property("PositionTypeId") + .HasColumnType("char(36)") + .HasComment("Id ประเภทตำแหน่ง"); + + b.Property("ProfileSalaryId") + .HasColumnType("char(36)"); + + b.Property("SalaryClass") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง (รายละเอียด)"); + + b.Property("SalaryRef") + .HasColumnType("longtext") + .HasComment("เอกสารอ้างอิง"); + + b.HasKey("Id"); + + b.HasIndex("ProfileSalaryId"); + + b.ToTable("ProfileSalaryHistories"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryOrganization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasComment("ไม่ใช้"); + + b.Property("Comment") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.HasKey("Id"); + + b.ToTable("ProfileSalaryOrganizations"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryPosition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasComment("ไม่ใช้"); + + b.Property("Comment") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("PositionId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PositionId"); + + b.ToTable("ProfileSalaryPositions"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryPositionLevel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasComment("ไม่ใช้"); + + b.Property("Comment") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.HasKey("Id"); + + b.ToTable("ProfileSalaryPositionLevels"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryPositionNumber", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasComment("ไม่ใช้"); + + b.Property("Comment") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.HasKey("Id"); + + b.ToTable("ProfileSalaryPositionsNumbers"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryPositionType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasComment("ไม่ใช้"); + + b.Property("Comment") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.HasKey("Id"); + + b.ToTable("ProfileSalaryPositionTypes"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileTraining", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateOrder") + .HasColumnType("datetime(6)") + .HasComment("คำสั่งลงวันที่/หนังสืออนุมัติลงวันที่"); + + b.Property("Department") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("หน่วยงานที่รับผิดชอบจัดการฝึกอบรม/ดูงาน"); + + b.Property("Duration") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("รวมระยะเวลาในการฝึกอบรม/ดูงาน"); + + b.Property("EndDate") + .HasColumnType("datetime(6)") + .HasComment("วันสิ้นสุดการฝึกอบรม/ดูงาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("ชื่อโครงการ/หลักสูตรการฝึกอบรม"); + + b.Property("NumberOrder") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("เลขที่คำสั่ง/เลขที่หนังสืออนุมัติ"); + + b.Property("Place") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("สถานที่ฝึกอบรม/ดูงาน"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)") + .HasComment("วันเริ่มต้นการฝึกอบรม/ดูงาน"); + + b.Property("Topic") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("หัวข้อการฝึกอบรม/ดูงาน"); + + b.Property("Yearly") + .HasMaxLength(200) + .HasColumnType("int") + .HasComment("ปีที่อบรม (พ.ศ.)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfileTrainings"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileTrainingHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DateOrder") + .HasColumnType("datetime(6)") + .HasComment("คำสั่งลงวันที่/หนังสืออนุมัติลงวันที่"); + + b.Property("Department") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("หน่วยงานที่รับผิดชอบจัดการฝึกอบรม/ดูงาน"); + + b.Property("Duration") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("รวมระยะเวลาในการฝึกอบรม/ดูงาน"); + + b.Property("EndDate") + .HasColumnType("datetime(6)") + .HasComment("วันสิ้นสุดการฝึกอบรม/ดูงาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("ชื่อโครงการ/หลักสูตรการฝึกอบรม"); + + b.Property("NumberOrder") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("เลขที่คำสั่ง/เลขที่หนังสืออนุมัติ"); + + b.Property("Place") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("สถานที่ฝึกอบรม/ดูงาน"); + + b.Property("ProfileTrainingId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)") + .HasComment("วันเริ่มต้นการฝึกอบรม/ดูงาน"); + + b.Property("Topic") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("หัวข้อการฝึกอบรม/ดูงาน"); + + b.Property("Yearly") + .HasMaxLength(200) + .HasColumnType("int") + .HasComment("ปีที่อบรม (พ.ศ.)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileTrainingId"); + + b.ToTable("ProfileTrainingHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.TypeLeave", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .HasColumnType("longtext") + .HasComment("ประเภทการลา"); + + b.HasKey("Id"); + + b.ToTable("TypeLeaves"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaPeriod", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Amount") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("varchar(10)"); + + b.Property("Year") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("InsigniaPeriods"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaRequest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("OrganizationOrganizationId") + .HasColumnType("char(36)"); + + b.Property("PeriodId") + .HasColumnType("char(36)"); + + b.Property("RequestNote") + .IsRequired() + .HasColumnType("text"); + + b.Property("RequestStatus") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationOrganizationId"); + + b.HasIndex("PeriodId"); + + b.ToTable("InsigniaRequests"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaRequestProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DocumentStatus") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("IsApprove") + .HasColumnType("tinyint(1)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("MatchingConditions") + .IsRequired() + .HasColumnType("text"); + + b.Property("Note") + .IsRequired() + .HasColumnType("text"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("QualificationStatus") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("RequestDate") + .HasColumnType("datetime(6)"); + + b.Property("RequestId") + .HasColumnType("char(36)"); + + b.Property("RequestInsigniaId") + .HasColumnType("char(36)"); + + b.Property("Salary") + .HasColumnType("decimal(65,30)"); + + b.Property("Special") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.HasIndex("RequestId"); + + b.HasIndex("RequestInsigniaId"); + + b.ToTable("InsigniaRequestProfiles"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.BloodGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(2) + .HasColumnType("varchar(2)") + .HasColumnOrder(1) + .HasComment("ชื่อหมู่โลหิต"); + + b.HasKey("Id"); + + b.ToTable("BloodGroups"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.District", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("varchar(150)") + .HasColumnOrder(1) + .HasComment("เขต/อำเภอ"); + + b.Property("ProvinceId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProvinceId"); + + b.ToTable("Districts"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.EducationLevel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ระดับการศึกษา"); + + b.HasKey("Id"); + + b.ToTable("EducationLevels"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Gender", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasColumnOrder(1) + .HasComment("เพศ"); + + b.HasKey("Id"); + + b.ToTable("Genders"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Holiday", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Category") + .IsRequired() + .HasColumnType("longtext") + .HasColumnOrder(6) + .HasComment("ประเภทของวันหยุดสำหรับ ทำงาน 5 วัน=`NORMAL`,ทำงาน 6 วัน=`6DAYS`"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("HolidayDate") + .HasColumnType("datetime(6)") + .HasColumnOrder(2) + .HasComment("วันหยุด"); + + b.Property("IsSpecial") + .HasColumnType("tinyint(1)") + .HasColumnOrder(5) + .HasComment("เป็นวันหยุดพิเศษหรือไม่"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)") + .HasColumnOrder(4) + .HasComment("ชื่อวันหยุด"); + + b.Property("OriginalDate") + .HasColumnType("datetime(6)") + .HasColumnOrder(3) + .HasComment("วันหยุด(Original)"); + + b.Property("Year") + .HasColumnType("int") + .HasColumnOrder(1) + .HasComment("ประจำปี"); + + b.HasKey("Id"); + + b.ToTable("Holidays"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Insignia", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("InsigniaTypeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(3) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Level") + .HasColumnType("int") + .HasColumnOrder(4) + .HasComment("ลำดับชั้นของเครื่องราชย์ เอาไว้ตรวจสอบเวลาขอว่าต้องได้ชั้นที่สูงกว่าที่เคยได้รับแล้วเท่านั้น"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อเครื่องราชย์"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext") + .HasColumnOrder(5) + .HasComment("หมายเหตุ"); + + b.Property("ShortName") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasColumnOrder(2) + .HasComment("ชื่อย่อเครื่องราชย์"); + + b.HasKey("Id"); + + b.HasIndex("InsigniaTypeId"); + + b.ToTable("Insignias"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.InsigniaType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasColumnOrder(1) + .HasComment("ชื่อประเภทเครื่องราชย์"); + + b.HasKey("Id"); + + b.ToTable("InsigniaTypes"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationAgency", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ หน่วยงานต้นสังกัด"); + + b.HasKey("Id"); + + b.ToTable("OrganizationAgencys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationFax", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ เบอร์โทรสาร"); + + b.HasKey("Id"); + + b.ToTable("OrganizationFaxs"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationGovernmentAgency", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ ส่วนราชการต้นสังกัด"); + + b.HasKey("Id"); + + b.ToTable("OrganizationGovernmentAgencys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationLevel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ ระดับ"); + + b.HasKey("Id"); + + b.ToTable("OrganizationLevels"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationOrganization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ หน่วยงาน"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext") + .HasColumnOrder(3) + .HasComment("หมายเหตุ"); + + b.HasKey("Id"); + + b.ToTable("OrganizationOrganizations"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationShortName", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("AgencyCode") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ รหัสหน่วยงาน"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("GovernmentCode") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(2) + .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ รหัสส่วนราชการ"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(4) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(3) + .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ ตัวย่อหน่วยงาน"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext") + .HasColumnOrder(5) + .HasComment("หมายเหตุ"); + + b.HasKey("Id"); + + b.ToTable("OrganizationShortNames"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ สถานะ"); + + b.HasKey("Id"); + + b.ToTable("OrganizationStatuses"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationTelExternal", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ เบอร์ติดต่อภายนอก"); + + b.HasKey("Id"); + + b.ToTable("OrganizationTelExternals"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationTelInternal", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ เบอร์ติดต่อภายใน"); + + b.HasKey("Id"); + + b.ToTable("OrganizationTelInternals"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.OrganizationType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ข้อมูลโครงสร้างหน่วยงานชื่อ ประเภท"); + + b.HasKey("Id"); + + b.ToTable("OrganizationTypes"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PhysicalStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("สถานภาพทางกาย"); + + b.HasKey("Id"); + + b.ToTable("PhysicalStatuses"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Position", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("ExecutiveName") + .IsRequired() + .HasMaxLength(300) + .HasColumnType("varchar(300)") + .HasColumnOrder(3) + .HasComment("ชื่อตำแหน่งทางการบริหาร"); + + b.Property("ExecutiveSideId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(9) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(300) + .HasColumnType("varchar(300)") + .HasColumnOrder(1) + .HasComment("ชื่อตำแหน่ง"); + + b.Property("PathSideId") + .HasColumnType("char(36)"); + + b.Property("PositionCategory") + .IsRequired() + .HasColumnType("longtext") + .HasColumnOrder(8) + .HasComment("ตำแหน่งสำหรับข้าราชการหรือลูกจ้าง officer/employee"); + + b.Property("PositionLevelId") + .HasColumnType("char(36)"); + + b.Property("PositionPathId") + .HasColumnType("char(36)"); + + b.Property("PositionTypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ExecutiveSideId"); + + b.HasIndex("PathSideId"); + + b.HasIndex("PositionLevelId"); + + b.HasIndex("PositionPathId"); + + b.HasIndex("PositionTypeId"); + + b.ToTable("Positions"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionEmployeeGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อกลุ่มงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ"); + + b.HasKey("Id"); + + b.ToTable("PositionEmployeeGroups"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionEmployeeLevel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อระดับชั้นงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ"); + + b.HasKey("Id"); + + b.ToTable("PositionEmployeeLevels"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionEmployeeLine", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อสายงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ"); + + b.HasKey("Id"); + + b.ToTable("PositionEmployeeLines"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionEmployeePosition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อตำแหน่งข้อมูลตำแหน่งของลูกจ้างกรุงเทพ"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext") + .HasColumnOrder(3) + .HasComment("หมายเหตุ"); + + b.HasKey("Id"); + + b.ToTable("PositionEmployeePositions"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionEmployeePositionSide", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อด้านของตำแหน่งข้อมูลตำแหน่งของลูกจ้างกรุงเทพ"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext") + .HasColumnOrder(3) + .HasComment("หมายเหตุ"); + + b.HasKey("Id"); + + b.ToTable("PositionEmployeePositionSides"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionEmployeeStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อสถานะของตำแหน่งข้อมูลตำแหน่งของลูกจ้างกรุงเทพ"); + + b.HasKey("Id"); + + b.ToTable("PositionEmployeeStatuses"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionExecutive", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อตำแหน่งทางการบริหารของข้อมูลตำแหน่งของข้าราชการ"); + + b.HasKey("Id"); + + b.ToTable("PositionExecutives"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionExecutiveSide", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อด้านทางการบริหาร"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext") + .HasColumnOrder(3) + .HasComment("หมายเหตุ"); + + b.HasKey("Id"); + + b.ToTable("PositionExecutiveSides"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionLevel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(4) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Level") + .HasColumnType("int") + .HasColumnOrder(3) + .HasComment("ลำดับชั้นของระดับตำแหน่ง"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อระดับตำแหน่ง"); + + b.Property("ShortName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(2) + .HasComment("ชื่อย่อระดับตำแหน่ง"); + + b.HasKey("Id"); + + b.ToTable("PositionLevels"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionLine", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อสายงานของข้อมูลตำแหน่งของข้าราชการ"); + + b.HasKey("Id"); + + b.ToTable("PositionLines"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionPath", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อสายงาน"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext") + .HasColumnOrder(3) + .HasComment("หมายเหตุ"); + + b.HasKey("Id"); + + b.ToTable("PositionPaths"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionPathSide", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อด้าน/สาขา"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext") + .HasColumnOrder(3) + .HasComment("หมายเหตุ"); + + b.HasKey("Id"); + + b.ToTable("PositionPathSides"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อสถานะของตำแหน่งของข้อมูลตำแหน่งของข้าราชการ"); + + b.HasKey("Id"); + + b.ToTable("PositionStatuss"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.PositionType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อประเภทตำแหน่ง"); + + b.HasKey("Id"); + + b.ToTable("PositionTypes"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Prefix", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(3) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasColumnOrder(2) + .HasComment("รายละเอียดคำนำหน้า"); + + b.HasKey("Id"); + + b.ToTable("Prefixes"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Province", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("varchar(150)") + .HasColumnOrder(1) + .HasComment("จังหวัด"); + + b.HasKey("Id"); + + b.ToTable("Provinces"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Relationship", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasColumnOrder(1) + .HasComment("ชื่อความสัมพันธ์"); + + b.HasKey("Id"); + + b.ToTable("Relationships"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Religion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ศาสนา"); + + b.HasKey("Id"); + + b.ToTable("Religions"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Royal", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(3) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อประเภทข้อมูลเหรียญตรา"); + + b.Property("ShortName") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("varchar(10)") + .HasColumnOrder(2) + .HasComment("ชื่อย่อเหรียญตรา"); + + b.HasKey("Id"); + + b.ToTable("Royals"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.RoyalHierarchy", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อลำดับชั้นข้อมูลเครื่องราชฯ"); + + b.HasKey("Id"); + + b.ToTable("RoyalHierarchys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.RoyalType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(2) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnOrder(1) + .HasComment("ชื่อประเภทข้อมูลเครื่องราชฯ"); + + b.HasKey("Id"); + + b.ToTable("RoyalTypes"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.SubDistrict", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DistrictId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnOrder(3) + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("varchar(150)") + .HasColumnOrder(1) + .HasComment("เขต/อำเภอ"); + + b.Property("ZipCode") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("varchar(10)") + .HasColumnOrder(2) + .HasComment("รหัสไปรษณีย์"); + + b.HasKey("Id"); + + b.HasIndex("DistrictId"); + + b.ToTable("SubDistricts"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Notifications.MessageQueueEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsSend") + .HasColumnType("tinyint(1)") + .HasComment("ทำการส่งข้อความแล้วหรือยัง?"); + + b.Property("IsSendEmail") + .HasColumnType("tinyint(1)") + .HasComment("ส่งอีเมลล์หรือไม่?"); + + b.Property("IsSendInbox") + .HasColumnType("tinyint(1)") + .HasComment("ส่งไปที่กล่องข้อความหรือไม่?"); + + b.Property("IsSendNotification") + .HasColumnType("tinyint(1)") + .HasComment("ส่งการแจ้งเตือนหรือไม่?"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("MessageContent") + .IsRequired() + .HasColumnType("longtext") + .HasComment("รายละเอียดข้อความ"); + + b.Property("MessagePayLoad") + .IsRequired() + .HasColumnType("longtext") + .HasComment("สิ่งที่แนบมาด้วย"); + + b.Property("ReceiverEmailAddress") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("varchar(500)") + .HasComment("อีเมล์ของผู้รับ"); + + b.Property("ReceiverUserId") + .HasColumnType("char(36)") + .HasComment("รหัสของผู้รับข้อความ"); + + b.Property("SenderSystem") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("ส่งจากระบบงาน"); + + b.Property("Subject") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("หัวเรื่อง"); + + b.HasKey("Id"); + + b.ToTable("MessageQueues"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Agency") + .HasColumnType("longtext"); + + b.Property("ConditionNote") + .HasColumnType("longtext"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Department") + .HasColumnType("longtext"); + + b.Property("Government") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsCondition") + .HasColumnType("tinyint(1)"); + + b.Property("IsDirector") + .HasColumnType("tinyint(1)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("OrganizationAgencyId") + .HasColumnType("char(36)"); + + b.Property("OrganizationFaxId") + .HasColumnType("char(36)"); + + b.Property("OrganizationGovernmentAgencyId") + .HasColumnType("char(36)"); + + b.Property("OrganizationLevelId") + .HasColumnType("char(36)"); + + b.Property("OrganizationOrder") + .HasColumnType("longtext"); + + b.Property("OrganizationOrganizationId") + .HasColumnType("char(36)"); + + b.Property("OrganizationShortNameId") + .HasColumnType("char(36)"); + + b.Property("OrganizationTelExternalId") + .HasColumnType("char(36)"); + + b.Property("OrganizationTelInternalId") + .HasColumnType("char(36)"); + + b.Property("OrganizationTypeId") + .HasColumnType("char(36)"); + + b.Property("OrganizationUserNote") + .HasColumnType("longtext"); + + b.Property("Pile") + .HasColumnType("longtext"); + + b.Property("PosNo") + .HasColumnType("longtext"); + + b.Property("PositionCondition") + .HasColumnType("longtext"); + + b.Property("PositionEmployeeLineId") + .HasColumnType("char(36)"); + + b.Property("PositionEmployeePositionId") + .HasColumnType("char(36)"); + + b.Property("PositionEmployeeStatusId") + .HasColumnType("char(36)"); + + b.Property("PositionMasterUserNote") + .HasColumnType("longtext"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("Qualification") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationAgencyId"); + + b.HasIndex("OrganizationFaxId"); + + b.HasIndex("OrganizationGovernmentAgencyId"); + + b.HasIndex("OrganizationLevelId"); + + b.HasIndex("OrganizationOrganizationId"); + + b.HasIndex("OrganizationShortNameId"); + + b.HasIndex("OrganizationTelExternalId"); + + b.HasIndex("OrganizationTelInternalId"); + + b.HasIndex("OrganizationTypeId"); + + b.HasIndex("PositionEmployeeLineId"); + + b.HasIndex("PositionEmployeePositionId"); + + b.HasIndex("PositionEmployeeStatusId"); + + b.HasIndex("ProfileId"); + + b.ToTable("OrganizationEmployees"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeeLevel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("OrganizationEmployeeId") + .HasColumnType("char(36)"); + + b.Property("PositionEmployeeLevelId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationEmployeeId"); + + b.HasIndex("PositionEmployeeLevelId"); + + b.ToTable("OrganizationPositionEmployeeLevels"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeePositionSide", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("OrganizationEmployeeId") + .HasColumnType("char(36)"); + + b.Property("PositionEmployeePositionSideId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationEmployeeId"); + + b.HasIndex("PositionEmployeePositionSideId"); + + b.ToTable("OrganizationPositionEmployeePositionSides"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.AvailablePositionLevelEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("PositionLevelId") + .HasColumnType("char(36)"); + + b.Property("PositionMasterId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PositionLevelId"); + + b.HasIndex("PositionMasterId"); + + b.ToTable("AvailablePositionLevels"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Agency") + .HasColumnType("longtext") + .HasColumnOrder(14) + .HasComment("หน่วยงาน"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Department") + .HasColumnType("longtext") + .HasColumnOrder(16) + .HasComment("ฝ่าย/ส่วน"); + + b.Property("Government") + .HasColumnType("longtext") + .HasColumnOrder(15) + .HasComment("ส่วนราชการ"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("OrganizationFaxId") + .HasColumnType("char(36)"); + + b.Property("OrganizationLevelId") + .HasColumnType("char(36)"); + + b.Property("OrganizationOrder") + .HasColumnType("int") + .HasColumnOrder(12) + .HasComment("OrganizationOrder"); + + b.Property("OrganizationOrganizationId") + .HasColumnType("char(36)"); + + b.Property("OrganizationShortNameId") + .HasColumnType("char(36)"); + + b.Property("OrganizationStatusId") + .HasColumnType("char(36)"); + + b.Property("OrganizationTelExternalId") + .HasColumnType("char(36)"); + + b.Property("OrganizationTelInternalId") + .HasColumnType("char(36)"); + + b.Property("OrganizationTypeId") + .HasColumnType("char(36)"); + + b.Property("OrganizationUserNote") + .HasColumnType("longtext") + .HasColumnOrder(13) + .HasComment("OrganizationUserNote"); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("Pile") + .HasColumnType("longtext") + .HasColumnOrder(17) + .HasComment("กอง"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationFaxId"); + + b.HasIndex("OrganizationLevelId"); + + b.HasIndex("OrganizationOrganizationId"); + + b.HasIndex("OrganizationShortNameId"); + + b.HasIndex("OrganizationStatusId"); + + b.HasIndex("OrganizationTelExternalId"); + + b.HasIndex("OrganizationTelInternalId"); + + b.HasIndex("OrganizationTypeId"); + + b.HasIndex("ParentId"); + + b.ToTable("Organizations"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationPositionEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsDirector") + .HasColumnType("tinyint(1)") + .HasColumnOrder(3) + .HasComment("Is Director"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("OrganizationId") + .HasColumnType("char(36)"); + + b.Property("PositionMasterId") + .HasColumnType("char(36)"); + + b.Property("PositionNumberId") + .HasColumnType("char(36)"); + + b.Property("PositionUserNote") + .HasColumnType("longtext") + .HasColumnOrder(4) + .HasComment("positionUserNote"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.HasIndex("PositionMasterId"); + + b.HasIndex("PositionNumberId"); + + b.ToTable("OrganizationPositions"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationPublishHistoryEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Detail") + .IsRequired() + .HasColumnType("longtext") + .HasColumnOrder(1) + .HasComment("รายละเอียดการแก้ไข"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("ObjectValue") + .IsRequired() + .HasColumnType("longtext") + .HasColumnOrder(2) + .HasComment("เก็บ Object ที่มีการอัพเดตในระบบ"); + + b.HasKey("Id"); + + b.ToTable("OrganizationPublishHistories"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsDirector") + .HasColumnType("tinyint(1)") + .HasColumnOrder(14) + .HasComment("IsDirector"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("PositionCondition") + .HasColumnType("longtext") + .HasColumnOrder(11) + .HasComment("PositionCondition"); + + b.Property("PositionExecutiveId") + .HasColumnType("char(36)"); + + b.Property("PositionExecutiveSideId") + .HasColumnType("char(36)"); + + b.Property("PositionExecutiveSideObject") + .HasColumnType("longtext"); + + b.Property("PositionId") + .HasColumnType("char(36)") + .HasColumnOrder(2) + .HasComment("PositionId"); + + b.Property("PositionLineId") + .HasColumnType("char(36)"); + + b.Property("PositionMasterUserNote") + .HasColumnType("longtext") + .HasColumnOrder(13) + .HasComment("PositionMasterUserNote"); + + b.Property("PositionPathId") + .HasColumnType("char(36)"); + + b.Property("PositionPathSideId") + .HasColumnType("char(36)"); + + b.Property("PositionPathSideObject") + .HasColumnType("longtext"); + + b.Property("PositionStatusId") + .HasColumnType("char(36)"); + + b.Property("PositionTypeId") + .HasColumnType("char(36)"); + + b.Property("Qualification") + .HasColumnType("longtext") + .HasColumnOrder(15) + .HasComment("คุณวุฒิ"); + + b.HasKey("Id"); + + b.HasIndex("PositionExecutiveId"); + + b.HasIndex("PositionExecutiveSideId"); + + b.HasIndex("PositionLineId"); + + b.HasIndex("PositionPathId"); + + b.HasIndex("PositionPathSideId"); + + b.HasIndex("PositionStatusId"); + + b.HasIndex("PositionTypeId"); + + b.ToTable("PositionMasters"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionMasterHistoryEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsDirector") + .HasColumnType("tinyint(1)") + .HasColumnOrder(14) + .HasComment("IsDirector"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Position") + .HasColumnType("longtext") + .HasColumnOrder(2) + .HasComment("Position"); + + b.Property("PositionCondition") + .HasColumnType("longtext") + .HasColumnOrder(11) + .HasComment("PositionCondition"); + + b.Property("PositionExecutive") + .HasColumnType("longtext") + .HasColumnOrder(5) + .HasComment("PositionExecutive"); + + b.Property("PositionExecutiveSide") + .HasColumnType("longtext") + .HasColumnOrder(6) + .HasComment("PositionExecutiveSide"); + + b.Property("PositionExecutiveSideObject") + .HasColumnType("longtext"); + + b.Property("PositionLevel") + .HasColumnType("longtext") + .HasColumnOrder(12) + .HasComment("PositionLevel"); + + b.Property("PositionLine") + .HasColumnType("longtext") + .HasColumnOrder(8) + .HasComment("PositionLine"); + + b.Property("PositionMasterEntityId") + .HasColumnType("char(36)"); + + b.Property("PositionMasterUserNote") + .HasColumnType("longtext") + .HasColumnOrder(13) + .HasComment("PositionMasterUserNote"); + + b.Property("PositionPath") + .HasColumnType("longtext") + .HasColumnOrder(3) + .HasComment("PositionPath"); + + b.Property("PositionPathSide") + .HasColumnType("longtext") + .HasColumnOrder(7) + .HasComment("PositionPathSide"); + + b.Property("PositionPathSideObject") + .HasColumnType("longtext"); + + b.Property("PositionStatus") + .HasColumnType("longtext") + .HasColumnOrder(10) + .HasComment("PositionStatus"); + + b.Property("PositionType") + .HasColumnType("longtext") + .HasColumnOrder(4) + .HasComment("PositionType"); + + b.Property("Qualification") + .HasColumnType("longtext") + .HasColumnOrder(15) + .HasComment("คุณวุฒิ"); + + b.HasKey("Id"); + + b.HasIndex("PositionMasterEntityId"); + + b.ToTable("PositionMasterHistoryEntity"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionNumberEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .HasMaxLength(300) + .HasColumnType("varchar(300)") + .HasColumnOrder(2) + .HasComment("ชื่อ"); + + b.Property("OrganizationShortNameId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationShortNameId"); + + b.ToTable("PositionNumbers"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.ProfilePosition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("OrganizationPositionId") + .HasColumnType("char(36)"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationPositionId"); + + b.HasIndex("ProfileId"); + + b.ToTable("ProfilePositions"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.Report2.Report2", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("GovernmentCode") + .HasColumnType("longtext"); + + b.Property("GovernmentCodeOld") + .HasColumnType("longtext"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("OrganizationOrganization") + .HasColumnType("longtext"); + + b.Property("OrganizationOrganizationId") + .HasColumnType("char(36)") + .HasComment("ชื่อหน่วยงาน"); + + b.Property("OrganizationOrganizationOld") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงานเดิม"); + + b.Property("OrganizationPositionId") + .HasColumnType("char(36)"); + + b.Property("OrganizationShortName") + .HasColumnType("longtext"); + + b.Property("OrganizationShortNameId") + .HasColumnType("char(36)") + .HasComment("รหัสส่วนราชการ"); + + b.Property("OrganizationShortNameOld") + .HasColumnType("longtext") + .HasComment("รหัสส่วนราชการเดิม"); + + b.Property("PositionExecutive") + .HasColumnType("longtext"); + + b.Property("PositionExecutiveId") + .HasColumnType("char(36)") + .HasComment("ตำแหน่งทางการบริหาร"); + + b.Property("PositionExecutiveOld") + .HasColumnType("longtext") + .HasComment("ตำแหน่งทางการบริหารเดิม"); + + b.Property("PositionExecutiveSide") + .HasColumnType("longtext"); + + b.Property("PositionExecutiveSideId") + .HasColumnType("char(36)") + .HasComment("ด้านทางบริหาร"); + + b.Property("PositionExecutiveSideOld") + .HasColumnType("longtext") + .HasComment("ด้านทางบริหารเดิม"); + + b.Property("PositionLevel") + .HasColumnType("longtext"); + + b.Property("PositionLevelId") + .HasColumnType("char(36)") + .HasComment("ระดับตำแหน่ง"); + + b.Property("PositionLevelOld") + .HasColumnType("longtext") + .HasComment("ระดับตำแหน่งเดิม"); + + b.Property("PositionNum") + .HasColumnType("longtext"); + + b.Property("PositionNumId") + .HasColumnType("char(36)") + .HasComment("ตำแหน่งเลขที่"); + + b.Property("PositionNumOld") + .HasColumnType("longtext") + .HasComment("ตำแหน่งเลขที่เดิม"); + + b.Property("PositionPath") + .HasColumnType("longtext"); + + b.Property("PositionPathId") + .HasColumnType("char(36)") + .HasComment("ตำแหน่งในสายงาน"); + + b.Property("PositionPathOld") + .HasColumnType("longtext") + .HasComment("ตำแหน่งในสายงานเดิม"); + + b.Property("PositionPathSide") + .HasColumnType("longtext"); + + b.Property("PositionPathSideId") + .HasColumnType("char(36)") + .HasComment("ด้าน/สาขา"); + + b.Property("PositionPathSideOld") + .HasColumnType("longtext") + .HasComment("ด้าน/สาขาเดิม"); + + b.Property("PositionType") + .HasColumnType("longtext"); + + b.Property("PositionTypeId") + .HasColumnType("char(36)") + .HasComment("ประเภทตำแหน่ง"); + + b.Property("PositionTypeOld") + .HasColumnType("longtext") + .HasComment("ประเภทตำแหน่งเดิม"); + + b.Property("ProfilePositionId") + .HasColumnType("char(36)") + .HasComment("สังกัดที่ถือครอง"); + + b.Property("Status") + .HasColumnType("longtext") + .HasComment("สถานะการเปลี่ยนแปลง"); + + b.HasKey("Id"); + + b.ToTable("Report2s"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.Report2.Report2DetailHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Detail") + .HasColumnType("longtext"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.HasKey("Id"); + + b.ToTable("Report2DetailHistories"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.Report2.Report2History", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Education") + .HasColumnType("longtext") + .HasComment("คุณวุฒิ"); + + b.Property("FullName") + .HasColumnType("longtext") + .HasComment("ชื่อ-สกุล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("NewGovernmentCode") + .HasColumnType("longtext"); + + b.Property("NewOrganizationOrganization") + .HasColumnType("longtext"); + + b.Property("NewOrganizationOrganizationId") + .HasColumnType("char(36)") + .HasComment("ชื่อหน่วยงาน กำหนดใหม่"); + + b.Property("NewOrganizationShortName") + .HasColumnType("longtext"); + + b.Property("NewOrganizationShortNameId") + .HasColumnType("char(36)") + .HasComment("รหัสส่วนราชการ กำหนดใหม่"); + + b.Property("NewPositionExecutive") + .HasColumnType("longtext"); + + b.Property("NewPositionExecutiveId") + .HasColumnType("char(36)") + .HasComment("ตำแหน่งทางการบริหาร กำหนดใหม่"); + + b.Property("NewPositionExecutiveSide") + .HasColumnType("longtext"); + + b.Property("NewPositionExecutiveSideId") + .HasColumnType("char(36)") + .HasComment("ด้านทางบริหาร กำหนดใหม่"); + + b.Property("NewPositionLevel") + .HasColumnType("longtext"); + + b.Property("NewPositionLevelId") + .HasColumnType("char(36)") + .HasComment("ระดับตำแหน่ง กำหนดใหม่"); + + b.Property("NewPositionNum") + .HasColumnType("longtext"); + + b.Property("NewPositionNumId") + .HasColumnType("char(36)") + .HasComment("ตำแหน่งเลขที่ กำหนดใหม่"); + + b.Property("NewPositionPath") + .HasColumnType("longtext"); + + b.Property("NewPositionPathId") + .HasColumnType("char(36)") + .HasComment("ตำแหน่งในสายงาน กำหนดใหม่"); + + b.Property("NewPositionPathSide") + .HasColumnType("longtext"); + + b.Property("NewPositionPathSideId") + .HasColumnType("char(36)") + .HasComment("ด้าน/สาขา กำหนดใหม่"); + + b.Property("NewPositionType") + .HasColumnType("longtext"); + + b.Property("NewPositionTypeId") + .HasColumnType("char(36)") + .HasComment("ประเภทตำแหน่ง กำหนดใหม่"); + + b.Property("OldGovernmentCode") + .HasColumnType("longtext"); + + b.Property("OldOrganizationOrganization") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน กำหนดเดิม"); + + b.Property("OldOrganizationShortName") + .HasColumnType("longtext") + .HasComment("รหัสส่วนราชการ กำหนดเดิม"); + + b.Property("OldPositionExecutive") + .HasColumnType("longtext") + .HasComment("ตำแหน่งทางการบริหาร กำหนดเดิม"); + + b.Property("OldPositionExecutiveSide") + .HasColumnType("longtext") + .HasComment("ด้านทางบริหาร กำหนดเดิม"); + + b.Property("OldPositionLevel") + .HasColumnType("longtext") + .HasComment("ระดับตำแหน่ง กำหนดเดิม"); + + b.Property("OldPositionNum") + .HasColumnType("longtext") + .HasComment("ตำแหน่งเลขที่ กำหนดเดิม"); + + b.Property("OldPositionPath") + .HasColumnType("longtext") + .HasComment("ตำแหน่งในสายงาน กำหนดเดิม"); + + b.Property("OldPositionPathSide") + .HasColumnType("longtext") + .HasComment("ด้าน/สาขา กำหนดเดิม"); + + b.Property("OldPositionType") + .HasColumnType("longtext") + .HasComment("ประเภทตำแหน่ง กำหนดเดิม"); + + b.Property("OrganizationPositionId") + .HasColumnType("char(36)"); + + b.Property("ProfilePositionId") + .HasColumnType("char(36)") + .HasComment("สังกัดที่ถือครอง"); + + b.Property("Report2DetailHistoryId") + .HasColumnType("char(36)"); + + b.Property("Salary") + .HasColumnType("double") + .HasComment("เงินเดือน"); + + b.Property("SalaryMonth") + .HasColumnType("double") + .HasComment("เงินตอบแทนรายเดือน"); + + b.Property("SalaryPosition") + .HasColumnType("double") + .HasComment("เงินประจำตำแหน่ง"); + + b.Property("Status") + .HasColumnType("longtext") + .HasComment("สถานะการเปลี่ยนแปลง"); + + b.HasKey("Id"); + + b.HasIndex("Report2DetailHistoryId"); + + b.ToTable("Report2Histories"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.Placement", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("EndDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่สิ้นสุดบัญชี"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext") + .HasComment("รอบการสอบ"); + + b.Property("Number") + .HasMaxLength(10) + .HasColumnType("int") + .HasComment("จำนวนผู้สอบได้"); + + b.Property("PlacementTypeId") + .HasColumnType("char(36)"); + + b.Property("Round") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ครั้งที่"); + + b.Property("StartDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่เริ่มบัญชีบัญชี"); + + b.Property("Year") + .HasMaxLength(5) + .HasColumnType("int") + .HasComment("ปีงบประมาณ"); + + b.HasKey("Id"); + + b.HasIndex("PlacementTypeId"); + + b.ToTable("Placements"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementCertificate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CertificateNo") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("เลขที่ใบอนุญาต"); + + b.Property("CertificateType") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อใบอนุญาต"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("ExpireDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่หมดอายุ"); + + b.Property("IssueDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่ออกใบอนุญาต"); + + b.Property("Issuer") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("หน่วยงานผู้ออกใบอนุญาต"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("PlacementProfileId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PlacementProfileId"); + + b.ToTable("PlacementCertificates"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementEducation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Country") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("ประเทศ"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("Degree") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("วุฒิการศึกษา"); + + b.Property("Duration") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("ระยะเวลา"); + + b.Property("DurationYear") + .HasColumnType("int") + .HasComment("ระยะเวลาหลักสูตร"); + + b.Property("EducationLevelId") + .HasColumnType("char(36)"); + + b.Property("EndDate") + .HasColumnType("datetime(6)") + .HasComment("ถึง"); + + b.Property("Field") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("สาขาวิชา/ทาง"); + + b.Property("FinishDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่สำเร็จการศึกษา"); + + b.Property("FundName") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("ทุน"); + + b.Property("Gpa") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("เกรดเฉลี่ย"); + + b.Property("Institute") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("สถานศึกษา"); + + b.Property("IsDate") + .HasColumnType("tinyint(1)") + .HasComment("ประเภทช่วงเวลาการศึกษา"); + + b.Property("IsEducation") + .HasColumnType("tinyint(1)") + .HasComment("เป็นวุฒิศึกษาในตำแหน่ง"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Other") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasComment("ข้อมูลการติดต่อ"); + + b.Property("PlacementProfileId") + .HasColumnType("char(36)"); + + b.Property("PositionPathId") + .HasColumnType("char(36)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)") + .HasComment("ตั้งแต่"); + + b.HasKey("Id"); + + b.HasIndex("EducationLevelId"); + + b.HasIndex("PlacementProfileId"); + + b.HasIndex("PositionPathId"); + + b.ToTable("PlacementEducations"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementIsProperty", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ชื่อคุณสมบัติ"); + + b.HasKey("Id"); + + b.ToTable("PlacementIsProperties"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Amount") + .HasColumnType("double") + .HasComment("เงินเดือน"); + + b.Property("BloodGroupId") + .HasColumnType("char(36)"); + + b.Property("CitizenDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่ออกบัตร"); + + b.Property("CitizenDistrictId") + .HasColumnType("char(36)"); + + b.Property("CitizenId") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("เลขประจำตัวประชาชน"); + + b.Property("CitizenProvinceId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("CurrentAddress") + .HasColumnType("longtext") + .HasComment("ที่อยู่ปัจจุบัน"); + + b.Property("CurrentDistrictId") + .HasColumnType("char(36)"); + + b.Property("CurrentProvinceId") + .HasColumnType("char(36)"); + + b.Property("CurrentSubDistrictId") + .HasColumnType("char(36)"); + + b.Property("CurrentZipCode") + .HasMaxLength(10) + .HasColumnType("varchar(10)") + .HasComment("รหัสไปรษณีย์ที่อยู่ปัจจุบัน"); + + b.Property("DateOfBirth") + .HasMaxLength(40) + .HasColumnType("datetime(6)") + .HasComment("วันเกิด"); + + b.Property("Draft") + .HasColumnType("tinyint(1)") + .HasComment("ข้อมูลตำแหน่ง Draft"); + + b.Property("Email") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("อีเมล"); + + b.Property("ExamNumber") + .HasColumnType("int") + .HasComment("ลำดับที่สอบได้"); + + b.Property("ExamRound") + .HasColumnType("int") + .HasComment("จำนวนครั้งที่สมัครสอบ"); + + b.Property("FatherFirstName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อจริงบิดา"); + + b.Property("FatherLastName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุลบิดา"); + + b.Property("FatherNationality") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("สัญชาติบิดา"); + + b.Property("FatherOccupation") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("อาชีพบิดา"); + + b.Property("FatherPrefixId") + .HasColumnType("char(36)"); + + b.Property("Firstname") + .HasColumnType("longtext") + .HasComment("ชื่อ"); + + b.Property("GenderId") + .HasColumnType("char(36)"); + + b.Property("IsOfficer") + .HasColumnType("tinyint(1)") + .HasComment("ข้าราชการฯ กทม."); + + b.Property("IsProperty") + .HasColumnType("longtext") + .HasComment("การคัดกรองคุณสมบัติ"); + + b.Property("IsRelief") + .HasColumnType("tinyint(1)") + .HasComment("ผ่อนผัน"); + + b.Property("Knowledge") + .HasColumnType("longtext") + .HasComment("ความสามารถพิเศษ"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Lastname") + .HasColumnType("longtext") + .HasComment("นามสกุล"); + + b.Property("Marry") + .HasColumnType("tinyint(1)") + .HasComment("คู่สมรส"); + + b.Property("MarryFirstName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อจริงคู่สมรส"); + + b.Property("MarryLastName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุลคู่สมรส"); + + b.Property("MarryNationality") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("สัญชาติคู่สมรส"); + + b.Property("MarryOccupation") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("อาชีพคู่สมรส"); + + b.Property("MarryPrefixId") + .HasColumnType("char(36)"); + + b.Property("MobilePhone") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("โทรศัพท์มือถือ"); + + b.Property("MotherFirstName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อจริงมารดา"); + + b.Property("MotherLastName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("นามสกุลมารดา"); + + b.Property("MotherNationality") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("สัญชาติมารดา"); + + b.Property("MotherOccupation") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("อาชีพมารดา"); + + b.Property("MotherPrefixId") + .HasColumnType("char(36)"); + + b.Property("MouthSalaryAmount") + .HasColumnType("double") + .HasComment("เงินค่าตอบแทนรายเดือน"); + + b.Property("Nationality") + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasComment("สัญชาติ"); + + b.Property("Number") + .HasColumnType("int") + .HasComment("ลำดับที่สอบได้"); + + b.Property("OccupationCompany") + .HasColumnType("longtext") + .HasComment("สำนัก/บริษัท บริษัท"); + + b.Property("OccupationDepartment") + .HasColumnType("longtext") + .HasComment("กอง/ฝ่าย บริษัท"); + + b.Property("OccupationEmail") + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasComment("อีเมล บริษัท"); + + b.Property("OccupationPosition") + .HasColumnType("longtext") + .HasComment("ตำแหน่งอาชีพ"); + + b.Property("OccupationTelephone") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("โทรศัพท์ บริษัท"); + + b.Property("OccupationType") + .HasColumnType("longtext") + .HasComment("ประเภทอาชีพที่ทำงานมาก่อน"); + + b.Property("OrganizationPositionId") + .HasColumnType("char(36)"); + + b.Property("Pass") + .HasColumnType("longtext") + .HasComment("ผลสมัครสอบ"); + + b.Property("PlacementId") + .HasColumnType("char(36)"); + + b.Property("PlacementStatus") + .IsRequired() + .HasColumnType("longtext") + .HasComment("สถานะการบรรจุ"); + + b.Property("PointA") + .HasColumnType("double") + .HasComment("คะแนนภาค ก"); + + b.Property("PointB") + .HasColumnType("double") + .HasComment("คะแนนภาค ข"); + + b.Property("PointC") + .HasColumnType("double") + .HasComment("คะแนนภาค ค"); + + b.Property("PointTotalA") + .HasColumnType("double") + .HasComment("คะแนนเต็มภาค ก"); + + b.Property("PointTotalB") + .HasColumnType("double") + .HasComment("คะแนนเต็มภาค ข"); + + b.Property("PointTotalC") + .HasColumnType("double") + .HasComment("คะแนนเต็มภาค ค"); + + b.Property("PositionCandidateId") + .HasColumnType("char(36)"); + + b.Property("PositionLevelId") + .HasColumnType("char(36)"); + + b.Property("PositionLineId") + .HasColumnType("char(36)"); + + b.Property("PositionNumberId") + .HasColumnType("char(36)"); + + b.Property("PositionPathId") + .HasColumnType("char(36)"); + + b.Property("PositionPathSideId") + .HasColumnType("char(36)"); + + b.Property("PositionSalaryAmount") + .HasColumnType("double") + .HasComment("เงินประจำตำแหน่ง"); + + b.Property("PositionTypeId") + .HasColumnType("char(36)"); + + b.Property("PrefixId") + .HasColumnType("char(36)"); + + b.Property("Race") + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasComment("เชื้อชาติ"); + + b.Property("RecruitDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่บรรจุ"); + + b.Property("RegistAddress") + .HasColumnType("longtext") + .HasComment("ที่อยู่ตามทะเบียนบ้าน"); + + b.Property("RegistDistrictId") + .HasColumnType("char(36)"); + + b.Property("RegistProvinceId") + .HasColumnType("char(36)"); + + b.Property("RegistSame") + .HasColumnType("tinyint(1)") + .HasComment("ที่อยู่ปัจจุบันเหมือนที่อยู่ตามทะเบียนบ้าน"); + + b.Property("RegistSubDistrictId") + .HasColumnType("char(36)"); + + b.Property("RegistZipCode") + .HasMaxLength(10) + .HasColumnType("varchar(10)") + .HasComment("รหัสไปรษณีย์ที่อยู่ตามทะเบียนบ้าน"); + + b.Property("RejectReason") + .HasColumnType("longtext") + .HasComment("เหตุผลสละสิทธิ์"); + + b.Property("RelationshipId") + .HasColumnType("char(36)"); + + b.Property("ReliefDocId") + .HasColumnType("char(36)"); + + b.Property("ReliefReason") + .HasColumnType("longtext") + .HasComment("เหตุผลผ่อนผัน"); + + b.Property("ReligionId") + .HasColumnType("char(36)"); + + b.Property("ReportingDate") + .HasColumnType("datetime(6)") + .HasComment("วันที่รายงานตัว"); + + b.Property("SalaryClass") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง (รายละเอียด)"); + + b.Property("SalaryRef") + .HasColumnType("longtext") + .HasComment("เอกสารอ้างอิง"); + + b.Property("Telephone") + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasComment("โทรศัพท์"); + + b.HasKey("Id"); + + b.HasIndex("BloodGroupId"); + + b.HasIndex("CitizenDistrictId"); + + b.HasIndex("CitizenProvinceId"); + + b.HasIndex("CurrentDistrictId"); + + b.HasIndex("CurrentProvinceId"); + + b.HasIndex("CurrentSubDistrictId"); + + b.HasIndex("FatherPrefixId"); + + b.HasIndex("GenderId"); + + b.HasIndex("MarryPrefixId"); + + b.HasIndex("MotherPrefixId"); + + b.HasIndex("OrganizationPositionId"); + + b.HasIndex("PlacementId"); + + b.HasIndex("PositionCandidateId"); + + b.HasIndex("PositionLevelId"); + + b.HasIndex("PositionLineId"); + + b.HasIndex("PositionNumberId"); + + b.HasIndex("PositionPathId"); + + b.HasIndex("PositionPathSideId"); + + b.HasIndex("PositionTypeId"); + + b.HasIndex("PrefixId"); + + b.HasIndex("RegistDistrictId"); + + b.HasIndex("RegistProvinceId"); + + b.HasIndex("RegistSubDistrictId"); + + b.HasIndex("RelationshipId"); + + b.HasIndex("ReliefDocId"); + + b.HasIndex("ReligionId"); + + b.ToTable("PlacementProfiles"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasComment("สถานะการใช้งาน"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ชื่อประเภทบรรจุ"); + + b.HasKey("Id"); + + b.ToTable("PlacementTypes"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.PlacementCommand", b => + { + b.HasBaseType("BMA.EHR.Domain.Models.Commands.Core.Command"); + + b.Property("ConclusionRegisterDate") + .HasColumnType("datetime(6)") + .HasComment("ลงวันที่ (เรื่อง รับสมัครสอบฯ)"); + + b.Property("ConclusionRegisterNo") + .IsRequired() + .HasColumnType("longtext") + .HasComment("มติ กก. ครั้งที่ (เรื่อง รับสมัครสอบฯ)"); + + b.Property("ConclusionResultDate") + .HasColumnType("datetime(6)") + .HasComment("ลงวันที่ (เรื่อง ผลการสอบแข่งขัน)"); + + b.Property("ConclusionResultNo") + .IsRequired() + .HasColumnType("longtext") + .HasComment("มติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)"); + + b.Property("ExamRoundId") + .HasColumnType("char(36)") + .HasComment("อ้างอิงรอบการสอบ"); + + b.Property("PositionName") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ตำแหน่งที่บรรจุ"); + + b.HasDiscriminator().HasValue("PlacementCommand"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.Command", b => + { + b.HasOne("BMA.EHR.Domain.Models.Commands.Core.CommandStatus", "CommandStatus") + .WithMany() + .HasForeignKey("CommandStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Commands.Core.CommandType", "CommandType") + .WithMany() + .HasForeignKey("CommandTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CommandStatus"); + + b.Navigation("CommandType"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandDocument", b => + { + b.HasOne("BMA.EHR.Domain.Models.Commands.Core.Command", "Command") + .WithMany("Documents") + .HasForeignKey("CommandId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Command"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitTypeLeave", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.LimitLeave", "LimitLeave") + .WithMany("LimitTypeLeaves") + .HasForeignKey("LimitLeaveId"); + + b.HasOne("BMA.EHR.Domain.Models.HR.TypeLeave", "TypeLeave") + .WithMany("LimitTypeLeaves") + .HasForeignKey("TypeLeaveId"); + + b.Navigation("LimitLeave"); + + b.Navigation("TypeLeave"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.Profile", b => + { + b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Avatar") + .WithMany() + .HasForeignKey("AvatarId"); + + b.HasOne("BMA.EHR.Domain.Models.HR.LimitLeave", "LimitLeave") + .WithMany("Profiles") + .HasForeignKey("LimitLeaveId"); + + b.Navigation("Avatar"); + + b.Navigation("LimitLeave"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAbility", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Abilitys") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAbilityHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileAbility", "ProfileAbility") + .WithMany("ProfileAbilityHistorys") + .HasForeignKey("ProfileAbilityId"); + + b.Navigation("ProfileAbility"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAddressHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("AddressHistory") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAssessment", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Assessments") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAssessmentHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileAssessment", "ProfileAssessment") + .WithMany("ProfileAssessmentHistorys") + .HasForeignKey("ProfileAssessmentId"); + + b.Navigation("ProfileAssessment"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAvatarHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "AvatarFile") + .WithMany() + .HasForeignKey("AvatarFileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("AvatarHistory") + .HasForeignKey("ProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AvatarFile"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCertificate", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Certificates") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCertificateHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileCertificate", "ProfileCertificate") + .WithMany("ProfileCertificateHistorys") + .HasForeignKey("ProfileCertificateId"); + + b.Navigation("ProfileCertificate"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChangeName", b => + { + b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("ChangeNames") + .HasForeignKey("ProfileId"); + + b.Navigation("Document"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChangeNameHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileChangeName", "ProfileChangeName") + .WithMany("ProfileChangeNameHistorys") + .HasForeignKey("ProfileChangeNameId"); + + b.Navigation("Document"); + + b.Navigation("ProfileChangeName"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChildren", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Childrens") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChildrenHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileChildren", null) + .WithMany("ProfileChildrenHistorys") + .HasForeignKey("ProfileChildrenId"); + + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileFamilyHistory", null) + .WithMany("Childrens") + .HasForeignKey("ProfileFamilyHistoryId"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCoupleHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("CoupleHistory") + .HasForeignKey("ProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCurrentAddressHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("CurrentAddressHistory") + .HasForeignKey("ProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDiscipline", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Disciplines") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDisciplineHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileDiscipline", "ProfileDiscipline") + .WithMany("ProfileDisciplineHistorys") + .HasForeignKey("ProfileDisciplineId"); + + b.Navigation("ProfileDiscipline"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDuty", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Dutys") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDutyHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileDuty", "ProfileDuty") + .WithMany("ProfileDutyHistorys") + .HasForeignKey("ProfileDutyId"); + + b.Navigation("ProfileDuty"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileEducation", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Educations") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileEducationHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileEducation", "ProfileEducation") + .WithMany("ProfileEducationHistorys") + .HasForeignKey("ProfileEducationId"); + + b.Navigation("ProfileEducation"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileFamilyHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("FamilyHistory") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileFatherHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("FatherHistory") + .HasForeignKey("ProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileGovernmentHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("GovernmentHistory") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("ProfileHistory") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHonor", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Honors") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHonorHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileHonor", "ProfileHonor") + .WithMany("ProfileHonorHistorys") + .HasForeignKey("ProfileHonorId"); + + b.Navigation("ProfileHonor"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileInsignia", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Insignias") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileInsigniaHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileInsignia", "ProfileInsignia") + .WithMany("ProfileInsigniaHistorys") + .HasForeignKey("ProfileInsigniaId"); + + b.Navigation("ProfileInsignia"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileLeave", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Leaves") + .HasForeignKey("ProfileId"); + + b.HasOne("BMA.EHR.Domain.Models.HR.TypeLeave", "TypeLeave") + .WithMany() + .HasForeignKey("TypeLeaveId"); + + b.Navigation("Profile"); + + b.Navigation("TypeLeave"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileLeaveHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileLeave", "ProfileLeave") + .WithMany("ProfileLeaveHistorys") + .HasForeignKey("ProfileLeaveId"); + + b.HasOne("BMA.EHR.Domain.Models.HR.TypeLeave", "TypeLeave") + .WithMany() + .HasForeignKey("TypeLeaveId"); + + b.Navigation("ProfileLeave"); + + b.Navigation("TypeLeave"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileMotherHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("MotherHistory") + .HasForeignKey("ProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileNopaid", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Nopaids") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileNopaidHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileNopaid", "ProfileNopaid") + .WithMany("ProfileNopaidHistorys") + .HasForeignKey("ProfileNopaidId"); + + b.Navigation("ProfileNopaid"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileOther", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Others") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileOtherHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileOther", "ProfileOther") + .WithMany("ProfileOtherHistorys") + .HasForeignKey("ProfileOtherId"); + + b.Navigation("ProfileOther"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfilePaper", b => + { + b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Papers") + .HasForeignKey("ProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileRegistrationAddressHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("RegistrationAddressHistory") + .HasForeignKey("ProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalary", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Salaries") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileSalary", "ProfileSalary") + .WithMany("ProfileSalaryHistorys") + .HasForeignKey("ProfileSalaryId"); + + b.Navigation("ProfileSalary"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalaryPosition", b => + { + b.HasOne("BMA.EHR.Domain.Models.MetaData.Position", "Position") + .WithMany() + .HasForeignKey("PositionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Position"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileTraining", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany("Trainings") + .HasForeignKey("ProfileId"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileTrainingHistory", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.ProfileTraining", "ProfileTraining") + .WithMany("ProfileTrainingHistorys") + .HasForeignKey("ProfileTrainingId"); + + b.Navigation("ProfileTraining"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaRequest", b => + { + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationOrganization", "OrganizationOrganization") + .WithMany() + .HasForeignKey("OrganizationOrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Insignias.InsigniaPeriod", "Period") + .WithMany("InsigniaRequests") + .HasForeignKey("PeriodId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OrganizationOrganization"); + + b.Navigation("Period"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaRequestProfile", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany() + .HasForeignKey("ProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Insignias.InsigniaRequest", "Request") + .WithMany("RequestProfiles") + .HasForeignKey("RequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.Insignia", "RequestInsignia") + .WithMany() + .HasForeignKey("RequestInsigniaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Profile"); + + b.Navigation("Request"); + + b.Navigation("RequestInsignia"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.District", b => + { + b.HasOne("BMA.EHR.Domain.Models.MetaData.Province", "Province") + .WithMany("Districts") + .HasForeignKey("ProvinceId"); + + b.Navigation("Province"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Insignia", b => + { + b.HasOne("BMA.EHR.Domain.Models.MetaData.InsigniaType", "InsigniaType") + .WithMany() + .HasForeignKey("InsigniaTypeId"); + + b.Navigation("InsigniaType"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Position", b => + { + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionExecutiveSide", "ExecutiveSide") + .WithMany() + .HasForeignKey("ExecutiveSideId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPathSide", "PathSide") + .WithMany() + .HasForeignKey("PathSideId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLevel", "PositionLevel") + .WithMany() + .HasForeignKey("PositionLevelId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPath", "PositionPath") + .WithMany() + .HasForeignKey("PositionPathId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionType", "PositionType") + .WithMany() + .HasForeignKey("PositionTypeId"); + + b.Navigation("ExecutiveSide"); + + b.Navigation("PathSide"); + + b.Navigation("PositionLevel"); + + b.Navigation("PositionPath"); + + b.Navigation("PositionType"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.SubDistrict", b => + { + b.HasOne("BMA.EHR.Domain.Models.MetaData.District", "District") + .WithMany("SubDistricts") + .HasForeignKey("DistrictId"); + + b.Navigation("District"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", b => + { + b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", "OrganizationAgency") + .WithMany() + .HasForeignKey("OrganizationAgencyId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationFax", "OrganizationFax") + .WithMany() + .HasForeignKey("OrganizationFaxId"); + + b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", "OrganizationGovernmentAgency") + .WithMany() + .HasForeignKey("OrganizationGovernmentAgencyId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationLevel", "OrganizationLevel") + .WithMany() + .HasForeignKey("OrganizationLevelId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationOrganization", "OrganizationOrganization") + .WithMany() + .HasForeignKey("OrganizationOrganizationId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationShortName", "OrganizationShortName") + .WithMany() + .HasForeignKey("OrganizationShortNameId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationTelExternal", "OrganizationTelExternal") + .WithMany() + .HasForeignKey("OrganizationTelExternalId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationTelInternal", "OrganizationTelInternal") + .WithMany() + .HasForeignKey("OrganizationTelInternalId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationType", "OrganizationType") + .WithMany() + .HasForeignKey("OrganizationTypeId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionEmployeeLine", "PositionEmployeeLine") + .WithMany() + .HasForeignKey("PositionEmployeeLineId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionEmployeePosition", "PositionEmployeePosition") + .WithMany() + .HasForeignKey("PositionEmployeePositionId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionEmployeeStatus", "PositionEmployeeStatus") + .WithMany() + .HasForeignKey("PositionEmployeeStatusId"); + + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany() + .HasForeignKey("ProfileId"); + + b.Navigation("OrganizationAgency"); + + b.Navigation("OrganizationFax"); + + b.Navigation("OrganizationGovernmentAgency"); + + b.Navigation("OrganizationLevel"); + + b.Navigation("OrganizationOrganization"); + + b.Navigation("OrganizationShortName"); + + b.Navigation("OrganizationTelExternal"); + + b.Navigation("OrganizationTelInternal"); + + b.Navigation("OrganizationType"); + + b.Navigation("PositionEmployeeLine"); + + b.Navigation("PositionEmployeePosition"); + + b.Navigation("PositionEmployeeStatus"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeeLevel", b => + { + b.HasOne("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", "OrganizationEmployee") + .WithMany("OrganizationPositionEmployeeLevels") + .HasForeignKey("OrganizationEmployeeId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionEmployeeLevel", "PositionEmployeeLevel") + .WithMany() + .HasForeignKey("PositionEmployeeLevelId"); + + b.Navigation("OrganizationEmployee"); + + b.Navigation("PositionEmployeeLevel"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeePositionSide", b => + { + b.HasOne("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", "OrganizationEmployee") + .WithMany("OrganizationPositionEmployeePositionSides") + .HasForeignKey("OrganizationEmployeeId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionEmployeePositionSide", "PositionEmployeePositionSide") + .WithMany() + .HasForeignKey("PositionEmployeePositionSideId"); + + b.Navigation("OrganizationEmployee"); + + b.Navigation("PositionEmployeePositionSide"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.AvailablePositionLevelEntity", b => + { + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLevel", "PositionLevel") + .WithMany() + .HasForeignKey("PositionLevelId"); + + b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", "PositionMaster") + .WithMany() + .HasForeignKey("PositionMasterId"); + + b.Navigation("PositionLevel"); + + b.Navigation("PositionMaster"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", b => + { + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationFax", "OrganizationFax") + .WithMany() + .HasForeignKey("OrganizationFaxId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationLevel", "OrganizationLevel") + .WithMany() + .HasForeignKey("OrganizationLevelId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationOrganization", "OrganizationOrganization") + .WithMany() + .HasForeignKey("OrganizationOrganizationId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationShortName", "OrganizationShortName") + .WithMany() + .HasForeignKey("OrganizationShortNameId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationStatus", "OrganizationStatus") + .WithMany() + .HasForeignKey("OrganizationStatusId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationTelExternal", "OrganizationTelExternal") + .WithMany() + .HasForeignKey("OrganizationTelExternalId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationTelInternal", "OrganizationTelInternal") + .WithMany() + .HasForeignKey("OrganizationTelInternalId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationType", "OrganizationType") + .WithMany() + .HasForeignKey("OrganizationTypeId"); + + b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", "Parent") + .WithMany("Organizations") + .HasForeignKey("ParentId"); + + b.Navigation("OrganizationFax"); + + b.Navigation("OrganizationLevel"); + + b.Navigation("OrganizationOrganization"); + + b.Navigation("OrganizationShortName"); + + b.Navigation("OrganizationStatus"); + + b.Navigation("OrganizationTelExternal"); + + b.Navigation("OrganizationTelInternal"); + + b.Navigation("OrganizationType"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationPositionEntity", b => + { + b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", "Organization") + .WithMany() + .HasForeignKey("OrganizationId"); + + b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", "PositionMaster") + .WithMany() + .HasForeignKey("PositionMasterId"); + + b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionNumberEntity", "PositionNumber") + .WithMany() + .HasForeignKey("PositionNumberId"); + + b.Navigation("Organization"); + + b.Navigation("PositionMaster"); + + b.Navigation("PositionNumber"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", b => + { + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionExecutive", "PositionExecutive") + .WithMany() + .HasForeignKey("PositionExecutiveId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionExecutiveSide", "PositionExecutiveSide") + .WithMany() + .HasForeignKey("PositionExecutiveSideId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLine", "PositionLine") + .WithMany() + .HasForeignKey("PositionLineId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPath", "PositionPath") + .WithMany() + .HasForeignKey("PositionPathId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPathSide", "PositionPathSide") + .WithMany() + .HasForeignKey("PositionPathSideId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionStatus", "PositionStatus") + .WithMany() + .HasForeignKey("PositionStatusId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionType", "PositionType") + .WithMany() + .HasForeignKey("PositionTypeId"); + + b.Navigation("PositionExecutive"); + + b.Navigation("PositionExecutiveSide"); + + b.Navigation("PositionLine"); + + b.Navigation("PositionPath"); + + b.Navigation("PositionPathSide"); + + b.Navigation("PositionStatus"); + + b.Navigation("PositionType"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionMasterHistoryEntity", b => + { + b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", "PositionMasterEntity") + .WithMany("PositionMasterHistorys") + .HasForeignKey("PositionMasterEntityId"); + + b.Navigation("PositionMasterEntity"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionNumberEntity", b => + { + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationShortName", "OrganizationShortName") + .WithMany() + .HasForeignKey("OrganizationShortNameId"); + + b.Navigation("OrganizationShortName"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.ProfilePosition", b => + { + b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationPositionEntity", "OrganizationPosition") + .WithMany() + .HasForeignKey("OrganizationPositionId"); + + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany() + .HasForeignKey("ProfileId"); + + b.Navigation("OrganizationPosition"); + + b.Navigation("Profile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.Report2.Report2History", b => + { + b.HasOne("BMA.EHR.Domain.Models.Organizations.Report2.Report2DetailHistory", "Report2DetailHistory") + .WithMany() + .HasForeignKey("Report2DetailHistoryId"); + + b.Navigation("Report2DetailHistory"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.Placement", b => + { + b.HasOne("BMA.EHR.Domain.Models.Placement.PlacementType", "PlacementType") + .WithMany() + .HasForeignKey("PlacementTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PlacementType"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementCertificate", b => + { + b.HasOne("BMA.EHR.Domain.Models.Placement.PlacementProfile", "PlacementProfile") + .WithMany("PlacementCertificates") + .HasForeignKey("PlacementProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PlacementProfile"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementEducation", b => + { + b.HasOne("BMA.EHR.Domain.Models.MetaData.EducationLevel", "EducationLevel") + .WithMany() + .HasForeignKey("EducationLevelId"); + + b.HasOne("BMA.EHR.Domain.Models.Placement.PlacementProfile", "PlacementProfile") + .WithMany("PlacementEducations") + .HasForeignKey("PlacementProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPath", "PositionPath") + .WithMany() + .HasForeignKey("PositionPathId"); + + b.Navigation("EducationLevel"); + + b.Navigation("PlacementProfile"); + + b.Navigation("PositionPath"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementProfile", b => + { + b.HasOne("BMA.EHR.Domain.Models.MetaData.BloodGroup", "BloodGroup") + .WithMany() + .HasForeignKey("BloodGroupId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.District", "CitizenDistrict") + .WithMany() + .HasForeignKey("CitizenDistrictId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.Province", "CitizenProvince") + .WithMany() + .HasForeignKey("CitizenProvinceId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.District", "CurrentDistrict") + .WithMany() + .HasForeignKey("CurrentDistrictId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.Province", "CurrentProvince") + .WithMany() + .HasForeignKey("CurrentProvinceId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.SubDistrict", "CurrentSubDistrict") + .WithMany() + .HasForeignKey("CurrentSubDistrictId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.Prefix", "FatherPrefix") + .WithMany() + .HasForeignKey("FatherPrefixId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.Gender", "Gender") + .WithMany() + .HasForeignKey("GenderId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.Prefix", "MarryPrefix") + .WithMany() + .HasForeignKey("MarryPrefixId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.Prefix", "MotherPrefix") + .WithMany() + .HasForeignKey("MotherPrefixId"); + + b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationPositionEntity", "OrganizationPosition") + .WithMany() + .HasForeignKey("OrganizationPositionId"); + + b.HasOne("BMA.EHR.Domain.Models.Placement.Placement", "Placement") + .WithMany("PlacementProfiles") + .HasForeignKey("PlacementId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPath", "PositionCandidate") + .WithMany() + .HasForeignKey("PositionCandidateId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLevel", "PositionLevel") + .WithMany() + .HasForeignKey("PositionLevelId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLine", "PositionLine") + .WithMany() + .HasForeignKey("PositionLineId"); + + b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionNumberEntity", "PositionNumber") + .WithMany() + .HasForeignKey("PositionNumberId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPath", "PositionPath") + .WithMany() + .HasForeignKey("PositionPathId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPathSide", "PositionPathSide") + .WithMany() + .HasForeignKey("PositionPathSideId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionType", "PositionType") + .WithMany() + .HasForeignKey("PositionTypeId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.Prefix", "Prefix") + .WithMany() + .HasForeignKey("PrefixId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.District", "RegistDistrict") + .WithMany() + .HasForeignKey("RegistDistrictId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.Province", "RegistProvince") + .WithMany() + .HasForeignKey("RegistProvinceId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.SubDistrict", "RegistSubDistrict") + .WithMany() + .HasForeignKey("RegistSubDistrictId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.Relationship", "Relationship") + .WithMany() + .HasForeignKey("RelationshipId"); + + b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "ReliefDoc") + .WithMany() + .HasForeignKey("ReliefDocId"); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.Religion", "Religion") + .WithMany() + .HasForeignKey("ReligionId"); + + b.Navigation("BloodGroup"); + + b.Navigation("CitizenDistrict"); + + b.Navigation("CitizenProvince"); + + b.Navigation("CurrentDistrict"); + + b.Navigation("CurrentProvince"); + + b.Navigation("CurrentSubDistrict"); + + b.Navigation("FatherPrefix"); + + b.Navigation("Gender"); + + b.Navigation("MarryPrefix"); + + b.Navigation("MotherPrefix"); + + b.Navigation("OrganizationPosition"); + + b.Navigation("Placement"); + + b.Navigation("PositionCandidate"); + + b.Navigation("PositionLevel"); + + b.Navigation("PositionLine"); + + b.Navigation("PositionNumber"); + + b.Navigation("PositionPath"); + + b.Navigation("PositionPathSide"); + + b.Navigation("PositionType"); + + b.Navigation("Prefix"); + + b.Navigation("RegistDistrict"); + + b.Navigation("RegistProvince"); + + b.Navigation("RegistSubDistrict"); + + b.Navigation("Relationship"); + + b.Navigation("ReliefDoc"); + + b.Navigation("Religion"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.Command", b => + { + b.Navigation("Documents"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitLeave", b => + { + b.Navigation("LimitTypeLeaves"); + + b.Navigation("Profiles"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.Profile", b => + { + b.Navigation("Abilitys"); + + b.Navigation("AddressHistory"); + + b.Navigation("Assessments"); + + b.Navigation("AvatarHistory"); + + b.Navigation("Certificates"); + + b.Navigation("ChangeNames"); + + b.Navigation("Childrens"); + + b.Navigation("CoupleHistory"); + + b.Navigation("CurrentAddressHistory"); + + b.Navigation("Disciplines"); + + b.Navigation("Dutys"); + + b.Navigation("Educations"); + + b.Navigation("FamilyHistory"); + + b.Navigation("FatherHistory"); + + b.Navigation("GovernmentHistory"); + + b.Navigation("Honors"); + + b.Navigation("Insignias"); + + b.Navigation("Leaves"); + + b.Navigation("MotherHistory"); + + b.Navigation("Nopaids"); + + b.Navigation("Others"); + + b.Navigation("Papers"); + + b.Navigation("ProfileHistory"); + + b.Navigation("RegistrationAddressHistory"); + + b.Navigation("Salaries"); + + b.Navigation("Trainings"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAbility", b => + { + b.Navigation("ProfileAbilityHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAssessment", b => + { + b.Navigation("ProfileAssessmentHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileCertificate", b => + { + b.Navigation("ProfileCertificateHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChangeName", b => + { + b.Navigation("ProfileChangeNameHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileChildren", b => + { + b.Navigation("ProfileChildrenHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDiscipline", b => + { + b.Navigation("ProfileDisciplineHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileDuty", b => + { + b.Navigation("ProfileDutyHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileEducation", b => + { + b.Navigation("ProfileEducationHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileFamilyHistory", b => + { + b.Navigation("Childrens"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileHonor", b => + { + b.Navigation("ProfileHonorHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileInsignia", b => + { + b.Navigation("ProfileInsigniaHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileLeave", b => + { + b.Navigation("ProfileLeaveHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileNopaid", b => + { + b.Navigation("ProfileNopaidHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileOther", b => + { + b.Navigation("ProfileOtherHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalary", b => + { + b.Navigation("ProfileSalaryHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileTraining", b => + { + b.Navigation("ProfileTrainingHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.HR.TypeLeave", b => + { + b.Navigation("LimitTypeLeaves"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaPeriod", b => + { + b.Navigation("InsigniaRequests"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaRequest", b => + { + b.Navigation("RequestProfiles"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.District", b => + { + b.Navigation("SubDistricts"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.Province", b => + { + b.Navigation("Districts"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", b => + { + b.Navigation("OrganizationPositionEmployeeLevels"); + + b.Navigation("OrganizationPositionEmployeePositionSides"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", b => + { + b.Navigation("Organizations"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionMasterEntity", b => + { + b.Navigation("PositionMasterHistorys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.Placement", b => + { + b.Navigation("PlacementProfiles"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementProfile", b => + { + b.Navigation("PlacementCertificates"); + + b.Navigation("PlacementEducations"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/BMA.EHR.Infrastructure/Migrations/20230719025522_Update table PlacementProfile add positioncandidate.cs b/BMA.EHR.Infrastructure/Migrations/20230719025522_Update table PlacementProfile add positioncandidate.cs new file mode 100644 index 00000000..3cb14007 --- /dev/null +++ b/BMA.EHR.Infrastructure/Migrations/20230719025522_Update table PlacementProfile add positioncandidate.cs @@ -0,0 +1,50 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace BMA.EHR.Infrastructure.Migrations +{ + /// + public partial class UpdatetablePlacementProfileaddpositioncandidate : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "PositionCandidateId", + table: "PlacementProfiles", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + + migrationBuilder.CreateIndex( + name: "IX_PlacementProfiles_PositionCandidateId", + table: "PlacementProfiles", + column: "PositionCandidateId"); + + migrationBuilder.AddForeignKey( + name: "FK_PlacementProfiles_PositionPaths_PositionCandidateId", + table: "PlacementProfiles", + column: "PositionCandidateId", + principalTable: "PositionPaths", + principalColumn: "Id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_PlacementProfiles_PositionPaths_PositionCandidateId", + table: "PlacementProfiles"); + + migrationBuilder.DropIndex( + name: "IX_PlacementProfiles_PositionCandidateId", + table: "PlacementProfiles"); + + migrationBuilder.DropColumn( + name: "PositionCandidateId", + table: "PlacementProfiles"); + } + } +} diff --git a/BMA.EHR.Infrastructure/Migrations/ApplicationDBContextModelSnapshot.cs b/BMA.EHR.Infrastructure/Migrations/ApplicationDBContextModelSnapshot.cs index 28df20e8..f798a768 100644 --- a/BMA.EHR.Infrastructure/Migrations/ApplicationDBContextModelSnapshot.cs +++ b/BMA.EHR.Infrastructure/Migrations/ApplicationDBContextModelSnapshot.cs @@ -4820,6 +4820,252 @@ namespace BMA.EHR.Infrastructure.Migrations b.ToTable("TypeLeaves"); }); + modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaPeriod", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Amount") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("varchar(10)"); + + b.Property("Year") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("InsigniaPeriods"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaRequest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("OrganizationOrganizationId") + .HasColumnType("char(36)"); + + b.Property("PeriodId") + .HasColumnType("char(36)"); + + b.Property("RequestNote") + .IsRequired() + .HasColumnType("text"); + + b.Property("RequestStatus") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationOrganizationId"); + + b.HasIndex("PeriodId"); + + b.ToTable("InsigniaRequests"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaRequestProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(100) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(104) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(101) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("DocumentStatus") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("IsApprove") + .HasColumnType("tinyint(1)"); + + b.Property("LastUpdateFullName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)") + .HasColumnOrder(105) + .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdateUserId") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnOrder(103) + .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)") + .HasColumnOrder(102) + .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ"); + + b.Property("MatchingConditions") + .IsRequired() + .HasColumnType("text"); + + b.Property("Note") + .IsRequired() + .HasColumnType("text"); + + b.Property("ProfileId") + .HasColumnType("char(36)"); + + b.Property("QualificationStatus") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("RequestDate") + .HasColumnType("datetime(6)"); + + b.Property("RequestId") + .HasColumnType("char(36)"); + + b.Property("RequestInsigniaId") + .HasColumnType("char(36)"); + + b.Property("Salary") + .HasColumnType("decimal(65,30)"); + + b.Property("Special") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("ProfileId"); + + b.HasIndex("RequestId"); + + b.HasIndex("RequestInsigniaId"); + + b.ToTable("InsigniaRequestProfiles"); + }); + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.BloodGroup", b => { b.Property("Id") @@ -9551,6 +9797,10 @@ namespace BMA.EHR.Infrastructure.Migrations .HasColumnType("datetime(6)") .HasComment("วันเกิด"); + b.Property("Draft") + .HasColumnType("tinyint(1)") + .HasComment("ข้อมูลตำแหน่ง Draft"); + b.Property("Email") .HasMaxLength(200) .HasColumnType("varchar(200)") @@ -9766,6 +10016,9 @@ namespace BMA.EHR.Infrastructure.Migrations .HasColumnType("double") .HasComment("คะแนนเต็มภาค ค"); + b.Property("PositionCandidateId") + .HasColumnType("char(36)"); + b.Property("PositionLevelId") .HasColumnType("char(36)"); @@ -9882,6 +10135,8 @@ namespace BMA.EHR.Infrastructure.Migrations b.HasIndex("PlacementId"); + b.HasIndex("PositionCandidateId"); + b.HasIndex("PositionLevelId"); b.HasIndex("PositionLineId"); @@ -10510,6 +10765,52 @@ namespace BMA.EHR.Infrastructure.Migrations b.Navigation("ProfileTraining"); }); + modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaRequest", b => + { + b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationOrganization", "OrganizationOrganization") + .WithMany() + .HasForeignKey("OrganizationOrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Insignias.InsigniaPeriod", "Period") + .WithMany("InsigniaRequests") + .HasForeignKey("PeriodId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OrganizationOrganization"); + + b.Navigation("Period"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaRequestProfile", b => + { + b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile") + .WithMany() + .HasForeignKey("ProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Insignias.InsigniaRequest", "Request") + .WithMany("RequestProfiles") + .HasForeignKey("RequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.MetaData.Insignia", "RequestInsignia") + .WithMany() + .HasForeignKey("RequestInsigniaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Profile"); + + b.Navigation("Request"); + + b.Navigation("RequestInsignia"); + }); + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.District", b => { b.HasOne("BMA.EHR.Domain.Models.MetaData.Province", "Province") @@ -10956,6 +11257,10 @@ namespace BMA.EHR.Infrastructure.Migrations .WithMany("PlacementProfiles") .HasForeignKey("PlacementId"); + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPath", "PositionCandidate") + .WithMany() + .HasForeignKey("PositionCandidateId"); + b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLevel", "PositionLevel") .WithMany() .HasForeignKey("PositionLevelId"); @@ -11032,6 +11337,8 @@ namespace BMA.EHR.Infrastructure.Migrations b.Navigation("Placement"); + b.Navigation("PositionCandidate"); + b.Navigation("PositionLevel"); b.Navigation("PositionLine"); @@ -11211,6 +11518,16 @@ namespace BMA.EHR.Infrastructure.Migrations b.Navigation("LimitTypeLeaves"); }); + modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaPeriod", b => + { + b.Navigation("InsigniaRequests"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaRequest", b => + { + b.Navigation("RequestProfiles"); + }); + modelBuilder.Entity("BMA.EHR.Domain.Models.MetaData.District", b => { b.Navigation("SubDistricts"); diff --git a/BMA.EHR.Infrastructure/Persistence/ApplicationDBContext.cs b/BMA.EHR.Infrastructure/Persistence/ApplicationDBContext.cs index 146abe6a..1f696d23 100644 --- a/BMA.EHR.Infrastructure/Persistence/ApplicationDBContext.cs +++ b/BMA.EHR.Infrastructure/Persistence/ApplicationDBContext.cs @@ -10,6 +10,7 @@ using BMA.EHR.Domain.Models.Placement; using Microsoft.EntityFrameworkCore; using BMA.EHR.Domain.Models.Commands.Core; using BMA.EHR.Domain.Models.Commands; +using BMA.EHR.Domain.Models.Insignias; namespace BMA.EHR.Infrastructure.Persistence { @@ -281,6 +282,16 @@ namespace BMA.EHR.Infrastructure.Persistence #endregion + #region " Insignia " + + public DbSet InsigniaPeriods { get; set; } + + public DbSet InsigniaRequests { get; set; } + + public DbSet InsigniaRequestProfiles { get; set; } + + #endregion + public ApplicationDBContext(DbContextOptions options) : base(options) { } diff --git a/BMA.EHR.Insignia.Service/BMA.EHR.Insignia.Service.csproj b/BMA.EHR.Insignia.Service/BMA.EHR.Insignia.Service.csproj new file mode 100644 index 00000000..2a1bcb62 --- /dev/null +++ b/BMA.EHR.Insignia.Service/BMA.EHR.Insignia.Service.csproj @@ -0,0 +1,41 @@ + + + + net7.0 + enable + enable + 93677512-b64b-4a19-9e7d-dd283c7ec901 + Linux + True + . + BMA.EHR.Insignia.Service + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + + + + + diff --git a/BMA.EHR.Insignia.Service/ConfigureSwaggerOptions.cs b/BMA.EHR.Insignia.Service/ConfigureSwaggerOptions.cs new file mode 100644 index 00000000..d3d5fec3 --- /dev/null +++ b/BMA.EHR.Insignia.Service/ConfigureSwaggerOptions.cs @@ -0,0 +1,84 @@ +using Microsoft.AspNetCore.Mvc.ApiExplorer; +using Microsoft.Extensions.Options; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; +using System.Reflection; + +namespace BMA.EHR.Insignia.Service +{ + public class ConfigureSwaggerOptions : IConfigureNamedOptions + { + private readonly IApiVersionDescriptionProvider _provider; + + public ConfigureSwaggerOptions( + IApiVersionDescriptionProvider provider) + { + _provider = provider; + } + + public void Configure(SwaggerGenOptions options) + { + // add swagger document for every API version discovered + foreach (var description in _provider.ApiVersionDescriptions) + { + options.EnableAnnotations(); + + options.SwaggerDoc( + description.GroupName, + CreateVersionInfo(description)); + } + + options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme + { + In = ParameterLocation.Header, + Description = "Please enter a valid token", + Name = "Authorization", + Type = SecuritySchemeType.Http, + BearerFormat = "JWT", + Scheme = "Bearer" + }); + + options.AddSecurityRequirement(new OpenApiSecurityRequirement + { + { + new OpenApiSecurityScheme + { + Reference = new OpenApiReference + { + Type = ReferenceType.SecurityScheme, + Id = "Bearer" + } + }, + new string[]{} + } + }); + + // generate the XML docs that'll drive the swagger docs + var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml"; + var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); + options.IncludeXmlComments(xmlPath); + } + + public void Configure(string name, SwaggerGenOptions options) + { + Configure(options); + } + + private OpenApiInfo CreateVersionInfo( + ApiVersionDescription desc) + { + var info = new OpenApiInfo() + { + Title = "BMA EHR Insignia Service Document", + Version = desc.ApiVersion.ToString() + }; + + if (desc.IsDeprecated) + { + info.Description += " This API version has been deprecated. Please use one of the new APIs available from the explorer."; + } + + return info; + } + } +} diff --git a/BMA.EHR.Insignia.Service/Controllers/InsigniaPeriodController.cs b/BMA.EHR.Insignia.Service/Controllers/InsigniaPeriodController.cs new file mode 100644 index 00000000..9dbae085 --- /dev/null +++ b/BMA.EHR.Insignia.Service/Controllers/InsigniaPeriodController.cs @@ -0,0 +1,150 @@ +using System.Security.Claims; +using BMA.EHR.Application.Repositories; +using BMA.EHR.Application.Requests; +using BMA.EHR.Domain.Common; +using BMA.EHR.Domain.Models.Insignias; +using BMA.EHR.Domain.Shared; +using BMA.EHR.Infrastructure.Persistence; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Swashbuckle.AspNetCore.Annotations; + +namespace BMA.EHR.Insignia.Service.Controllers +{ + [Route("api/v{version:apiVersion}/insignia/period")] + [ApiVersion("1.0")] + [ApiController] + [Produces("application/json")] + [Authorize] + [SwaggerTag("รอบเครื่องราช")] + public class InsigniaPeriodController : BaseController + { + private readonly ApplicationDBContext _context; + private readonly MinIOService _documentService; + private readonly IHttpContextAccessor _httpContextAccessor; + private readonly InsigniaPeriodsRepository _repository; + + public InsigniaPeriodController(ApplicationDBContext context, + MinIOService documentService, + InsigniaPeriodsRepository repository, + IHttpContextAccessor httpContextAccessor) + { + _context = context; + _documentService = documentService; + _repository = repository; + _httpContextAccessor = httpContextAccessor; + } + + #region " Properties " + + private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value; + + private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value; + + #endregion + + [HttpGet("{type}")] + public async Task> GetList(string type) + { + var data = _context.InsigniaPeriods.AsQueryable() + .Where(x => x.Type == type) + .OrderByDescending(x => x.Year) + .ThenByDescending(x => x.StartDate) + .Select(p => new + { + period_id = p.Id, + period_amount = p.Amount, + period_name = p.Name, + period_start = p.StartDate, + period_end = p.EndDate, + period_status = _repository.CalStatusByDate(p.StartDate, p.EndDate, p.Year.ToString()), + period_year = p.Year + }) + .ToList(); + + return Success(data); + } + + [HttpGet("{id:length(36)}")] + public async Task> GetById(Guid id) + { + var data = _context.InsigniaPeriods.AsQueryable() + .Where(x => x.Id == id) + .Select(p => new + { + period_id = p.Id, + period_amount = p.Amount, + period_name = p.Name, + period_start = p.StartDate, + period_end = p.EndDate, + period_status = _repository.CalStatusByDate(p.StartDate, p.EndDate, p.Year.ToString()), + period_year = p.Year, + docs = new List() + }) + .FirstOrDefault(); + + return Success(data); + } + + [HttpPost("{type}")] + public async Task> Post([FromBody] InsigniaPeriodRequest req, string type) + { + if (req == null) + return BadRequest(); + + var period = new InsigniaPeriod + { + Name = req.Name, + Year = req.Year, + StartDate = req.StartDate, + EndDate = req.EndDate, + Amount = req.Amount, + Type = type + }; + + _context.InsigniaPeriods.Add(period); + _context.SaveChanges(); + + return Success(); + } + + [HttpDelete("{id:length(36)}")] + public async Task> Delete(Guid id) + { + var deleted = _context.InsigniaPeriods.AsQueryable() + .FirstOrDefault(x => x.Id == id); + + if (deleted == null) + return NotFound(); + + _context.InsigniaPeriods.Remove(deleted); + _context.SaveChanges(); + + return Success(); + } + + [HttpPut("{type}/{id:length(36)}")] + public async Task> Put([FromBody] InsigniaPeriodRequest req, Guid id, string type) + { + if (req == null) + return BadRequest(); + + var uppdated = _context.InsigniaPeriods.AsQueryable() + .FirstOrDefault(x => x.Id == id); + + if (uppdated == null) + return NotFound(); + + uppdated.Name = req.Name; + uppdated.Year = req.Year; + uppdated.StartDate = req.StartDate; + uppdated.EndDate = req.EndDate; + uppdated.Amount = req.Amount; + uppdated.Type = type; + + _context.SaveChanges(); + + return Success(); + } + } +} \ No newline at end of file diff --git a/BMA.EHR.Insignia.Service/Controllers/InsigniaReceiveController.cs b/BMA.EHR.Insignia.Service/Controllers/InsigniaReceiveController.cs new file mode 100644 index 00000000..58430844 --- /dev/null +++ b/BMA.EHR.Insignia.Service/Controllers/InsigniaReceiveController.cs @@ -0,0 +1,213 @@ +using System.Security.Claims; +using BMA.EHR.Application.Repositories; +using BMA.EHR.Application.Requests; +using BMA.EHR.Domain.Common; +using BMA.EHR.Domain.Models.Insignias; +using BMA.EHR.Domain.Shared; +using BMA.EHR.Infrastructure.Persistence; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Swashbuckle.AspNetCore.Annotations; + +namespace BMA.EHR.Insignia.Service.Controllers +{ + [Route("api/v{version:apiVersion}/insignia/receive")] + [ApiVersion("1.0")] + [ApiController] + [Produces("application/json")] + [Authorize] + [SwaggerTag("เครื่องราช")] + public class InsigniaReceiveController : BaseController + { + private readonly ApplicationDBContext _context; + private readonly MinIOService _documentService; + private readonly IHttpContextAccessor _httpContextAccessor; + private readonly InsigniaPeriodsRepository _repository; + + public InsigniaReceiveController(ApplicationDBContext context, + MinIOService documentService, + InsigniaPeriodsRepository repository, + IHttpContextAccessor httpContextAccessor) + { + _context = context; + _documentService = documentService; + _repository = repository; + _httpContextAccessor = httpContextAccessor; + } + + [HttpGet("{type}/{ocId:length(36)}")] + public async Task> GetInsigniaList(string type, Guid ocId) + { + var result = _repository.GetInsigniaRequest(type, ocId); + + if (result == null) + { + return NotFound(); + } + else + { + // var request = _context.InsigniaRequestProfiles + // .Include(x => x.Request) + // .ThenInclude(x => x.Period) + // .Include(x => x.RequestInsignia) + // .ThenInclude(x => x.InsigniaType) + // .Include(x => x.Profile) + // .ThenInclude(x => x.AcademicStanding) + // .Include(x => x.Profile) + // .ThenInclude(x => x.Position) + // .Include(x => x.Profile) + // .ThenInclude(x => x.Insignias) + // .ThenInclude(x => x.Insignia) + // .ThenInclude(x => x.InsigniaType) + // .Include(x => x.Profile) + // .ThenInclude(x => x.PositionNumber) + // .Where(x => x.Request.Period.Id == result.PeriodId) + // .Where(x => x.Request.RequestStatus == "st5p") + // .Where(x => x.IsApprove) + // .Select(p => new + // { + // Profile = p.Profile.Id, + // Name = $"{p.Profile.Prefix} {p.Profile.FirstName} {p.Profile.LastName}", + // Insignia = p.RequestInsignia, + // Type = p.RequestInsignia.InsigniaType, + // IsApprove = p.IsApprove, + // InsigniaId = p.RequestInsignia.Id, + // Year = p.Request.Period.Year, + // Special = p.Special, + // LastInsignia = p.Profile.Insignias.AsQueryable() + // .Include(x => x.Insignia) + // .Where(x => x.Insignia.Id == p.RequestInsignia.Id) + // .Where(x => x.Year == p.Request.Period.Year) + // .FirstOrDefault() + // }) + // .ToList() + // .Select(r => new InsigniaReceiveResponse + // { + // Profile = r.Profile, + // Name = r.Name, + // Insignia = r.Insignia.Name, + // TypeId = r.Type == null ? null : r.Type.Id, + // TypeName = r.Type == null ? "" : r.Type.Description, + // IsApprove = r.IsApprove, + // InsigniaId = r.InsigniaId, + // InsigniaPage = r.LastInsignia == null ? "" : r.LastInsignia.Page, + // InsigniaNo = r.LastInsignia == null ? "" : r.LastInsignia.No, + // InsigniaIssue = r.LastInsignia == null ? "" : r.LastInsignia.Issue, + // InsigniaVolumeno = r.LastInsignia == null ? "" : r.LastInsignia.VolumeNo, + // InsigniaVolume = r.LastInsignia == null ? "" : r.LastInsignia.Volume, + // InsigniaSection = r.LastInsignia == null ? "" : r.LastInsignia.Section, + // InsigniaDatereceive = r.LastInsignia == null ? null : r.LastInsignia.DateReceive, + // InsigniaDateannounce = r.LastInsignia == null ? null : r.LastInsignia.DateAnnounce, + // Special = r.Special + // }) + // .ToList() + // .GroupBy(r => new { r.TypeId, r.TypeName }) + // .Select(r => new + // { + // TypeId = r.Key.TypeId, + // InsigniaIssue = r.Where(r => r.InsigniaIssue != "").FirstOrDefault() != null ? r.Where(r => r.InsigniaIssue != "").FirstOrDefault().InsigniaIssue : "", + // InsigniaVolumeno = r.Where(r => r.InsigniaIssue != "").FirstOrDefault() != null ? r.Where(r => r.InsigniaIssue != "").FirstOrDefault().InsigniaVolumeno : null, + // InsigniaVolume = r.Where(r => r.InsigniaIssue != "").FirstOrDefault() != null ? r.Where(r => r.InsigniaIssue != "").FirstOrDefault().InsigniaVolume : "", + // InsigniaSection = r.Where(r => r.InsigniaIssue != "").FirstOrDefault() != null ? r.Where(r => r.InsigniaIssue != "").FirstOrDefault().InsigniaSection : "", + // InsigniaDatereceive = r.Where(r => r.InsigniaIssue != "").FirstOrDefault() != null ? r.Where(r => r.InsigniaIssue != "").FirstOrDefault().InsigniaDatereceive : null, + // InsigniaDateannounce = r.Where(r => r.InsigniaIssue != "").FirstOrDefault() != null ? r.Where(r => r.InsigniaIssue != "").FirstOrDefault().InsigniaDateannounce : null, + // TypeName = r.Key.TypeName, + // Profile = r.Select(r => new + // { + // Profile = r.Profile, + // Name = r.Name, + // Insignia = r.Insignia, + // InsigniaId = r.InsigniaId, + // InsigniaPage = r.InsigniaPage, + // InsigniaNo = r.InsigniaNo, + // //Special = bool.Parse(r.Special) + // }).ToList(), + // Docs = new List() + // }); + + return Success(); + // return Success(request); + } + } + + + [HttpPost("{type}")] + public async Task> SaveToProfile([FromBody] SaveToProfileRequest items, string type) + { + var item = new Kp7Item + { + InsigniaDatereceive = items.InsigniaDatereceive, + InsigniaLevel = items.InsigniaLevel, + InsigniaIssue = items.InsigniaIssue, + InsigniaVolumeno = items.InsigniaVolumeno, + InsigniaVolume = items.InsigniaVolume, + InsigniaSection = items.InsigniaSection, + InsigniaDateannounce = items.InsigniaDateannounce + }; + + if (items.Profile.Count() != 0) + { + // foreach (var i in items.Profile) + // { + // var profile = _context.Profiles.AsQueryable() + // .Include(x => x.Insignias) + // .ThenInclude(x => x.Insignia) + // .Where(x => x.Id == i.FkProfileId) + // .FirstOrDefault(); + // if (profile != null) + // { + // var kp7 = profile.Insignias.AsQueryable() + // .Where(x => x.Insignia.Id == i.Kp7InsigniaId) + // .FirstOrDefault(); + + // if (kp7 != null) + // { + // // exit item update to database + // kp7.DateReceive = items.InsigniaDatereceive.Value; + // kp7.Level = items.InsigniaLevel; + // kp7.Issue = items.InsigniaIssue; + // kp7.VolumeNo = items.InsigniaVolumeno.Value.ToString(); + // kp7.Volume = items.InsigniaVolume; + // kp7.Section = items.InsigniaSection; + // kp7.DateAnnounce = items.InsigniaDateannounce.Value; + // kp7.Page = i.InsigniaPage; + // kp7.No = i.InsigniaNo; + // } + // else + // { + // // insert new item to kp7 + // var insignia_item = _context.Insignias.FirstOrDefault(x => x.Id == i.Kp7InsigniaId); + // var result = _repository.GetInsigniaRequest(type, items.OCId); + + // var period = _context.InsigniaPeriods.FirstOrDefault(x => x.Id == result.PeriodId); + + // kp7 = new Models.HR.ProfileInsignia + // { + // Order = profile.Insignias.ToList().Count + 1, + // Year = period.Year, + // Insignia = insignia_item, + // DateReceive = items.InsigniaDatereceive.Value, + // DateStamp = DateTime.Now, + // Level = items.InsigniaLevel, + // Issue = items.InsigniaIssue, + // VolumeNo = items.InsigniaVolumeno.Value.ToString(), + // Volume = items.InsigniaVolume, + // Section = items.InsigniaSection, + // DateAnnounce = items.InsigniaDateannounce.Value, + // Page = i.InsigniaPage, + // No = i.InsigniaNo, + // }; + // profile.Insignias.Add(kp7); + // } + // } + // else + // return NotFound("Profile not found!!!"); + // } + } + _context.SaveChanges(); + + return Success(); + } + + } +} diff --git a/BMA.EHR.Insignia.Service/Controllers/InsigniaRequestController.cs b/BMA.EHR.Insignia.Service/Controllers/InsigniaRequestController.cs new file mode 100644 index 00000000..344ce509 --- /dev/null +++ b/BMA.EHR.Insignia.Service/Controllers/InsigniaRequestController.cs @@ -0,0 +1,509 @@ +using System.Security.Claims; +using BMA.EHR.Application.Repositories; +using BMA.EHR.Application.Requests; +using BMA.EHR.Domain.Common; +using BMA.EHR.Domain.Models.Insignias; +using BMA.EHR.Domain.Shared; +using BMA.EHR.Infrastructure.Persistence; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using Newtonsoft.Json; +using Swashbuckle.AspNetCore.Annotations; + +namespace BMA.EHR.Insignia.Service.Controllers +{ + [Route("api/v{version:apiVersion}/insignia/request")] + [ApiVersion("1.0")] + [ApiController] + [Produces("application/json")] + [Authorize] + [SwaggerTag("เครื่องราช")] + public class InsigniaRequestController : BaseController + { + private readonly ApplicationDBContext _context; + private readonly MinIOService _documentService; + private readonly IHttpContextAccessor _httpContextAccessor; + private readonly InsigniaPeriodsRepository _repository; + private readonly string Royal_Type = "Royal"; + + public InsigniaRequestController(ApplicationDBContext context, + MinIOService documentService, + InsigniaPeriodsRepository repository, + IHttpContextAccessor httpContextAccessor) + { + _context = context; + _documentService = documentService; + _repository = repository; + _httpContextAccessor = httpContextAccessor; + } + + #region " Private " + + private static string GetRequestlStatusText(string status) + { + switch (status.ToLower()) + { + case "st1": return "จัดทำรายชื่อ"; + case "st2": return "รอ ผอ. โรงเรียนรับรอง"; + case "st3": return "รอเจ้าหน้าที่เขตตรวจสอบ"; + case "st3p": return "รอนำเสนอผู้อำนวยการเขต"; + case "st4": return "รอเสนอสำนักการศึกษา"; + case "st5": return "รอเจ้าหน้าที่ สนศ. ตรวจสอบ"; + case "st5p": return "เจ้าหน้าที่ สนศ. ตรวจสอบแล้ว"; + case "pending": return "รอออกคำสั่ง"; + case "finish": return "ออกคำสั่งแล้ว"; + default: return "สถานะไม่ถูกต้อง"; + } + } + + #endregion + + #region " ดึงเครื่องราชฯ ล่าสุดของครู (GetInsigniaLast) " + private InsigniaItem GetInsigniaLast(Guid? id) + { + var insignia = _context.Insignias.AsQueryable() + .Where(i => id != null ? i.Id == id : i.Name.Contains("ตริตาภรณ์มงกุฎไทย")).Select(i => new InsigniaItem + { + Id = i.Id, + Name = i.Name, + ShortName = i.ShortName, + Level = i.InsigniaType == null ? null : i.InsigniaType.Name, + LevelId = i.InsigniaType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : i.InsigniaType.Id + }).FirstOrDefault(); + + return insignia; + } + #endregion + + #region " จัดทำรายชื่อครูที่มีสิทธิในการยืนขอเครื่องราชฯ " + + [HttpGet("old/{role}/{ocId:length(36)}")] + public async Task> GetInsignaiRequest(Guid ocId, string role) + { + var result = await _repository.GetInsigniaRequest(Royal_Type, ocId); + if (result != null) + { + Guid period = result.PeriodId; + string periodName = result.Name; + string requestStatus = result.RequestStatus; + var resend = new InsigniaResults + { + PeriodId = period, + Year = result.Year, + Name = periodName, + RequestStatus = requestStatus, + OrganizationName = result.OrganizationName, + Items = new List() + }; + var candidate = _repository.GetInsigniaCandidate(period, ocId); + + // ตรวจสอบว่ารายการอยู่ใน table insignia_request_new + if (requestStatus == null) + { + // บันทึกรายชื่อ + _repository.InsertCandidate(period, ocId, candidate); + } + if (role == "officer") + { + resend.Items = _repository.InsigniaHasProfile(period, ocId); + return Success(resend); + } + else + { + var passData = _context.InsigniaRequests.AsQueryable() + .Include(x => x.OrganizationOrganization) + .Include(x => x.RequestProfiles) + .Where(x => x.OrganizationOrganization.Id == ocId) + .Where(x => x.Period.Id == period) + .Select(ir => new + { + requstID = ir.Id, + requstStatus = ir.RequestStatus, + requstStatusName = GetRequestlStatusText(ir.RequestStatus), + fkInstituteId = -1, + fkDivisionId = ir.OrganizationOrganization.Id, + fkDivision = ir.OrganizationOrganization.Name, + fkInstitute = "", + fkPeriodId = ir.Period.Id, + insigniaRequestHasProfile = ir.RequestProfiles.AsQueryable() + .Include(x => x.Profile) + .ThenInclude(x => x.Position) + .Include(x => x.Profile) + // .ThenInclude(x => x.PositionNumber) + .Include(x => x.Profile) + // .ThenInclude(x => x.AcademicStanding) + .Include(x => x.RequestInsignia) + .ThenInclude(x => x.InsigniaType) + .Select(irp => new + { + request_id = irp.Request.Id, + isApprove = irp.IsApprove, + statusInstitute = irp.IsApprove.ToString(), + request_date = irp.RequestDate, + profileId = irp.Profile.Id, + // prefix = irp.Profile.Prefix, + firstname = irp.Profile.FirstName, + lastname = irp.Profile.LastName, + // posno = irp.Profile.PositionNumber.Id, + type = irp.Profile.ProfileType, + // position = irp.Profile.Position.Name, + // rank = irp.Profile.AcademicStanding.Name, + instituteName = "", + instituteId = -1, + // divisionName = irp.Profile.OrganizationOrganization.Name, + // divisionId = irp.Profile.OrganizationOrganization.Id, + lastInsigniaName = "", + requestInsigniaLevel = irp.RequestInsignia.InsigniaType == null ? null : irp.RequestInsignia.InsigniaType.Name, + requestInsigniaName = irp.RequestInsignia.Name, + requestQua = irp.QualificationStatus, + requestDoc = irp.DocumentStatus, + requestNote = irp.Note, + requestSalary = irp.Salary, + }) + .Where(x => x.isApprove) + .OrderBy(y => y.profileId) + .ToList() + }) + .ToList() + .FirstOrDefault(); + + var failData = _context.InsigniaRequests.AsQueryable() + .Include(x => x.OrganizationOrganization) + .Include(x => x.RequestProfiles) + .Where(x => x.OrganizationOrganization.Id == ocId) + .Where(x => x.Period.Id == period) + .Select(ir => new + { + requstID = ir.Id, + requstStatus = ir.RequestStatus, + requstStatusName = GetRequestlStatusText(ir.RequestStatus), + fkInstituteId = -1, + fkDivisionId = ir.OrganizationOrganization.Id, + fkDivision = ir.OrganizationOrganization.Name, + fkInstitute = "", + fkPeriodId = ir.Period.Id, + insigniaRequestHasProfile = ir.RequestProfiles.AsQueryable() + .Include(x => x.Profile) + .ThenInclude(x => x.Position) + .Include(x => x.Profile) + // .ThenInclude(x => x.PositionNumber) + .Include(x => x.Profile) + // .ThenInclude(x => x.AcademicStanding) + .Include(x => x.RequestInsignia) + .ThenInclude(x => x.InsigniaType) + .Select(irp => new + { + request_id = irp.Request.Id, + isApprove = irp.IsApprove, + statusInstitute = irp.IsApprove.ToString(), + request_date = irp.RequestDate, + profileId = irp.Profile.Id, + // prefix = irp.Profile.Prefix, + firstname = irp.Profile.FirstName, + lastname = irp.Profile.LastName, + // posno = irp.Profile.PositionNumber.Id, + type = irp.Profile.ProfileType, + // position = irp.Profile.Position.Name, + // rank = irp.Profile.AcademicStanding.Name, + instituteName = "", + instituteId = -1, + // divisionName = irp.Profile.OrganizationOrganization.Name, + // divisionId = irp.Profile.OrganizationOrganization.Id, + lastInsigniaName = "", + requestInsigniaLevel = irp.RequestInsignia.InsigniaType == null ? null : irp.RequestInsignia.InsigniaType.Name, + requestInsigniaName = irp.RequestInsignia.Name, + requestQua = irp.QualificationStatus, + requestDoc = irp.DocumentStatus, + requestNote = irp.Note, + requestSalary = irp.Salary, + }) + .Where(x => !x.isApprove) + .OrderBy(y => y.profileId) + .ToList() + }) + .ToList() + .FirstOrDefault(); + + var period_data = (from p in _context.InsigniaPeriods.AsQueryable() + where p.Id == period + select new + { + periodName = p.Name, + periodYear = p.Year, + }).FirstOrDefault(); + + return Success(new { passData = passData, failData = failData, period = period_data }); + } + // select data to display + } + return Success(); + } + + [HttpGet("{role}/{ocId:length(36)}")] + public async Task> GetInsignaiRequestBkk(Guid ocId, string role) + { + var result = await _repository.GetInsigniaRequest(Royal_Type, ocId); + if (result != null) + { + Guid period = result.PeriodId; + string periodName = result.Name; + string requestStatus = result.RequestStatus; + var resend = new InsigniaResults + { + PeriodId = period, + Year = result.Year, + Name = periodName, + RequestStatus = requestStatus, + OrganizationName = result.OrganizationName, + Items = new List() + }; + var candidate = _repository.GetInsigniaCandidateBKK(period, ocId); + + // ตรวจสอบว่ารายการอยู่ใน table insignia_request_new + if (requestStatus == null) + { + // บันทึกรายชื่อ + _repository.InsertCandidate(period, ocId, candidate); + } + if (role == "officer") + { + resend.Items = _repository.InsigniaHasProfile(period, ocId); + return Success(resend); + + } + else + { + var passData = _context.InsigniaRequests.AsQueryable() + .Include(x => x.OrganizationOrganization) + .Include(x => x.RequestProfiles) + .Where(x => x.OrganizationOrganization.Id == ocId) + .Where(x => x.Period.Id == period) + .Select(ir => new + { + requstID = ir.Id, + requstStatus = ir.RequestStatus, + requstStatusName = GetRequestlStatusText(ir.RequestStatus), + fkInstituteId = -1, + fkDivisionId = ir.OrganizationOrganization.Id, + fkDivision = ir.OrganizationOrganization.Name, + fkInstitute = "", + fkPeriodId = ir.Period.Id, + insigniaRequestHasProfile = ir.RequestProfiles.AsQueryable() + .Include(x => x.Profile) + .ThenInclude(x => x.Position) + .Include(x => x.Profile) + // .ThenInclude(x => x.PositionNumber) + .Include(x => x.Profile) + // .ThenInclude(x => x.AcademicStanding) + .Include(x => x.RequestInsignia) + .ThenInclude(x => x.InsigniaType) + .Select(irp => new + { + request_id = irp.Request.Id, + isApprove = irp.IsApprove, + statusInstitute = irp.IsApprove.ToString(), + request_date = irp.RequestDate, + profileId = irp.Profile.Id, + // prefix = irp.Profile.Prefix, + firstname = irp.Profile.FirstName, + lastname = irp.Profile.LastName, + // posno = irp.Profile.PositionNumber.Id, + type = irp.Profile.ProfileType, + // position = irp.Profile.Position.Name, + // rank = $"{irp.Profile.PositionType.Name}/{irp.Profile.PositionLevel.Name}", + instituteName = "", + instituteId = -1, + // divisionName = irp.Profile.OrganizationOrganization.Name, + // divisionId = irp.Profile.OrganizationOrganization.Id, + lastInsigniaName = "", + requestInsigniaLevel = irp.RequestInsignia.InsigniaType.Name, + requestInsigniaName = irp.RequestInsignia.Name, + requestQua = irp.QualificationStatus, + requestDoc = irp.DocumentStatus, + requestNote = irp.Note, + requestSalary = irp.Salary, + matchingConditions = JsonConvert.DeserializeObject>(irp.MatchingConditions) + }) + .Where(x => x.isApprove) + .OrderBy(y => y.profileId) + .ToList() + }) + .ToList() + .FirstOrDefault(); + + var failData = _context.InsigniaRequests.AsQueryable() + .Include(x => x.OrganizationOrganization) + .Include(x => x.RequestProfiles) + .Where(x => x.OrganizationOrganization.Id == ocId) + .Where(x => x.Period.Id == period) + .Select(ir => new + { + requstID = ir.Id, + requstStatus = ir.RequestStatus, + requstStatusName = GetRequestlStatusText(ir.RequestStatus), + fkInstituteId = -1, + fkDivisionId = ir.OrganizationOrganization.Id, + fkDivision = ir.OrganizationOrganization.Name, + fkInstitute = "", + fkPeriodId = ir.Period.Id, + insigniaRequestHasProfile = ir.RequestProfiles.AsQueryable() + .Include(x => x.Profile) + .ThenInclude(x => x.Position) + .Include(x => x.Profile) + // .ThenInclude(x => x.PositionNumber) + .Include(x => x.Profile) + // .ThenInclude(x => x.AcademicStanding) + .Include(x => x.RequestInsignia) + .ThenInclude(x => x.InsigniaType) + .Select(irp => new + { + request_id = irp.Request.Id, + isApprove = irp.IsApprove, + statusInstitute = irp.IsApprove.ToString(), + request_date = irp.RequestDate, + profileId = irp.Profile.Id, + // prefix = irp.Profile.Prefix, + firstname = irp.Profile.FirstName, + lastname = irp.Profile.LastName, + // posno = irp.Profile.PositionNumber.Id, + type = irp.Profile.ProfileType, + // position = irp.Profile.Position.Name, + // rank = irp.Profile.AcademicStanding.Name, + instituteName = "", + instituteId = -1, + // divisionName = irp.Profile.OrganizationOrganization.Name, + // divisionId = irp.Profile.OrganizationOrganization.Id, + lastInsigniaName = "", + requestInsigniaLevel = irp.RequestInsignia.InsigniaType.Name, + requestInsigniaName = irp.RequestInsignia.Name, + requestQua = irp.QualificationStatus, + requestDoc = irp.DocumentStatus, + requestNote = irp.Note, + requestSalary = irp.Salary, + matchingConditions = JsonConvert.DeserializeObject>(irp.MatchingConditions) + }) + .Where(x => !x.isApprove) + .OrderBy(y => y.profileId) + .ToList() + }) + .ToList() + .FirstOrDefault(); + + var period_data = (from p in _context.InsigniaPeriods.AsQueryable() + where p.Id == period + select new + { + periodName = p.Name, + periodYear = p.Year, + }).FirstOrDefault(); + + return Success(new { passData = passData, failData = failData, period = period_data }); + } + // select data to display + } + + return Success(); + } + + #endregion + + #region " บันทึกหมายเหตุ " + + [HttpPut("note/{profileId}")] + public async Task> SaveNote(Guid profileId, SaveRequsetNote items) + { + var id = await _repository.GetRequestId(items.PeriodId, items.OcId); + var note = _context.InsigniaRequestProfiles.AsQueryable() + .Where(d => d.Profile.Id == profileId && d.Request.Id == id).FirstOrDefault(); + if (note != null) + note.Note = items.Note; + _context.SaveChanges(); + return Success(); + } + + #endregion + + #region " บันทึกรายชื่อครูในการขอยื่นเครื่องราชฯ เเต่ยังไม่ส่งไปยัง ผอ.โรงเรียน " + + [HttpPut("approve/{ocId:length(36)}")] + public async Task> SaveRequestList(Guid ocId, InsigniaApproveRequest items) + { + var result = await _repository.GetInsigniaRequest(Royal_Type, ocId); + if (result != null) + await _repository.SaveAprove(result.PeriodId, ocId, items); + return Success(); + } + + #endregion + + #region " เปลี่ยน status เป็น st2 รอ ผอ.สำนักรับรอง " + + [HttpPost("status/officer/send/{ocId:length(36)}")] + public async Task> ChangeStatusToSt2(Guid ocId, InsigniaApproveRequest items) + { + var result = await _repository.GetInsigniaRequest(Royal_Type, ocId); + + if (items != null) + { + _repository.SaveAprove(result.PeriodId, ocId, items); + } + var requestId = await _repository.GetRequestId(result.PeriodId, ocId); + var requestNew = await _context.InsigniaRequests.FirstOrDefaultAsync(i => i.Id == requestId); + if (requestNew != null) + { + requestNew.RequestStatus = "st2"; + _context.SaveChanges(); + return Success(); + } + else + return Error(GlobalMessages.InvalidInsigniaRequest); + } + + #endregion + + #region " เปลี่ยน status สำหรับ ผอ.สำนัก " + + [HttpPost("status/director/approve/{ocId:length(36)}")] + public async Task> ChangeStatusToSt5p(Guid ocId) + { + var result = await _repository.GetInsigniaRequest(Royal_Type, ocId); + if (result == null) + return Error(GlobalMessages.InvalidInsigniaRequest); + var requestId = await _repository.GetRequestId(result.PeriodId, ocId); + if (requestId == null) + return Error(GlobalMessages.InvalidInsigniaRequest); + var requestNew = await _context.InsigniaRequests.FirstOrDefaultAsync(i => i.Id == requestId); + if (requestNew != null) + { + requestNew.RequestStatus = "st5p"; + _context.SaveChanges(); + return Success(); + } + else + return Error(GlobalMessages.InvalidInsigniaRequest); + } + + [HttpPost("status/director/reject/{ocId:length(36)}")] + public async Task> ChangeStatusToSt1(Guid ocId) + { + var result = await _repository.GetInsigniaRequest(Royal_Type, ocId); + if (result == null) + return Error(GlobalMessages.InvalidInsigniaRequest); + var requestId = await _repository.GetRequestId(result.PeriodId, ocId); + if (requestId == null) + return Error(GlobalMessages.InvalidInsigniaRequest); + var requestNew = await _context.InsigniaRequests.FirstOrDefaultAsync(i => i.Id == requestId); + if (requestNew != null) + { + requestNew.RequestStatus = "st1"; + _context.SaveChanges(); + return Success(); + } + else + return Error(GlobalMessages.InvalidInsigniaRequest); + } + + #endregion + } +} diff --git a/BMA.EHR.Insignia.Service/Dockerfile b/BMA.EHR.Insignia.Service/Dockerfile new file mode 100644 index 00000000..e636d2f1 --- /dev/null +++ b/BMA.EHR.Insignia.Service/Dockerfile @@ -0,0 +1,27 @@ +#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base +WORKDIR /app +EXPOSE 80 +EXPOSE 443 + +FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build +WORKDIR /src + +COPY ["BMA.EHR.Domain/BMA.EHR.Domain.csproj", "BMA.EHR.Domain/"] +COPY ["BMA.EHR.Application/BMA.EHR.Application.csproj", "BMA.EHR.Application/"] +COPY ["BMA.EHR.Infrastructure/BMA.EHR.Infrastructure.csproj", "BMA.EHR.Infrastructure/"] +COPY ["BMA.EHR.Insignia.Service/BMA.EHR.Insignia.Service.csproj", "BMA.EHR.Insignia.Service/"] + +RUN dotnet restore "BMA.EHR.Insignia.Service/BMA.EHR.Insignia.Service.csproj" +COPY . . +WORKDIR "/src/BMA.EHR.Insignia.Service" +RUN dotnet build "BMA.EHR.Insignia.Service.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "BMA.EHR.Insignia.Service.csproj" -c Release -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "BMA.EHR.Insignia.Service.dll"] \ No newline at end of file diff --git a/BMA.EHR.Insignia.Service/Program.cs b/BMA.EHR.Insignia.Service/Program.cs new file mode 100644 index 00000000..c27d5942 --- /dev/null +++ b/BMA.EHR.Insignia.Service/Program.cs @@ -0,0 +1,161 @@ +using BMA.EHR.Application; +using BMA.EHR.Domain.Middlewares; +using BMA.EHR.Infrastructure; +using BMA.EHR.Infrastructure.Persistence; +using BMA.EHR.Insignia.Service; +using Microsoft.AspNetCore.Authentication.JwtBearer; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.ApiExplorer; +using Microsoft.AspNetCore.Mvc.Versioning; +using Microsoft.EntityFrameworkCore; +using Microsoft.IdentityModel.Logging; +using Microsoft.IdentityModel.Tokens; +using Serilog; +using Serilog.Exceptions; +using Serilog.Sinks.Elasticsearch; +using System.Reflection; +using System.Text; + +var builder = WebApplication.CreateBuilder(args); +{ + var issuer = builder.Configuration["Jwt:Issuer"]; + var key = builder.Configuration["Jwt:Key"]; + + + IdentityModelEventSource.ShowPII = true; + + builder.Services.AddHttpContextAccessor(); + + builder.Services.AddApiVersioning(opt => + { + opt.DefaultApiVersion = new ApiVersion(1, 0); + opt.AssumeDefaultVersionWhenUnspecified = true; + opt.ReportApiVersions = true; + opt.ApiVersionReader = ApiVersionReader.Combine(new UrlSegmentApiVersionReader(), + new HeaderApiVersionReader("x-api-version"), + new MediaTypeApiVersionReader("x-api-version")); + }); + + builder.Services.AddVersionedApiExplorer(setup => + { + setup.GroupNameFormat = "'v'VVV"; + setup.SubstituteApiVersionInUrl = true; + }); + + builder.Services.AddEndpointsApiExplorer(); + + // Authorization + builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(opt => + { + opt.RequireHttpsMetadata = false; //false for dev + opt.Authority = issuer; + opt.TokenValidationParameters = new() + { + ValidateIssuer = true, + ValidateAudience = false, + ValidateLifetime = true, + ValidateIssuerSigningKey = true, + ValidIssuer = issuer, + IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(key)) + }; + }); + builder.Services.AddAuthorization(); + + // use serilog + ConfigureLogs(); + builder.Host.UseSerilog(); + + // Add config CORS + builder.Services.AddCors(options => options.AddDefaultPolicy(builder => + { + builder + .AllowAnyOrigin() + .AllowAnyMethod() + .AllowAnyHeader() + .SetIsOriginAllowedToAllowWildcardSubdomains(); + })); + + + // Add services to the container. + builder.Services.AddApplication(); + builder.Services.AddPersistence(builder.Configuration); + + builder.Services.AddControllers(options => + { + options.SuppressAsyncSuffixInActionNames = false; + }) + .AddNewtonsoftJson(x => x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore); + + builder.Services.AddSwaggerGen(); + builder.Services.ConfigureOptions(); + + builder.Services.AddHealthChecks(); +} + +var app = builder.Build(); +{ + var apiVersionDescriptionProvider = app.Services.GetRequiredService(); + + if (app.Environment.IsDevelopment()) + { + app.UseSwagger(); + app.UseSwaggerUI(options => + { + foreach (var description in apiVersionDescriptionProvider.ApiVersionDescriptions) + { + options.SwaggerEndpoint($"/swagger/{description.GroupName}/swagger.json", + description.GroupName.ToUpperInvariant()); + } + }); + } + + app.MapHealthChecks("/health"); + + + app.UseHttpsRedirection(); + app.UseCors(); + app.UseAuthentication(); + app.UseAuthorization(); + app.UseDefaultFiles(); + app.UseStaticFiles(); + app.MapControllers(); + app.UseMiddleware(); + + // apply migrations + await using var scope = app.Services.CreateAsyncScope(); + await using var db = scope.ServiceProvider.GetRequiredService(); + await db.Database.MigrateAsync(); + + app.Run(); +} + +void ConfigureLogs() +{ + var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); + var configuration = new ConfigurationBuilder() + .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) + .AddJsonFile( + $"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", + optional: true) + .Build(); + + Log.Logger = new LoggerConfiguration() + .Enrich.FromLogContext() + .MinimumLevel.Error() + .WriteTo.Console() + .Enrich.WithExceptionDetails() + .WriteTo.Elasticsearch(ConfigureElasticSink(configuration, environment ?? "")) + .Enrich.WithProperty("Environment", environment) + .ReadFrom.Configuration(configuration) + .CreateLogger(); +} + +ElasticsearchSinkOptions ConfigureElasticSink(IConfigurationRoot configuration, string environment) +{ + return new ElasticsearchSinkOptions(new Uri(configuration["ElasticConfiguration:Uri"] ?? "")) + { + AutoRegisterTemplate = true, + IndexFormat = $"{Assembly.GetExecutingAssembly()?.GetName()?.Name?.ToLower().Replace(".", "-")}-{environment?.ToLower().Replace(".", "-")}" + }; +} + diff --git a/BMA.EHR.Insignia.Service/Properties/launchSettings.json b/BMA.EHR.Insignia.Service/Properties/launchSettings.json new file mode 100644 index 00000000..2a0b5552 --- /dev/null +++ b/BMA.EHR.Insignia.Service/Properties/launchSettings.json @@ -0,0 +1,48 @@ +{ + "profiles": { + "http": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:5014" + }, + "https": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": true, + "applicationUrl": "https://localhost:7270;http://localhost:5014" + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", + "publishAllPorts": true, + "useSSL": true + } + }, + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:11516", + "sslPort": 44362 + } + } +} \ No newline at end of file diff --git a/BMA.EHR.Insignia.Service/appsettings.Development.json b/BMA.EHR.Insignia.Service/appsettings.Development.json new file mode 100644 index 00000000..0c208ae9 --- /dev/null +++ b/BMA.EHR.Insignia.Service/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/BMA.EHR.Insignia.Service/appsettings.json b/BMA.EHR.Insignia.Service/appsettings.json new file mode 100644 index 00000000..a06ebbd5 --- /dev/null +++ b/BMA.EHR.Insignia.Service/appsettings.json @@ -0,0 +1,35 @@ +{ + "Serilog": { + "MinimumLevel": { + "Default": "Information", + "Override": { + "Microsoft": "Information", + "System": "Warning" + } + } + }, + "ElasticConfiguration": { + "Uri": "http://localhost:9200" + }, + "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;" + }, + "Jwt": { + "Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI", + "Issuer": "https://identity.frappet.com/realms/bma-ehr" + }, + "EPPlus": { + "ExcelPackage": { + "LicenseContext": "NonCommercial" + } + }, + "MinIO": { + "Endpoint": "https://s3.frappet.com/", + "AccessKey": "frappet", + "SecretKey": "P@ssw0rd", + "BucketName": "bma-recruit" + }, + "Protocol": "HTTPS" +} diff --git a/BMA.EHR.Insignia.Service/nuget.config b/BMA.EHR.Insignia.Service/nuget.config new file mode 100644 index 00000000..33b28ffd --- /dev/null +++ b/BMA.EHR.Insignia.Service/nuget.config @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/BMA.EHR.Insignia.Service/wwwroot/index.html b/BMA.EHR.Insignia.Service/wwwroot/index.html new file mode 100644 index 00000000..ece944ac --- /dev/null +++ b/BMA.EHR.Insignia.Service/wwwroot/index.html @@ -0,0 +1,184 @@ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ +

Result

+

+
+    

Events

+

+
+
+    
+
+
\ No newline at end of file
diff --git a/BMA.EHR.Insignia.Service/wwwroot/keycloak.js b/BMA.EHR.Insignia.Service/wwwroot/keycloak.js
new file mode 100644
index 00000000..936a3c3c
--- /dev/null
+++ b/BMA.EHR.Insignia.Service/wwwroot/keycloak.js
@@ -0,0 +1,1766 @@
+/*
+ * Copyright 2016 Red Hat, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+(function(root, factory) {
+    if ( typeof exports === 'object' ) {
+        if ( typeof module === 'object' ) {
+            module.exports = factory( require("js-sha256"), require("base64-js") );
+        } else {
+            exports["keycloak"] = factory( require("js-sha256"), require("base64-js") );
+        }
+    } else {
+        /**
+        * [js-sha256]{@link https://github.com/emn178/js-sha256}
+        *
+        * @version 0.9.0
+        * @author Chen, Yi-Cyuan [emn178@gmail.com]
+        * @copyright Chen, Yi-Cyuan 2014-2017
+        * @license MIT
+        */
+        !function () { "use strict"; function t(t, i) { i ? (d[0] = d[16] = d[1] = d[2] = d[3] = d[4] = d[5] = d[6] = d[7] = d[8] = d[9] = d[10] = d[11] = d[12] = d[13] = d[14] = d[15] = 0, this.blocks = d) : this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], t ? (this.h0 = 3238371032, this.h1 = 914150663, this.h2 = 812702999, this.h3 = 4144912697, this.h4 = 4290775857, this.h5 = 1750603025, this.h6 = 1694076839, this.h7 = 3204075428) : (this.h0 = 1779033703, this.h1 = 3144134277, this.h2 = 1013904242, this.h3 = 2773480762, this.h4 = 1359893119, this.h5 = 2600822924, this.h6 = 528734635, this.h7 = 1541459225), this.block = this.start = this.bytes = this.hBytes = 0, this.finalized = this.hashed = !1, this.first = !0, this.is224 = t } function i(i, r, s) { var e, n = typeof i; if ("string" === n) { var o, a = [], u = i.length, c = 0; for (e = 0; e < u; ++e)(o = i.charCodeAt(e)) < 128 ? a[c++] = o : o < 2048 ? (a[c++] = 192 | o >> 6, a[c++] = 128 | 63 & o) : o < 55296 || o >= 57344 ? (a[c++] = 224 | o >> 12, a[c++] = 128 | o >> 6 & 63, a[c++] = 128 | 63 & o) : (o = 65536 + ((1023 & o) << 10 | 1023 & i.charCodeAt(++e)), a[c++] = 240 | o >> 18, a[c++] = 128 | o >> 12 & 63, a[c++] = 128 | o >> 6 & 63, a[c++] = 128 | 63 & o); i = a } else { if ("object" !== n) throw new Error(h); if (null === i) throw new Error(h); if (f && i.constructor === ArrayBuffer) i = new Uint8Array(i); else if (!(Array.isArray(i) || f && ArrayBuffer.isView(i))) throw new Error(h) } i.length > 64 && (i = new t(r, !0).update(i).array()); var y = [], p = []; for (e = 0; e < 64; ++e) { var l = i[e] || 0; y[e] = 92 ^ l, p[e] = 54 ^ l } t.call(this, r, s), this.update(p), this.oKeyPad = y, this.inner = !0, this.sharedMemory = s } var h = "input is invalid type", r = "object" == typeof window, s = r ? window : {}; s.JS_SHA256_NO_WINDOW && (r = !1); var e = !r && "object" == typeof self, n = !s.JS_SHA256_NO_NODE_JS && "object" == typeof process && process.versions && process.versions.node; n ? s = global : e && (s = self); var o = !s.JS_SHA256_NO_COMMON_JS && "object" == typeof module && module.exports, a = "function" == typeof define && define.amd, f = !s.JS_SHA256_NO_ARRAY_BUFFER && "undefined" != typeof ArrayBuffer, u = "0123456789abcdef".split(""), c = [-2147483648, 8388608, 32768, 128], y = [24, 16, 8, 0], p = [1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298], l = ["hex", "array", "digest", "arrayBuffer"], d = []; !s.JS_SHA256_NO_NODE_JS && Array.isArray || (Array.isArray = function (t) { return "[object Array]" === Object.prototype.toString.call(t) }), !f || !s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW && ArrayBuffer.isView || (ArrayBuffer.isView = function (t) { return "object" == typeof t && t.buffer && t.buffer.constructor === ArrayBuffer }); var A = function (i, h) { return function (r) { return new t(h, !0).update(r)[i]() } }, w = function (i) { var h = A("hex", i); n && (h = b(h, i)), h.create = function () { return new t(i) }, h.update = function (t) { return h.create().update(t) }; for (var r = 0; r < l.length; ++r) { var s = l[r]; h[s] = A(s, i) } return h }, b = function (t, i) { var r = eval("require('crypto')"), s = eval("require('buffer').Buffer"), e = i ? "sha224" : "sha256", n = function (i) { if ("string" == typeof i) return r.createHash(e).update(i, "utf8").digest("hex"); if (null === i || void 0 === i) throw new Error(h); return i.constructor === ArrayBuffer && (i = new Uint8Array(i)), Array.isArray(i) || ArrayBuffer.isView(i) || i.constructor === s ? r.createHash(e).update(new s(i)).digest("hex") : t(i) }; return n }, v = function (t, h) { return function (r, s) { return new i(r, h, !0).update(s)[t]() } }, _ = function (t) { var h = v("hex", t); h.create = function (h) { return new i(h, t) }, h.update = function (t, i) { return h.create(t).update(i) }; for (var r = 0; r < l.length; ++r) { var s = l[r]; h[s] = v(s, t) } return h }; t.prototype.update = function (t) { if (!this.finalized) { var i, r = typeof t; if ("string" !== r) { if ("object" !== r) throw new Error(h); if (null === t) throw new Error(h); if (f && t.constructor === ArrayBuffer) t = new Uint8Array(t); else if (!(Array.isArray(t) || f && ArrayBuffer.isView(t))) throw new Error(h); i = !0 } for (var s, e, n = 0, o = t.length, a = this.blocks; n < o;) { if (this.hashed && (this.hashed = !1, a[0] = this.block, a[16] = a[1] = a[2] = a[3] = a[4] = a[5] = a[6] = a[7] = a[8] = a[9] = a[10] = a[11] = a[12] = a[13] = a[14] = a[15] = 0), i) for (e = this.start; n < o && e < 64; ++n)a[e >> 2] |= t[n] << y[3 & e++]; else for (e = this.start; n < o && e < 64; ++n)(s = t.charCodeAt(n)) < 128 ? a[e >> 2] |= s << y[3 & e++] : s < 2048 ? (a[e >> 2] |= (192 | s >> 6) << y[3 & e++], a[e >> 2] |= (128 | 63 & s) << y[3 & e++]) : s < 55296 || s >= 57344 ? (a[e >> 2] |= (224 | s >> 12) << y[3 & e++], a[e >> 2] |= (128 | s >> 6 & 63) << y[3 & e++], a[e >> 2] |= (128 | 63 & s) << y[3 & e++]) : (s = 65536 + ((1023 & s) << 10 | 1023 & t.charCodeAt(++n)), a[e >> 2] |= (240 | s >> 18) << y[3 & e++], a[e >> 2] |= (128 | s >> 12 & 63) << y[3 & e++], a[e >> 2] |= (128 | s >> 6 & 63) << y[3 & e++], a[e >> 2] |= (128 | 63 & s) << y[3 & e++]); this.lastByteIndex = e, this.bytes += e - this.start, e >= 64 ? (this.block = a[16], this.start = e - 64, this.hash(), this.hashed = !0) : this.start = e } return this.bytes > 4294967295 && (this.hBytes += this.bytes / 4294967296 << 0, this.bytes = this.bytes % 4294967296), this } }, t.prototype.finalize = function () { if (!this.finalized) { this.finalized = !0; var t = this.blocks, i = this.lastByteIndex; t[16] = this.block, t[i >> 2] |= c[3 & i], this.block = t[16], i >= 56 && (this.hashed || this.hash(), t[0] = this.block, t[16] = t[1] = t[2] = t[3] = t[4] = t[5] = t[6] = t[7] = t[8] = t[9] = t[10] = t[11] = t[12] = t[13] = t[14] = t[15] = 0), t[14] = this.hBytes << 3 | this.bytes >>> 29, t[15] = this.bytes << 3, this.hash() } }, t.prototype.hash = function () { var t, i, h, r, s, e, n, o, a, f = this.h0, u = this.h1, c = this.h2, y = this.h3, l = this.h4, d = this.h5, A = this.h6, w = this.h7, b = this.blocks; for (t = 16; t < 64; ++t)i = ((s = b[t - 15]) >>> 7 | s << 25) ^ (s >>> 18 | s << 14) ^ s >>> 3, h = ((s = b[t - 2]) >>> 17 | s << 15) ^ (s >>> 19 | s << 13) ^ s >>> 10, b[t] = b[t - 16] + i + b[t - 7] + h << 0; for (a = u & c, t = 0; t < 64; t += 4)this.first ? (this.is224 ? (e = 300032, w = (s = b[0] - 1413257819) - 150054599 << 0, y = s + 24177077 << 0) : (e = 704751109, w = (s = b[0] - 210244248) - 1521486534 << 0, y = s + 143694565 << 0), this.first = !1) : (i = (f >>> 2 | f << 30) ^ (f >>> 13 | f << 19) ^ (f >>> 22 | f << 10), r = (e = f & u) ^ f & c ^ a, w = y + (s = w + (h = (l >>> 6 | l << 26) ^ (l >>> 11 | l << 21) ^ (l >>> 25 | l << 7)) + (l & d ^ ~l & A) + p[t] + b[t]) << 0, y = s + (i + r) << 0), i = (y >>> 2 | y << 30) ^ (y >>> 13 | y << 19) ^ (y >>> 22 | y << 10), r = (n = y & f) ^ y & u ^ e, A = c + (s = A + (h = (w >>> 6 | w << 26) ^ (w >>> 11 | w << 21) ^ (w >>> 25 | w << 7)) + (w & l ^ ~w & d) + p[t + 1] + b[t + 1]) << 0, i = ((c = s + (i + r) << 0) >>> 2 | c << 30) ^ (c >>> 13 | c << 19) ^ (c >>> 22 | c << 10), r = (o = c & y) ^ c & f ^ n, d = u + (s = d + (h = (A >>> 6 | A << 26) ^ (A >>> 11 | A << 21) ^ (A >>> 25 | A << 7)) + (A & w ^ ~A & l) + p[t + 2] + b[t + 2]) << 0, i = ((u = s + (i + r) << 0) >>> 2 | u << 30) ^ (u >>> 13 | u << 19) ^ (u >>> 22 | u << 10), r = (a = u & c) ^ u & y ^ o, l = f + (s = l + (h = (d >>> 6 | d << 26) ^ (d >>> 11 | d << 21) ^ (d >>> 25 | d << 7)) + (d & A ^ ~d & w) + p[t + 3] + b[t + 3]) << 0, f = s + (i + r) << 0; this.h0 = this.h0 + f << 0, this.h1 = this.h1 + u << 0, this.h2 = this.h2 + c << 0, this.h3 = this.h3 + y << 0, this.h4 = this.h4 + l << 0, this.h5 = this.h5 + d << 0, this.h6 = this.h6 + A << 0, this.h7 = this.h7 + w << 0 }, t.prototype.hex = function () { this.finalize(); var t = this.h0, i = this.h1, h = this.h2, r = this.h3, s = this.h4, e = this.h5, n = this.h6, o = this.h7, a = u[t >> 28 & 15] + u[t >> 24 & 15] + u[t >> 20 & 15] + u[t >> 16 & 15] + u[t >> 12 & 15] + u[t >> 8 & 15] + u[t >> 4 & 15] + u[15 & t] + u[i >> 28 & 15] + u[i >> 24 & 15] + u[i >> 20 & 15] + u[i >> 16 & 15] + u[i >> 12 & 15] + u[i >> 8 & 15] + u[i >> 4 & 15] + u[15 & i] + u[h >> 28 & 15] + u[h >> 24 & 15] + u[h >> 20 & 15] + u[h >> 16 & 15] + u[h >> 12 & 15] + u[h >> 8 & 15] + u[h >> 4 & 15] + u[15 & h] + u[r >> 28 & 15] + u[r >> 24 & 15] + u[r >> 20 & 15] + u[r >> 16 & 15] + u[r >> 12 & 15] + u[r >> 8 & 15] + u[r >> 4 & 15] + u[15 & r] + u[s >> 28 & 15] + u[s >> 24 & 15] + u[s >> 20 & 15] + u[s >> 16 & 15] + u[s >> 12 & 15] + u[s >> 8 & 15] + u[s >> 4 & 15] + u[15 & s] + u[e >> 28 & 15] + u[e >> 24 & 15] + u[e >> 20 & 15] + u[e >> 16 & 15] + u[e >> 12 & 15] + u[e >> 8 & 15] + u[e >> 4 & 15] + u[15 & e] + u[n >> 28 & 15] + u[n >> 24 & 15] + u[n >> 20 & 15] + u[n >> 16 & 15] + u[n >> 12 & 15] + u[n >> 8 & 15] + u[n >> 4 & 15] + u[15 & n]; return this.is224 || (a += u[o >> 28 & 15] + u[o >> 24 & 15] + u[o >> 20 & 15] + u[o >> 16 & 15] + u[o >> 12 & 15] + u[o >> 8 & 15] + u[o >> 4 & 15] + u[15 & o]), a }, t.prototype.toString = t.prototype.hex, t.prototype.digest = function () { this.finalize(); var t = this.h0, i = this.h1, h = this.h2, r = this.h3, s = this.h4, e = this.h5, n = this.h6, o = this.h7, a = [t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, 255 & t, i >> 24 & 255, i >> 16 & 255, i >> 8 & 255, 255 & i, h >> 24 & 255, h >> 16 & 255, h >> 8 & 255, 255 & h, r >> 24 & 255, r >> 16 & 255, r >> 8 & 255, 255 & r, s >> 24 & 255, s >> 16 & 255, s >> 8 & 255, 255 & s, e >> 24 & 255, e >> 16 & 255, e >> 8 & 255, 255 & e, n >> 24 & 255, n >> 16 & 255, n >> 8 & 255, 255 & n]; return this.is224 || a.push(o >> 24 & 255, o >> 16 & 255, o >> 8 & 255, 255 & o), a }, t.prototype.array = t.prototype.digest, t.prototype.arrayBuffer = function () { this.finalize(); var t = new ArrayBuffer(this.is224 ? 28 : 32), i = new DataView(t); return i.setUint32(0, this.h0), i.setUint32(4, this.h1), i.setUint32(8, this.h2), i.setUint32(12, this.h3), i.setUint32(16, this.h4), i.setUint32(20, this.h5), i.setUint32(24, this.h6), this.is224 || i.setUint32(28, this.h7), t }, i.prototype = new t, i.prototype.finalize = function () { if (t.prototype.finalize.call(this), this.inner) { this.inner = !1; var i = this.array(); t.call(this, this.is224, this.sharedMemory), this.update(this.oKeyPad), this.update(i), t.prototype.finalize.call(this) } }; var B = w(); B.sha256 = B, B.sha224 = w(!0), B.sha256.hmac = _(), B.sha224.hmac = _(!0), o ? module.exports = B : (s.sha256 = B.sha256, s.sha224 = B.sha224, a && define(function () { return B })) }();
+
+        /**
+         * [base64-js]{@link https://github.com/beatgammit/base64-js}
+         *
+         * @version v1.3.0
+         * @author Kirill, Fomichev
+         * @copyright Kirill, Fomichev 2014
+         * @license MIT
+         */
+        (function (r) { if (typeof exports === "object" && typeof module !== "undefined") { module.exports = r() } else if (typeof define === "function" && define.amd) { define([], r) } else { var e; if (typeof window !== "undefined") { e = window } else if (typeof global !== "undefined") { e = global } else if (typeof self !== "undefined") { e = self } else { e = this } e.base64js = r() } })(function () { var r, e, n; return function () { function r(e, n, t) { function o(f, i) { if (!n[f]) { if (!e[f]) { var u = "function" == typeof require && require; if (!i && u) return u(f, !0); if (a) return a(f, !0); var v = new Error("Cannot find module '" + f + "'"); throw v.code = "MODULE_NOT_FOUND", v } var d = n[f] = { exports: {} }; e[f][0].call(d.exports, function (r) { var n = e[f][1][r]; return o(n || r) }, d, d.exports, r, e, n, t) } return n[f].exports } for (var a = "function" == typeof require && require, f = 0; f < t.length; f++)o(t[f]); return o } return r }()({ "/": [function (r, e, n) { "use strict"; n.byteLength = d; n.toByteArray = h; n.fromByteArray = p; var t = []; var o = []; var a = typeof Uint8Array !== "undefined" ? Uint8Array : Array; var f = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; for (var i = 0, u = f.length; i < u; ++i) { t[i] = f[i]; o[f.charCodeAt(i)] = i } o["-".charCodeAt(0)] = 62; o["_".charCodeAt(0)] = 63; function v(r) { var e = r.length; if (e % 4 > 0) { throw new Error("Invalid string. Length must be a multiple of 4") } var n = r.indexOf("="); if (n === -1) n = e; var t = n === e ? 0 : 4 - n % 4; return [n, t] } function d(r) { var e = v(r); var n = e[0]; var t = e[1]; return (n + t) * 3 / 4 - t } function c(r, e, n) { return (e + n) * 3 / 4 - n } function h(r) { var e; var n = v(r); var t = n[0]; var f = n[1]; var i = new a(c(r, t, f)); var u = 0; var d = f > 0 ? t - 4 : t; for (var h = 0; h < d; h += 4) { e = o[r.charCodeAt(h)] << 18 | o[r.charCodeAt(h + 1)] << 12 | o[r.charCodeAt(h + 2)] << 6 | o[r.charCodeAt(h + 3)]; i[u++] = e >> 16 & 255; i[u++] = e >> 8 & 255; i[u++] = e & 255 } if (f === 2) { e = o[r.charCodeAt(h)] << 2 | o[r.charCodeAt(h + 1)] >> 4; i[u++] = e & 255 } if (f === 1) { e = o[r.charCodeAt(h)] << 10 | o[r.charCodeAt(h + 1)] << 4 | o[r.charCodeAt(h + 2)] >> 2; i[u++] = e >> 8 & 255; i[u++] = e & 255 } return i } function s(r) { return t[r >> 18 & 63] + t[r >> 12 & 63] + t[r >> 6 & 63] + t[r & 63] } function l(r, e, n) { var t; var o = []; for (var a = e; a < n; a += 3) { t = (r[a] << 16 & 16711680) + (r[a + 1] << 8 & 65280) + (r[a + 2] & 255); o.push(s(t)) } return o.join("") } function p(r) { var e; var n = r.length; var o = n % 3; var a = []; var f = 16383; for (var i = 0, u = n - o; i < u; i += f) { a.push(l(r, i, i + f > u ? u : i + f)) } if (o === 1) { e = r[n - 1]; a.push(t[e >> 2] + t[e << 4 & 63] + "==") } else if (o === 2) { e = (r[n - 2] << 8) + r[n - 1]; a.push(t[e >> 10] + t[e >> 4 & 63] + t[e << 2 & 63] + "=") } return a.join("") } }, {}] }, {}, [])("/") });
+
+        /**
+         * [promise-polyfill]{@link https://github.com/taylorhakes/promise-polyfill}
+         *
+         * @version v8.1.3
+         * @author Hakes, Taylor
+         * @copyright Hakes, Taylor 2014
+         * @license MIT
+         */
+        !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n():"function"==typeof define&&define.amd?define(n):n()}(0,function(){"use strict";function e(e){var n=this.constructor;return this.then(function(t){return n.resolve(e()).then(function(){return t})},function(t){return n.resolve(e()).then(function(){return n.reject(t)})})}function n(e){return!(!e||"undefined"==typeof e.length)}function t(){}function o(e){if(!(this instanceof o))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=undefined,this._deferreds=[],c(e,this)}function r(e,n){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,o._immediateFn(function(){var t=1===e._state?n.onFulfilled:n.onRejected;if(null!==t){var o;try{o=t(e._value)}catch(r){return void f(n.promise,r)}i(n.promise,o)}else(1===e._state?i:f)(n.promise,e._value)})):e._deferreds.push(n)}function i(e,n){try{if(n===e)throw new TypeError("A promise cannot be resolved with itself.");if(n&&("object"==typeof n||"function"==typeof n)){var t=n.then;if(n instanceof o)return e._state=3,e._value=n,void u(e);if("function"==typeof t)return void c(function(e,n){return function(){e.apply(n,arguments)}}(t,n),e)}e._state=1,e._value=n,u(e)}catch(r){f(e,r)}}function f(e,n){e._state=2,e._value=n,u(e)}function u(e){2===e._state&&0===e._deferreds.length&&o._immediateFn(function(){e._handled||o._unhandledRejectionFn(e._value)});for(var n=0,t=e._deferreds.length;t>n;n++)r(e,e._deferreds[n]);e._deferreds=null}function c(e,n){var t=!1;try{e(function(e){t||(t=!0,i(n,e))},function(e){t||(t=!0,f(n,e))})}catch(o){if(t)return;t=!0,f(n,o)}}var a=setTimeout;o.prototype["catch"]=function(e){return this.then(null,e)},o.prototype.then=function(e,n){var o=new this.constructor(t);return r(this,new function(e,n,t){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof n?n:null,this.promise=t}(e,n,o)),o},o.prototype["finally"]=e,o.all=function(e){return new o(function(t,o){function r(e,n){try{if(n&&("object"==typeof n||"function"==typeof n)){var u=n.then;if("function"==typeof u)return void u.call(n,function(n){r(e,n)},o)}i[e]=n,0==--f&&t(i)}catch(c){o(c)}}if(!n(e))return o(new TypeError("Promise.all accepts an array"));var i=Array.prototype.slice.call(e);if(0===i.length)return t([]);for(var f=i.length,u=0;i.length>u;u++)r(u,i[u])})},o.resolve=function(e){return e&&"object"==typeof e&&e.constructor===o?e:new o(function(n){n(e)})},o.reject=function(e){return new o(function(n,t){t(e)})},o.race=function(e){return new o(function(t,r){if(!n(e))return r(new TypeError("Promise.race accepts an array"));for(var i=0,f=e.length;f>i;i++)o.resolve(e[i]).then(t,r)})},o._immediateFn="function"==typeof setImmediate&&function(e){setImmediate(e)}||function(e){a(e,0)},o._unhandledRejectionFn=function(e){void 0!==console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};var l=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw Error("unable to locate global object")}();"Promise"in l?l.Promise.prototype["finally"]||(l.Promise.prototype["finally"]=e):l.Promise=o});
+
+        var Keycloak = factory( root["sha256"], root["base64js"] );
+        root["Keycloak"] = Keycloak;
+
+        if ( typeof define === "function" && define.amd ) {
+            define( "keycloak", [], function () { return Keycloak; } );
+        }
+    }
+})(window, function (sha256_imported, base64js_imported) {
+    if (typeof Promise === 'undefined') {
+        throw Error('Keycloak requires an environment that supports Promises. Make sure that you include the appropriate polyfill.');
+    }
+
+    var loggedPromiseDeprecation = false;
+
+    function logPromiseDeprecation() {
+        if (!loggedPromiseDeprecation) {
+            loggedPromiseDeprecation = true;
+            console.warn('[KEYCLOAK] Usage of legacy style promise methods such as `.error()` and `.success()` has been deprecated and support will be removed in future versions. Use standard style promise methods such as `.then() and `.catch()` instead.');
+        }
+    }
+
+    function Keycloak (config) {
+        if (!(this instanceof Keycloak)) {
+            return new Keycloak(config);
+        }
+
+        var kc = this;
+        var adapter;
+        var refreshQueue = [];
+        var callbackStorage;
+
+        var loginIframe = {
+            enable: true,
+            callbackList: [],
+            interval: 5
+        };
+
+        var scripts = document.getElementsByTagName('script');
+        for (var i = 0; i < scripts.length; i++) {
+            if ((scripts[i].src.indexOf('keycloak.js') !== -1 || scripts[i].src.indexOf('keycloak.min.js') !== -1) && scripts[i].src.indexOf('version=') !== -1) {
+                kc.iframeVersion = scripts[i].src.substring(scripts[i].src.indexOf('version=') + 8).split('&')[0];
+            }
+        }
+
+        var useNonce = true;
+        var logInfo = createLogger(console.info);
+        var logWarn = createLogger(console.warn);
+
+        kc.init = function (initOptions) {
+            kc.authenticated = false;
+
+            callbackStorage = createCallbackStorage();
+            var adapters = ['default', 'cordova', 'cordova-native'];
+
+            if (initOptions && adapters.indexOf(initOptions.adapter) > -1) {
+                adapter = loadAdapter(initOptions.adapter);
+            } else if (initOptions && typeof initOptions.adapter === "object") {
+                adapter = initOptions.adapter;
+            } else {
+                if (window.Cordova || window.cordova) {
+                    adapter = loadAdapter('cordova');
+                } else {
+                    adapter = loadAdapter();
+                }
+            }
+
+            if (initOptions) {
+                if (typeof initOptions.useNonce !== 'undefined') {
+                    useNonce = initOptions.useNonce;
+                }
+
+                if (typeof initOptions.checkLoginIframe !== 'undefined') {
+                    loginIframe.enable = initOptions.checkLoginIframe;
+                }
+
+                if (initOptions.checkLoginIframeInterval) {
+                    loginIframe.interval = initOptions.checkLoginIframeInterval;
+                }
+
+                if (initOptions.onLoad === 'login-required') {
+                    kc.loginRequired = true;
+                }
+
+                if (initOptions.responseMode) {
+                    if (initOptions.responseMode === 'query' || initOptions.responseMode === 'fragment') {
+                        kc.responseMode = initOptions.responseMode;
+                    } else {
+                        throw 'Invalid value for responseMode';
+                    }
+                }
+
+                if (initOptions.flow) {
+                    switch (initOptions.flow) {
+                        case 'standard':
+                            kc.responseType = 'code';
+                            break;
+                        case 'implicit':
+                            kc.responseType = 'id_token token';
+                            break;
+                        case 'hybrid':
+                            kc.responseType = 'code id_token token';
+                            break;
+                        default:
+                            throw 'Invalid value for flow';
+                    }
+                    kc.flow = initOptions.flow;
+                }
+
+                if (initOptions.timeSkew != null) {
+                    kc.timeSkew = initOptions.timeSkew;
+                }
+
+                if(initOptions.redirectUri) {
+                    kc.redirectUri = initOptions.redirectUri;
+                }
+
+                if (initOptions.silentCheckSsoRedirectUri) {
+                    kc.silentCheckSsoRedirectUri = initOptions.silentCheckSsoRedirectUri;
+                }
+
+                if (typeof initOptions.silentCheckSsoFallback === 'boolean') {
+                    kc.silentCheckSsoFallback = initOptions.silentCheckSsoFallback;
+                } else {
+                    kc.silentCheckSsoFallback = true;
+                }
+
+                if (initOptions.pkceMethod) {
+                    if (initOptions.pkceMethod !== "S256") {
+                        throw 'Invalid value for pkceMethod';
+                    }
+                    kc.pkceMethod = initOptions.pkceMethod;
+                }
+
+                if (typeof initOptions.enableLogging === 'boolean') {
+                    kc.enableLogging = initOptions.enableLogging;
+                } else {
+                    kc.enableLogging = false;
+                }
+
+                if (typeof initOptions.scope === 'string') {
+                    kc.scope = initOptions.scope;
+                }
+
+                if (typeof initOptions.messageReceiveTimeout === 'number' && initOptions.messageReceiveTimeout > 0) {
+                    kc.messageReceiveTimeout = initOptions.messageReceiveTimeout;
+                } else {
+                    kc.messageReceiveTimeout = 10000;
+                }
+            }
+
+            if (!kc.responseMode) {
+                kc.responseMode = 'fragment';
+            }
+            if (!kc.responseType) {
+                kc.responseType = 'code';
+                kc.flow = 'standard';
+            }
+
+            var promise = createPromise();
+
+            var initPromise = createPromise();
+            initPromise.promise.then(function() {
+                kc.onReady && kc.onReady(kc.authenticated);
+                promise.setSuccess(kc.authenticated);
+            }).catch(function(error) {
+                promise.setError(error);
+            });
+
+            var configPromise = loadConfig(config);
+
+            function onLoad() {
+                var doLogin = function(prompt) {
+                    if (!prompt) {
+                        options.prompt = 'none';
+                    }
+
+                    kc.login(options).then(function () {
+                        initPromise.setSuccess();
+                    }).catch(function (error) {
+                        initPromise.setError(error);
+                    });
+                }
+
+                var checkSsoSilently = function() {
+                    var ifrm = document.createElement("iframe");
+                    var src = kc.createLoginUrl({prompt: 'none', redirectUri: kc.silentCheckSsoRedirectUri});
+                    ifrm.setAttribute("src", src);
+                    ifrm.setAttribute("title", "keycloak-silent-check-sso");
+                    ifrm.style.display = "none";
+                    document.body.appendChild(ifrm);
+
+                    var messageCallback = function(event) {
+                        if (event.origin !== window.location.origin || ifrm.contentWindow !== event.source) {
+                            return;
+                        }
+
+                        var oauth = parseCallback(event.data);
+                        processCallback(oauth, initPromise);
+
+                        document.body.removeChild(ifrm);
+                        window.removeEventListener("message", messageCallback);
+                    };
+
+                    window.addEventListener("message", messageCallback);
+                };
+
+                var options = {};
+                switch (initOptions.onLoad) {
+                    case 'check-sso':
+                        if (loginIframe.enable) {
+                            setupCheckLoginIframe().then(function() {
+                                checkLoginIframe().then(function (unchanged) {
+                                    if (!unchanged) {
+                                        kc.silentCheckSsoRedirectUri ? checkSsoSilently() : doLogin(false);
+                                    } else {
+                                        initPromise.setSuccess();
+                                    }
+                                }).catch(function (error) {
+                                    initPromise.setError(error);
+                                });
+                            });
+                        } else {
+                            kc.silentCheckSsoRedirectUri ? checkSsoSilently() : doLogin(false);
+                        }
+                        break;
+                    case 'login-required':
+                        doLogin(true);
+                        break;
+                    default:
+                        throw 'Invalid value for onLoad';
+                }
+            }
+
+            function processInit() {
+                var callback = parseCallback(window.location.href);
+
+                if (callback) {
+                    window.history.replaceState(window.history.state, null, callback.newUrl);
+                }
+
+                if (callback && callback.valid) {
+                    return setupCheckLoginIframe().then(function() {
+                        processCallback(callback, initPromise);
+                    }).catch(function (error) {
+                        initPromise.setError(error);
+                    });
+                } else if (initOptions) {
+                    if (initOptions.token && initOptions.refreshToken) {
+                        setToken(initOptions.token, initOptions.refreshToken, initOptions.idToken);
+
+                        if (loginIframe.enable) {
+                            setupCheckLoginIframe().then(function() {
+                                checkLoginIframe().then(function (unchanged) {
+                                    if (unchanged) {
+                                        kc.onAuthSuccess && kc.onAuthSuccess();
+                                        initPromise.setSuccess();
+                                        scheduleCheckIframe();
+                                    } else {
+                                        initPromise.setSuccess();
+                                    }
+                                }).catch(function (error) {
+                                    initPromise.setError(error);
+                                });
+                            });
+                        } else {
+                            kc.updateToken(-1).then(function() {
+                                kc.onAuthSuccess && kc.onAuthSuccess();
+                                initPromise.setSuccess();
+                            }).catch(function(error) {
+                                kc.onAuthError && kc.onAuthError();
+                                if (initOptions.onLoad) {
+                                    onLoad();
+                                } else {
+                                    initPromise.setError(error);
+                                }
+                            });
+                        }
+                    } else if (initOptions.onLoad) {
+                        onLoad();
+                    } else {
+                        initPromise.setSuccess();
+                    }
+                } else {
+                    initPromise.setSuccess();
+                }
+            }
+
+            function domReady() {
+                var promise = createPromise();
+
+                var checkReadyState = function () {
+                    if (document.readyState === 'interactive' || document.readyState === 'complete') {
+                        document.removeEventListener('readystatechange', checkReadyState);
+                        promise.setSuccess();
+                    }
+                }
+                document.addEventListener('readystatechange', checkReadyState);
+
+                checkReadyState(); // just in case the event was already fired and we missed it (in case the init is done later than at the load time, i.e. it's done from code)
+
+                return promise.promise;
+            }
+
+            configPromise.then(function () {
+                domReady()
+                    .then(check3pCookiesSupported)
+                    .then(processInit)
+                    .catch(function (error) {
+                        promise.setError(error);
+                    });
+            });
+            configPromise.catch(function (error) {
+                promise.setError(error);
+            });
+
+            return promise.promise;
+        }
+
+        kc.login = function (options) {
+            return adapter.login(options);
+        }
+
+        function generateRandomData(len) {
+            // use web crypto APIs if possible
+            var array = null;
+            var crypto = window.crypto || window.msCrypto;
+            if (crypto && crypto.getRandomValues && window.Uint8Array) {
+                array = new Uint8Array(len);
+                crypto.getRandomValues(array);
+                return array;
+            }
+
+            // fallback to Math random
+            array = new Array(len);
+            for (var j = 0; j < array.length; j++) {
+                array[j] = Math.floor(256 * Math.random());
+            }
+            return array;
+        }
+
+        function generateCodeVerifier(len) {
+            return generateRandomString(len, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789');
+        }
+
+        function generateRandomString(len, alphabet){
+            var randomData = generateRandomData(len);
+            var chars = new Array(len);
+            for (var i = 0; i < len; i++) {
+                chars[i] = alphabet.charCodeAt(randomData[i] % alphabet.length);
+            }
+            return String.fromCharCode.apply(null, chars);
+        }
+
+        function generatePkceChallenge(pkceMethod, codeVerifier) {
+            switch (pkceMethod) {
+                // The use of the "plain" method is considered insecure and therefore not supported.
+                case "S256":
+                    // hash codeVerifier, then encode as url-safe base64 without padding
+                    var hashBytes = new Uint8Array(sha256_imported.arrayBuffer(codeVerifier));
+                    var encodedHash = base64js_imported.fromByteArray(hashBytes)
+                        .replace(/\+/g, '-')
+                        .replace(/\//g, '_')
+                        .replace(/\=/g, '');
+                    return encodedHash;
+                default:
+                    throw 'Invalid value for pkceMethod';
+            }
+        }
+
+        kc.createLoginUrl = function(options) {
+            var state = createUUID();
+            var nonce = createUUID();
+
+            var redirectUri = adapter.redirectUri(options);
+
+            var callbackState = {
+                state: state,
+                nonce: nonce,
+                redirectUri: encodeURIComponent(redirectUri)
+            };
+
+            if (options && options.prompt) {
+                callbackState.prompt = options.prompt;
+            }
+
+            var baseUrl;
+            if (options && options.action == 'register') {
+                baseUrl = kc.endpoints.register();
+            } else {
+                baseUrl = kc.endpoints.authorize();
+            }
+
+            var scope = options && options.scope || kc.scope;
+            if (!scope) {
+                // if scope is not set, default to "openid"
+                scope = "openid";
+            } else if (scope.indexOf("openid") === -1) {
+                // if openid scope is missing, prefix the given scopes with it
+                scope = "openid " + scope;
+            }
+
+            var url = baseUrl
+                + '?client_id=' + encodeURIComponent(kc.clientId)
+                + '&redirect_uri=' + encodeURIComponent(redirectUri)
+                + '&state=' + encodeURIComponent(state)
+                + '&response_mode=' + encodeURIComponent(kc.responseMode)
+                + '&response_type=' + encodeURIComponent(kc.responseType)
+                + '&scope=' + encodeURIComponent(scope);
+            if (useNonce) {
+                url = url + '&nonce=' + encodeURIComponent(nonce);
+            }
+
+            if (options && options.prompt) {
+                url += '&prompt=' + encodeURIComponent(options.prompt);
+            }
+
+            if (options && options.maxAge) {
+                url += '&max_age=' + encodeURIComponent(options.maxAge);
+            }
+
+            if (options && options.loginHint) {
+                url += '&login_hint=' + encodeURIComponent(options.loginHint);
+            }
+
+            if (options && options.idpHint) {
+                url += '&kc_idp_hint=' + encodeURIComponent(options.idpHint);
+            }
+
+            if (options && options.action && options.action != 'register') {
+                url += '&kc_action=' + encodeURIComponent(options.action);
+            }
+
+            if (options && options.locale) {
+                url += '&ui_locales=' + encodeURIComponent(options.locale);
+            }
+
+            if (kc.pkceMethod) {
+                var codeVerifier = generateCodeVerifier(96);
+                callbackState.pkceCodeVerifier = codeVerifier;
+                var pkceChallenge = generatePkceChallenge(kc.pkceMethod, codeVerifier);
+                url += '&code_challenge=' + pkceChallenge;
+                url += '&code_challenge_method=' + kc.pkceMethod;
+            }
+
+            callbackStorage.add(callbackState);
+
+            return url;
+        }
+
+        kc.logout = function(options) {
+            return adapter.logout(options);
+        }
+
+        kc.createLogoutUrl = function(options) {
+            var url = kc.endpoints.logout()
+                + '?redirect_uri=' + encodeURIComponent(adapter.redirectUri(options, false));
+
+            return url;
+        }
+
+        kc.register = function (options) {
+            return adapter.register(options);
+        }
+
+        kc.createRegisterUrl = function(options) {
+            if (!options) {
+                options = {};
+            }
+            options.action = 'register';
+            return kc.createLoginUrl(options);
+        }
+
+        kc.createAccountUrl = function(options) {
+            var realm = getRealmUrl();
+            var url = undefined;
+            if (typeof realm !== 'undefined') {
+                url = realm
+                + '/account'
+                + '?referrer=' + encodeURIComponent(kc.clientId)
+                + '&referrer_uri=' + encodeURIComponent(adapter.redirectUri(options));
+            }
+            return url;
+        }
+
+        kc.accountManagement = function() {
+            return adapter.accountManagement();
+        }
+
+        kc.hasRealmRole = function (role) {
+            var access = kc.realmAccess;
+            return !!access && access.roles.indexOf(role) >= 0;
+        }
+
+        kc.hasResourceRole = function(role, resource) {
+            if (!kc.resourceAccess) {
+                return false;
+            }
+
+            var access = kc.resourceAccess[resource || kc.clientId];
+            return !!access && access.roles.indexOf(role) >= 0;
+        }
+
+        kc.loadUserProfile = function() {
+            var url = getRealmUrl() + '/account';
+            var req = new XMLHttpRequest();
+            req.open('GET', url, true);
+            req.setRequestHeader('Accept', 'application/json');
+            req.setRequestHeader('Authorization', 'bearer ' + kc.token);
+
+            var promise = createPromise();
+
+            req.onreadystatechange = function () {
+                if (req.readyState == 4) {
+                    if (req.status == 200) {
+                        kc.profile = JSON.parse(req.responseText);
+                        promise.setSuccess(kc.profile);
+                    } else {
+                        promise.setError();
+                    }
+                }
+            }
+
+            req.send();
+
+            return promise.promise;
+        }
+
+        kc.loadUserInfo = function() {
+            var url = kc.endpoints.userinfo();
+            var req = new XMLHttpRequest();
+            req.open('GET', url, true);
+            req.setRequestHeader('Accept', 'application/json');
+            req.setRequestHeader('Authorization', 'bearer ' + kc.token);
+
+            var promise = createPromise();
+
+            req.onreadystatechange = function () {
+                if (req.readyState == 4) {
+                    if (req.status == 200) {
+                        kc.userInfo = JSON.parse(req.responseText);
+                        promise.setSuccess(kc.userInfo);
+                    } else {
+                        promise.setError();
+                    }
+                }
+            }
+
+            req.send();
+
+            return promise.promise;
+        }
+
+        kc.isTokenExpired = function(minValidity) {
+            if (!kc.tokenParsed || (!kc.refreshToken && kc.flow != 'implicit' )) {
+                throw 'Not authenticated';
+            }
+
+            if (kc.timeSkew == null) {
+                logInfo('[KEYCLOAK] Unable to determine if token is expired as timeskew is not set');
+                return true;
+            }
+
+            var expiresIn = kc.tokenParsed['exp'] - Math.ceil(new Date().getTime() / 1000) + kc.timeSkew;
+            if (minValidity) {
+                if (isNaN(minValidity)) {
+                    throw 'Invalid minValidity';
+                }
+                expiresIn -= minValidity;
+            }
+            return expiresIn < 0;
+        }
+
+        kc.updateToken = function(minValidity) {
+            var promise = createPromise();
+
+            if (!kc.refreshToken) {
+                promise.setError();
+                return promise.promise;
+            }
+
+            minValidity = minValidity || 5;
+
+            var exec = function() {
+                var refreshToken = false;
+                if (minValidity == -1) {
+                    refreshToken = true;
+                    logInfo('[KEYCLOAK] Refreshing token: forced refresh');
+                } else if (!kc.tokenParsed || kc.isTokenExpired(minValidity)) {
+                    refreshToken = true;
+                    logInfo('[KEYCLOAK] Refreshing token: token expired');
+                }
+
+                if (!refreshToken) {
+                    promise.setSuccess(false);
+                } else {
+                    var params = 'grant_type=refresh_token&' + 'refresh_token=' + kc.refreshToken;
+                    var url = kc.endpoints.token();
+
+                    refreshQueue.push(promise);
+
+                    if (refreshQueue.length == 1) {
+                        var req = new XMLHttpRequest();
+                        req.open('POST', url, true);
+                        req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
+                        req.withCredentials = true;
+
+                        params += '&client_id=' + encodeURIComponent(kc.clientId);
+
+                        var timeLocal = new Date().getTime();
+
+                        req.onreadystatechange = function () {
+                            if (req.readyState == 4) {
+                                if (req.status == 200) {
+                                    logInfo('[KEYCLOAK] Token refreshed');
+
+                                    timeLocal = (timeLocal + new Date().getTime()) / 2;
+
+                                    var tokenResponse = JSON.parse(req.responseText);
+
+                                    setToken(tokenResponse['access_token'], tokenResponse['refresh_token'], tokenResponse['id_token'], timeLocal);
+
+                                    kc.onAuthRefreshSuccess && kc.onAuthRefreshSuccess();
+                                    for (var p = refreshQueue.pop(); p != null; p = refreshQueue.pop()) {
+                                        p.setSuccess(true);
+                                    }
+                                } else {
+                                    logWarn('[KEYCLOAK] Failed to refresh token');
+
+                                    if (req.status == 400) {
+                                        kc.clearToken();
+                                    }
+
+                                    kc.onAuthRefreshError && kc.onAuthRefreshError();
+                                    for (var p = refreshQueue.pop(); p != null; p = refreshQueue.pop()) {
+                                        p.setError(true);
+                                    }
+                                }
+                            }
+                        };
+
+                        req.send(params);
+                    }
+                }
+            }
+
+            if (loginIframe.enable) {
+                var iframePromise = checkLoginIframe();
+                iframePromise.then(function() {
+                    exec();
+                }).catch(function(error) {
+                    promise.setError(error);
+                });
+            } else {
+                exec();
+            }
+
+            return promise.promise;
+        }
+
+        kc.clearToken = function() {
+            if (kc.token) {
+                setToken(null, null, null);
+                kc.onAuthLogout && kc.onAuthLogout();
+                if (kc.loginRequired) {
+                    kc.login();
+                }
+            }
+        }
+
+        function getRealmUrl() {
+            if (typeof kc.authServerUrl !== 'undefined') {
+                if (kc.authServerUrl.charAt(kc.authServerUrl.length - 1) == '/') {
+                    return kc.authServerUrl + 'realms/' + encodeURIComponent(kc.realm);
+                } else {
+                    return kc.authServerUrl + '/realms/' + encodeURIComponent(kc.realm);
+                }
+            } else {
+            	return undefined;
+            }
+        }
+
+        function getOrigin() {
+            if (!window.location.origin) {
+                return window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '');
+            } else {
+                return window.location.origin;
+            }
+        }
+
+        function processCallback(oauth, promise) {
+            var code = oauth.code;
+            var error = oauth.error;
+            var prompt = oauth.prompt;
+
+            var timeLocal = new Date().getTime();
+
+            if (oauth['kc_action_status']) {
+                kc.onActionUpdate && kc.onActionUpdate(oauth['kc_action_status']);
+            }
+
+            if (error) {
+                if (prompt != 'none') {
+                    var errorData = { error: error, error_description: oauth.error_description };
+                    kc.onAuthError && kc.onAuthError(errorData);
+                    promise && promise.setError(errorData);
+                } else {
+                    promise && promise.setSuccess();
+                }
+                return;
+            } else if ((kc.flow != 'standard') && (oauth.access_token || oauth.id_token)) {
+                authSuccess(oauth.access_token, null, oauth.id_token, true);
+            }
+
+            if ((kc.flow != 'implicit') && code) {
+                var params = 'code=' + code + '&grant_type=authorization_code';
+                var url = kc.endpoints.token();
+
+                var req = new XMLHttpRequest();
+                req.open('POST', url, true);
+                req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
+
+                params += '&client_id=' + encodeURIComponent(kc.clientId);
+                params += '&redirect_uri=' + oauth.redirectUri;
+
+                if (oauth.pkceCodeVerifier) {
+                    params += '&code_verifier=' + oauth.pkceCodeVerifier;
+                }
+
+                req.withCredentials = true;
+
+                req.onreadystatechange = function() {
+                    if (req.readyState == 4) {
+                        if (req.status == 200) {
+
+                            var tokenResponse = JSON.parse(req.responseText);
+                            authSuccess(tokenResponse['access_token'], tokenResponse['refresh_token'], tokenResponse['id_token'], kc.flow === 'standard');
+                            scheduleCheckIframe();
+                        } else {
+                            kc.onAuthError && kc.onAuthError();
+                            promise && promise.setError();
+                        }
+                    }
+                };
+
+                req.send(params);
+            }
+
+            function authSuccess(accessToken, refreshToken, idToken, fulfillPromise) {
+                timeLocal = (timeLocal + new Date().getTime()) / 2;
+
+                setToken(accessToken, refreshToken, idToken, timeLocal);
+
+                if (useNonce && ((kc.tokenParsed && kc.tokenParsed.nonce != oauth.storedNonce) ||
+                    (kc.refreshTokenParsed && kc.refreshTokenParsed.nonce != oauth.storedNonce) ||
+                    (kc.idTokenParsed && kc.idTokenParsed.nonce != oauth.storedNonce))) {
+
+                    logInfo('[KEYCLOAK] Invalid nonce, clearing token');
+                    kc.clearToken();
+                    promise && promise.setError();
+                } else {
+                    if (fulfillPromise) {
+                        kc.onAuthSuccess && kc.onAuthSuccess();
+                        promise && promise.setSuccess();
+                    }
+                }
+            }
+
+        }
+
+        function loadConfig(url) {
+            var promise = createPromise();
+            var configUrl;
+
+            if (!config) {
+                configUrl = 'keycloak.json';
+            } else if (typeof config === 'string') {
+                configUrl = config;
+            }
+
+            function setupOidcEndoints(oidcConfiguration) {
+                if (! oidcConfiguration) {
+                    kc.endpoints = {
+                        authorize: function() {
+                            return getRealmUrl() + '/protocol/openid-connect/auth';
+                        },
+                        token: function() {
+                            return getRealmUrl() + '/protocol/openid-connect/token';
+                        },
+                        logout: function() {
+                            return getRealmUrl() + '/protocol/openid-connect/logout';
+                        },
+                        checkSessionIframe: function() {
+                            var src = getRealmUrl() + '/protocol/openid-connect/login-status-iframe.html';
+                            if (kc.iframeVersion) {
+                              src = src + '?version=' + kc.iframeVersion;
+                            }
+                            return src;
+                        },
+                        thirdPartyCookiesIframe: function() {
+                            var src = getRealmUrl() + '/protocol/openid-connect/3p-cookies/step1.html';
+                            if (kc.iframeVersion) {
+                                src = src + '?version=' + kc.iframeVersion;
+                            }
+                            return src;
+                        },
+                        register: function() {
+                            return getRealmUrl() + '/protocol/openid-connect/registrations';
+                        },
+                        userinfo: function() {
+                            return getRealmUrl() + '/protocol/openid-connect/userinfo';
+                        }
+                    };
+                } else {
+                    kc.endpoints = {
+                        authorize: function() {
+                            return oidcConfiguration.authorization_endpoint;
+                        },
+                        token: function() {
+                            return oidcConfiguration.token_endpoint;
+                        },
+                        logout: function() {
+                            if (!oidcConfiguration.end_session_endpoint) {
+                                throw "Not supported by the OIDC server";
+                            }
+                            return oidcConfiguration.end_session_endpoint;
+                        },
+                        checkSessionIframe: function() {
+                            if (!oidcConfiguration.check_session_iframe) {
+                                throw "Not supported by the OIDC server";
+                            }
+                            return oidcConfiguration.check_session_iframe;
+                        },
+                        register: function() {
+                            throw 'Redirection to "Register user" page not supported in standard OIDC mode';
+                        },
+                        userinfo: function() {
+                            if (!oidcConfiguration.userinfo_endpoint) {
+                                throw "Not supported by the OIDC server";
+                            }
+                            return oidcConfiguration.userinfo_endpoint;
+                        }
+                    }
+                }
+            }
+
+            if (configUrl) {
+                var req = new XMLHttpRequest();
+                req.open('GET', configUrl, true);
+                req.setRequestHeader('Accept', 'application/json');
+
+                req.onreadystatechange = function () {
+                    if (req.readyState == 4) {
+                        if (req.status == 200 || fileLoaded(req)) {
+                            var config = JSON.parse(req.responseText);
+
+                            kc.authServerUrl = config['auth-server-url'];
+                            kc.realm = config['realm'];
+                            kc.clientId = config['resource'];
+                            setupOidcEndoints(null);
+                            promise.setSuccess();
+                        } else {
+                            promise.setError();
+                        }
+                    }
+                };
+
+                req.send();
+            } else {
+                if (!config.clientId) {
+                    throw 'clientId missing';
+                }
+
+                kc.clientId = config.clientId;
+
+                var oidcProvider = config['oidcProvider'];
+                if (!oidcProvider) {
+                    if (!config['url']) {
+                        var scripts = document.getElementsByTagName('script');
+                        for (var i = 0; i < scripts.length; i++) {
+                            if (scripts[i].src.match(/.*keycloak\.js/)) {
+                                config.url = scripts[i].src.substr(0, scripts[i].src.indexOf('/js/keycloak.js'));
+                                break;
+                            }
+                        }
+                    }
+                    if (!config.realm) {
+                        throw 'realm missing';
+                    }
+
+                    kc.authServerUrl = config.url;
+                    kc.realm = config.realm;
+                    setupOidcEndoints(null);
+                    promise.setSuccess();
+                } else {
+                    if (typeof oidcProvider === 'string') {
+                        var oidcProviderConfigUrl;
+                        if (oidcProvider.charAt(oidcProvider.length - 1) == '/') {
+                            oidcProviderConfigUrl = oidcProvider + '.well-known/openid-configuration';
+                        } else {
+                            oidcProviderConfigUrl = oidcProvider + '/.well-known/openid-configuration';
+                        }
+                        var req = new XMLHttpRequest();
+                        req.open('GET', oidcProviderConfigUrl, true);
+                        req.setRequestHeader('Accept', 'application/json');
+
+                        req.onreadystatechange = function () {
+                            if (req.readyState == 4) {
+                                if (req.status == 200 || fileLoaded(req)) {
+                                    var oidcProviderConfig = JSON.parse(req.responseText);
+                                    setupOidcEndoints(oidcProviderConfig);
+                                    promise.setSuccess();
+                                } else {
+                                    promise.setError();
+                                }
+                            }
+                        };
+
+                        req.send();
+                    } else {
+                        setupOidcEndoints(oidcProvider);
+                        promise.setSuccess();
+                    }
+                }
+            }
+
+            return promise.promise;
+        }
+
+        function fileLoaded(xhr) {
+            return xhr.status == 0 && xhr.responseText && xhr.responseURL.startsWith('file:');
+        }
+
+        function setToken(token, refreshToken, idToken, timeLocal) {
+            if (kc.tokenTimeoutHandle) {
+                clearTimeout(kc.tokenTimeoutHandle);
+                kc.tokenTimeoutHandle = null;
+            }
+
+            if (refreshToken) {
+                kc.refreshToken = refreshToken;
+                kc.refreshTokenParsed = decodeToken(refreshToken);
+            } else {
+                delete kc.refreshToken;
+                delete kc.refreshTokenParsed;
+            }
+
+            if (idToken) {
+                kc.idToken = idToken;
+                kc.idTokenParsed = decodeToken(idToken);
+            } else {
+                delete kc.idToken;
+                delete kc.idTokenParsed;
+            }
+
+            if (token) {
+                kc.token = token;
+                kc.tokenParsed = decodeToken(token);
+                kc.sessionId = kc.tokenParsed.session_state;
+                kc.authenticated = true;
+                kc.subject = kc.tokenParsed.sub;
+                kc.realmAccess = kc.tokenParsed.realm_access;
+                kc.resourceAccess = kc.tokenParsed.resource_access;
+
+                if (timeLocal) {
+                    kc.timeSkew = Math.floor(timeLocal / 1000) - kc.tokenParsed.iat;
+                }
+
+                if (kc.timeSkew != null) {
+                    logInfo('[KEYCLOAK] Estimated time difference between browser and server is ' + kc.timeSkew + ' seconds');
+
+                    if (kc.onTokenExpired) {
+                        var expiresIn = (kc.tokenParsed['exp'] - (new Date().getTime() / 1000) + kc.timeSkew) * 1000;
+                        logInfo('[KEYCLOAK] Token expires in ' + Math.round(expiresIn / 1000) + ' s');
+                        if (expiresIn <= 0) {
+                            kc.onTokenExpired();
+                        } else {
+                            kc.tokenTimeoutHandle = setTimeout(kc.onTokenExpired, expiresIn);
+                        }
+                    }
+                }
+            } else {
+                delete kc.token;
+                delete kc.tokenParsed;
+                delete kc.subject;
+                delete kc.realmAccess;
+                delete kc.resourceAccess;
+
+                kc.authenticated = false;
+            }
+        }
+
+        function decodeToken(str) {
+            str = str.split('.')[1];
+
+            str = str.replace(/-/g, '+');
+            str = str.replace(/_/g, '/');
+            switch (str.length % 4) {
+                case 0:
+                    break;
+                case 2:
+                    str += '==';
+                    break;
+                case 3:
+                    str += '=';
+                    break;
+                default:
+                    throw 'Invalid token';
+            }
+
+            str = decodeURIComponent(escape(atob(str)));
+
+            str = JSON.parse(str);
+            return str;
+        }
+
+        function createUUID() {
+            var hexDigits = '0123456789abcdef';
+            var s = generateRandomString(36, hexDigits).split("");
+            s[14] = '4';
+            s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);
+            s[8] = s[13] = s[18] = s[23] = '-';
+            var uuid = s.join('');
+            return uuid;
+        }
+
+        function parseCallback(url) {
+            var oauth = parseCallbackUrl(url);
+            if (!oauth) {
+                return;
+            }
+
+            var oauthState = callbackStorage.get(oauth.state);
+
+            if (oauthState) {
+                oauth.valid = true;
+                oauth.redirectUri = oauthState.redirectUri;
+                oauth.storedNonce = oauthState.nonce;
+                oauth.prompt = oauthState.prompt;
+                oauth.pkceCodeVerifier = oauthState.pkceCodeVerifier;
+            }
+
+            return oauth;
+        }
+
+        function parseCallbackUrl(url) {
+            var supportedParams;
+            switch (kc.flow) {
+                case 'standard':
+                    supportedParams = ['code', 'state', 'session_state', 'kc_action_status'];
+                    break;
+                case 'implicit':
+                    supportedParams = ['access_token', 'token_type', 'id_token', 'state', 'session_state', 'expires_in', 'kc_action_status'];
+                    break;
+                case 'hybrid':
+                    supportedParams = ['access_token', 'token_type', 'id_token', 'code', 'state', 'session_state', 'expires_in', 'kc_action_status'];
+                    break;
+            }
+
+            supportedParams.push('error');
+            supportedParams.push('error_description');
+            supportedParams.push('error_uri');
+
+            var queryIndex = url.indexOf('?');
+            var fragmentIndex = url.indexOf('#');
+
+            var newUrl;
+            var parsed;
+
+            if (kc.responseMode === 'query' && queryIndex !== -1) {
+                newUrl = url.substring(0, queryIndex);
+                parsed = parseCallbackParams(url.substring(queryIndex + 1, fragmentIndex !== -1 ? fragmentIndex : url.length), supportedParams);
+                if (parsed.paramsString !== '') {
+                    newUrl += '?' + parsed.paramsString;
+                }
+                if (fragmentIndex !== -1) {
+                    newUrl += url.substring(fragmentIndex);
+                }
+            } else if (kc.responseMode === 'fragment' && fragmentIndex !== -1) {
+                newUrl = url.substring(0, fragmentIndex);
+                parsed = parseCallbackParams(url.substring(fragmentIndex + 1), supportedParams);
+                if (parsed.paramsString !== '') {
+                    newUrl += '#' + parsed.paramsString;
+                }
+            }
+
+            if (parsed && parsed.oauthParams) {
+                if (kc.flow === 'standard' || kc.flow === 'hybrid') {
+                    if ((parsed.oauthParams.code || parsed.oauthParams.error) && parsed.oauthParams.state) {
+                        parsed.oauthParams.newUrl = newUrl;
+                        return parsed.oauthParams;
+                    }
+                } else if (kc.flow === 'implicit') {
+                    if ((parsed.oauthParams.access_token || parsed.oauthParams.error) && parsed.oauthParams.state) {
+                        parsed.oauthParams.newUrl = newUrl;
+                        return parsed.oauthParams;
+                    }
+                }
+            }
+        }
+
+        function parseCallbackParams(paramsString, supportedParams) {
+            var p = paramsString.split('&');
+            var result = {
+                paramsString: '',
+                oauthParams: {}
+            }
+            for (var i = 0; i < p.length; i++) {
+                var split = p[i].indexOf("=");
+                var key = p[i].slice(0, split);
+                if (supportedParams.indexOf(key) !== -1) {
+                    result.oauthParams[key] = p[i].slice(split + 1);
+                } else {
+                    if (result.paramsString !== '') {
+                        result.paramsString += '&';
+                    }
+                    result.paramsString += p[i];
+                }
+            }
+            return result;
+        }
+
+        function createPromise() {
+            // Need to create a native Promise which also preserves the
+            // interface of the custom promise type previously used by the API
+            var p = {
+                setSuccess: function(result) {
+                    p.resolve(result);
+                },
+
+                setError: function(result) {
+                    p.reject(result);
+                }
+            };
+            p.promise = new Promise(function(resolve, reject) {
+                p.resolve = resolve;
+                p.reject = reject;
+            });
+
+            p.promise.success = function(callback) {
+                logPromiseDeprecation();
+
+                this.then(function handleSuccess(value) {
+                    callback(value);
+                });
+
+                return this;
+            }
+
+            p.promise.error = function(callback) {
+                logPromiseDeprecation();
+
+                this.catch(function handleError(error) {
+                    callback(error);
+                });
+
+                return this;
+            }
+
+            return p;
+        }
+
+        // Function to extend existing native Promise with timeout
+        function applyTimeoutToPromise(promise, timeout, errorMessage) {
+            var timeoutHandle = null;
+            var timeoutPromise = new Promise(function (resolve, reject) {
+                timeoutHandle = setTimeout(function () {
+                    reject({ "error": errorMessage || "Promise is not settled within timeout of " + timeout + "ms" });
+                }, timeout);
+            });
+
+            return Promise.race([promise, timeoutPromise]).finally(function () {
+                clearTimeout(timeoutHandle);
+            });
+        }
+
+        function setupCheckLoginIframe() {
+            var promise = createPromise();
+
+            if (!loginIframe.enable) {
+                promise.setSuccess();
+                return promise.promise;
+            }
+
+            if (loginIframe.iframe) {
+                promise.setSuccess();
+                return promise.promise;
+            }
+
+            var iframe = document.createElement('iframe');
+            loginIframe.iframe = iframe;
+
+            iframe.onload = function() {
+                var authUrl = kc.endpoints.authorize();
+                if (authUrl.charAt(0) === '/') {
+                    loginIframe.iframeOrigin = getOrigin();
+                } else {
+                    loginIframe.iframeOrigin = authUrl.substring(0, authUrl.indexOf('/', 8));
+                }
+                promise.setSuccess();
+            }
+
+            var src = kc.endpoints.checkSessionIframe();
+            iframe.setAttribute('src', src );
+            iframe.setAttribute('title', 'keycloak-session-iframe' );
+            iframe.style.display = 'none';
+            document.body.appendChild(iframe);
+
+            var messageCallback = function(event) {
+                if ((event.origin !== loginIframe.iframeOrigin) || (loginIframe.iframe.contentWindow !== event.source)) {
+                    return;
+                }
+
+                if (!(event.data == 'unchanged' || event.data == 'changed' || event.data == 'error')) {
+                    return;
+                }
+
+
+                if (event.data != 'unchanged') {
+                    kc.clearToken();
+                }
+
+                var callbacks = loginIframe.callbackList.splice(0, loginIframe.callbackList.length);
+
+                for (var i = callbacks.length - 1; i >= 0; --i) {
+                    var promise = callbacks[i];
+                    if (event.data == 'error') {
+                        promise.setError();
+                    } else {
+                        promise.setSuccess(event.data == 'unchanged');
+                    }
+                }
+            };
+
+            window.addEventListener('message', messageCallback, false);
+
+            return promise.promise;
+        }
+
+        function scheduleCheckIframe() {
+            if (loginIframe.enable) {
+                if (kc.token) {
+                    setTimeout(function() {
+                        checkLoginIframe().then(function(unchanged) {
+                            if (unchanged) {
+                                scheduleCheckIframe();
+                            }
+                        });
+                    }, loginIframe.interval * 1000);
+                }
+            }
+        }
+
+        function checkLoginIframe() {
+            var promise = createPromise();
+
+            if (loginIframe.iframe && loginIframe.iframeOrigin ) {
+                var msg = kc.clientId + ' ' + (kc.sessionId ? kc.sessionId : '');
+                loginIframe.callbackList.push(promise);
+                var origin = loginIframe.iframeOrigin;
+                if (loginIframe.callbackList.length == 1) {
+                    loginIframe.iframe.contentWindow.postMessage(msg, origin);
+                }
+            } else {
+                promise.setSuccess();
+            }
+
+            return promise.promise;
+        }
+
+        function check3pCookiesSupported() {
+            var promise = createPromise();
+
+            if (loginIframe.enable || kc.silentCheckSsoRedirectUri) {
+                var iframe = document.createElement('iframe');
+                iframe.setAttribute('src', kc.endpoints.thirdPartyCookiesIframe());
+                iframe.setAttribute('title', 'keycloak-3p-check-iframe' );
+                iframe.style.display = 'none';
+                document.body.appendChild(iframe);
+
+                var messageCallback = function(event) {
+                    if (iframe.contentWindow !== event.source) {
+                        return;
+                    }
+
+                    if (event.data !== "supported" && event.data !== "unsupported") {
+                        return;
+                    } else if (event.data === "unsupported") {
+                        loginIframe.enable = false;
+                        if (kc.silentCheckSsoFallback) {
+                            kc.silentCheckSsoRedirectUri = false;
+                        }
+                        logWarn("[KEYCLOAK] 3rd party cookies aren't supported by this browser. checkLoginIframe and " +
+                            "silent check-sso are not available.")
+                    }
+
+                    document.body.removeChild(iframe);
+                    window.removeEventListener("message", messageCallback);
+                    promise.setSuccess();
+                };
+
+                window.addEventListener('message', messageCallback, false);
+            } else {
+                promise.setSuccess();
+            }
+
+            return applyTimeoutToPromise(promise.promise, kc.messageReceiveTimeout, "Timeout when waiting for 3rd party check iframe message.");
+        }
+
+        function loadAdapter(type) {
+            if (!type || type == 'default') {
+                return {
+                    login: function(options) {
+                        window.location.replace(kc.createLoginUrl(options));
+                        return createPromise().promise;
+                    },
+
+                    logout: function(options) {
+                        window.location.replace(kc.createLogoutUrl(options));
+                        return createPromise().promise;
+                    },
+
+                    register: function(options) {
+                        window.location.replace(kc.createRegisterUrl(options));
+                        return createPromise().promise;
+                    },
+
+                    accountManagement : function() {
+                        var accountUrl = kc.createAccountUrl();
+                        if (typeof accountUrl !== 'undefined') {
+                            window.location.href = accountUrl;
+                        } else {
+                            throw "Not supported by the OIDC server";
+                        }
+                        return createPromise().promise;
+                    },
+
+                    redirectUri: function(options, encodeHash) {
+                        if (arguments.length == 1) {
+                            encodeHash = true;
+                        }
+
+                        if (options && options.redirectUri) {
+                            return options.redirectUri;
+                        } else if (kc.redirectUri) {
+                            return kc.redirectUri;
+                        } else {
+                            return location.href;
+                        }
+                    }
+                };
+            }
+
+            if (type == 'cordova') {
+                loginIframe.enable = false;
+                var cordovaOpenWindowWrapper = function(loginUrl, target, options) {
+                    if (window.cordova && window.cordova.InAppBrowser) {
+                        // Use inappbrowser for IOS and Android if available
+                        return window.cordova.InAppBrowser.open(loginUrl, target, options);
+                    } else {
+                        return window.open(loginUrl, target, options);
+                    }
+                };
+
+                var shallowCloneCordovaOptions = function (userOptions) {
+                    if (userOptions && userOptions.cordovaOptions) {
+                        return Object.keys(userOptions.cordovaOptions).reduce(function (options, optionName) {
+                            options[optionName] = userOptions.cordovaOptions[optionName];
+                            return options;
+                        }, {});
+                    } else {
+                        return {};
+                    }
+                };
+
+                var formatCordovaOptions = function (cordovaOptions) {
+                    return Object.keys(cordovaOptions).reduce(function (options, optionName) {
+                        options.push(optionName+"="+cordovaOptions[optionName]);
+                        return options;
+                    }, []).join(",");
+                };
+
+                var createCordovaOptions = function (userOptions) {
+                    var cordovaOptions = shallowCloneCordovaOptions(userOptions);
+                    cordovaOptions.location = 'no';
+                    if (userOptions && userOptions.prompt == 'none') {
+                        cordovaOptions.hidden = 'yes';
+                    }
+                    return formatCordovaOptions(cordovaOptions);
+                };
+
+                return {
+                    login: function(options) {
+                        var promise = createPromise();
+
+                        var cordovaOptions = createCordovaOptions(options);
+                        var loginUrl = kc.createLoginUrl(options);
+                        var ref = cordovaOpenWindowWrapper(loginUrl, '_blank', cordovaOptions);
+                        var completed = false;
+
+                        var closed = false;
+                        var closeBrowser = function() {
+                            closed = true;
+                            ref.close();
+                        };
+
+                        ref.addEventListener('loadstart', function(event) {
+                            if (event.url.indexOf('http://localhost') == 0) {
+                                var callback = parseCallback(event.url);
+                                processCallback(callback, promise);
+                                closeBrowser();
+                                completed = true;
+                            }
+                        });
+
+                        ref.addEventListener('loaderror', function(event) {
+                            if (!completed) {
+                                if (event.url.indexOf('http://localhost') == 0) {
+                                    var callback = parseCallback(event.url);
+                                    processCallback(callback, promise);
+                                    closeBrowser();
+                                    completed = true;
+                                } else {
+                                    promise.setError();
+                                    closeBrowser();
+                                }
+                            }
+                        });
+
+                        ref.addEventListener('exit', function(event) {
+                            if (!closed) {
+                                promise.setError({
+                                    reason: "closed_by_user"
+                                });
+                            }
+                        });
+
+                        return promise.promise;
+                    },
+
+                    logout: function(options) {
+                        var promise = createPromise();
+
+                        var logoutUrl = kc.createLogoutUrl(options);
+                        var ref = cordovaOpenWindowWrapper(logoutUrl, '_blank', 'location=no,hidden=yes,clearcache=yes');
+
+                        var error;
+
+                        ref.addEventListener('loadstart', function(event) {
+                            if (event.url.indexOf('http://localhost') == 0) {
+                                ref.close();
+                            }
+                        });
+
+                        ref.addEventListener('loaderror', function(event) {
+                            if (event.url.indexOf('http://localhost') == 0) {
+                                ref.close();
+                            } else {
+                                error = true;
+                                ref.close();
+                            }
+                        });
+
+                        ref.addEventListener('exit', function(event) {
+                            if (error) {
+                                promise.setError();
+                            } else {
+                                kc.clearToken();
+                                promise.setSuccess();
+                            }
+                        });
+
+                        return promise.promise;
+                    },
+
+                    register : function(options) {
+                        var promise = createPromise();
+                        var registerUrl = kc.createRegisterUrl();
+                        var cordovaOptions = createCordovaOptions(options);
+                        var ref = cordovaOpenWindowWrapper(registerUrl, '_blank', cordovaOptions);
+                        ref.addEventListener('loadstart', function(event) {
+                            if (event.url.indexOf('http://localhost') == 0) {
+                                ref.close();
+                                var oauth = parseCallback(event.url);
+                                processCallback(oauth, promise);
+                            }
+                        });
+                        return promise.promise;
+                    },
+
+                    accountManagement : function() {
+                        var accountUrl = kc.createAccountUrl();
+                        if (typeof accountUrl !== 'undefined') {
+                            var ref = cordovaOpenWindowWrapper(accountUrl, '_blank', 'location=no');
+                            ref.addEventListener('loadstart', function(event) {
+                                if (event.url.indexOf('http://localhost') == 0) {
+                                    ref.close();
+                                }
+                            });
+                        } else {
+                            throw "Not supported by the OIDC server";
+                        }
+                    },
+
+                    redirectUri: function(options) {
+                        return 'http://localhost';
+                    }
+                }
+            }
+
+            if (type == 'cordova-native') {
+                loginIframe.enable = false;
+
+                return {
+                    login: function(options) {
+                        var promise = createPromise();
+                        var loginUrl = kc.createLoginUrl(options);
+
+                        universalLinks.subscribe('keycloak', function(event) {
+                            universalLinks.unsubscribe('keycloak');
+                            window.cordova.plugins.browsertab.close();
+                            var oauth = parseCallback(event.url);
+                            processCallback(oauth, promise);
+                        });
+
+                        window.cordova.plugins.browsertab.openUrl(loginUrl);
+                        return promise.promise;
+                    },
+
+                    logout: function(options) {
+                        var promise = createPromise();
+                        var logoutUrl = kc.createLogoutUrl(options);
+
+                        universalLinks.subscribe('keycloak', function(event) {
+                            universalLinks.unsubscribe('keycloak');
+                            window.cordova.plugins.browsertab.close();
+                            kc.clearToken();
+                            promise.setSuccess();
+                        });
+
+                        window.cordova.plugins.browsertab.openUrl(logoutUrl);
+                        return promise.promise;
+                    },
+
+                    register : function(options) {
+                        var promise = createPromise();
+                        var registerUrl = kc.createRegisterUrl(options);
+                        universalLinks.subscribe('keycloak' , function(event) {
+                            universalLinks.unsubscribe('keycloak');
+                            window.cordova.plugins.browsertab.close();
+                            var oauth = parseCallback(event.url);
+                            processCallback(oauth, promise);
+                        });
+                        window.cordova.plugins.browsertab.openUrl(registerUrl);
+                        return promise.promise;
+
+                    },
+
+                    accountManagement : function() {
+                        var accountUrl = kc.createAccountUrl();
+                        if (typeof accountUrl !== 'undefined') {
+                            window.cordova.plugins.browsertab.openUrl(accountUrl);
+                        } else {
+                            throw "Not supported by the OIDC server";
+                        }
+                    },
+
+                    redirectUri: function(options) {
+                        if (options && options.redirectUri) {
+                            return options.redirectUri;
+                        } else if (kc.redirectUri) {
+                            return kc.redirectUri;
+                        } else {
+                            return "http://localhost";
+                        }
+                    }
+                }
+            }
+
+            throw 'invalid adapter type: ' + type;
+        }
+
+        var LocalStorage = function() {
+            if (!(this instanceof LocalStorage)) {
+                return new LocalStorage();
+            }
+
+            localStorage.setItem('kc-test', 'test');
+            localStorage.removeItem('kc-test');
+
+            var cs = this;
+
+            function clearExpired() {
+                var time = new Date().getTime();
+                for (var i = 0; i < localStorage.length; i++)  {
+                    var key = localStorage.key(i);
+                    if (key && key.indexOf('kc-callback-') == 0) {
+                        var value = localStorage.getItem(key);
+                        if (value) {
+                            try {
+                                var expires = JSON.parse(value).expires;
+                                if (!expires || expires < time) {
+                                    localStorage.removeItem(key);
+                                }
+                            } catch (err) {
+                                localStorage.removeItem(key);
+                            }
+                        }
+                    }
+                }
+            }
+
+            cs.get = function(state) {
+                if (!state) {
+                    return;
+                }
+
+                var key = 'kc-callback-' + state;
+                var value = localStorage.getItem(key);
+                if (value) {
+                    localStorage.removeItem(key);
+                    value = JSON.parse(value);
+                }
+
+                clearExpired();
+                return value;
+            };
+
+            cs.add = function(state) {
+                clearExpired();
+
+                var key = 'kc-callback-' + state.state;
+                state.expires = new Date().getTime() + (60 * 60 * 1000);
+                localStorage.setItem(key, JSON.stringify(state));
+            };
+        };
+
+        var CookieStorage = function() {
+            if (!(this instanceof CookieStorage)) {
+                return new CookieStorage();
+            }
+
+            var cs = this;
+
+            cs.get = function(state) {
+                if (!state) {
+                    return;
+                }
+
+                var value = getCookie('kc-callback-' + state);
+                setCookie('kc-callback-' + state, '', cookieExpiration(-100));
+                if (value) {
+                    return JSON.parse(value);
+                }
+            };
+
+            cs.add = function(state) {
+                setCookie('kc-callback-' + state.state, JSON.stringify(state), cookieExpiration(60));
+            };
+
+            cs.removeItem = function(key) {
+                setCookie(key, '', cookieExpiration(-100));
+            };
+
+            var cookieExpiration = function (minutes) {
+                var exp = new Date();
+                exp.setTime(exp.getTime() + (minutes*60*1000));
+                return exp;
+            };
+
+            var getCookie = function (key) {
+                var name = key + '=';
+                var ca = document.cookie.split(';');
+                for (var i = 0; i < ca.length; i++) {
+                    var c = ca[i];
+                    while (c.charAt(0) == ' ') {
+                        c = c.substring(1);
+                    }
+                    if (c.indexOf(name) == 0) {
+                        return c.substring(name.length, c.length);
+                    }
+                }
+                return '';
+            };
+
+            var setCookie = function (key, value, expirationDate) {
+                var cookie = key + '=' + value + '; '
+                    + 'expires=' + expirationDate.toUTCString() + '; ';
+                document.cookie = cookie;
+            }
+        };
+
+        function createCallbackStorage() {
+            try {
+                return new LocalStorage();
+            } catch (err) {
+            }
+
+            return new CookieStorage();
+        }
+
+        function createLogger(fn) {
+            return function() {
+                if (kc.enableLogging) {
+                    fn.apply(console, Array.prototype.slice.call(arguments));
+                }
+            };
+        }
+    }
+
+    return Keycloak;
+})
diff --git a/BMA.EHR.Insignia.Service/wwwroot/keycloak.json b/BMA.EHR.Insignia.Service/wwwroot/keycloak.json
new file mode 100644
index 00000000..9eba3b39
--- /dev/null
+++ b/BMA.EHR.Insignia.Service/wwwroot/keycloak.json
@@ -0,0 +1,7 @@
+{
+  "realm": "bma-ehr",
+  "auth-server-url": "https://identity.frappet.com",
+  "ssl-required": "external",
+  "resource": "bma-ehr",
+  "public-client": true
+}
\ No newline at end of file
diff --git a/BMA.EHR.OrganizationEmployee.Service/Controllers/OrganizationEmployeeController.cs b/BMA.EHR.OrganizationEmployee.Service/Controllers/OrganizationEmployeeController.cs
index 6a733ada..c7401204 100644
--- a/BMA.EHR.OrganizationEmployee.Service/Controllers/OrganizationEmployeeController.cs
+++ b/BMA.EHR.OrganizationEmployee.Service/Controllers/OrganizationEmployeeController.cs
@@ -343,5 +343,37 @@ namespace BMA.EHR.OrganizationEmployee.Service.Controllers
 
             return Success();
         }
+
+        [HttpGet("position/{profileId:length(36)}")]
+        public async Task> GetPositionEmployee(Guid profileId)
+        {
+            var profile = await _context.Profiles.FindAsync(profileId);
+            if (profile == null)
+                return Error(GlobalMessages.DataNotFound, 404);
+
+            var organizationEmployee = await _context.OrganizationEmployees
+                                                .Where(x => x.Profile == null || (x.Profile != null && x.Profile == profile))
+                                                .ToListAsync();
+
+            return Success(organizationEmployee);
+        }
+
+        [HttpPut("position/{profileId:length(36)}")]
+        public async Task> PutPositionEmployee([FromBody] PositionOrgEmployee req, Guid profileId)
+        {
+            var profile = await _context.Profiles.FindAsync(profileId);
+            if (profile == null)
+                return Error(GlobalMessages.DataNotFound, 404);
+
+            var organizationEmployee = await _context.OrganizationEmployees
+                                                .Include(x => x.Profile)
+                                                .FirstOrDefaultAsync(x => x.Id == req.OrganizationEmployeeId);
+            if (organizationEmployee == null)
+                return Error(GlobalMessages.OrganizationEmployeeNotFound, 404);
+            organizationEmployee.Profile = profile;
+            _context.SaveChanges();
+
+            return Success();
+        }
     }
 }
\ No newline at end of file
diff --git a/BMA.EHR.OrganizationEmployee.Service/Requests/PositionOrgEmployee.cs b/BMA.EHR.OrganizationEmployee.Service/Requests/PositionOrgEmployee.cs
new file mode 100644
index 00000000..94106b46
--- /dev/null
+++ b/BMA.EHR.OrganizationEmployee.Service/Requests/PositionOrgEmployee.cs
@@ -0,0 +1,10 @@
+using BMA.EHR.Domain.Models.MetaData;
+using Microsoft.EntityFrameworkCore;
+
+namespace BMA.EHR.OrganizationEmployee.Service.Requests
+{
+    public class PositionOrgEmployee
+    {
+        public Guid? OrganizationEmployeeId { get; set; }
+    }
+}
diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs
index b4be0065..e7d09923 100644
--- a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs
+++ b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs
@@ -106,6 +106,8 @@ namespace BMA.EHR.Placement.Service.Controllers
                     FullName = x.Prefix == null ? null : x.Prefix.Name + $"{x.Firstname} {x.Lastname}",
                     IdCard = x.CitizenId,
                     ProfilePhoto = x.Id,
+                    PositionCandidate = x.PositionCandidate == null ? null : x.PositionCandidate.Name,
+                    PositionCandidateId = x.PositionCandidate == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionCandidate.Id,
                     OrganizationName = x.OrganizationPosition == null ? null : (x.OrganizationPosition.Organization == null ? null : (x.OrganizationPosition.Organization.OrganizationOrganization == null ? null : x.OrganizationPosition.Organization.OrganizationOrganization.Name)),////
                     OrganizationShortName = x.OrganizationPosition == null ? null : (x.OrganizationPosition.Organization == null ? null : (x.OrganizationPosition.Organization.OrganizationShortName == null ? null : x.OrganizationPosition.Organization.OrganizationShortName.Name)),////
                     PositionNumber = x.PositionNumber == null ? null : x.PositionNumber.Name,
@@ -113,6 +115,7 @@ namespace BMA.EHR.Placement.Service.Controllers
                     ReportingDate = x.ReportingDate,
                     BmaOfficer = x.IsOfficer,
                     StatusId = x.PlacementStatus,
+                    Draft = x.Draft,
                     Number = x.Number,
                     Deferment = x.IsRelief,
                 }).ToListAsync();
@@ -126,6 +129,8 @@ namespace BMA.EHR.Placement.Service.Controllers
                         p.FullName,
                         p.IdCard,
                         p.ProfilePhoto,
+                        p.PositionCandidate,
+                        p.PositionCandidateId,
                         p.OrganizationName,
                         p.OrganizationShortName,
                         p.PositionNumber,
@@ -133,6 +138,7 @@ namespace BMA.EHR.Placement.Service.Controllers
                         p.ReportingDate,
                         BmaOfficer = await _documentService.CheckBmaOfficer(p.IdCard),
                         p.StatusId,
+                        p.Draft,
                         p.Number,
                         p.Deferment,
                     };
@@ -158,6 +164,8 @@ namespace BMA.EHR.Placement.Service.Controllers
                     FullName = x.Prefix == null ? null : x.Prefix.Name + $"{x.Firstname} {x.Lastname}",
                     IdCard = x.CitizenId,
                     ProfilePhoto = x.Id,
+                    PositionCandidate = x.PositionCandidate == null ? null : x.PositionCandidate.Name,
+                    PositionCandidateId = x.PositionCandidate == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionCandidate.Id,
                     OrganizationName = x.OrganizationPosition == null ? null : (x.OrganizationPosition.Organization == null ? null : (x.OrganizationPosition.Organization.OrganizationOrganization == null ? null : x.OrganizationPosition.Organization.OrganizationOrganization.Name)),////
                     OrganizationShortName = x.OrganizationPosition == null ? null : (x.OrganizationPosition.Organization == null ? null : (x.OrganizationPosition.Organization.OrganizationShortName == null ? null : x.OrganizationPosition.Organization.OrganizationShortName.Name)),////
                     PositionNumber = x.PositionNumber == null ? null : x.PositionNumber.Name,
@@ -165,6 +173,7 @@ namespace BMA.EHR.Placement.Service.Controllers
                     ReportingDate = x.ReportingDate,
                     BmaOfficer = x.IsOfficer,
                     StatusId = x.PlacementStatus,
+                    Draft = x.Draft,
                     Number = x.Number,
                     Deferment = x.IsRelief,
                 }).OrderBy(x => x.Number).ToListAsync();
@@ -178,6 +187,8 @@ namespace BMA.EHR.Placement.Service.Controllers
                         p.FullName,
                         p.IdCard,
                         p.ProfilePhoto,
+                        p.PositionCandidate,
+                        p.PositionCandidateId,
                         p.OrganizationName,
                         p.OrganizationShortName,
                         p.PositionNumber,
@@ -185,6 +196,7 @@ namespace BMA.EHR.Placement.Service.Controllers
                         p.ReportingDate,
                         BmaOfficer = await _documentService.CheckBmaOfficer(p.IdCard),
                         p.StatusId,
+                        p.Draft,
                         p.Number,
                         p.Deferment,
                     };
@@ -225,10 +237,13 @@ namespace BMA.EHR.Placement.Service.Controllers
                 Firstname = x.Firstname,
                 Lastname = x.Lastname,
                 Nationality = x.Nationality,
+                Draft = x.Draft,
                 Race = x.Race,
                 DateOfBirth = x.DateOfBirth,
                 Age = x.DateOfBirth == null ? null : x.DateOfBirth.Value.CalculateAgeStrV2(0, 0),
                 Telephone = x.Telephone,
+                PositionCandidate = x.PositionCandidate == null ? null : x.PositionCandidate.Name,
+                PositionCandidateId = x.PositionCandidate == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionCandidate.Id,
                 Gender = x.Gender == null ? null : x.Gender.Name,
                 GenderId = x.Gender == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.Gender.Id,
                 Relationship = x.Relationship == null ? null : x.Relationship.Name,
@@ -330,11 +345,14 @@ namespace BMA.EHR.Placement.Service.Controllers
                 data.FullName,
                 data.Firstname,
                 data.Lastname,
+                data.Draft,
                 data.Nationality,
                 data.Race,
                 data.DateOfBirth,
                 data.Age,
                 data.Telephone,
+                data.PositionCandidate,
+                data.PositionCandidateId,
                 data.Gender,
                 data.GenderId,
                 data.Relationship,
@@ -585,6 +603,7 @@ namespace BMA.EHR.Placement.Service.Controllers
                     return Error(GlobalMessages.PositionTypeNotFound, 404);
                 person.PositionType = save;
             }
+            person.Draft = false;
             person.Amount = req.SalaryAmount;
             person.MouthSalaryAmount = req.MouthSalaryAmount;
             person.PositionSalaryAmount = req.PositionSalaryAmount;
@@ -896,6 +915,7 @@ namespace BMA.EHR.Placement.Service.Controllers
                 DurationYear = req.DurationYear,
                 Other = req.Other,
                 FundName = req.FundName,
+                IsDate = req.IsDate,
                 FinishDate = req.FinishDate,
                 StartDate = req.StartDate,
                 EndDate = req.EndDate,
@@ -941,6 +961,7 @@ namespace BMA.EHR.Placement.Service.Controllers
             education.DurationYear = req.DurationYear;
             education.Other = req.Other;
             education.FundName = req.FundName;
+            education.IsDate = req.IsDate;
             education.FinishDate = req.FinishDate;
             education.StartDate = req.StartDate;
             education.EndDate = req.EndDate;
@@ -974,5 +995,25 @@ namespace BMA.EHR.Placement.Service.Controllers
             return Success(position);
         }
 
+        [HttpPut("position/{placementId:length(36)}")]
+        public async Task> UpdatePositionDraft([FromBody] List items, Guid placementId)
+        {
+            var placement = await _context.Placements
+                .FirstOrDefaultAsync(x => x.Id == placementId);
+            if (placement == null)
+                return Error(GlobalMessages.DataNotFound, 404);
+
+            foreach (var item in items)
+            {
+                var profile = await _context.PlacementProfiles
+                    .FirstOrDefaultAsync(x => x.Id == item);
+                if (profile != null)
+                    profile.Draft = true;
+            }
+            _context.SaveChanges();
+
+            return Success();
+        }
+
     }
 }
diff --git a/BMA.EHR.Placement.Service/Requests/PersonEducationRequest.cs b/BMA.EHR.Placement.Service/Requests/PersonEducationRequest.cs
index dee0e76a..380111d5 100644
--- a/BMA.EHR.Placement.Service/Requests/PersonEducationRequest.cs
+++ b/BMA.EHR.Placement.Service/Requests/PersonEducationRequest.cs
@@ -19,6 +19,7 @@ namespace BMA.EHR.Placement.Service.Requests
         public int DurationYear { get; set; }
         public string? Other { get; set; }
         public string? FundName { get; set; }
+        public bool? IsDate { get; set; }
         public DateTime? FinishDate { get; set; }
         public DateTime? StartDate { get; set; }
         public DateTime? EndDate { get; set; }
diff --git a/BMA.EHR.Solution.sln b/BMA.EHR.Solution.sln
index 58eade2a..f41ee256 100644
--- a/BMA.EHR.Solution.sln
+++ b/BMA.EHR.Solution.sln
@@ -21,7 +21,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.OrganizationEmploye
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.Report.Service", "BMA.EHR.Report.Service\BMA.EHR.Report.Service.csproj", "{AC4B2602-C543-4165-85D7-F6F92F553D80}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMA.EHR.Command.Service", "BMA.EHR.Command.Service\BMA.EHR.Command.Service.csproj", "{E4E905EE-61DF-4451-B063-5C86BC7574CE}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.Command.Service", "BMA.EHR.Command.Service\BMA.EHR.Command.Service.csproj", "{E4E905EE-61DF-4451-B063-5C86BC7574CE}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMA.EHR.Insignia.Service", "BMA.EHR.Insignia.Service\BMA.EHR.Insignia.Service.csproj", "{04B37ACD-65CF-44ED-BC40-B5E7A71C374B}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -61,6 +63,10 @@ Global
 		{E4E905EE-61DF-4451-B063-5C86BC7574CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{E4E905EE-61DF-4451-B063-5C86BC7574CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{E4E905EE-61DF-4451-B063-5C86BC7574CE}.Release|Any CPU.Build.0 = Release|Any CPU
+		{04B37ACD-65CF-44ED-BC40-B5E7A71C374B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{04B37ACD-65CF-44ED-BC40-B5E7A71C374B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{04B37ACD-65CF-44ED-BC40-B5E7A71C374B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{04B37ACD-65CF-44ED-BC40-B5E7A71C374B}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -75,6 +81,7 @@ Global
 		{A54AA069-8B0E-4784-953B-5DA9F9C8285E} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
 		{AC4B2602-C543-4165-85D7-F6F92F553D80} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
 		{E4E905EE-61DF-4451-B063-5C86BC7574CE} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
+		{04B37ACD-65CF-44ED-BC40-B5E7A71C374B} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {3111A492-1818-4438-B718-75199D8E779A}