From 39acbb7f953a86fc256a0bf762b8e17e3343f00e Mon Sep 17 00:00:00 2001 From: kittapath Date: Wed, 25 Dec 2024 10:21:31 +0700 Subject: [PATCH 01/13] no message --- .../Repositories/InsigniaPeriodsRepository.cs | 34 ++++++- BMA.EHR.Insignia/appsettings.json | 20 ++-- .../Controllers/MainController.cs | 97 +++++++++++++++++++ BMA.EHR.MetaData.Service/Program.cs | 8 ++ .../Services/BloodGroupService.cs | 92 ++++++++++++++++++ .../Services/EducationLevelService.cs | 90 +++++++++++++++++ .../Services/GenderService.cs | 90 +++++++++++++++++ .../Services/PrefixService.cs | 90 +++++++++++++++++ .../Services/ProvinceService.cs | 93 ++++++++++++++++++ .../Services/RelationshipService.cs | 89 +++++++++++++++++ .../Services/ReligionService.cs | 90 +++++++++++++++++ 11 files changed, 780 insertions(+), 13 deletions(-) create mode 100644 BMA.EHR.MetaData.Service/Controllers/MainController.cs create mode 100644 BMA.EHR.MetaData.Service/Services/BloodGroupService.cs create mode 100644 BMA.EHR.MetaData.Service/Services/EducationLevelService.cs create mode 100644 BMA.EHR.MetaData.Service/Services/GenderService.cs create mode 100644 BMA.EHR.MetaData.Service/Services/PrefixService.cs create mode 100644 BMA.EHR.MetaData.Service/Services/ProvinceService.cs create mode 100644 BMA.EHR.MetaData.Service/Services/RelationshipService.cs create mode 100644 BMA.EHR.MetaData.Service/Services/ReligionService.cs diff --git a/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs b/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs index 7edb2d48..d2cb59ac 100644 --- a/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs +++ b/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs @@ -87,8 +87,8 @@ namespace BMA.EHR.Application.Repositories Id = i.Id, Name = i.Name, ShortName = i.ShortName, - Level = i.InsigniaType.Name, - LevelId = i.InsigniaType.Id + Level = i.InsigniaType?.Name ?? "", + LevelId = i.InsigniaType?.Id ?? null }) .FirstOrDefault(); @@ -6531,24 +6531,39 @@ namespace BMA.EHR.Application.Repositories (await _userProfileRepository.GetOfficerProfileByRootIdAsync(ocId, AccessToken)); //var allEmployeeProfileByRoot = // (await _userProfileRepository.GetEmployeeProfileByRootIdAsync(ocId, AccessToken)); - + Console.WriteLine("111111"); var type_coin = await GetCoinCandidate(periodId, ocId, allOfficerProfilesByRoot); + Console.WriteLine("111112"); var type1_level1 = await GetInsigniaCandidate_Type1_Level1(periodId, ocId, allOfficerProfilesByRoot); + Console.WriteLine("111113"); var type1_level2 = await GetInsigniaCandidate_Type1_Level2(periodId, ocId, allOfficerProfilesByRoot); + Console.WriteLine("111114"); var type1_level3 = await GetInsigniaCandidate_Type1_Level3(periodId, ocId, allOfficerProfilesByRoot); + Console.WriteLine("111115"); var type1_level4 = await GetInsigniaCandidate_Type1_Level4(periodId, ocId, allOfficerProfilesByRoot); + Console.WriteLine("111116"); var type2_level5 = await GetInsigniaCandidate_Type2_Level5(periodId, ocId, allOfficerProfilesByRoot); + Console.WriteLine("111117"); var type2_level6 = await GetInsigniaCandidate_Type2_Level6(periodId, ocId, allOfficerProfilesByRoot); + Console.WriteLine("111118"); var type2_level7 = await GetInsigniaCandidate_Type2_Level7(periodId, ocId, allOfficerProfilesByRoot); + Console.WriteLine("111119"); var type2_level8 = await GetInsigniaCandidate_Type2_Level8(periodId, ocId, allOfficerProfilesByRoot); + Console.WriteLine("111110"); var type2_level9_1 = await GetInsigniaCandidate_Type2_Level9_1(periodId, ocId, allOfficerProfilesByRoot); + Console.WriteLine("1111111"); var type2_level9_2 = await GetInsigniaCandidate_Type2_Level9_2(periodId, ocId, allOfficerProfilesByRoot); + Console.WriteLine("1111112"); var type3_level10 = await GetInsigniaCandidate_Type3_Level10(periodId, ocId, allOfficerProfilesByRoot); + Console.WriteLine("1111113"); var type3_level11 = await GetInsigniaCandidate_Type3_Level11(periodId, ocId, allOfficerProfilesByRoot); + Console.WriteLine("1111114"); var type4_level10 = await GetInsigniaCandidate_Type4_Level10(periodId, ocId, allOfficerProfilesByRoot); + Console.WriteLine("1111115"); var type4_level11 = await GetInsigniaCandidate_Type4_Level11(periodId, ocId, allOfficerProfilesByRoot); + Console.WriteLine("1111116"); // union result foreach (var r in type_coin) @@ -6693,11 +6708,14 @@ namespace BMA.EHR.Application.Repositories { try { + Console.WriteLine("2222222"); var period = await _dbContext.Set().FirstOrDefaultAsync(p => p.Id == periodId); + Console.WriteLine("22222221"); if (period == null) throw new Exception(GlobalMessages.CoinPeriodNotFound); + Console.WriteLine("22222223"); var inst_profile = allProfilesByRoot.Where(x => x.DateAppoint != null) .Select(p => new { @@ -6743,6 +6761,8 @@ namespace BMA.EHR.Application.Repositories PositionSalaryAmount = p.PositionSalaryAmount, }); + Console.WriteLine("22222224"); + Console.WriteLine(JsonConvert.SerializeObject(inst_profile)); // check วันที่บรรจะต้องมากกว่า 25 ปี var result = ((from p in inst_profile where p.ProfileDateAppoint <= new DateTime(period.Year - 25, 5, 29) @@ -6774,25 +6794,33 @@ namespace BMA.EHR.Application.Repositories MatchingConditions = new List(), })).ToList(); + Console.WriteLine("22222225"); var result_candidate = new List(); + Console.WriteLine("22222226"); foreach (var r in result) { + Console.WriteLine("22222228"); var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + Console.WriteLine("22222220"); // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? if (!CanRequestInsignia(r.ProfileId, period.Year)) continue; + Console.WriteLine("22222229"); // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) continue; + Console.WriteLine("222222212"); if (old == null) { result_candidate.Add(r); } + Console.WriteLine("222222243"); } + Console.WriteLine("22222227"); return result_candidate; } diff --git a/BMA.EHR.Insignia/appsettings.json b/BMA.EHR.Insignia/appsettings.json index 18131c5b..b46a9934 100644 --- a/BMA.EHR.Insignia/appsettings.json +++ b/BMA.EHR.Insignia/appsettings.json @@ -14,16 +14,16 @@ "AllowedHosts": "*", "ConnectionStrings": { //"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB", - //"DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" - //"DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", - "DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", - "ExamConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_exam_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", - "LeaveConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_leave_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", - "DisciplineConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_discipline_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" + //"DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=53636;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" + //"DefaultConnection": "server=hrms.chin.in.th;user=root;password=adminVM123;port=53636;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", + "DefaultConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", + "ExamConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", + "LeaveConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", + "DisciplineConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_discipline;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" }, "Jwt": { - "Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI", - "Issuer": "https://id.frappet.synology.me/realms/bma-ehr" + "Key": "j7C9RO_p4nRtuwCH4z9Db_A_6We42tkD_p4lZtDrezc", + "Issuer": "https://hrms-id.chin.in.th/realms/hrms" }, "EPPlus": { "ExcelPackage": { @@ -42,9 +42,9 @@ }, "Protocol": "HTTPS", "Node": { - "API": "https://bma-ehr.frappet.synology.me/api/v1/probation" + "API": "https://hrms.chin.in.th/api/v1/probation" }, - "API": "https://bma-ehr.frappet.synology.me/api/v1", + "API": "https://hrms.chin.in.th/api/v1", "RabbitMQ": { "URL": "localhost", "UserName": "frappet", diff --git a/BMA.EHR.MetaData.Service/Controllers/MainController.cs b/BMA.EHR.MetaData.Service/Controllers/MainController.cs new file mode 100644 index 00000000..27a5cecd --- /dev/null +++ b/BMA.EHR.MetaData.Service/Controllers/MainController.cs @@ -0,0 +1,97 @@ +using BMA.EHR.Domain.Common; +using BMA.EHR.Domain.Models.MetaData; +using BMA.EHR.MetaData.Service.Request; +using BMA.EHR.MetaData.Service.Services; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Swashbuckle.AspNetCore.Annotations; + +namespace BMA.EHR.MetaData.Service.Controllers +{ + [Route("api/v{version:apiVersion}/metadata/main")] + [ApiVersion("1.0")] + [ApiController] + [Produces("application/json")] + [Authorize] + [SwaggerTag("จัดการข้อมูลตำแหน่ง เพื่อนำไปใช้งานในระบบ")] + public class MainController : BaseController + { + #region " Fields " + + private readonly BloodGroupService _bloodGroupService; + private readonly EducationLevelService _educationLevelService; + private readonly GenderService _genderService; + private readonly ProvinceService _provinceService; + private readonly PrefixService _prefixService; + private readonly RelationshipService _relationshipService; + private readonly ReligionService _religionService; + + #endregion + + #region " Constructor and Destructor " + + public MainController( + BloodGroupService bloodGroupService, + ProvinceService provinceService, + EducationLevelService educationLevelService, + GenderService genderService, + PrefixService prefixService, + RelationshipService relationshipService, + ReligionService religionService) + { + _bloodGroupService = bloodGroupService; + _provinceService = provinceService; + _educationLevelService = educationLevelService; + _genderService = genderService; + _prefixService = prefixService; + _relationshipService = relationshipService; + _religionService = religionService; + } + + #endregion + + #region " Methods " + + /// + /// อ่านข้อมูล ข้อมูลเกี่ยวกับบุคคล + /// + /// + /// อ่านข้อมูล ข้อมูลเกี่ยวกับบุคคล สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("person")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> GetsMainPersonAsync() + { + try + { + var bloodGroups = await _bloodGroupService.GetsAsync(showAll: false); + var provinces = await _provinceService.GetsAsync(showAll: false); + var educationLevels = await _educationLevelService.GetsAsync(showAll: false); + var genders = await _genderService.GetsAsync(showAll: false); + var prefixs = await _prefixService.GetsAsync(showAll: false); + var relationships = await _relationshipService.GetsAsync(showAll: false); + var religions = await _religionService.GetsAsync(showAll: false); + + return Success(new + { + bloodGroups, + provinces, + educationLevels, + genders, + prefixs, + relationships, + religions, + }); + } + catch (Exception ex) + { + return Error(ex); + } + } + + #endregion + } +} diff --git a/BMA.EHR.MetaData.Service/Program.cs b/BMA.EHR.MetaData.Service/Program.cs index 7a34cf83..6032b868 100644 --- a/BMA.EHR.MetaData.Service/Program.cs +++ b/BMA.EHR.MetaData.Service/Program.cs @@ -89,6 +89,14 @@ var builder = WebApplication.CreateBuilder(args); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); + + builder.Services.AddTransient(); + builder.Services.AddTransient(); + builder.Services.AddTransient(); + builder.Services.AddTransient(); + builder.Services.AddTransient(); + builder.Services.AddTransient(); + builder.Services.AddTransient(); builder.Services.AddControllers(options => { options.SuppressAsyncSuffixInActionNames = false; diff --git a/BMA.EHR.MetaData.Service/Services/BloodGroupService.cs b/BMA.EHR.MetaData.Service/Services/BloodGroupService.cs new file mode 100644 index 00000000..8a689920 --- /dev/null +++ b/BMA.EHR.MetaData.Service/Services/BloodGroupService.cs @@ -0,0 +1,92 @@ +using BMA.EHR.Domain.Models.MetaData; +using BMA.EHR.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; +using System.Security.Claims; + +namespace BMA.EHR.MetaData.Service.Services +{ + public class BloodGroupService + { + #region " Fields " + + private readonly ApplicationDBContext _context; + private readonly IHttpContextAccessor _httpContextAccessor; + private readonly ILogger _logger; + + #endregion + + #region " Constructor and Destructor " + + public BloodGroupService(ApplicationDBContext context, + IHttpContextAccessor httpContextAccessor, + ILogger logger) + { + _context = context; + _httpContextAccessor = httpContextAccessor; + _logger = logger; + } + + #endregion + + #region " Properties " + + private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value; + + private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value; + + #endregion + + #region " Methods " + + public async Task> GetsAsync(bool showAll = true) + { + if (showAll) + return await _context.BloodGroups.AsQueryable() + .OrderBy(d => d.Name) + .ToListAsync(); + else + return await _context.BloodGroups.AsQueryable() + .Where(p => p.IsActive) + .OrderBy(d => d.Name) + .ToListAsync(); + } + + public async Task GetByIdAsync(Guid id) + { + return await _context.BloodGroups.FirstOrDefaultAsync(x => x.Id == id); + } + + public async Task UpdateAsync(Guid id, BloodGroup updated) + { + var existData = await _context.BloodGroups.FirstOrDefaultAsync(x => x.Id == id); + if (existData != null) + { + if (existData.Name != updated.Name || existData.IsActive != updated.IsActive) + { + existData.Name = updated.Name; + existData.IsActive = updated.IsActive; + existData.LastUpdatedAt = DateTime.Now; + existData.LastUpdateUserId = UserId ?? ""; + existData.LastUpdateFullName = FullName ?? ""; + } + await _context.SaveChangesAsync(); + } + } + + public async Task CreateAsync(BloodGroup inserted) + { + inserted.CreatedUserId = UserId ?? ""; + inserted.CreatedFullName = FullName ?? "System Administrator"; + inserted.CreatedAt = DateTime.Now; + inserted.LastUpdatedAt = DateTime.Now; + inserted.LastUpdateFullName = FullName ?? "System Administrator"; + inserted.LastUpdateUserId = UserId ?? ""; + + await _context.BloodGroups.AddAsync(inserted); + + await _context.SaveChangesAsync(); + } + + #endregion + } +} diff --git a/BMA.EHR.MetaData.Service/Services/EducationLevelService.cs b/BMA.EHR.MetaData.Service/Services/EducationLevelService.cs new file mode 100644 index 00000000..ac034480 --- /dev/null +++ b/BMA.EHR.MetaData.Service/Services/EducationLevelService.cs @@ -0,0 +1,90 @@ +using BMA.EHR.Domain.Models.MetaData; +using BMA.EHR.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; +using System.Security.Claims; + + +namespace BMA.EHR.MetaData.Service.Services +{ + public class EducationLevelService + { + #region " Fields " + + private readonly ApplicationDBContext _context; + private readonly IHttpContextAccessor _httpContextAccessor; + + #endregion + + #region " Constructor and Destructor " + + public EducationLevelService(ApplicationDBContext context, + IHttpContextAccessor httpContextAccessor) + { + _context = context; + _httpContextAccessor = httpContextAccessor; + } + + #endregion + + #region " Properties " + + private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value; + + private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value; + + #endregion + + #region " Methods " + + public async Task> GetsAsync(bool showAll = true) + { + if (showAll) + return await _context.EducationLevels.AsQueryable() + .OrderBy(d => d.Name) + .ToListAsync(); + else + return await _context.EducationLevels.AsQueryable() + .Where(p => p.IsActive) + .OrderBy(d => d.Name) + .ToListAsync(); + } + + public async Task GetByIdAsync(Guid id) + { + return await _context.EducationLevels.FirstOrDefaultAsync(x => x.Id == id); + } + + public async Task UpdateAsync(Guid id, EducationLevel updated) + { + var existData = await _context.EducationLevels.FirstOrDefaultAsync(x => x.Id == id); + if (existData != null) + { + if (existData.Name != updated.Name || existData.IsActive != updated.IsActive) + { + existData.Name = updated.Name; + existData.IsActive = updated.IsActive; + existData.LastUpdatedAt = DateTime.Now; + existData.LastUpdateUserId = UserId ?? ""; + existData.LastUpdateFullName = FullName ?? ""; + } + await _context.SaveChangesAsync(); + } + } + + public async Task CreateAsync(EducationLevel inserted) + { + inserted.CreatedUserId = UserId ?? ""; + inserted.CreatedFullName = FullName ?? "System Administrator"; + inserted.CreatedAt = DateTime.Now; + inserted.LastUpdatedAt = DateTime.Now; + inserted.LastUpdateFullName = FullName ?? "System Administrator"; + inserted.LastUpdateUserId = UserId ?? ""; + + await _context.EducationLevels.AddAsync(inserted); + + await _context.SaveChangesAsync(); + } + + #endregion + } +} diff --git a/BMA.EHR.MetaData.Service/Services/GenderService.cs b/BMA.EHR.MetaData.Service/Services/GenderService.cs new file mode 100644 index 00000000..59588160 --- /dev/null +++ b/BMA.EHR.MetaData.Service/Services/GenderService.cs @@ -0,0 +1,90 @@ +using BMA.EHR.Domain.Models.MetaData; +using BMA.EHR.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; +using System.Security.Claims; + + +namespace BMA.EHR.MetaData.Service.Services +{ + public class GenderService + { + #region " Fields " + + private readonly ApplicationDBContext _context; + private readonly IHttpContextAccessor _httpContextAccessor; + + #endregion + + #region " Constructor and Destructor " + + public GenderService(ApplicationDBContext context, + IHttpContextAccessor httpContextAccessor) + { + _context = context; + _httpContextAccessor = httpContextAccessor; + } + + #endregion + + #region " Properties " + + private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value; + + private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value; + + #endregion + + #region " Methods " + + public async Task> GetsAsync(bool showAll = true) + { + if (showAll) + return await _context.Genders.AsQueryable() + .OrderBy(d => d.Name) + .ToListAsync(); + else + return await _context.Genders.AsQueryable() + .Where(p => p.IsActive) + .OrderBy(d => d.Name) + .ToListAsync(); + } + + public async Task GetByIdAsync(Guid id) + { + return await _context.Genders.FirstOrDefaultAsync(x => x.Id == id); + } + + public async Task UpdateAsync(Guid id, Gender updated) + { + var existData = await _context.Genders.FirstOrDefaultAsync(x => x.Id == id); + if (existData != null) + { + if (existData.Name != updated.Name || existData.IsActive != updated.IsActive) + { + existData.Name = updated.Name; + existData.IsActive = updated.IsActive; + existData.LastUpdatedAt = DateTime.Now; + existData.LastUpdateUserId = UserId ?? ""; + existData.LastUpdateFullName = FullName ?? ""; + } + await _context.SaveChangesAsync(); + } + } + + public async Task CreateAsync(Gender inserted) + { + inserted.CreatedUserId = UserId ?? ""; + inserted.CreatedFullName = FullName ?? "System Administrator"; + inserted.CreatedAt = DateTime.Now; + inserted.LastUpdatedAt = DateTime.Now; + inserted.LastUpdateFullName = FullName ?? "System Administrator"; + inserted.LastUpdateUserId = UserId ?? ""; + + await _context.Genders.AddAsync(inserted); + + await _context.SaveChangesAsync(); + } + + #endregion + } +} diff --git a/BMA.EHR.MetaData.Service/Services/PrefixService.cs b/BMA.EHR.MetaData.Service/Services/PrefixService.cs new file mode 100644 index 00000000..44477c61 --- /dev/null +++ b/BMA.EHR.MetaData.Service/Services/PrefixService.cs @@ -0,0 +1,90 @@ +using BMA.EHR.Domain.Models.MetaData; +using BMA.EHR.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; +using System.Security.Claims; + + +namespace BMA.EHR.MetaData.Service.Services +{ + public class PrefixService + { + #region " Fields " + + private readonly ApplicationDBContext _context; + private readonly IHttpContextAccessor _httpContextAccessor; + + #endregion + + #region " Constructor and Destructor " + + public PrefixService(ApplicationDBContext context, + IHttpContextAccessor httpContextAccessor) + { + _context = context; + _httpContextAccessor = httpContextAccessor; + } + + #endregion + + #region " Properties " + + private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value; + + private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value; + + #endregion + + #region " Methods " + + public async Task> GetsAsync(bool showAll = true) + { + if (showAll) + return await _context.Prefixes.AsQueryable() + .OrderBy(d => d.Name) + .ToListAsync(); + else + return await _context.Prefixes.AsQueryable() + .Where(p => p.IsActive) + .OrderBy(d => d.Name) + .ToListAsync(); + } + + public async Task GetByIdAsync(Guid id) + { + return await _context.Prefixes.FirstOrDefaultAsync(x => x.Id == id); + } + + public async Task UpdateAsync(Guid id, Prefix updated) + { + var existData = await _context.Prefixes.FirstOrDefaultAsync(x => x.Id == id); + if (existData != null) + { + if (existData.Name != updated.Name || existData.IsActive != updated.IsActive) + { + existData.Name = updated.Name; + existData.IsActive = updated.IsActive; + existData.LastUpdateUserId = UserId ?? ""; + existData.LastUpdateFullName = FullName ?? ""; + existData.LastUpdatedAt = DateTime.Now; + } + await _context.SaveChangesAsync(); + } + } + + public async Task CreateAsync(Prefix inserted) + { + inserted.CreatedUserId = UserId ?? ""; + inserted.CreatedFullName = FullName ?? "System Administrator"; + inserted.CreatedAt = DateTime.Now; + inserted.LastUpdatedAt = DateTime.Now; + inserted.LastUpdateFullName = FullName ?? "System Administrator"; + inserted.LastUpdateUserId = UserId ?? ""; + + await _context.Prefixes.AddAsync(inserted); + + await _context.SaveChangesAsync(); + } + + #endregion + } +} diff --git a/BMA.EHR.MetaData.Service/Services/ProvinceService.cs b/BMA.EHR.MetaData.Service/Services/ProvinceService.cs new file mode 100644 index 00000000..ade9fb6f --- /dev/null +++ b/BMA.EHR.MetaData.Service/Services/ProvinceService.cs @@ -0,0 +1,93 @@ +using BMA.EHR.Domain.Models.MetaData; +using BMA.EHR.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; +using System.Security.Claims; + + +namespace BMA.EHR.MetaData.Service.Services +{ + public class ProvinceService + { + #region " Fields " + + private readonly ApplicationDBContext _context; + private readonly IHttpContextAccessor _httpContextAccessor; + + #endregion + + #region " Constructor and Destructor " + + public ProvinceService(ApplicationDBContext context, + IHttpContextAccessor httpContextAccessor) + { + _context = context; + _httpContextAccessor = httpContextAccessor; + } + + #endregion + + #region " Properties " + + private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value; + + private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value; + + #endregion + + #region " Methods " + + public async Task> GetsAsync(bool showAll = true) + { + if (showAll) + return await _context.Provinces.AsQueryable() + .OrderBy(d => d.Name) + .ToListAsync(); + else + return await _context.Provinces.AsQueryable() + .Where(p => p.IsActive) + .OrderBy(d => d.Name) + .ToListAsync(); + } + + public async Task GetByIdAsync(Guid id) + { + return await _context.Provinces + .AsQueryable() + .Include(x => x.Districts) + .FirstOrDefaultAsync(x => x.Id == id); + } + + public async Task UpdateAsync(Guid id, Province updated) + { + var existData = await _context.Provinces.FirstOrDefaultAsync(x => x.Id == id); + if (existData != null) + { + if (existData.Name != updated.Name || existData.IsActive != updated.IsActive) + { + existData.Name = updated.Name; + existData.IsActive = updated.IsActive; + existData.LastUpdatedAt = DateTime.Now; + existData.LastUpdateUserId = UserId ?? ""; + existData.LastUpdateFullName = FullName ?? ""; + } + await _context.SaveChangesAsync(); + } + } + + public async Task CreateAsync(Province inserted) + { + inserted.CreatedUserId = UserId ?? ""; + inserted.CreatedFullName = FullName ?? "System Administrator"; + inserted.CreatedAt = DateTime.Now; + inserted.LastUpdatedAt = DateTime.Now; + inserted.LastUpdateFullName = FullName ?? "System Administrator"; + inserted.LastUpdateUserId = UserId ?? ""; + + await _context.Provinces.AddAsync(inserted); + + await _context.SaveChangesAsync(); + } + + #endregion + } +} \ No newline at end of file diff --git a/BMA.EHR.MetaData.Service/Services/RelationshipService.cs b/BMA.EHR.MetaData.Service/Services/RelationshipService.cs new file mode 100644 index 00000000..8b60132f --- /dev/null +++ b/BMA.EHR.MetaData.Service/Services/RelationshipService.cs @@ -0,0 +1,89 @@ +using BMA.EHR.Domain.Models.MetaData; +using BMA.EHR.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; +using System.Security.Claims; + + +namespace BMA.EHR.MetaData.Service.Services; + +public class RelationshipService +{ + #region " Fields " + + private readonly ApplicationDBContext _context; + private readonly IHttpContextAccessor _httpContextAccessor; + + #endregion + + #region " Constructor and Destructor " + + public RelationshipService(ApplicationDBContext context, + IHttpContextAccessor httpContextAccessor) + { + _context = context; + _httpContextAccessor = httpContextAccessor; + } + + #endregion + + #region " Properties " + + private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value; + + private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value; + + #endregion + + #region " Methods " + + public async Task> GetsAsync(bool showAll = true) + { + if (showAll) + return await _context.Relationships.AsQueryable() + .OrderBy(d => d.Name) + .ToListAsync(); + else + return await _context.Relationships.AsQueryable() + .Where(p => p.IsActive) + .OrderBy(d => d.Name) + .ToListAsync(); + } + + public async Task GetByIdAsync(Guid id) + { + return await _context.Relationships.FirstOrDefaultAsync(x => x.Id == id); + } + + public async Task UpdateAsync(Guid id, Relationship updated) + { + var existData = await _context.Relationships.FirstOrDefaultAsync(x => x.Id == id); + if (existData != null) + { + if (existData.Name != updated.Name || existData.IsActive != updated.IsActive) + { + existData.Name = updated.Name; + existData.IsActive = updated.IsActive; + existData.LastUpdateUserId = UserId ?? ""; + existData.LastUpdateFullName = FullName ?? ""; + existData.LastUpdatedAt = DateTime.Now; + } + await _context.SaveChangesAsync(); + } + } + + public async Task CreateAsync(Relationship inserted) + { + inserted.CreatedUserId = UserId ?? ""; + inserted.CreatedFullName = FullName ?? "System Administrator"; + inserted.CreatedAt = DateTime.Now; + inserted.LastUpdatedAt = DateTime.Now; + inserted.LastUpdateFullName = FullName ?? "System Administrator"; + inserted.LastUpdateUserId = UserId ?? ""; + + await _context.Relationships.AddAsync(inserted); + + await _context.SaveChangesAsync(); + } + + #endregion +} \ No newline at end of file diff --git a/BMA.EHR.MetaData.Service/Services/ReligionService.cs b/BMA.EHR.MetaData.Service/Services/ReligionService.cs new file mode 100644 index 00000000..f646bc44 --- /dev/null +++ b/BMA.EHR.MetaData.Service/Services/ReligionService.cs @@ -0,0 +1,90 @@ +using BMA.EHR.Domain.Models.MetaData; +using BMA.EHR.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; +using System.Security.Claims; + + +namespace BMA.EHR.MetaData.Service.Services +{ + public class ReligionService + { + #region " Fields " + + private readonly ApplicationDBContext _context; + private readonly IHttpContextAccessor _httpContextAccessor; + + #endregion + + #region " Constructor and Destructor " + + public ReligionService(ApplicationDBContext context, + IHttpContextAccessor httpContextAccessor) + { + _context = context; + _httpContextAccessor = httpContextAccessor; + } + + #endregion + + #region " Properties " + + private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value; + + private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value; + + #endregion + + #region " Methods " + + public async Task> GetsAsync(bool showAll = true) + { + if (showAll) + return await _context.Religions.AsQueryable() + .OrderBy(d => d.Name) + .ToListAsync(); + else + return await _context.Religions.AsQueryable() + .Where(p => p.IsActive) + .OrderBy(d => d.Name) + .ToListAsync(); + } + + public async Task GetByIdAsync(Guid id) + { + return await _context.Religions.FirstOrDefaultAsync(x => x.Id == id); + } + + public async Task UpdateAsync(Guid id, Religion updated) + { + var existData = await _context.Religions.FirstOrDefaultAsync(x => x.Id == id); + if (existData != null) + { + if (existData.Name != updated.Name || existData.IsActive != updated.IsActive) + { + existData.Name = updated.Name; + existData.IsActive = updated.IsActive; + existData.LastUpdateUserId = UserId ?? ""; + existData.LastUpdateFullName = FullName ?? ""; + existData.LastUpdatedAt = DateTime.Now; + } + await _context.SaveChangesAsync(); + } + } + + public async Task CreateAsync(Religion inserted) + { + inserted.CreatedUserId = UserId ?? ""; + inserted.CreatedFullName = FullName ?? "System Administrator"; + inserted.CreatedAt = DateTime.Now; + inserted.LastUpdatedAt = DateTime.Now; + inserted.LastUpdateFullName = FullName ?? "System Administrator"; + inserted.LastUpdateUserId = UserId ?? ""; + + await _context.Religions.AddAsync(inserted); + + await _context.SaveChangesAsync(); + } + + #endregion + } +} From a521eb345d23bd660326625fe708cc753cc726b4 Mon Sep 17 00:00:00 2001 From: Bright Date: Wed, 25 Dec 2024 18:15:38 +0700 Subject: [PATCH 02/13] =?UTF-8?q?fix=20=E0=B8=AB=E0=B8=A1=E0=B8=B2?= =?UTF-8?q?=E0=B8=A2=E0=B9=80=E0=B8=AB=E0=B8=95=E0=B8=B8=E0=B9=81=E0=B8=99?= =?UTF-8?q?=E0=B8=A7=E0=B8=99=E0=B8=AD=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/DisciplineResultController.cs | 16 +- .../PlacementAppointmentController.cs | 194 ++++++++-------- .../Controllers/PlacementController.cs | 219 +++++++++--------- .../Controllers/PlacementOfficerController.cs | 26 ++- .../Controllers/PlacementReceiveController.cs | 42 ++-- .../PlacementTransferController.cs | 34 +-- .../Controllers/RetirementOtherController.cs | 90 +++---- .../Controllers/RetirementResignController.cs | 68 +++--- .../RetirementResignEmployeeController.cs | 68 +++--- 9 files changed, 399 insertions(+), 358 deletions(-) diff --git a/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs b/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs index 36028d83..9662aa45 100644 --- a/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs +++ b/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs @@ -1039,13 +1039,15 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new { - fullName = _null, - positionname = r.RemarkHorizontal, - positionno = _null, - organizationname = _null, - salary = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new { + fullName = _null, + positionname = r.RemarkHorizontal, + positionno = _null, + organizationname = _null, + salary = _null, + }); + } } return Success(result); } diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs index fa8e7b28..fc25fa13 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs @@ -844,27 +844,29 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - Education = _null, - OldOc = _null, - OldPositionType = _null, - OldPositionLevel = _null, - OldPositionNumber = _null, - OldSalary = _null, - LeaveDate = _null, - NewOc = _null, - NewPositionType = _null, - NewPositionLevel = _null, - NewPositionNumber = _null, - NewSalary = _null, - AppointDate = _null, - CommandExcecuteDate = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + Education = _null, + OldOc = _null, + OldPositionType = _null, + OldPositionLevel = _null, + OldPositionNumber = _null, + OldSalary = _null, + LeaveDate = _null, + NewOc = _null, + NewPositionType = _null, + NewPositionLevel = _null, + NewPositionNumber = _null, + NewSalary = _null, + AppointDate = _null, + CommandExcecuteDate = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } @@ -1054,27 +1056,29 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - Education = _null, - OldOc = _null, - OldPositionType = _null, - OldPositionLevel = _null, - OldPositionNumber = _null, - OldSalary = _null, - LeaveDate = _null, - NewOc = _null, - NewPositionType = _null, - NewPositionLevel = _null, - NewPositionNumber = _null, - NewSalary = _null, - AppointDate = _null, - CommandExcecuteDate = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + Education = _null, + OldOc = _null, + OldPositionType = _null, + OldPositionLevel = _null, + OldPositionNumber = _null, + OldSalary = _null, + LeaveDate = _null, + NewOc = _null, + NewPositionType = _null, + NewPositionLevel = _null, + NewPositionNumber = _null, + NewSalary = _null, + AppointDate = _null, + CommandExcecuteDate = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } @@ -1261,21 +1265,23 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - OldOrganization = _null, - OldPositionLevel = _null, - OldPositionNumber = _null, - OldSalary = _null, - NewOc = _null, - NewPositionLevel = _null, - NewPositionNumber = _null, - NewSalary = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + OldOrganization = _null, + OldPositionLevel = _null, + OldPositionNumber = _null, + OldSalary = _null, + NewOc = _null, + NewPositionLevel = _null, + NewPositionNumber = _null, + NewSalary = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } @@ -1464,21 +1470,23 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - OldOc = _null, - OldPositionNumber = _null, - OldSalary = _null, - NewOc = _null, - NewPositionNumber = _null, - NewSalary = _null, - ReportingDate = _null, - CommandExcecuteDate = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + OldOc = _null, + OldPositionNumber = _null, + OldSalary = _null, + NewOc = _null, + NewPositionNumber = _null, + NewSalary = _null, + ReportingDate = _null, + CommandExcecuteDate = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } @@ -1678,26 +1686,28 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - Education = _null, - OldOc = _null, - OldPositionType = _null, - OldPositionLevel = _null, - OldPositionNumber = _null, - OldSalary = _null, - NewOc = _null, - NewPositionType = _null, - NewPositionLevel = _null, - NewPositionNumber = _null, - NewSalary = _null, - AppointDate = _null, - CommandExcecuteDate = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + Education = _null, + OldOc = _null, + OldPositionType = _null, + OldPositionLevel = _null, + OldPositionNumber = _null, + OldSalary = _null, + NewOc = _null, + NewPositionType = _null, + NewPositionLevel = _null, + NewPositionNumber = _null, + NewSalary = _null, + AppointDate = _null, + CommandExcecuteDate = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs index 0736477f..a93d007f 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs @@ -1623,27 +1623,30 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { - No = _null, - FullName = r.RemarkHorizontal, - Education = _null, - PositionName = _null, - ExamNumber = _null, - PlacementName = _null, - Oc = _null, - PositionType = _null, - PositionLevel = _null, - PositionNumber = _null, - Salary = _null, - AppointDate = _null, - CommandExcecuteDate = _null, - OccupationPosition = _null, - PositionCandidate = _null, - OcCandidate = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + Education = _null, + PositionName = _null, + ExamNumber = _null, + PlacementName = _null, + Oc = _null, + PositionType = _null, + PositionLevel = _null, + PositionNumber = _null, + Salary = _null, + AppointDate = _null, + CommandExcecuteDate = _null, + OccupationPosition = _null, + PositionCandidate = _null, + OcCandidate = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } @@ -1927,26 +1930,28 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - Education = _null, - PositionName = _null, - ExamNumber = _null, - PlacementName = _null, - Oc = _null, - PositionType = _null, - PositionLevel = _null, - PositionNumber = _null, - Salary = _null, - AppointDate = _null, - CommandExcecuteDate = _null, - OccupationPosition = _null, - PositionCandidate = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + Education = _null, + PositionName = _null, + ExamNumber = _null, + PlacementName = _null, + Oc = _null, + PositionType = _null, + PositionLevel = _null, + PositionNumber = _null, + Salary = _null, + AppointDate = _null, + CommandExcecuteDate = _null, + OccupationPosition = _null, + PositionCandidate = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } @@ -2250,28 +2255,30 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - Education = _null, - OldOc = _null, - OldPositionType = _null, - OldPositionLevel = _null, - OldPositionNumber = _null, - OldSalary = _null, - OldPosition = _null, - NewOc = _null, - NewPosition = _null, - NewPositionType = _null, - NewPositionLevel = _null, - NewPositionNumber = _null, - NewSalary = _null, - AppointDate = _null, - CommandExcecuteDate = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + Education = _null, + OldOc = _null, + OldPositionType = _null, + OldPositionLevel = _null, + OldPositionNumber = _null, + OldSalary = _null, + OldPosition = _null, + NewOc = _null, + NewPosition = _null, + NewPositionType = _null, + NewPositionLevel = _null, + NewPositionNumber = _null, + NewSalary = _null, + AppointDate = _null, + CommandExcecuteDate = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } @@ -2476,28 +2483,30 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - Education = _null, - OldOc = _null, - OldPosition = _null, - OldPositionType = _null, - OldPositionLevel = _null, - OldPositionNumber = _null, - OldSalary = _null, - NewOc = _null, - NewPosition = _null, - NewPositionType = _null, - NewPositionLevel = _null, - NewPositionNumber = _null, - NewSalary = _null, - AppointDate = _null, - CommandExcecuteDate = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + Education = _null, + OldOc = _null, + OldPosition = _null, + OldPositionType = _null, + OldPositionLevel = _null, + OldPositionNumber = _null, + OldSalary = _null, + NewOc = _null, + NewPosition = _null, + NewPositionType = _null, + NewPositionLevel = _null, + NewPositionNumber = _null, + NewSalary = _null, + AppointDate = _null, + CommandExcecuteDate = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } @@ -2693,26 +2702,28 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - Education = _null, - OldOc = _null, - OldPositionType = _null, - OldPositionLevel = _null, - OldPositionNumber = _null, - OldSalary = _null, - LeaveDate = _null, - NewOc = _null, - NewPositionType = _null, - NewPositionLevel = _null, - NewPositionNumber = _null, - NewSalary = _null, - AppointDate = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + Education = _null, + OldOc = _null, + OldPositionType = _null, + OldPositionLevel = _null, + OldPositionNumber = _null, + OldSalary = _null, + LeaveDate = _null, + NewOc = _null, + NewPositionType = _null, + NewPositionLevel = _null, + NewPositionNumber = _null, + NewSalary = _null, + AppointDate = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementOfficerController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementOfficerController.cs index 67a4149e..217a2d06 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementOfficerController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementOfficerController.cs @@ -628,18 +628,20 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - PositionName = _null, - Organization = _null, - StartDate = _null, - EndDate = _null, - Reason = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + PositionName = _null, + Organization = _null, + StartDate = _null, + EndDate = _null, + Reason = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs index 4e581132..5eb0f505 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs @@ -974,26 +974,28 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - Education = _null, - OldOrg = _null, - OldOc = _null, - OldPositionType = _null, - OldPositionLevel = _null, - OldSalary = _null, - NewOc = _null, - NewPositionType = _null, - NewPositionLevel = _null, - NewPositionNumber = _null, - NewSalary = _null, - AppointDate = _null, - CommandExcecuteDate = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + Education = _null, + OldOrg = _null, + OldOc = _null, + OldPositionType = _null, + OldPositionLevel = _null, + OldSalary = _null, + NewOc = _null, + NewPositionType = _null, + NewPositionLevel = _null, + NewPositionNumber = _null, + NewSalary = _null, + AppointDate = _null, + CommandExcecuteDate = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs index d0828a85..045be807 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs @@ -838,22 +838,24 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - OldOc = _null, - PositionType = _null, - PositionLevel = _null, - PositionNumber = _null, - Salary = _null, - ReceiveOrganizationName = _null, - ActiveDate = _null, - CommandExcecuteDate = _null, - Reason = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + OldOc = _null, + PositionType = _null, + PositionLevel = _null, + PositionNumber = _null, + Salary = _null, + ReceiveOrganizationName = _null, + ActiveDate = _null, + CommandExcecuteDate = _null, + Reason = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs index 3ee9b641..81bc5bce 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs @@ -721,27 +721,29 @@ namespace BMA.EHR.Retirement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - Education = _null, - OldOc = _null, - OldPositionType = _null, - OldPositionLevel = _null, - OldPositionNumber = _null, - OldSalary = _null, - LeaveDate = _null, - NewOc = _null, - NewPositionType = _null, - NewPositionLevel = _null, - NewPositionNumber = _null, - NewSalary = _null, - AppointDate = _null, - CommandExcecuteDate = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + Education = _null, + OldOc = _null, + OldPositionType = _null, + OldPositionLevel = _null, + OldPositionNumber = _null, + OldSalary = _null, + LeaveDate = _null, + NewOc = _null, + NewPositionType = _null, + NewPositionLevel = _null, + NewPositionNumber = _null, + NewSalary = _null, + AppointDate = _null, + CommandExcecuteDate = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } @@ -925,28 +927,30 @@ namespace BMA.EHR.Retirement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - Education = _null, - OldOc = _null, - OldPositionType = _null, - OldPositionLevel = _null, - OldPositionNumber = _null, - OldSalary = _null, - LeaveDate = _null, - MilitaryDate = _null, - NewOc = _null, - NewPositionType = _null, - NewPositionLevel = _null, - NewPositionNumber = _null, - NewSalary = _null, - AppointDate = _null, - CommandExcecuteDate = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + Education = _null, + OldOc = _null, + OldPositionType = _null, + OldPositionLevel = _null, + OldPositionNumber = _null, + OldSalary = _null, + LeaveDate = _null, + MilitaryDate = _null, + NewOc = _null, + NewPositionType = _null, + NewPositionLevel = _null, + NewPositionNumber = _null, + NewSalary = _null, + AppointDate = _null, + CommandExcecuteDate = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs index 31eecadd..7507add9 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs @@ -2394,22 +2394,24 @@ namespace BMA.EHR.Retirement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - CitizenId = _null, - PositionName = _null, - Organization = _null, - PositionLevel = _null, - PositionType = _null, - PositionNumber = _null, - ActiveDate = _null, - Salary = _null, - Remark = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + CitizenId = _null, + PositionName = _null, + Organization = _null, + PositionLevel = _null, + PositionType = _null, + PositionNumber = _null, + ActiveDate = _null, + Salary = _null, + Remark = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } @@ -2575,22 +2577,24 @@ namespace BMA.EHR.Retirement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - CitizenId = _null, - PositionName = _null, - Organization = _null, - PositionLevel = _null, - PositionType = _null, - PositionNumber = _null, - ActiveDate = _null, - Salary = _null, - Remark = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + CitizenId = _null, + PositionName = _null, + Organization = _null, + PositionLevel = _null, + PositionType = _null, + PositionNumber = _null, + ActiveDate = _null, + Salary = _null, + Remark = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementResignEmployeeController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementResignEmployeeController.cs index 4e50079f..86a554c6 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementResignEmployeeController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementResignEmployeeController.cs @@ -2337,22 +2337,24 @@ namespace BMA.EHR.Retirement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - CitizenId = _null, - PositionName = _null, - Organization = _null, - PositionLevel = _null, - PositionType = _null, - PositionNumber = _null, - ActiveDate = _null, - Salary = _null, - Remark = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + CitizenId = _null, + PositionName = _null, + Organization = _null, + PositionLevel = _null, + PositionType = _null, + PositionNumber = _null, + ActiveDate = _null, + Salary = _null, + Remark = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } @@ -2518,22 +2520,24 @@ namespace BMA.EHR.Retirement.Service.Controllers { result.Add(r); string? _null = null; - result.Add(new - { - No = _null, - FullName = r.RemarkHorizontal, - CitizenId = _null, - PositionName = _null, - Organization = _null, - PositionLevel = _null, - PositionType = _null, - PositionNumber = _null, - ActiveDate = _null, - Salary = _null, - Remark = _null, - RemarkHorizontal = _null, - RemarkVertical = _null, - }); + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + result.Add(new + { + No = _null, + FullName = r.RemarkHorizontal, + CitizenId = _null, + PositionName = _null, + Organization = _null, + PositionLevel = _null, + PositionType = _null, + PositionNumber = _null, + ActiveDate = _null, + Salary = _null, + Remark = _null, + RemarkHorizontal = _null, + RemarkVertical = _null, + }); + } } return Success(result); } From 90a958addedd35d35682874e7a281e0933689d32 Mon Sep 17 00:00:00 2001 From: kittapath Date: Wed, 25 Dec 2024 22:57:15 +0700 Subject: [PATCH 03/13] no message --- .../Repositories/InsigniaPeriodsRepository.cs | 358 ++++++++++-------- .../Profiles/GetProfileByKeycloakIdDto.cs | 10 +- 2 files changed, 195 insertions(+), 173 deletions(-) diff --git a/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs b/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs index d2cb59ac..bca46caf 100644 --- a/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs +++ b/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs @@ -264,7 +264,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix ?? "", FullName = $"{(p.Prefix ?? "")}{p.FirstName} {p.LastName}", Position = p.Position ?? "", - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", ProfileDateAppoint = p.DateAppoint.Value, GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), PosNo = p.PosNo, @@ -282,9 +282,9 @@ namespace BMA.EHR.Application.Repositories : p.ProfileInsignia!.OrderByDescending(x => x.Year).FirstOrDefault()!.InsigniaId.Value, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PositionSalaryAmount = p.PositionSalaryAmount, @@ -371,7 +371,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix ?? "", FullName = $"{(p.Prefix ?? "")}{p.FirstName} {p.LastName}", Position = p.Position ?? "", - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", ProfileDateAppoint = p.DateAppoint.Value, GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), PosNo = p.PosNo, @@ -393,9 +393,9 @@ namespace BMA.EHR.Application.Repositories : p.ProfileInsignia!.OrderByDescending(x => x.Year).FirstOrDefault()!.InsigniaId.Value, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, IsHigherLevel = IsHigherLevel(p.ProfileInsignia.ToList() @@ -476,7 +476,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix ?? "", FullName = $"{(p.Prefix ?? "")}{p.FirstName} {p.LastName}", Position = p.Position ?? "", - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", ProfileDateAppoint = p.DateAppoint.Value, GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), PosNo = p.PosNo, @@ -496,9 +496,9 @@ namespace BMA.EHR.Application.Repositories : p.ProfileInsignia!.OrderByDescending(x => x.Year).FirstOrDefault()!.InsigniaId.Value, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, IsHigherLevel = IsHigherLevel(p.ProfileInsignia.ToList() @@ -661,7 +661,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix ?? "", FullName = $"{(p.Prefix ?? "")}{p.FirstName} {p.LastName}", Position = p.Position ?? "", - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", ProfileDateAppoint = p.DateAppoint.Value, GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), PosNo = p.PosNo, @@ -679,9 +679,9 @@ namespace BMA.EHR.Application.Repositories : p.ProfileInsignia!.OrderByDescending(x => x.Year).FirstOrDefault()!.InsigniaId.Value, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PositionSalaryAmount = p.PositionSalaryAmount, @@ -767,7 +767,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix ?? "", FullName = $"{(p.Prefix ?? "")}{p.FirstName} {p.LastName}", Position = p.Position ?? "", - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", ProfileDateAppoint = p.DateAppoint.Value, GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), PosNo = p.PosNo, @@ -785,9 +785,9 @@ namespace BMA.EHR.Application.Repositories : p.ProfileInsignia!.OrderByDescending(x => x.Year).FirstOrDefault()!.InsigniaId.Value, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, IsHigherLevel = IsHigherLevel(p.ProfileInsignia.ToList() @@ -871,7 +871,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix ?? "", FullName = $"{(p.Prefix ?? "")}{p.FirstName} {p.LastName}", Position = p.Position ?? "", - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", ProfileDateAppoint = p.DateAppoint.Value, GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), PosNo = p.PosNo, @@ -889,9 +889,9 @@ namespace BMA.EHR.Application.Repositories : p.ProfileInsignia!.OrderByDescending(x => x.Year).FirstOrDefault()!.InsigniaId.Value, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, IsHigherLevel = IsHigherLevel(p.ProfileInsignia.ToList() @@ -1036,11 +1036,15 @@ namespace BMA.EHR.Application.Repositories { try { + Console.WriteLine("11asd1112"); var period = await _dbContext.Set().FirstOrDefaultAsync(p => p.Id == periodId); + Console.WriteLine("11asd1112z"); if (period == null) throw new Exception(GlobalMessages.CoinPeriodNotFound); + Console.WriteLine("11asdz111qwe2"); var CurrentRetireDate = new DateTime(period.Year, 9, 30); + Console.WriteLine("11asdz1cad112"); var inst_profile = allProfilesByRoot .Select(p => new { @@ -1053,10 +1057,10 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix ?? "", FullName = $"{(p.Prefix ?? "")}{p.FirstName} {p.LastName}", Position = p.Position ?? "", - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", ProfileDateAppoint = p.DateAppoint.Value, GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), - PosNo = p.PosNo, + PosNo = p.PosNo ?? "", PositionLevelId = p.PosLevelId, PositionLevelName = p.PosLevel, PositionTypeId = p.PosTypeId, @@ -1078,9 +1082,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, ProfileInsignia = p.ProfileInsignia, @@ -1090,6 +1094,16 @@ namespace BMA.EHR.Application.Repositories Root = p.Root, }); + Console.WriteLine("11asdz1qweqwdgfafs112"); + Console.WriteLine(inst_profile); + Console.WriteLine("11asdz1qweqwdgfafs1112"); + Console.WriteLine(allProfilesByRoot); + Console.WriteLine("11asdz1qweqwdgfafs1212"); + Console.WriteLine(JsonConvert.SerializeObject(allProfilesByRoot)); + Console.WriteLine("11asdz1qweqwdgfafs3112"); + Console.WriteLine(JsonConvert.SerializeObject(inst_profile)); + Console.WriteLine("11asdz1qweqwdgfafs1412"); + Console.WriteLine("11asdz1112"); // check วันที่บรรจะต้องน้อยกว่า 29/5/ปี-5 var s1 = ((from p in inst_profile where p.ProfileDateAppoint <= new DateTime(period.Year - 5, 5, 29) @@ -1113,7 +1127,7 @@ namespace BMA.EHR.Application.Repositories FullName = p.FullName, Position = p.Position, PosNo = p.PosNo, - Rank = p.Rank, + Rank = p.Rank ?? "", GovAge = p.GovAge, LastInsignia = p.LastInsignia, LastInsigniaId = p.LastInsigniaId, @@ -1135,6 +1149,7 @@ namespace BMA.EHR.Application.Repositories } })).ToList(); + Console.WriteLine("11ased1112"); var s2 = (from p in allProfilesByRoot where p.PosType == "ทั่วไป" && p.PosLevel == "ปฏิบัติงาน" @@ -1153,10 +1168,10 @@ namespace BMA.EHR.Application.Repositories p.LastName, p.BirthDate, p.DateAppoint, - Prefix = p.Prefix == null ? null : p.Prefix, + Prefix = p.Prefix == null ? "" : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", - Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Position = p.Position == null ? "" : p.Position, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -1175,13 +1190,13 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, - PosNo = p.PosNo, - Gender = p.Gender == null ? null : p.Gender, + PosNo = p.PosNo ?? "", + Gender = p.Gender == null ? "" : p.Gender, PositionLevelId = p.PosLevelId, PositionLevelName = p.PosLevel, PositionTypeId = p.PosTypeId, @@ -1244,6 +1259,7 @@ namespace BMA.EHR.Application.Repositories }) .ToList(); + Console.WriteLine("11atsd1112"); var s3 = (from p in allProfilesByRoot where p.PosType == "ทั่วไป" && p.PosLevel == "ปฏิบัติงาน" @@ -1262,10 +1278,10 @@ namespace BMA.EHR.Application.Repositories p.LastName, p.BirthDate, p.DateAppoint, - Prefix = p.Prefix == null ? null : p.Prefix, + Prefix = p.Prefix == null ? "" : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", - Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Position = p.Position == null ? "" : p.Position, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -1284,13 +1300,13 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, - PosNo = p.PosNo, - Gender = p.Gender == null ? null : p.Gender, + PosNo = p.PosNo ?? "", + Gender = p.Gender == null ? "" : p.Gender, PositionLevelId = p.PosLevelId, PositionLevelName = p.PosLevel, PositionTypeId = p.PosTypeId, @@ -1352,6 +1368,7 @@ namespace BMA.EHR.Application.Repositories }) .ToList(); + Console.WriteLine("11hasd1112"); var s4 = (from p in allProfilesByRoot where p.PosType == "ทั่วไป" && p.PosLevel == "ปฏิบัติงาน" @@ -1370,10 +1387,10 @@ namespace BMA.EHR.Application.Repositories p.LastName, p.BirthDate, p.DateAppoint, - Prefix = p.Prefix == null ? null : p.Prefix, + Prefix = p.Prefix == null ? "" : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", - Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Position = p.Position == null ? "" : p.Position, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -1392,13 +1409,13 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, - PosNo = p.PosNo, - Gender = p.Gender == null ? null : p.Gender, + PosNo = p.PosNo ?? "", + Gender = p.Gender == null ? "" : p.Gender, PositionLevelId = p.PosLevelId, PositionLevelName = p.PosLevel, PositionTypeId = p.PosTypeId, @@ -1468,8 +1485,10 @@ namespace BMA.EHR.Application.Repositories .ToList(); + Console.WriteLine("11asd1fs112"); var result_candidate = new List(); + Console.WriteLine("11aqfassd1112"); foreach (var r in s4) { var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); @@ -1488,6 +1507,7 @@ namespace BMA.EHR.Application.Repositories } } + Console.WriteLine("11asdxcd1112"); foreach (var r in s3) { var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); @@ -1506,6 +1526,7 @@ namespace BMA.EHR.Application.Repositories } } + Console.WriteLine("11asdqwfds1112"); foreach (var r in s2) { var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); @@ -1524,6 +1545,7 @@ namespace BMA.EHR.Application.Repositories } } + Console.WriteLine("11aszxcsdd1112"); foreach (var r in s1) { var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); @@ -1542,6 +1564,7 @@ namespace BMA.EHR.Application.Repositories } } + Console.WriteLine("11asqgtyud1112"); return result_candidate; } catch @@ -1588,7 +1611,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -1607,9 +1630,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -1696,7 +1719,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -1715,9 +1738,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -1876,7 +1899,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -1895,9 +1918,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -1989,7 +2012,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -2008,9 +2031,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -2170,7 +2193,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -2189,9 +2212,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -2284,7 +2307,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -2303,9 +2326,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -2407,7 +2430,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -2426,9 +2449,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -2615,7 +2638,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -2634,9 +2657,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -2782,7 +2805,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -2801,9 +2824,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -2902,7 +2925,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -2921,9 +2944,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -3025,7 +3048,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -3044,9 +3067,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year - 5, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year - 5, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year - 5, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year - 5, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -3232,7 +3255,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -3251,9 +3274,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -3348,7 +3371,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -3367,9 +3390,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -3544,7 +3567,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -3563,9 +3586,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -3665,7 +3688,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -3684,9 +3707,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -3788,7 +3811,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -3807,9 +3830,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -3993,7 +4016,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -4013,9 +4036,9 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -4122,7 +4145,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -4142,9 +4165,9 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo == null ? "" : p.PosNo, @@ -4251,7 +4274,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -4271,9 +4294,9 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, @@ -4461,7 +4484,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -4481,9 +4504,9 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -4590,7 +4613,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -4610,9 +4633,9 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -4719,7 +4742,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -4739,9 +4762,9 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -4923,10 +4946,10 @@ namespace BMA.EHR.Application.Repositories p.LastName, p.BirthDate, p.DateAppoint, - Prefix = p.Prefix == null ? null : p.Prefix, + Prefix = p.Prefix == null ? "" : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", - Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Position = p.Position == null ? "" : p.Position, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -4946,13 +4969,13 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo == null ? "" : p.PosNo, - Gender = p.Gender == null ? null : p.Gender, + Gender = p.Gender == null ? "" : p.Gender, PositionLevelId = p.PosLevelId, PositionLevelName = p.PosLevel, PositionTypeId = p.PosTypeId, @@ -5042,10 +5065,10 @@ namespace BMA.EHR.Application.Repositories p.LastName, p.BirthDate, p.DateAppoint, - Prefix = p.Prefix == null ? null : p.Prefix, + Prefix = p.Prefix == null ? "" : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", - Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Position = p.Position == null ? "" : p.Position, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -5065,13 +5088,13 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, - Gender = p.Gender == null ? null : p.Gender, + Gender = p.Gender == null ? "" : p.Gender, PositionLevelId = p.PosLevelId, PositionLevelName = p.PosLevel, PositionTypeId = p.PosTypeId, @@ -5232,10 +5255,10 @@ namespace BMA.EHR.Application.Repositories p.LastName, p.BirthDate, p.DateAppoint, - Prefix = p.Prefix == null ? null : p.Prefix, + Prefix = p.Prefix == null ? "" : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", - Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Position = p.Position == null ? "" : p.Position, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -5255,13 +5278,13 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, - Gender = p.Gender == null ? null : p.Gender, + Gender = p.Gender == null ? "" : p.Gender, PositionLevelId = p.PosLevelId, PositionLevelName = p.PosLevel, PositionTypeId = p.PosTypeId, @@ -5355,10 +5378,10 @@ namespace BMA.EHR.Application.Repositories p.LastName, p.BirthDate, p.DateAppoint, - Prefix = p.Prefix == null ? null : p.Prefix, + Prefix = p.Prefix == null ? "" : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", - Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Position = p.Position == null ? "" : p.Position, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -5378,13 +5401,13 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, - Gender = p.Gender == null ? null : p.Gender, + Gender = p.Gender == null ? "" : p.Gender, PositionLevelId = p.PosLevelId, PositionLevelName = p.PosLevel, PositionTypeId = p.PosTypeId, @@ -5479,10 +5502,10 @@ namespace BMA.EHR.Application.Repositories p.LastName, p.BirthDate, p.DateAppoint, - Prefix = p.Prefix == null ? null : p.Prefix, + Prefix = p.Prefix == null ? "" : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -5502,13 +5525,13 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, - Gender = p.Gender == null ? null : p.Gender, + Gender = p.Gender == null ? "" : p.Gender, PositionLevelId = p.PosLevelId, PositionLevelName = p.PosLevel, PositionTypeId = p.PosTypeId, @@ -5685,7 +5708,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -5705,9 +5728,9 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -5808,7 +5831,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -5828,9 +5851,9 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -5931,7 +5954,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -5951,9 +5974,9 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -6105,7 +6128,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -6125,9 +6148,9 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -6234,7 +6257,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -6254,9 +6277,9 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -6363,7 +6386,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix == null ? null : p.Prefix, FullName = $"{(p.Prefix == null ? null : p.Prefix)}{p.FirstName} {p.LastName}", Position = p.Position == null ? null : p.Position, - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), ProfileDateAppoint = p.DateAppoint.Value, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 ? "" : @@ -6383,9 +6406,9 @@ namespace BMA.EHR.Application.Repositories Salary = p.Amount, SalaryPosition = p.PositionSalaryAmount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PosNo = p.PosNo, @@ -6527,8 +6550,7 @@ namespace BMA.EHR.Application.Repositories try { var result_candidate = new List(); - var allOfficerProfilesByRoot = - (await _userProfileRepository.GetOfficerProfileByRootIdAsync(ocId, AccessToken)); + var allOfficerProfilesByRoot = await _userProfileRepository.GetOfficerProfileByRootIdAsync(ocId, AccessToken); //var allEmployeeProfileByRoot = // (await _userProfileRepository.GetEmployeeProfileByRootIdAsync(ocId, AccessToken)); Console.WriteLine("111111"); @@ -6555,15 +6577,15 @@ namespace BMA.EHR.Application.Repositories Console.WriteLine("1111111"); var type2_level9_2 = await GetInsigniaCandidate_Type2_Level9_2(periodId, ocId, allOfficerProfilesByRoot); - Console.WriteLine("1111112"); + Console.WriteLine("a1111112"); var type3_level10 = await GetInsigniaCandidate_Type3_Level10(periodId, ocId, allOfficerProfilesByRoot); - Console.WriteLine("1111113"); + Console.WriteLine("111s1113"); var type3_level11 = await GetInsigniaCandidate_Type3_Level11(periodId, ocId, allOfficerProfilesByRoot); - Console.WriteLine("1111114"); + Console.WriteLine("111s1114"); var type4_level10 = await GetInsigniaCandidate_Type4_Level10(periodId, ocId, allOfficerProfilesByRoot); - Console.WriteLine("1111115"); + Console.WriteLine("1d111115"); var type4_level11 = await GetInsigniaCandidate_Type4_Level11(periodId, ocId, allOfficerProfilesByRoot); - Console.WriteLine("1111116"); + Console.WriteLine("1a111116"); // union result foreach (var r in type_coin) @@ -6728,7 +6750,7 @@ namespace BMA.EHR.Application.Repositories Prefix = p.Prefix ?? "", FullName = $"{(p.Prefix ?? "")}{p.FirstName} {p.LastName}", Position = p.Position ?? "", - Rank = p.PosLevel, + Rank = p.PosLevel ?? "", ProfileDateAppoint = p.DateAppoint.Value, GovAge = p.DateAppoint.Value.CalculateGovAgeStr(0, 0), PosNo = p.PosNo, @@ -6753,9 +6775,9 @@ namespace BMA.EHR.Application.Repositories .OrderByDescending(x => x.Year).FirstOrDefault().InsigniaId, Salary = p.Amount, SalaryCondition = p.ProfileSalary == null || p.ProfileSalary.Count == 0 ? 0 : - p.ProfileSalary.Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + p.ProfileSalary.Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault() != null ? p.ProfileSalary - .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) + .Where(x => x.Date != null).Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, PositionSalaryAmount = p.PositionSalaryAmount, @@ -6783,7 +6805,7 @@ namespace BMA.EHR.Application.Repositories FullName = p.FullName, Position = p.Position, PosNo = p.PosNo, - Rank = p.Rank, + Rank = p.Rank ?? "", GovAge = p.GovAge, LastInsignia = p.LastInsignia, LastInsigniaId = p.LastInsigniaId, diff --git a/BMA.EHR.Application/Responses/Profiles/GetProfileByKeycloakIdDto.cs b/BMA.EHR.Application/Responses/Profiles/GetProfileByKeycloakIdDto.cs index 5f92679a..d43b35bf 100644 --- a/BMA.EHR.Application/Responses/Profiles/GetProfileByKeycloakIdDto.cs +++ b/BMA.EHR.Application/Responses/Profiles/GetProfileByKeycloakIdDto.cs @@ -94,7 +94,7 @@ namespace BMA.EHR.Application.Responses.Profiles public Guid? LastUpdateUserId { get; set; } public string? CreatedFullName { get; set; } public string? LastUpdateFullName { get; set; } - public string PosNo { get; set; } = string.Empty; + public string? PosNo { get; set; } = string.Empty; public double? Amount { get; set; } @@ -102,15 +102,15 @@ namespace BMA.EHR.Application.Responses.Profiles public double? MouthSalaryAmount { get; set; } - public int Order { get; set; } + public int? Order { get; set; } public DateTime? Date { get; set; } - public string PositionLevel { get; set; } = string.Empty; + public string? PositionLevel { get; set; } = string.Empty; - public string PositionType { get; set; } = string.Empty; + public string? PositionType { get; set; } = string.Empty; - public string Position { get; set; } = string.Empty; + public string? Position { get; set; } = string.Empty; } From f9656fedcb0ff0bbcaac424353a7423b993aad66 Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Thu, 26 Dec 2024 10:53:03 +0700 Subject: [PATCH 04/13] report template --- .../Controllers/RetirementController.cs | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs index bb6c5aca..4044d892 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs @@ -1280,5 +1280,49 @@ namespace BMA.EHR.Retirement.Service.Controllers await _context.SaveChangesAsync(); return Success(true); } + + /// + /// report1 + /// + /// + /// + /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("report1")] + public async Task> report1(string? nodeId = null, int? node = 0, DateOnly? startDate = null, DateOnly? startEnd = null) + { + var data = new + { + template = "retriement01", + reportName = "xlsx-report", + data = "" + }; + + return Success(data); + } + + /// + /// report2 + /// + /// + /// + /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("report2")] + public async Task> report2(string? nodeId = null, int? node = 0, DateOnly? startDate = null, DateOnly? startEnd = null) + { + + var data = new + { + template = "retriement02", + reportName = "xlsx-report", + data = "" + + }; + + return Success(data); + } } } From f2fa09c01f3c2c05f9d4ab71377dfd3206361660 Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Thu, 26 Dec 2024 11:18:47 +0700 Subject: [PATCH 05/13] fix --- .../Controllers/RetirementController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs index 4044d892..87e2be80 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs @@ -1294,7 +1294,7 @@ namespace BMA.EHR.Retirement.Service.Controllers { var data = new { - template = "retriement01", + template = "retirement01", reportName = "xlsx-report", data = "" }; @@ -1316,7 +1316,7 @@ namespace BMA.EHR.Retirement.Service.Controllers var data = new { - template = "retriement02", + template = "retirement02", reportName = "xlsx-report", data = "" From f5c76a5fac68360a528f40b03719a6f1511b6d74 Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Thu, 26 Dec 2024 13:24:09 +0700 Subject: [PATCH 06/13] #888 --- BMA.EHR.Placement.Service/Controllers/PlacementController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs index a93d007f..62f6021d 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs @@ -727,7 +727,7 @@ namespace BMA.EHR.Placement.Service.Controllers .FirstOrDefaultAsync(x => x.Id == req.PersonalId); if (person == null) return Error(GlobalMessages.DataNotFound, 404); - + bool? _nullBool = null; person.OrganizationPosition = null; person.PositionNumber = null; person.PositionPath = null; @@ -772,7 +772,7 @@ namespace BMA.EHR.Placement.Service.Controllers person.nodeId = null; person.posmasterId = null; person.positionId = null; - person.Draft = false; + person.Draft = _nullBool; person.typeCommand = null; await _context.SaveChangesAsync(); From 8dffddc4250d7aaf4f83cd3337c71de1a1392cc0 Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Thu, 26 Dec 2024 13:53:12 +0700 Subject: [PATCH 07/13] fix --- BMA.EHR.Placement.Service/Controllers/PlacementController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs index 62f6021d..bc7a4883 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs @@ -762,7 +762,7 @@ namespace BMA.EHR.Placement.Service.Controllers person.child4ShortName = null; person.orgRevisionId = null; person.posMasterNo = null; - person.positionName = null; + //person.positionName = null; person.positionField = null; person.posTypeId = null; person.posTypeName = null; From 2573ce1a168c58111aecb1e9f8b2d6317fc48a79 Mon Sep 17 00:00:00 2001 From: kittapath Date: Thu, 26 Dec 2024 14:39:27 +0700 Subject: [PATCH 08/13] no message --- .../Repositories/InsigniaPeriodsRepository.cs | 52 ------------------- 1 file changed, 52 deletions(-) diff --git a/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs b/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs index bca46caf..e17423de 100644 --- a/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs +++ b/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs @@ -1036,15 +1036,11 @@ namespace BMA.EHR.Application.Repositories { try { - Console.WriteLine("11asd1112"); var period = await _dbContext.Set().FirstOrDefaultAsync(p => p.Id == periodId); - Console.WriteLine("11asd1112z"); if (period == null) throw new Exception(GlobalMessages.CoinPeriodNotFound); - Console.WriteLine("11asdz111qwe2"); var CurrentRetireDate = new DateTime(period.Year, 9, 30); - Console.WriteLine("11asdz1cad112"); var inst_profile = allProfilesByRoot .Select(p => new { @@ -1094,16 +1090,6 @@ namespace BMA.EHR.Application.Repositories Root = p.Root, }); - Console.WriteLine("11asdz1qweqwdgfafs112"); - Console.WriteLine(inst_profile); - Console.WriteLine("11asdz1qweqwdgfafs1112"); - Console.WriteLine(allProfilesByRoot); - Console.WriteLine("11asdz1qweqwdgfafs1212"); - Console.WriteLine(JsonConvert.SerializeObject(allProfilesByRoot)); - Console.WriteLine("11asdz1qweqwdgfafs3112"); - Console.WriteLine(JsonConvert.SerializeObject(inst_profile)); - Console.WriteLine("11asdz1qweqwdgfafs1412"); - Console.WriteLine("11asdz1112"); // check วันที่บรรจะต้องน้อยกว่า 29/5/ปี-5 var s1 = ((from p in inst_profile where p.ProfileDateAppoint <= new DateTime(period.Year - 5, 5, 29) @@ -1149,7 +1135,6 @@ namespace BMA.EHR.Application.Repositories } })).ToList(); - Console.WriteLine("11ased1112"); var s2 = (from p in allProfilesByRoot where p.PosType == "ทั่วไป" && p.PosLevel == "ปฏิบัติงาน" @@ -1259,7 +1244,6 @@ namespace BMA.EHR.Application.Repositories }) .ToList(); - Console.WriteLine("11atsd1112"); var s3 = (from p in allProfilesByRoot where p.PosType == "ทั่วไป" && p.PosLevel == "ปฏิบัติงาน" @@ -1368,7 +1352,6 @@ namespace BMA.EHR.Application.Repositories }) .ToList(); - Console.WriteLine("11hasd1112"); var s4 = (from p in allProfilesByRoot where p.PosType == "ทั่วไป" && p.PosLevel == "ปฏิบัติงาน" @@ -1485,10 +1468,8 @@ namespace BMA.EHR.Application.Repositories .ToList(); - Console.WriteLine("11asd1fs112"); var result_candidate = new List(); - Console.WriteLine("11aqfassd1112"); foreach (var r in s4) { var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); @@ -1507,7 +1488,6 @@ namespace BMA.EHR.Application.Repositories } } - Console.WriteLine("11asdxcd1112"); foreach (var r in s3) { var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); @@ -1526,7 +1506,6 @@ namespace BMA.EHR.Application.Repositories } } - Console.WriteLine("11asdqwfds1112"); foreach (var r in s2) { var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); @@ -1545,7 +1524,6 @@ namespace BMA.EHR.Application.Repositories } } - Console.WriteLine("11aszxcsdd1112"); foreach (var r in s1) { var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); @@ -1564,7 +1542,6 @@ namespace BMA.EHR.Application.Repositories } } - Console.WriteLine("11asqgtyud1112"); return result_candidate; } catch @@ -6553,39 +6530,23 @@ namespace BMA.EHR.Application.Repositories var allOfficerProfilesByRoot = await _userProfileRepository.GetOfficerProfileByRootIdAsync(ocId, AccessToken); //var allEmployeeProfileByRoot = // (await _userProfileRepository.GetEmployeeProfileByRootIdAsync(ocId, AccessToken)); - Console.WriteLine("111111"); var type_coin = await GetCoinCandidate(periodId, ocId, allOfficerProfilesByRoot); - Console.WriteLine("111112"); var type1_level1 = await GetInsigniaCandidate_Type1_Level1(periodId, ocId, allOfficerProfilesByRoot); - Console.WriteLine("111113"); var type1_level2 = await GetInsigniaCandidate_Type1_Level2(periodId, ocId, allOfficerProfilesByRoot); - Console.WriteLine("111114"); var type1_level3 = await GetInsigniaCandidate_Type1_Level3(periodId, ocId, allOfficerProfilesByRoot); - Console.WriteLine("111115"); var type1_level4 = await GetInsigniaCandidate_Type1_Level4(periodId, ocId, allOfficerProfilesByRoot); - Console.WriteLine("111116"); var type2_level5 = await GetInsigniaCandidate_Type2_Level5(periodId, ocId, allOfficerProfilesByRoot); - Console.WriteLine("111117"); var type2_level6 = await GetInsigniaCandidate_Type2_Level6(periodId, ocId, allOfficerProfilesByRoot); - Console.WriteLine("111118"); var type2_level7 = await GetInsigniaCandidate_Type2_Level7(periodId, ocId, allOfficerProfilesByRoot); - Console.WriteLine("111119"); var type2_level8 = await GetInsigniaCandidate_Type2_Level8(periodId, ocId, allOfficerProfilesByRoot); - Console.WriteLine("111110"); var type2_level9_1 = await GetInsigniaCandidate_Type2_Level9_1(periodId, ocId, allOfficerProfilesByRoot); - Console.WriteLine("1111111"); var type2_level9_2 = await GetInsigniaCandidate_Type2_Level9_2(periodId, ocId, allOfficerProfilesByRoot); - Console.WriteLine("a1111112"); var type3_level10 = await GetInsigniaCandidate_Type3_Level10(periodId, ocId, allOfficerProfilesByRoot); - Console.WriteLine("111s1113"); var type3_level11 = await GetInsigniaCandidate_Type3_Level11(periodId, ocId, allOfficerProfilesByRoot); - Console.WriteLine("111s1114"); var type4_level10 = await GetInsigniaCandidate_Type4_Level10(periodId, ocId, allOfficerProfilesByRoot); - Console.WriteLine("1d111115"); var type4_level11 = await GetInsigniaCandidate_Type4_Level11(periodId, ocId, allOfficerProfilesByRoot); - Console.WriteLine("1a111116"); // union result foreach (var r in type_coin) @@ -6730,14 +6691,11 @@ namespace BMA.EHR.Application.Repositories { try { - Console.WriteLine("2222222"); var period = await _dbContext.Set().FirstOrDefaultAsync(p => p.Id == periodId); - Console.WriteLine("22222221"); if (period == null) throw new Exception(GlobalMessages.CoinPeriodNotFound); - Console.WriteLine("22222223"); var inst_profile = allProfilesByRoot.Where(x => x.DateAppoint != null) .Select(p => new { @@ -6783,8 +6741,6 @@ namespace BMA.EHR.Application.Repositories PositionSalaryAmount = p.PositionSalaryAmount, }); - Console.WriteLine("22222224"); - Console.WriteLine(JsonConvert.SerializeObject(inst_profile)); // check วันที่บรรจะต้องมากกว่า 25 ปี var result = ((from p in inst_profile where p.ProfileDateAppoint <= new DateTime(period.Year - 25, 5, 29) @@ -6816,33 +6772,25 @@ namespace BMA.EHR.Application.Repositories MatchingConditions = new List(), })).ToList(); - Console.WriteLine("22222225"); var result_candidate = new List(); - Console.WriteLine("22222226"); foreach (var r in result) { - Console.WriteLine("22222228"); var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); - Console.WriteLine("22222220"); // Check ได้รับหรือเคยยื่นขอไปในปีที่แล้วหรือไม่? if (!CanRequestInsignia(r.ProfileId, period.Year)) continue; - Console.WriteLine("22222229"); // Check ว่าชั้นที่ขอสูงกว่าชั้นที่เคยได้รับแล้วหรือไม่? if (!IsHigherLevel2(r.LastInsignia, r.RequestInsignia.Name)) continue; - Console.WriteLine("222222212"); if (old == null) { result_candidate.Add(r); } - Console.WriteLine("222222243"); } - Console.WriteLine("22222227"); return result_candidate; } From e18c9dbfa2ec5ff3c51e5054494554c04ad3e118 Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Thu, 26 Dec 2024 15:04:10 +0700 Subject: [PATCH 09/13] uncomment code --- .../Repositories/InsigniaPeriodsRepository.cs | 66 ++++++++++--------- 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs b/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs index 7edb2d48..9117eed6 100644 --- a/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs +++ b/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs @@ -287,8 +287,8 @@ namespace BMA.EHR.Application.Repositories .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, - PositionSalaryAmount = p.PositionSalaryAmount, - Amount = p.Amount, + PositionSalaryAmount = p.PositionSalaryAmount ?? 0, + Amount = p.Amount ?? 0, RootId = p.RootId, Root = p.Root, }); @@ -322,8 +322,8 @@ namespace BMA.EHR.Application.Repositories LastInsignia = p.LastInsignia, LastInsigniaId = p.LastInsigniaId, Salary = p.Salary, - PositionSalaryAmount = p.PositionSalaryAmount, - Amount = p.Amount, + PositionSalaryAmount = p.PositionSalaryAmount ?? 0, + Amount = p.Amount ?? 0, RootId = p.RootId, Root = p.Root, RequestInsignia = GetInsigniaByName("เบญจมาภรณ์มงกุฎไทย"), @@ -380,8 +380,8 @@ namespace BMA.EHR.Application.Repositories PositionTypeId = p.PosTypeId, PositionTypeName = p.PosType, Gender = p.Gender ?? "", - PositionSalaryAmount = p.PositionSalaryAmount, - Amount = p.Amount, + PositionSalaryAmount = p.PositionSalaryAmount ?? 0, + Amount = p.Amount ?? 0, RootId = p.RootId, Root = p.Root, LastInsignia = p.ProfileInsignia == null || p.ProfileInsignia.Count == 0 @@ -511,8 +511,8 @@ namespace BMA.EHR.Application.Repositories .FirstOrDefault() == null ? 0 : p.ProfileInsignia.Where(x => x.InsigniaId.Value == bcmRoyal.Id).OrderBy(x => x.Year) .FirstOrDefault().Year, - PositionSalaryAmount = p.PositionSalaryAmount, - Amount = p.Amount, + PositionSalaryAmount = p.PositionSalaryAmount ?? 0, + Amount = p.Amount ?? 0, RootId = p.RootId, Root = p.Root, }) @@ -684,8 +684,8 @@ namespace BMA.EHR.Application.Repositories .Where(x => x.Date.Value <= new DateTime(period.Year, 4, 29)) .OrderByDescending(x => x.Order).FirstOrDefault().Amount : p.Amount, - PositionSalaryAmount = p.PositionSalaryAmount, - Amount = p.Amount, + PositionSalaryAmount = p.PositionSalaryAmount ?? 0, + Amount = p.Amount ?? 0, RootId = p.RootId, Root = p.Root, }); @@ -800,8 +800,8 @@ namespace BMA.EHR.Application.Repositories .FirstOrDefault() == null ? 0 : p.ProfileInsignia.Where(x => x.InsigniaId.Value == bcpRoyal.Id).OrderBy(x => x.Year) .FirstOrDefault().Year, - PositionSalaryAmount = p.PositionSalaryAmount, - Amount = p.Amount, + PositionSalaryAmount = p.PositionSalaryAmount ?? 0, + Amount = p.Amount ?? 0, RootId = p.RootId, Root = p.Root, }) @@ -831,8 +831,8 @@ namespace BMA.EHR.Application.Repositories RequestInsignia = GetInsigniaByName("จัตุรถาภรณ์มงกุฎไทย"), Seq = 2, Gender = p.Gender, - PositionSalaryAmount = p.PositionSalaryAmount, - Amount = p.Amount, + PositionSalaryAmount = p.PositionSalaryAmount ?? 0, + Amount = p.Amount ?? 0, RootId = p.RootId, Root = p.Root, MatchingConditions = new List @@ -935,8 +935,8 @@ namespace BMA.EHR.Application.Repositories RequestInsignia = GetInsigniaByName("จัตุรถาภรณ์ช้างเผือก"), Seq = 2, Gender = p.Gender, - PositionSalaryAmount = p.PositionSalaryAmount, - Amount = p.Amount, + PositionSalaryAmount = p.PositionSalaryAmount ?? 0, + Amount = p.Amount ?? 0, RootId = p.RootId, Root = p.Root, MatchingConditions = new List @@ -6529,8 +6529,9 @@ namespace BMA.EHR.Application.Repositories var result_candidate = new List(); var allOfficerProfilesByRoot = (await _userProfileRepository.GetOfficerProfileByRootIdAsync(ocId, AccessToken)); - //var allEmployeeProfileByRoot = - // (await _userProfileRepository.GetEmployeeProfileByRootIdAsync(ocId, AccessToken)); + + var allEmployeeProfileByRoot = + (await _userProfileRepository.GetEmployeeProfileByRootIdAsync(ocId, AccessToken)); var type_coin = await GetCoinCandidate(periodId, ocId, allOfficerProfilesByRoot); var type1_level1 = await GetInsigniaCandidate_Type1_Level1(periodId, ocId, allOfficerProfilesByRoot); @@ -6550,6 +6551,10 @@ namespace BMA.EHR.Application.Repositories var type4_level10 = await GetInsigniaCandidate_Type4_Level10(periodId, ocId, allOfficerProfilesByRoot); var type4_level11 = await GetInsigniaCandidate_Type4_Level11(periodId, ocId, allOfficerProfilesByRoot); + + var employee_type1 = await GetEmployeeInsignia_Type1(periodId, ocId, allEmployeeProfileByRoot); + var employee_type2 = await GetEmployeeInsignia_Type2(periodId, ocId, allEmployeeProfileByRoot); + // union result foreach (var r in type_coin) { @@ -6656,20 +6661,19 @@ namespace BMA.EHR.Application.Repositories result_candidate.Add(r); } - // TODO : Remove for Test Error - //foreach (var r in employee_type2) - //{ - // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); - // if (old == null) - // result_candidate.Add(r); - //} + foreach (var r in employee_type2) + { + var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + if (old == null) + result_candidate.Add(r); + } - //foreach (var r in employee_type1) - //{ - // var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); - // if (old == null) - // result_candidate.Add(r); - //} + foreach (var r in employee_type1) + { + var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId); + if (old == null) + result_candidate.Add(r); + } //foreach (var r in type) From d9d1a9949795698e3b404df571ea83bc6aa1cb6f Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Thu, 26 Dec 2024 16:03:47 +0700 Subject: [PATCH 10/13] Merge --- .../Repositories/InsigniaPeriodsRepository.cs | 8 ++++---- .../Controllers/InsigniaRequestController.cs | 3 +++ BMA.EHR.Insignia/appsettings.json | 20 ++++++++++--------- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs b/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs index 76aadcd0..78bdd679 100644 --- a/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs +++ b/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs @@ -322,8 +322,8 @@ namespace BMA.EHR.Application.Repositories LastInsignia = p.LastInsignia, LastInsigniaId = p.LastInsigniaId, Salary = p.Salary, - PositionSalaryAmount = p.PositionSalaryAmount ?? 0, - Amount = p.Amount ?? 0, + PositionSalaryAmount = p.PositionSalaryAmount, + Amount = p.Amount, RootId = p.RootId, Root = p.Root, RequestInsignia = GetInsigniaByName("เบญจมาภรณ์มงกุฎไทย"), @@ -831,8 +831,8 @@ namespace BMA.EHR.Application.Repositories RequestInsignia = GetInsigniaByName("จัตุรถาภรณ์มงกุฎไทย"), Seq = 2, Gender = p.Gender, - PositionSalaryAmount = p.PositionSalaryAmount ?? 0, - Amount = p.Amount ?? 0, + PositionSalaryAmount = p.PositionSalaryAmount, + Amount = p.Amount, RootId = p.RootId, Root = p.Root, MatchingConditions = new List diff --git a/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs b/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs index 009e6e41..ee25953e 100644 --- a/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs +++ b/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs @@ -411,6 +411,9 @@ namespace BMA.EHR.Insignia.Service.Controllers if (organization == null) continue; + // TODO - Comment This + //if (organization.Id.ToString() != "e93c0ed3-7b80-42aa-8626-8abf0042f618") continue; + var result = await _repository.GetInsigniaRequest(insigniaPeriodId, organization.Id); if (result != null) { diff --git a/BMA.EHR.Insignia/appsettings.json b/BMA.EHR.Insignia/appsettings.json index b46a9934..8af3f8ff 100644 --- a/BMA.EHR.Insignia/appsettings.json +++ b/BMA.EHR.Insignia/appsettings.json @@ -14,16 +14,18 @@ "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=53636;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" + "DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" //"DefaultConnection": "server=hrms.chin.in.th;user=root;password=adminVM123;port=53636;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", - "DefaultConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", - "ExamConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", - "LeaveConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", - "DisciplineConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_discipline;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" + //"DefaultConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", + //"ExamConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", + //"LeaveConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", + //"DisciplineConnection": "server=hrms.chin.in.th;user=root;password=ey2qVVyyqGYw8CyA7h8X72559r2Ad84K;port=53636;database=hrms_discipline;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" }, "Jwt": { - "Key": "j7C9RO_p4nRtuwCH4z9Db_A_6We42tkD_p4lZtDrezc", - "Issuer": "https://hrms-id.chin.in.th/realms/hrms" + //"Key": "j7C9RO_p4nRtuwCH4z9Db_A_6We42tkD_p4lZtDrezc", + //"Issuer": "https://hrms-id.chin.in.th/realms/hrms" + "Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI", + "Issuer": "https://id.frappet.synology.me/realms/bma-ehr" }, "EPPlus": { "ExcelPackage": { @@ -42,9 +44,9 @@ }, "Protocol": "HTTPS", "Node": { - "API": "https://hrms.chin.in.th/api/v1/probation" + "API": "https://bma-ehr.frappet.synology.me/api/v1/probation" }, - "API": "https://hrms.chin.in.th/api/v1", + "API": "https://bma-ehr.frappet.synology.me/api/v1", "RabbitMQ": { "URL": "localhost", "UserName": "frappet", From 38d149c2134b5e54e9a83596eeba9d5f8b0334a7 Mon Sep 17 00:00:00 2001 From: Bright Date: Thu, 26 Dec 2024 17:37:59 +0700 Subject: [PATCH 11/13] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88?= =?UTF-8?q?=E0=B8=A1=E0=B8=9F=E0=B8=B4=E0=B8=A5=E0=B8=94=E0=B9=8C=E0=B8=AA?= =?UTF-8?q?=E0=B8=96=E0=B8=B2=E0=B8=99=E0=B8=A0=E0=B8=B2=E0=B8=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BMA.EHR.Domain/Models/Discipline/DisciplineComplaint_Appeal.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/BMA.EHR.Domain/Models/Discipline/DisciplineComplaint_Appeal.cs b/BMA.EHR.Domain/Models/Discipline/DisciplineComplaint_Appeal.cs index 3f653f9f..7bea750a 100644 --- a/BMA.EHR.Domain/Models/Discipline/DisciplineComplaint_Appeal.cs +++ b/BMA.EHR.Domain/Models/Discipline/DisciplineComplaint_Appeal.cs @@ -45,6 +45,9 @@ namespace BMA.EHR.Domain.Models.Discipline [Comment("สังกัดผู้อุทธรณ์/ร้องทุกข์")] public string? Oc { get; set; } + [Comment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)")] + public string? profileType { get; set; } + public virtual List DisciplineComplaint_Appeal_Docs { get; set; } = new List(); public virtual List DisciplineComplaint_Appeal_Historys { get; set; } = new List(); } From 935e6e5a4b00b2c05da9caee48e947bf16993219 Mon Sep 17 00:00:00 2001 From: kittapath Date: Fri, 27 Dec 2024 00:17:02 +0700 Subject: [PATCH 12/13] no message --- .../Controllers/PlacementReceiveController.cs | 11 ++++++----- BMA.EHR.Placement.Service/Requests/OrgRequest.cs | 1 + .../Controllers/RetirementResignController.cs | 8 +++++--- .../Controllers/RetirementResignEmployeeController.cs | 8 +++++--- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs index 5eb0f505..33e31c73 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs @@ -342,7 +342,7 @@ namespace BMA.EHR.Placement.Service.Controllers data.PositionTypeOld, data.PositionLevelOld, data.PositionNumberOld, - organizationPositionOld = data.OrganizationPositionOld == "/" || data.OrganizationPositionOld == null ? null: data.OrganizationPositionOld, + organizationPositionOld = data.OrganizationPositionOld == "/" || data.OrganizationPositionOld == null ? null : data.OrganizationPositionOld, data.IsActive, data.rootOld, @@ -489,7 +489,7 @@ namespace BMA.EHR.Placement.Service.Controllers placementReceive.posLevelNameOld = org.result.posLevelName; // placementReceive.EducationOld = profile.Educations.Count() == 0 ? null : $"{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Degree}-{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Field}"; - // placementReceive.AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount; + placementReceive.AmountOld = org.result.Amount; placementReceive.PositionOld = org.result.position; placementReceive.PositionLevelOld = org.result.posLevelName; @@ -974,7 +974,8 @@ namespace BMA.EHR.Placement.Service.Controllers { result.Add(r); string? _null = null; - if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") + { result.Add(new { No = _null, @@ -994,7 +995,7 @@ namespace BMA.EHR.Placement.Service.Controllers CommandExcecuteDate = _null, RemarkHorizontal = _null, RemarkVertical = _null, - }); + }); } } return Success(result); @@ -1037,7 +1038,7 @@ namespace BMA.EHR.Placement.Service.Controllers email = (String?)null, phone = (String?)null, keycloak = string.Empty, - isProbation = true, + isProbation = false, isLeave = false, dateRetire = (DateTime?)null, dateAppoint = r.commandAffectDate, diff --git a/BMA.EHR.Placement.Service/Requests/OrgRequest.cs b/BMA.EHR.Placement.Service/Requests/OrgRequest.cs index 61e77526..219566df 100644 --- a/BMA.EHR.Placement.Service/Requests/OrgRequest.cs +++ b/BMA.EHR.Placement.Service/Requests/OrgRequest.cs @@ -42,6 +42,7 @@ namespace BMA.EHR.Placement.Service.Requests public string? posLevelName { get; set; } public double? salary { get; set; } public string? education { get; set; } + public double? Amount { get; set; } } } \ No newline at end of file diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs index 7507add9..960075ed 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs @@ -946,7 +946,7 @@ namespace BMA.EHR.Retirement.Service.Controllers retirementResign.posTypeNameOld = org.result.posTypeName; retirementResign.posLevelOldId = org.result.posLevelId; retirementResign.posLevelNameOld = org.result.posLevelName; - + retirementResign.AmountOld = org.result.salary; retirementResign.PositionOld = org.result.position; retirementResign.PositionLevelOld = org.result.posLevelName; retirementResign.PositionTypeOld = org.result.posTypeName; @@ -2394,7 +2394,8 @@ namespace BMA.EHR.Retirement.Service.Controllers { result.Add(r); string? _null = null; - if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") + { result.Add(new { No = _null, @@ -2577,7 +2578,8 @@ namespace BMA.EHR.Retirement.Service.Controllers { result.Add(r); string? _null = null; - if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") + { result.Add(new { No = _null, diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementResignEmployeeController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementResignEmployeeController.cs index 86a554c6..001a020c 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementResignEmployeeController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementResignEmployeeController.cs @@ -889,7 +889,7 @@ namespace BMA.EHR.Retirement.Service.Controllers retirementResignEmployee.posTypeNameOld = org.result.posTypeName; retirementResignEmployee.posLevelOldId = org.result.posLevelId; retirementResignEmployee.posLevelNameOld = org.result.posLevelName; - + retirementResignEmployee.AmountOld = org.result.salary; retirementResignEmployee.PositionOld = org.result.position; retirementResignEmployee.PositionLevelOld = org.result.posLevelName; retirementResignEmployee.PositionTypeOld = org.result.posTypeName; @@ -2337,7 +2337,8 @@ namespace BMA.EHR.Retirement.Service.Controllers { result.Add(r); string? _null = null; - if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") + { result.Add(new { No = _null, @@ -2520,7 +2521,8 @@ namespace BMA.EHR.Retirement.Service.Controllers { result.Add(r); string? _null = null; - if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") { + if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") + { result.Add(new { No = _null, From 8566987275b3cfc561dd68ccdb6c60c4a6e20a3b Mon Sep 17 00:00:00 2001 From: kittapath Date: Fri, 27 Dec 2024 00:23:43 +0700 Subject: [PATCH 13/13] migrate db dis --- ... disciplinecom add profiletype.Designer.cs | 3379 +++++++++++++++++ ...ate table disciplinecom add profiletype.cs | 30 + .../DisciplineDbContextModelSnapshot.cs | 4 + 3 files changed, 3413 insertions(+) create mode 100644 BMA.EHR.Infrastructure/Migrations/DisciplineDb/20241226172314_update table disciplinecom add profiletype.Designer.cs create mode 100644 BMA.EHR.Infrastructure/Migrations/DisciplineDb/20241226172314_update table disciplinecom add profiletype.cs diff --git a/BMA.EHR.Infrastructure/Migrations/DisciplineDb/20241226172314_update table disciplinecom add profiletype.Designer.cs b/BMA.EHR.Infrastructure/Migrations/DisciplineDb/20241226172314_update table disciplinecom add profiletype.Designer.cs new file mode 100644 index 00000000..3192c4eb --- /dev/null +++ b/BMA.EHR.Infrastructure/Migrations/DisciplineDb/20241226172314_update table disciplinecom add profiletype.Designer.cs @@ -0,0 +1,3379 @@ +// +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.DisciplineDb +{ + [DbContext(typeof(DisciplineDbContext))] + [Migration("20241226172314_update table disciplinecom add profiletype")] + partial class updatetabledisciplinecomaddprofiletype + { + /// + 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.Discipline.DisciplineComplaint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Appellant") + .HasColumnType("longtext") + .HasComment("ผู้ร้องเรียน"); + + b.Property("ComplaintFrom") + .HasColumnType("longtext") + .HasComment("รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)"); + + b.Property("ConsideredAgency") + .HasColumnType("longtext") + .HasComment("หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง"); + + b.Property("ConsideredAgencyId") + .HasColumnType("longtext") + .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("DateConsideration") + .HasColumnType("datetime(6)") + .HasComment("วันที่กำหนดพิจารณา"); + + b.Property("DateNotification") + .HasColumnType("datetime(6)") + .HasComment("วันแจ้งเตือนล่วงหน้า"); + + b.Property("DateReceived") + .HasColumnType("datetime(6)") + .HasComment("วันที่รับเรื่อง เป็นวันที่ถือเป็นจุดเริ่มต้นของวินัยนั้น ๆ"); + + b.Property("Description") + .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("LevelConsideration") + .HasColumnType("longtext") + .HasComment("ระดับการพิจารณา 'ยังไม่ระบุ' (NORMAL คือ ปกติ, URGENT คือ ด่วน, VERY_URGENT คือ ด่วนมาก)"); + + b.Property("OffenseDetails") + .HasColumnType("longtext") + .HasComment("ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)"); + + b.Property("Organization") + .HasColumnType("longtext") + .HasComment("กรณีหน่วยงานใส่หน่วยงาน"); + + b.Property("OrganizationId") + .HasColumnType("longtext") + .HasComment("กรณีหน่วยงานใส่หน่วยงาน id"); + + b.Property("RespondentType") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)"); + + b.Property("Result") + .HasColumnType("longtext") + .HasComment("ผลการตรวจสอบ"); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext") + .HasComment("สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text") + .HasComment("เรื่องที่ร้องเรียน"); + + b.Property("activeId") + .HasColumnType("longtext") + .HasComment("version หน่วยงาน"); + + b.HasKey("Id"); + + b.ToTable("DisciplineComplaints"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Appeal", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CaseNumber") + .HasColumnType("longtext") + .HasComment("คดีเลขที่"); + + b.Property("CaseType") + .HasColumnType("longtext") + .HasComment("ประเภทคดี"); + + 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("Description") + .HasColumnType("text") + .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("Oc") + .HasColumnType("longtext") + .HasComment("สังกัดผู้อุทธรณ์/ร้องทุกข์"); + + b.Property("Position") + .HasColumnType("longtext") + .HasComment("ตำแหน่งผู้อุทธรณ์/ร้องทุกข์"); + + b.Property("ProfileId") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ProfileId"); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext") + .HasComment("สถานะอุทธรณ์/ร้องทุกข์"); + + b.Property("Title") + .HasColumnType("text") + .HasComment("เรื่องที่อุทธรณ์/ร้องทุกข์"); + + b.Property("Type") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ประเภทอุทธรณ์หรือร้องทุกข์"); + + b.Property("Year") + .HasColumnType("int") + .HasComment("ปีงบประมาณ"); + + b.Property("profileType") + .HasColumnType("longtext") + .HasComment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)"); + + b.HasKey("Id"); + + b.ToTable("DisciplineComplaint_Appeals"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Appeal_Doc", 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("DisciplineComplaint_AppealId") + .HasColumnType("char(36)"); + + 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("DisciplineComplaint_AppealId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineComplaint_Appeal_Docs"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Appeal_History", 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("DisciplineComplaint_AppealId") + .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("Status") + .IsRequired() + .HasColumnType("longtext") + .HasComment("สถานะอุทธรณ์/ร้องทุกข์"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineComplaint_AppealId"); + + b.ToTable("DisciplineComplaint_Appeal_Historys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Channel", 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() + .HasColumnType("longtext") + .HasComment("ชื่อประเภทการร้องเรียน"); + + b.HasKey("Id"); + + b.ToTable("DisciplineComplaint_Channels"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Doc", 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("DisciplineComplaintId") + .HasColumnType("char(36)"); + + 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("DisciplineComplaintId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineComplaint_Docs"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Profile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "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("DisciplineComplaintId") + .HasColumnType("char(36)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อ"); + + b.Property("IsAncestorDNA") + .HasColumnType("tinyint(1)") + .HasComment("รายการเก่า"); + + 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("Organization") + .HasColumnType("longtext") + .HasComment("สังกัด"); + + b.Property("PersonId") + .HasColumnType("longtext") + .HasComment("id อ้างอิง profile"); + + b.Property("PosNo") + .HasColumnType("longtext") + .HasComment("เลขที่ตำแหน่ง"); + + b.Property("Position") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("Prefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้า"); + + b.Property("Salary") + .HasColumnType("double") + .HasComment("เงินเดือน"); + + b.Property("child1") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child1"); + + b.Property("child1Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child1"); + + b.Property("child1ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child1"); + + b.Property("child2") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child2"); + + b.Property("child2Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child2"); + + b.Property("child2ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child2"); + + b.Property("child3") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child3"); + + b.Property("child3Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child3"); + + b.Property("child3ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child3"); + + b.Property("child4") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child4"); + + b.Property("child4Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child4"); + + b.Property("child4ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child4"); + + b.Property("posLevelId") + .HasColumnType("longtext") + .HasComment("id ระดับตำแหน่ง"); + + b.Property("posLevelName") + .HasColumnType("longtext") + .HasComment("ชื่อระดับตำแหน่ง"); + + b.Property("posMasterNo") + .HasColumnType("int") + .HasComment("เลขที่ตำแหน่ง"); + + b.Property("posTypeId") + .HasColumnType("longtext") + .HasComment("id ประเภทตำแหน่ง"); + + b.Property("posTypeName") + .HasColumnType("longtext") + .HasComment("ชื่อประเภทตำแหน่ง"); + + b.Property("profileType") + .HasColumnType("longtext") + .HasComment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)"); + + b.Property("root") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน root"); + + b.Property("rootId") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน root"); + + b.Property("rootShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน root"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineComplaintId"); + + b.ToTable("DisciplineComplaint_Profiles"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDirector", 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("Email") + .HasColumnType("longtext") + .HasComment("อีเมล"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ชื่อ"); + + b.Property("LastName") + .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.Property("Phone") + .HasColumnType("longtext") + .HasComment("เบอร์โทรศัพท์"); + + b.Property("Position") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("Prefix") + .IsRequired() + .HasColumnType("longtext") + .HasComment("คำนำหน้าชื่อ"); + + b.Property("Qualification") + .HasColumnType("longtext") + .HasComment("คุณวุฒิ"); + + b.HasKey("Id"); + + b.ToTable("DisciplineDirectors"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Appellant") + .HasColumnType("longtext") + .HasComment("ผู้ร้องเรียน"); + + b.Property("ComplaintFrom") + .HasColumnType("longtext") + .HasComment("รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)"); + + b.Property("ConsideredAgency") + .HasColumnType("longtext") + .HasComment("หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง"); + + b.Property("ConsideredAgencyId") + .HasColumnType("longtext") + .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("DateConsideration") + .HasColumnType("datetime(6)") + .HasComment("วันที่กำหนดพิจารณา"); + + b.Property("DateNotification") + .HasColumnType("datetime(6)") + .HasComment("วันแจ้งเตือนล่วงหน้า"); + + b.Property("DateReceived") + .HasColumnType("datetime(6)") + .HasComment("วันที่รับเรื่อง เป็นวันที่ถือเป็นจุดเริ่มต้นของวินัยนั้น ๆ"); + + b.Property("Description") + .HasColumnType("text") + .HasComment("รายละเอียดของเรื่องร้องเรียน"); + + b.Property("DisciplinaryCaseFault") + .HasColumnType("longtext") + .HasComment("กรณีความผิด"); + + b.Property("DisciplinaryCauseText") + .HasColumnType("longtext") + .HasComment("ผลการสอบสวน กรณีมีมูล"); + + b.Property("DisciplinaryDateAllegation") + .HasColumnType("datetime(6)") + .HasComment("วันที่รับทราบข้อกล่าวหา"); + + b.Property("DisciplinaryDateEnd") + .HasColumnType("datetime(6)") + .HasComment("วันที่สิ้นสุดการสอบสวน"); + + b.Property("DisciplinaryDateEvident") + .HasColumnType("datetime(6)") + .HasComment("วันที่สรุปพยานหลักฐาน"); + + b.Property("DisciplinaryDateInvestigation") + .HasColumnType("datetime(6)") + .HasComment("วันที่มีคำสั่งให้สอบสวน"); + + b.Property("DisciplinaryDateResult") + .HasColumnType("datetime(6)") + .HasComment("วันที่รายงานผลการสอบสวน"); + + b.Property("DisciplinaryDateStart") + .HasColumnType("datetime(6)") + .HasComment("วันที่เริ่มการสอบสวน"); + + b.Property("DisciplinaryDaysExtend") + .HasColumnType("int") + .HasComment("จำนวนวันที่ขยาย"); + + b.Property("DisciplinaryExtendStatus") + .HasColumnType("tinyint(1)") + .HasComment("ขยายเวลา"); + + b.Property("DisciplinaryFaultLevel") + .HasColumnType("longtext") + .HasComment("ระดับโทษความผิด กรณีไม่ร้ายแรง: ภาคทัณฑ์, ตัดเงินเดือน, ลดขั้นเงินเดือน | กรณีร้ายแรง: ปลดออก, ไล่ออก"); + + b.Property("DisciplinaryFaultLevelOther") + .HasColumnType("longtext") + .HasComment("ระดับโทษความผิดกรณีอื่นๆ"); + + b.Property("DisciplinaryInvestigateAt") + .HasColumnType("longtext") + .HasComment("สอบสวนที่"); + + b.Property("DisciplinaryRecordAccuser") + .HasColumnType("longtext") + .HasComment("บันทึกถ้อยคำของผู้กล่าวหา"); + + b.Property("DisciplinaryRefLaw") + .HasColumnType("longtext") + .HasComment("อ้างอิงมาตราตามกฎหมาย"); + + b.Property("DisciplinaryResult") + .HasColumnType("longtext") + .HasComment("ผลการสอบสวน เหตุผล"); + + b.Property("DisciplinaryStatusResult") + .HasColumnType("longtext") + .HasComment("ผลการสอบสวน ผล"); + + b.Property("DisciplinarySummaryEvidence") + .HasColumnType("longtext") + .HasComment("สรุปพยานหลักฐานสนับสนุนข้อกล่าวหา"); + + b.Property("DisciplinaryWitnesses") + .HasColumnType("longtext") + .HasComment("พยานและบันทึกถ้อยคำพยาน"); + + b.Property("DisciplineInvestigateId") + .HasColumnType("char(36)"); + + b.Property("InvestigationCauseText") + .HasColumnType("longtext") + .HasComment("กรณีมีมูลต้องเลือกว่า 'ร้ายแรง' หรือ 'ไม่ร้ายแรง'"); + + b.Property("InvestigationDateEnd") + .HasColumnType("datetime(6)") + .HasComment("วันที่สิ้นสุดการสืบสวน"); + + b.Property("InvestigationDateStart") + .HasColumnType("datetime(6)") + .HasComment("วันที่เริ่มการสืบสวน"); + + b.Property("InvestigationDaysExtend") + .HasColumnType("int") + .HasComment("จำนวนวันที่ต้องการขยาย"); + + b.Property("InvestigationDescription") + .HasColumnType("longtext") + .HasComment("รายละเอียดเกี่ยวกับการสืบสวน"); + + b.Property("InvestigationDetail") + .HasColumnType("longtext") + .HasComment("ลักษณะการสืบสวน (APPOINT_DIRECTORS คือ แต่งตั้งกรรมการสืบสวน, SECRET_INVESTIGATION คือ สืบสวนทางลับ, OTHER คือ อื่น ๆ)"); + + b.Property("InvestigationDetailOther") + .HasColumnType("longtext") + .HasComment("ลักษณะการสืบสวนกรณีเลือกอื่นๆ"); + + b.Property("InvestigationExtendStatus") + .HasColumnType("tinyint(1)") + .HasComment("ขยายเวลา"); + + b.Property("InvestigationStatusResult") + .HasColumnType("longtext") + .HasComment("สถานะหรือผลการสืบสวน (NOT_SPECIFIED คือ ยังไม่ระบุ, HAVE_CAUSE คือ มีมูล, NO_CAUSE คือ ไม่มีมูล"); + + 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("LevelConsideration") + .HasColumnType("longtext") + .HasComment("ระดับการพิจารณา 'ยังไม่ระบุ' (NORMAL คือ ปกติ, URGENT คือ ด่วน, VERY_URGENT คือ ด่วนมาก)"); + + b.Property("OffenseDetails") + .HasColumnType("longtext") + .HasComment("ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)"); + + b.Property("Organization") + .HasColumnType("longtext") + .HasComment("กรณีหน่วยงานใส่หน่วยงาน"); + + b.Property("OrganizationId") + .HasColumnType("longtext") + .HasComment("กรณีหน่วยงานใส่หน่วยงาน id"); + + b.Property("RespondentType") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)"); + + b.Property("Result") + .HasColumnType("longtext") + .HasComment("ผลการตรวจสอบ"); + + b.Property("ResultComplaint") + .HasColumnType("longtext") + .HasComment("ผลการตรวจสอบเรื่องร้องเรียน"); + + b.Property("ResultDescription") + .HasColumnType("longtext") + .HasComment("สรุปผลการพิจารณา"); + + b.Property("ResultDisciplineType") + .HasColumnType("longtext") + .HasComment("ประเภทวินัย"); + + b.Property("ResultInvestigate") + .HasColumnType("longtext") + .HasComment("ผลการตรวจสอบเรื่องสืบสวน"); + + b.Property("ResultOc") + .HasColumnType("longtext") + .HasComment("หน่วยงาย/ส่วนราชการ"); + + b.Property("ResultTitleType") + .HasColumnType("longtext") + .HasComment("ประเภทของเรื่อง"); + + b.Property("ResultYear") + .HasColumnType("int") + .HasComment("ปีงบประมาณ"); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext") + .HasComment("สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text") + .HasComment("เรื่องที่ร้องเรียน"); + + b.Property("activeId") + .HasColumnType("longtext") + .HasComment("version หน่วยงาน"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineInvestigateId"); + + b.ToTable("DisciplineDisciplinarys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinaryExtend", 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("DaysExtend") + .HasColumnType("int") + .HasComment("จำนวนวันที่การขยาย"); + + b.Property("DisciplineDisciplinaryId") + .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("Name") + .HasColumnType("longtext") + .HasComment("ชื่อการขยาย"); + + b.Property("Num") + .HasColumnType("int") + .HasComment("ครั้งที่ขยาย"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.ToTable("DisciplineDisciplinaryExtends"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DirectorInvestigate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CommandNo") + .HasColumnType("longtext") + .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("DisciplineDirectorId") + .HasColumnType("char(36)"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("Duty") + .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("DisciplineDirectorId"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.ToTable("DisciplineDisciplinary_DirectorInvestigates"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocComplaintInvestigate", 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("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + 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("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocComplaintInvestigates"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocInvestigate", 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("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + 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("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocInvestigates"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocInvestigateRelevant", 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("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + 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("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocInvestigateRelevants"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocOther", 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("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + 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("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocOthers"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocRecordAccuser", 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("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + 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("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocRecordAccusers"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocRelevant", 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("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + 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("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocRelevants"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocResult", 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("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + 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("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocResults"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocSummaryEvidence", 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("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + 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("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocSummaryEvidences"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocWitnesses", 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("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + 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("DisciplineDisciplinaryId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineDisciplinary_DocWitnessess"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_ProfileComplaintInvestigate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CitizenId") + .HasMaxLength(13) + .HasColumnType("varchar(13)") + .HasComment("รหัสบัตรประชาชน"); + + b.Property("CommandTypeDiscardId") + .HasColumnType("char(36)") + .HasComment("ประเภทออกคำสั่งงดโทด"); + + b.Property("CommandTypeId") + .HasColumnType("char(36)") + .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("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อ"); + + b.Property("IsAncestorDNA") + .HasColumnType("tinyint(1)") + .HasComment("รายการเก่า"); + + b.Property("IsReport") + .HasColumnType("longtext") + .HasComment("ส่งไปยุติเรื่อง"); + + b.Property("IsSuspend") + .HasColumnType("longtext") + .HasComment("ส่งไปพักราชการ"); + + 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("Organization") + .HasColumnType("longtext") + .HasComment("สังกัด"); + + b.Property("PersonId") + .HasColumnType("longtext") + .HasComment("id อ้างอิง profile"); + + b.Property("PosNo") + .HasColumnType("longtext") + .HasComment("เลขที่ตำแหน่ง"); + + b.Property("Position") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("Prefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้า"); + + b.Property("Salary") + .HasColumnType("double") + .HasComment("เงินเดือน"); + + b.Property("Status") + .HasColumnType("longtext") + .HasComment("สถานะออกคำสั่ง"); + + b.Property("StatusDiscard") + .HasColumnType("longtext") + .HasComment("สถานะออกคำสั่งงดโทด"); + + b.Property("child1") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child1"); + + b.Property("child1Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child1"); + + b.Property("child1ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child1"); + + b.Property("child2") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child2"); + + b.Property("child2Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child2"); + + b.Property("child2ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child2"); + + b.Property("child3") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child3"); + + b.Property("child3Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child3"); + + b.Property("child3ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child3"); + + b.Property("child4") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child4"); + + b.Property("child4Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child4"); + + b.Property("child4ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child4"); + + b.Property("posLevelId") + .HasColumnType("longtext") + .HasComment("id ระดับตำแหน่ง"); + + b.Property("posLevelName") + .HasColumnType("longtext") + .HasComment("ชื่อระดับตำแหน่ง"); + + b.Property("posMasterNo") + .HasColumnType("int") + .HasComment("เลขที่ตำแหน่ง"); + + b.Property("posTypeId") + .HasColumnType("longtext") + .HasComment("id ประเภทตำแหน่ง"); + + b.Property("posTypeName") + .HasColumnType("longtext") + .HasComment("ชื่อประเภทตำแหน่ง"); + + b.Property("profileType") + .HasColumnType("longtext") + .HasComment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)"); + + b.Property("root") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน root"); + + b.Property("rootId") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน root"); + + b.Property("rootShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน root"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.ToTable("DisciplineDisciplinary_ProfileComplaintInvestigates"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("Appellant") + .HasColumnType("longtext") + .HasComment("ผู้ร้องเรียน"); + + b.Property("ComplaintFrom") + .HasColumnType("longtext") + .HasComment("รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)"); + + b.Property("ConsideredAgency") + .HasColumnType("longtext") + .HasComment("หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง"); + + b.Property("ConsideredAgencyId") + .HasColumnType("longtext") + .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("DateConsideration") + .HasColumnType("datetime(6)") + .HasComment("วันที่กำหนดพิจารณา"); + + b.Property("DateNotification") + .HasColumnType("datetime(6)") + .HasComment("วันแจ้งเตือนล่วงหน้า"); + + b.Property("DateReceived") + .HasColumnType("datetime(6)") + .HasComment("วันที่รับเรื่อง เป็นวันที่ถือเป็นจุดเริ่มต้นของวินัยนั้น ๆ"); + + b.Property("Description") + .HasColumnType("text") + .HasComment("รายละเอียดของเรื่องร้องเรียน"); + + b.Property("DisciplineComplaintId") + .HasColumnType("char(36)"); + + b.Property("InvestigationCauseText") + .HasColumnType("longtext") + .HasComment("กรณีมีมูลต้องเลือกว่า 'ร้ายแรง' หรือ 'ไม่ร้ายแรง'"); + + b.Property("InvestigationDateEnd") + .HasColumnType("datetime(6)") + .HasComment("วันที่สิ้นสุดการสืบสวน"); + + b.Property("InvestigationDateStart") + .HasColumnType("datetime(6)") + .HasComment("วันที่เริ่มการสืบสวน"); + + b.Property("InvestigationDaysExtend") + .HasColumnType("int") + .HasComment("จำนวนวันที่ต้องการขยาย"); + + b.Property("InvestigationDescription") + .HasColumnType("longtext") + .HasComment("รายละเอียดเกี่ยวกับการสืบสวน"); + + b.Property("InvestigationDetail") + .HasColumnType("longtext") + .HasComment("ลักษณะการสืบสวน (appoint_directors คือ แต่งตั้งกรรมการสืบสวน, secret_investigation คือ สืบสวนทางลับ, other คือ อื่น ๆ)"); + + b.Property("InvestigationDetailOther") + .HasColumnType("longtext") + .HasComment("ลักษณะการสืบสวนกรณีเลือกอื่นๆ"); + + b.Property("InvestigationExtendStatus") + .HasColumnType("tinyint(1)") + .HasComment("ขยายเวลา"); + + b.Property("InvestigationStatusResult") + .HasColumnType("longtext") + .HasComment("สถานะหรือผลการสืบสวน (not_specified คือ ยังไม่ระบุ, have_cause คือ มีมูล, no_cause คือ ไม่มีมูล"); + + 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("LevelConsideration") + .HasColumnType("longtext") + .HasComment("ระดับการพิจารณา 'ยังไม่ระบุ' (NORMAL คือ ปกติ, URGENT คือ ด่วน, VERY_URGENT คือ ด่วนมาก)"); + + b.Property("OffenseDetails") + .HasColumnType("longtext") + .HasComment("ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)"); + + b.Property("Organization") + .HasColumnType("longtext") + .HasComment("กรณีหน่วยงานใส่หน่วยงาน"); + + b.Property("OrganizationId") + .HasColumnType("longtext") + .HasComment("กรณีหน่วยงานใส่หน่วยงาน id"); + + b.Property("RespondentType") + .IsRequired() + .HasColumnType("longtext") + .HasComment("ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)"); + + b.Property("Result") + .HasColumnType("longtext") + .HasComment("ผลการตรวจสอบ"); + + b.Property("ResultComplaint") + .HasColumnType("longtext") + .HasComment("ผลการตรวจสอบเรื่องร้องเรียน"); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext") + .HasComment("สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text") + .HasComment("เรื่องที่ร้องเรียน"); + + b.Property("activeId") + .HasColumnType("longtext") + .HasComment("version หน่วยงาน"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineComplaintId"); + + b.ToTable("DisciplineInvestigates"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigateExtend", 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("DaysExtend") + .HasColumnType("int") + .HasComment("จำนวนวันที่การขยาย"); + + b.Property("DisciplineInvestigateId") + .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("Name") + .HasColumnType("longtext") + .HasComment("ชื่อการขยาย"); + + b.Property("Num") + .HasColumnType("int") + .HasComment("ครั้งที่ขยาย"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineInvestigateId"); + + b.ToTable("DisciplineInvestigateExtends"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigateRelevant_Doc", 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("DisciplineInvestigateId") + .HasColumnType("char(36)"); + + 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("DisciplineInvestigateId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineInvestigateRelevant_Docs"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate_Director", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CommandNo") + .HasColumnType("longtext") + .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("DisciplineDirectorId") + .HasColumnType("char(36)"); + + b.Property("DisciplineInvestigateId") + .HasColumnType("char(36)"); + + b.Property("Duty") + .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("DisciplineDirectorId"); + + b.HasIndex("DisciplineInvestigateId"); + + b.ToTable("DisciplineInvestigate_Directors"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate_Doc", 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("DisciplineInvestigateId") + .HasColumnType("char(36)"); + + 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("DisciplineInvestigateId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineInvestigate_Docs"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate_DocComplaint", 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("DisciplineInvestigateId") + .HasColumnType("char(36)"); + + 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("DisciplineInvestigateId"); + + b.HasIndex("DocumentId"); + + b.ToTable("DisciplineInvestigate_DocComplaints"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate_ProfileComplaint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "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("DisciplineInvestigateId") + .HasColumnType("char(36)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อ"); + + b.Property("IsAncestorDNA") + .HasColumnType("tinyint(1)") + .HasComment("รายการเก่า"); + + b.Property("IsDisciplinary") + .HasColumnType("tinyint(1)") + .HasComment("ส่งไปสอบสวน"); + + b.Property("IsReport") + .HasColumnType("longtext") + .HasComment("ส่งไปยุติเรื่อง"); + + 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("Organization") + .HasColumnType("longtext") + .HasComment("สังกัด"); + + b.Property("PersonId") + .HasColumnType("longtext") + .HasComment("id อ้างอิง profile"); + + b.Property("PosNo") + .HasColumnType("longtext") + .HasComment("เลขที่ตำแหน่ง"); + + b.Property("Position") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("Prefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้า"); + + b.Property("Salary") + .HasColumnType("double") + .HasComment("เงินเดือน"); + + b.Property("child1") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child1"); + + b.Property("child1Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child1"); + + b.Property("child1ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child1"); + + b.Property("child2") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child2"); + + b.Property("child2Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child2"); + + b.Property("child2ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child2"); + + b.Property("child3") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child3"); + + b.Property("child3Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child3"); + + b.Property("child3ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child3"); + + b.Property("child4") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child4"); + + b.Property("child4Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child4"); + + b.Property("child4ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child4"); + + b.Property("posLevelId") + .HasColumnType("longtext") + .HasComment("id ระดับตำแหน่ง"); + + b.Property("posLevelName") + .HasColumnType("longtext") + .HasComment("ชื่อระดับตำแหน่ง"); + + b.Property("posMasterNo") + .HasColumnType("int") + .HasComment("เลขที่ตำแหน่ง"); + + b.Property("posTypeId") + .HasColumnType("longtext") + .HasComment("id ประเภทตำแหน่ง"); + + b.Property("posTypeName") + .HasColumnType("longtext") + .HasComment("ชื่อประเภทตำแหน่ง"); + + b.Property("profileType") + .HasColumnType("longtext") + .HasComment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)"); + + b.Property("root") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน root"); + + b.Property("rootId") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน root"); + + b.Property("rootShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน root"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineInvestigateId"); + + b.ToTable("DisciplineInvestigate_ProfileComplaints"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineReport_Profile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)") + .HasColumnOrder(0) + .HasComment("PrimaryKey") + .HasAnnotation("Relational:JsonPropertyName", "id"); + + b.Property("CitizenId") + .HasMaxLength(13) + .HasColumnType("varchar(13)") + .HasComment("รหัสบัตรประชาชน"); + + b.Property("CommandTypeId") + .HasColumnType("char(36)") + .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("DescriptionSuspend") + .HasColumnType("longtext") + .HasComment("เหตุที่ถูกสั่งพักราชการ/ออกจากราชการไว้ก่อน"); + + b.Property("DisciplinaryCaseFault") + .HasColumnType("longtext") + .HasComment("กรณีความผิด"); + + b.Property("DisciplinaryFaultLevel") + .HasColumnType("longtext") + .HasComment("ระดับโทษความผิด กรณีไม่ร้ายแรง: ภาคทัณฑ์, ตัดเงินเดือน, ลดขั้นเงินเดือน | กรณีร้ายแรง: ปลดออก, ไล่ออก"); + + b.Property("DisciplineDisciplinaryId") + .HasColumnType("char(36)"); + + b.Property("EndDateSuspend") + .HasColumnType("datetime(6)") + .HasComment("วันสิ้นสุดการสั่งพักราชการ/ให้ออกจากราชการไว้ก่อน"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasComment("ชื่อ"); + + 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("OffenseDetails") + .HasColumnType("longtext") + .HasComment("ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)"); + + b.Property("Organization") + .HasColumnType("longtext") + .HasComment("สังกัด"); + + b.Property("PersonId") + .HasColumnType("longtext") + .HasComment("id อ้างอิง profile"); + + b.Property("PosNo") + .HasColumnType("longtext") + .HasComment("เลขที่ตำแหน่ง"); + + b.Property("Position") + .HasColumnType("longtext") + .HasComment("ตำแหน่ง"); + + b.Property("PositionLevel") + .HasColumnType("longtext") + .HasComment("ระดับ"); + + b.Property("PositionType") + .HasColumnType("longtext") + .HasComment("ประเภท"); + + b.Property("Prefix") + .HasColumnType("longtext") + .HasComment("คำนำหน้า"); + + b.Property("Salary") + .HasColumnType("double") + .HasComment("เงินเดือน"); + + b.Property("StartDateSuspend") + .HasColumnType("datetime(6)") + .HasComment("วันที่สั่งพักราชการ/ให้ออกจากราชการไว้ก่อน"); + + b.Property("Status") + .HasColumnType("longtext") + .HasComment("สถานะออกคำสั่ง"); + + b.Property("Title") + .HasColumnType("text") + .HasComment("เรื่องที่ร้องเรียน"); + + b.Property("child1") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child1"); + + b.Property("child1Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child1"); + + b.Property("child1ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child1"); + + b.Property("child2") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child2"); + + b.Property("child2Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child2"); + + b.Property("child2ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child2"); + + b.Property("child3") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child3"); + + b.Property("child3Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child3"); + + b.Property("child3ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child3"); + + b.Property("child4") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน child4"); + + b.Property("child4Id") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน child4"); + + b.Property("child4ShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน child4"); + + b.Property("posLevelId") + .HasColumnType("longtext") + .HasComment("id ระดับตำแหน่ง"); + + b.Property("posLevelName") + .HasColumnType("longtext") + .HasComment("ชื่อระดับตำแหน่ง"); + + b.Property("posMasterNo") + .HasColumnType("int") + .HasComment("เลขที่ตำแหน่ง"); + + b.Property("posTypeId") + .HasColumnType("longtext") + .HasComment("id ประเภทตำแหน่ง"); + + b.Property("posTypeName") + .HasColumnType("longtext") + .HasComment("ชื่อประเภทตำแหน่ง"); + + b.Property("profileType") + .HasColumnType("longtext") + .HasComment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)"); + + b.Property("root") + .HasColumnType("longtext") + .HasComment("ชื่อหน่วยงาน root"); + + b.Property("rootId") + .HasColumnType("longtext") + .HasComment("id หน่วยงาน root"); + + b.Property("rootShortName") + .HasColumnType("longtext") + .HasComment("ชื่อย่อหน่วยงาน root"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineDisciplinaryId"); + + b.ToTable("DisciplineReport_Profiles"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.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.Discipline.DisciplineComplaint_Appeal_Doc", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Appeal", "DisciplineComplaint_Appeal") + .WithMany("DisciplineComplaint_Appeal_Docs") + .HasForeignKey("DisciplineComplaint_AppealId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineComplaint_Appeal"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Appeal_History", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Appeal", "DisciplineComplaint_Appeal") + .WithMany("DisciplineComplaint_Appeal_Historys") + .HasForeignKey("DisciplineComplaint_AppealId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineComplaint_Appeal"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Doc", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint", "DisciplineComplaint") + .WithMany("DisciplineComplaint_Docs") + .HasForeignKey("DisciplineComplaintId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineComplaint"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Profile", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint", "DisciplineComplaint") + .WithMany("DisciplineComplaint_Profiles") + .HasForeignKey("DisciplineComplaintId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineComplaint"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", "DisciplineInvestigate") + .WithMany("DisciplineDisciplinarys") + .HasForeignKey("DisciplineInvestigateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineInvestigate"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinaryExtend", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinaryExtends") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DirectorInvestigate", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDirector", "DisciplineDirector") + .WithMany("DisciplineDisciplinary_DirectorInvestigates") + .HasForeignKey("DisciplineDirectorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DirectorInvestigates") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDirector"); + + b.Navigation("DisciplineDisciplinary"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocComplaintInvestigate", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocComplaintInvestigates") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocInvestigate", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocInvestigates") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocInvestigateRelevant", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocInvestigateRelevants") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocOther", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocOthers") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocRecordAccuser", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocRecordAccusers") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocRelevant", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocRelevants") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocResult", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocResults") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocSummaryEvidence", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocSummaryEvidences") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocWitnesses", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_DocWitnessess") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_ProfileComplaintInvestigate", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany("DisciplineDisciplinary_ProfileComplaintInvestigates") + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint", "DisciplineComplaint") + .WithMany("DisciplineInvestigates") + .HasForeignKey("DisciplineComplaintId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineComplaint"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigateExtend", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", "DisciplineInvestigate") + .WithMany("DisciplineInvestigateExtends") + .HasForeignKey("DisciplineInvestigateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineInvestigate"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigateRelevant_Doc", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", "DisciplineInvestigate") + .WithMany("DisciplineInvestigateRelevant_Docs") + .HasForeignKey("DisciplineInvestigateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineInvestigate"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate_Director", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDirector", "DisciplineDirector") + .WithMany("DisciplineInvestigate_Directors") + .HasForeignKey("DisciplineDirectorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", "DisciplineInvestigate") + .WithMany("DisciplineInvestigate_Directors") + .HasForeignKey("DisciplineInvestigateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDirector"); + + b.Navigation("DisciplineInvestigate"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate_Doc", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", "DisciplineInvestigate") + .WithMany("DisciplineInvestigate_Docs") + .HasForeignKey("DisciplineInvestigateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineInvestigate"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate_DocComplaint", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", "DisciplineInvestigate") + .WithMany("DisciplineInvestigate_DocComplaints") + .HasForeignKey("DisciplineInvestigateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineInvestigate"); + + b.Navigation("Document"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate_ProfileComplaint", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", "DisciplineInvestigate") + .WithMany("DisciplineInvestigate_ProfileComplaints") + .HasForeignKey("DisciplineInvestigateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineInvestigate"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineReport_Profile", b => + { + b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary") + .WithMany() + .HasForeignKey("DisciplineDisciplinaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineDisciplinary"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint", b => + { + b.Navigation("DisciplineComplaint_Docs"); + + b.Navigation("DisciplineComplaint_Profiles"); + + b.Navigation("DisciplineInvestigates"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Appeal", b => + { + b.Navigation("DisciplineComplaint_Appeal_Docs"); + + b.Navigation("DisciplineComplaint_Appeal_Historys"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDirector", b => + { + b.Navigation("DisciplineDisciplinary_DirectorInvestigates"); + + b.Navigation("DisciplineInvestigate_Directors"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", b => + { + b.Navigation("DisciplineDisciplinaryExtends"); + + b.Navigation("DisciplineDisciplinary_DirectorInvestigates"); + + b.Navigation("DisciplineDisciplinary_DocComplaintInvestigates"); + + b.Navigation("DisciplineDisciplinary_DocInvestigateRelevants"); + + b.Navigation("DisciplineDisciplinary_DocInvestigates"); + + b.Navigation("DisciplineDisciplinary_DocOthers"); + + b.Navigation("DisciplineDisciplinary_DocRecordAccusers"); + + b.Navigation("DisciplineDisciplinary_DocRelevants"); + + b.Navigation("DisciplineDisciplinary_DocResults"); + + b.Navigation("DisciplineDisciplinary_DocSummaryEvidences"); + + b.Navigation("DisciplineDisciplinary_DocWitnessess"); + + b.Navigation("DisciplineDisciplinary_ProfileComplaintInvestigates"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineInvestigate", b => + { + b.Navigation("DisciplineDisciplinarys"); + + b.Navigation("DisciplineInvestigateExtends"); + + b.Navigation("DisciplineInvestigateRelevant_Docs"); + + b.Navigation("DisciplineInvestigate_Directors"); + + b.Navigation("DisciplineInvestigate_DocComplaints"); + + b.Navigation("DisciplineInvestigate_Docs"); + + b.Navigation("DisciplineInvestigate_ProfileComplaints"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/BMA.EHR.Infrastructure/Migrations/DisciplineDb/20241226172314_update table disciplinecom add profiletype.cs b/BMA.EHR.Infrastructure/Migrations/DisciplineDb/20241226172314_update table disciplinecom add profiletype.cs new file mode 100644 index 00000000..1acab7fd --- /dev/null +++ b/BMA.EHR.Infrastructure/Migrations/DisciplineDb/20241226172314_update table disciplinecom add profiletype.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb +{ + /// + public partial class updatetabledisciplinecomaddprofiletype : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "profileType", + table: "DisciplineComplaint_Appeals", + type: "longtext", + nullable: true, + comment: "สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)") + .Annotation("MySql:CharSet", "utf8mb4"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "profileType", + table: "DisciplineComplaint_Appeals"); + } + } +} diff --git a/BMA.EHR.Infrastructure/Migrations/DisciplineDb/DisciplineDbContextModelSnapshot.cs b/BMA.EHR.Infrastructure/Migrations/DisciplineDb/DisciplineDbContextModelSnapshot.cs index c34f85d7..5e6e4c43 100644 --- a/BMA.EHR.Infrastructure/Migrations/DisciplineDb/DisciplineDbContextModelSnapshot.cs +++ b/BMA.EHR.Infrastructure/Migrations/DisciplineDb/DisciplineDbContextModelSnapshot.cs @@ -241,6 +241,10 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb .HasColumnType("int") .HasComment("ปีงบประมาณ"); + b.Property("profileType") + .HasColumnType("longtext") + .HasComment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)"); + b.HasKey("Id"); b.ToTable("DisciplineComplaint_Appeals");