From 7630cb4277ffe17fe92d083b500746105d5440f3 Mon Sep 17 00:00:00 2001 From: kittapath Date: Tue, 24 Dec 2024 13:34:54 +0700 Subject: [PATCH 1/9] no message --- .../Controllers/PlacementController.cs | 16 ++++++++-------- .../Controllers/RetirementOtherController.cs | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs index 6dfb31a4..cebc8517 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs @@ -161,10 +161,10 @@ namespace BMA.EHR.Placement.Service.Controllers if (org.result.isOfficer == false) { rootId = org.result.rootId == null ? "" : org.result.rootId; - child1Id = org.result.child1Id == null ? "" : org.result.child1Id; - child2Id = org.result.child2Id == null ? "" : org.result.child2Id; - child3Id = org.result.child3Id == null ? "" : org.result.child3Id; - child4Id = org.result.child4Id == null ? "" : org.result.child4Id; + // child1Id = org.result.child1Id == null ? "" : org.result.child1Id; + // child2Id = org.result.child2Id == null ? "" : org.result.child2Id; + // child3Id = org.result.child3Id == null ? "" : org.result.child3Id; + // child4Id = org.result.child4Id == null ? "" : org.result.child4Id; var data1 = await _context.PlacementProfiles .Where(x => x.Placement.Id == examId) .Where(x => x.Draft == true) @@ -633,10 +633,10 @@ namespace BMA.EHR.Placement.Service.Controllers if (org.result.isOfficer == false) { rootId = org.result.rootId == null ? "" : org.result.rootId; - child1Id = org.result.child1Id == null ? "" : org.result.child1Id; - child2Id = org.result.child2Id == null ? "" : org.result.child2Id; - child3Id = org.result.child3Id == null ? "" : org.result.child3Id; - child4Id = org.result.child4Id == null ? "" : org.result.child4Id; + // child1Id = org.result.child1Id == null ? "" : org.result.child1Id; + // child2Id = org.result.child2Id == null ? "" : org.result.child2Id; + // child3Id = org.result.child3Id == null ? "" : org.result.child3Id; + // child4Id = org.result.child4Id == null ? "" : org.result.child4Id; var placement = await _context.Placements .Where(x => x.Id == examId) .Select(x => new diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs index 2f5d1bed..3ee9b641 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs @@ -82,7 +82,7 @@ namespace BMA.EHR.Retirement.Service.Controllers var child2Id = ""; var child3Id = ""; var child4Id = ""; - var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position"; + var apiUrl = $"{_configuration["API"]}/org/permission/checkOrg/{UserId}"; using (var client = new HttpClient()) { client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", "")); From d88394984b64ff1ba35c907e9ea20e59c6d89a16 Mon Sep 17 00:00:00 2001 From: kittapath Date: Tue, 24 Dec 2024 23:41:01 +0700 Subject: [PATCH 2/9] no message --- .../MessageQueue/NotificationRepository.cs | 139 +++++++++++++++--- 1 file changed, 117 insertions(+), 22 deletions(-) diff --git a/BMA.EHR.Application/Repositories/MessageQueue/NotificationRepository.cs b/BMA.EHR.Application/Repositories/MessageQueue/NotificationRepository.cs index 8388fd0c..4ccc3606 100644 --- a/BMA.EHR.Application/Repositories/MessageQueue/NotificationRepository.cs +++ b/BMA.EHR.Application/Repositories/MessageQueue/NotificationRepository.cs @@ -223,7 +223,22 @@ namespace BMA.EHR.Application.Repositories.MessageQueue } if (IsSendMail == true) { - _emailSenderService.SendMail(Subject, Body, "kittapath@frappet.com"); + var apiUrl = $"{_configuration["API"]}/org/dotnet/email/{ReceiverUserId}"; + using (var client = new HttpClient()) + { + client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", "")); + client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]); + var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl); + var _res = await client.SendAsync(_req); + var _result = await _res.Content.ReadAsStringAsync(); + + if (_res.IsSuccessStatusCode) + { + var org = JsonConvert.DeserializeObject(_result); + if (org != null && org.result != null) + _emailSenderService.SendMail(Subject, Body, org.result); + } + } } await _dbContext.SaveChangesAsync(); //} @@ -250,25 +265,40 @@ namespace BMA.EHR.Application.Repositories.MessageQueue LastUpdateUserId = UserId ?? "", LastUpdatedAt = DateTime.Now, }); - /* if (IsSendInbox == true) - { - _dbContext.Set().Add(new Inbox - { - Subject = Subject, - Body = Body, - ReceiverUserId = ReceiverUserId, - Payload = Payload, - CreatedFullName = FullName ?? "System Administrator", - CreatedUserId = UserId ?? "", - CreatedAt = DateTime.Now, - LastUpdateFullName = FullName ?? "System Administrator", - LastUpdateUserId = UserId ?? "", - LastUpdatedAt = DateTime.Now, - }); - }*/ + /* if (IsSendInbox == true) + { + _dbContext.Set().Add(new Inbox + { + Subject = Subject, + Body = Body, + ReceiverUserId = ReceiverUserId, + Payload = Payload, + CreatedFullName = FullName ?? "System Administrator", + CreatedUserId = UserId ?? "", + CreatedAt = DateTime.Now, + LastUpdateFullName = FullName ?? "System Administrator", + LastUpdateUserId = UserId ?? "", + LastUpdatedAt = DateTime.Now, + }); + }*/ if (IsSendMail == true) { - _emailSenderService.SendMail(Subject, Body, "kittapath@frappet.com"); + var apiUrl = $"{_configuration["API"]}/org/dotnet/email/{ReceiverUserId}"; + using (var client = new HttpClient()) + { + client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", "")); + client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]); + var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl); + var _res = await client.SendAsync(_req); + var _result = await _res.Content.ReadAsStringAsync(); + + if (_res.IsSuccessStatusCode) + { + var org = JsonConvert.DeserializeObject(_result); + if (org != null && org.result != null) + _emailSenderService.SendMail(Subject, Body, org.result); + } + } } await _dbContext.SaveChangesAsync(); } @@ -327,7 +357,22 @@ namespace BMA.EHR.Application.Repositories.MessageQueue } if (IsSendMail == true) { - _emailSenderService.SendMail(Subject, Body, "kittapath@frappet.com"); + var apiUrl = $"{_configuration["API"]}/org/dotnet/email/{ReceiverUserId}"; + using (var client = new HttpClient()) + { + client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", "")); + client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]); + var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl); + var _res = await client.SendAsync(_req); + var _result = await _res.Content.ReadAsStringAsync(); + + if (_res.IsSuccessStatusCode) + { + var org = JsonConvert.DeserializeObject(_result); + if (org != null && org.result != null) + _emailSenderService.SendMail(Subject, Body, org.result); + } + } } } await _dbContext.SaveChangesAsync(); @@ -343,6 +388,11 @@ namespace BMA.EHR.Application.Repositories.MessageQueue public Guid ReceiverUserId { get; set; } public string NotiLink { get; set; } } + + public class ResultRequest + { + public string result { get; set; } + } public async Task PushNotificationsLinkAsync(NotisLinkRequest[] ReceiverUserIds, string Subject, string Body, string Payload = "", bool IsSendInbox = false, bool IsSendMail = false) { try @@ -380,7 +430,22 @@ namespace BMA.EHR.Application.Repositories.MessageQueue } if (IsSendMail == true) { - _emailSenderService.SendMail(Subject, Body, "kittapath@frappet.com"); + var apiUrl = $"{_configuration["API"]}/org/dotnet/email/{ReceiverUserId.ReceiverUserId}"; + using (var client = new HttpClient()) + { + client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", "")); + client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]); + var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl); + var _res = await client.SendAsync(_req); + var _result = await _res.Content.ReadAsStringAsync(); + + if (_res.IsSuccessStatusCode) + { + var org = JsonConvert.DeserializeObject(_result); + if (org != null && org.result != null) + _emailSenderService.SendMail(Subject, Body, org.result); + } + } } } await _dbContext.SaveChangesAsync(); @@ -435,7 +500,22 @@ namespace BMA.EHR.Application.Repositories.MessageQueue } if (data.IsSendMail == true) { - _emailSenderService.SendMail(Subject, Body, "kittapath@frappet.com"); + var apiUrl = $"{_configuration["API"]}/org/dotnet/email/{data.ReceiverUserId}"; + using (var client = new HttpClient()) + { + client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", "")); + client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]); + var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl); + var _res = await client.SendAsync(_req); + var _result = await _res.Content.ReadAsStringAsync(); + + if (_res.IsSuccessStatusCode) + { + var org = JsonConvert.DeserializeObject(_result); + if (org != null && org.result != null) + _emailSenderService.SendMail(Subject, Body, org.result); + } + } } } await _dbContext.SaveChangesAsync(); @@ -482,7 +562,22 @@ namespace BMA.EHR.Application.Repositories.MessageQueue } if (IsSendMail == true) { - _emailSenderService.SendMail(Subject, Body, "kittapath@frappet.com"); + var apiUrl = $"{_configuration["API"]}/org/dotnet/email/{ReceiverUserId}"; + using (var client = new HttpClient()) + { + client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", "")); + client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]); + var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl); + var _res = await client.SendAsync(_req); + var _result = await _res.Content.ReadAsStringAsync(); + + if (_res.IsSuccessStatusCode) + { + var org = JsonConvert.DeserializeObject(_result); + if (org != null && org.result != null) + _emailSenderService.SendMail(Subject, Body, org.result); + } + } } await _dbContext.SaveChangesAsync(); } From 39acbb7f953a86fc256a0bf762b8e17e3343f00e Mon Sep 17 00:00:00 2001 From: kittapath Date: Wed, 25 Dec 2024 10:21:31 +0700 Subject: [PATCH 3/9] 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 4/9] =?UTF-8?q?fix=20=E0=B8=AB=E0=B8=A1=E0=B8=B2=E0=B8=A2?= =?UTF-8?q?=E0=B9=80=E0=B8=AB=E0=B8=95=E0=B8=B8=E0=B9=81=E0=B8=99=E0=B8=A7?= =?UTF-8?q?=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 5/9] 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 6/9] 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 7/9] 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 8/9] #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 9/9] 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;