Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Suphonchai Phoonsawat 2025-03-27 12:25:26 +07:00
commit 15d8bb4365
20 changed files with 346 additions and 208 deletions

View file

@ -6,102 +6,102 @@ on:
- "retirement-[0-9]+.[0-9]+.[0-9]+"
workflow_dispatch:
env:
REGISTRY: docker.frappet.com
IMAGE_NAME: ehr/bma-ehr-retirement-service
DEPLOY_HOST: frappet.com
DEPLOY_PORT: 10102
# COMPOSE_PATH: /home/frappet/docker/bma-ehr
COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-retirement
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
REGISTRY: docker.frappet.com
IMAGE_NAME: ehr/bma-ehr-retirement-service
DEPLOY_HOST: frappet.com
DEPLOY_PORT: 10102
# COMPOSE_PATH: /home/frappet/docker/bma-ehr
COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-retirement
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
jobs:
# act workflow_dispatch -W .github/workflows/release_retirement.yaml --input IMAGE_VER=latest -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357
release-dev:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set output tags
id: vars
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Gen Version
id: gen_ver
run: |
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
IMAGE_VER=${{ steps.vars.outputs.tag }}
else
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
fi
if [[ $IMAGE_VER == '' ]]; then
IMAGE_VER='test-vBeta'
fi
echo '::set-output name=image_ver::'$IMAGE_VER
- name: Check Version
run: |
echo $GITHUB_REF
echo ${{ steps.gen_ver.outputs.image_ver }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login in to registry
uses: docker/login-action@v2
with:
registry: ${{env.REGISTRY}}
username: ${{secrets.DOCKER_USER}}
password: ${{secrets.DOCKER_PASS}}
- name: Build and load local docker image
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64
file: BMA.EHR.Retirement.Service/Dockerfile
push: true
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
# act workflow_dispatch -W .github/workflows/release_retirement.yaml --input IMAGE_VER=latest -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357
release-dev:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set output tags
id: vars
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Gen Version
id: gen_ver
run: |
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
IMAGE_VER=${{ steps.vars.outputs.tag }}
else
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
fi
if [[ $IMAGE_VER == '' ]]; then
IMAGE_VER='test-vBeta'
fi
echo '::set-output name=image_ver::'$IMAGE_VER
- name: Check Version
run: |
echo $GITHUB_REF
echo ${{ steps.gen_ver.outputs.image_ver }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login in to registry
uses: docker/login-action@v2
with:
registry: ${{env.REGISTRY}}
username: ${{secrets.DOCKER_USER}}
password: ${{secrets.DOCKER_PASS}}
- name: Build and load local docker image
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64
file: BMA.EHR.Retirement.Service/Dockerfile
push: true
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
- name: Reload docker compose
uses: appleboy/ssh-action@v0.1.8
with:
host: ${{env.DEPLOY_HOST}}
username: frappet
password: ${{ secrets.SSH_PASSWORD }}
port: ${{env.DEPLOY_PORT}}
script: |
cd "${{env.COMPOSE_PATH}}"
docker compose pull
docker compose up -d
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
- name: Notify Discord Success
if: success()
run: |
curl -H "Content-Type: application/json" \
-X POST \
-d '{
"embeds": [{
"title": "✅ Deployment Success!",
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`",
"color": 3066993,
"footer": {
"text": "Release Notification",
"icon_url": "https://example.com/success-icon.png"
},
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
}]
}' \
${{ secrets.DISCORD_WEBHOOK }}
- name: Reload docker compose
uses: appleboy/ssh-action@v0.1.8
with:
host: ${{env.DEPLOY_HOST}}
username: frappet
password: ${{ secrets.SSH_PASSWORD }}
port: ${{env.DEPLOY_PORT}}
script: |
cd "${{env.COMPOSE_PATH}}"
docker compose pull
docker compose up -d
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
- name: Notify Discord Success
if: success()
run: |
curl -H "Content-Type: application/json" \
-X POST \
-d '{
"embeds": [{
"title": "✅ Deployment Success!",
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`",
"color": 3066993,
"footer": {
"text": "Release Notification",
"icon_url": "https://example.com/success-icon.png"
},
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
}]
}' \
${{ secrets.DISCORD_WEBHOOK }}
- name: Notify Discord Failure
if: failure()
run: |
curl -H "Content-Type: application/json" \
-X POST \
-d '{
"embeds": [{
"title": "❌ Deployment Failed!",
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`",
"color": 15158332,
"footer": {
"text": "Release Notification",
"icon_url": "https://example.com/failure-icon.png"
},
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
}]
}' \
${{ secrets.DISCORD_WEBHOOK }}
- name: Notify Discord Failure
if: failure()
run: |
curl -H "Content-Type: application/json" \
-X POST \
-d '{
"embeds": [{
"title": "❌ Deployment Failed!",
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`",
"color": 15158332,
"footer": {
"text": "Release Notification",
"icon_url": "https://example.com/failure-icon.png"
},
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
}]
}' \
${{ secrets.DISCORD_WEBHOOK }}

View file

@ -248,7 +248,7 @@ namespace BMA.EHR.Application.Repositories.Commands
.Where(x => x.PlacementStatus.Trim().ToUpper() == "PREPARE-CONTAIN")
.Where(x => x.Draft! == true)
.Where(x => x.Placement!.PlacementType!.Name == "สอบแข่งขัน")
.Where(x => x.typeCommand.Trim().ToUpper() == "APPOINTED")
.Where(x => x.typeCommand.Trim().ToUpper() == "APPOINT")
.OrderBy(x => x.ExamNumber)
.ToListAsync();
@ -307,7 +307,7 @@ namespace BMA.EHR.Application.Repositories.Commands
.Where(x => x.PlacementStatus.Trim().ToUpper() == "PREPARE-CONTAIN")
.Where(x => x.Draft! == true)
.Where(x => x.Placement!.PlacementType!.Name != "สอบแข่งขัน")
.Where(x => x.typeCommand.Trim().ToUpper() == "APPOINTED")
.Where(x => x.typeCommand.Trim().ToUpper() == "APPOINT")
.OrderBy(x => x.ExamNumber)
.ToListAsync();

View file

@ -1,4 +1,5 @@
using System.Reflection.Metadata;
using System.Net.Http.Headers;
using System.Reflection.Metadata;
using BMA.EHR.Application.Common.Interfaces;
using BMA.EHR.Application.Responses;
using BMA.EHR.Domain.Extensions;
@ -9,6 +10,7 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
namespace BMA.EHR.Application.Repositories.Reports
@ -21,20 +23,23 @@ namespace BMA.EHR.Application.Repositories.Reports
private readonly IWebHostEnvironment _hostingEnvironment;
private readonly MinIOService _documentService;
private readonly OrganizationCommonRepository _organizationCommonRepository;
private readonly IConfiguration _configuration;
#endregion
#region " Constructor and Destructor "
public RetireReportRepository(IApplicationDBContext dbContext,
MinIOService documentService,
OrganizationCommonRepository organizationCommonRepository,
IWebHostEnvironment hostEnvironment)
MinIOService documentService,
OrganizationCommonRepository organizationCommonRepository,
IWebHostEnvironment hostEnvironment,
IConfiguration configuration)
{
_dbContext = dbContext;
_hostingEnvironment = hostEnvironment;
_organizationCommonRepository = organizationCommonRepository;
_documentService = documentService;
_configuration = configuration;
}
#endregion
@ -64,12 +69,33 @@ namespace BMA.EHR.Application.Repositories.Reports
//}
#region
public async Task<dynamic> GetProfileRetirementdAsync(Guid retireId)
public async Task<dynamic> GetProfileRetirementdAsync(Guid retireId, string token)
{
var retire = await _dbContext.Set<RetirementPeriod>()
.Include(x => x.RetirementProfiles)
.FirstOrDefaultAsync(x => x.Id == retireId);
// var retires = new List<dynamic>();
var apiUrl = $"{_configuration["API"]}/org/root/search/sort";
dynamic rootOrder = new List<string>();
dynamic posTypeNameOrder = new List<string>();
dynamic posLevelNameOrder = new List<string>();
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
var org = JsonConvert.DeserializeObject<dynamic>(_result);
if (org != null && org.result != null)
{
rootOrder = org.result.root;
posTypeNameOrder = org.result.posTypeNameOrder;
posLevelNameOrder = org.result.posLevelNameOrder;
}
}
if (retire == null)
{
var retireHistorys = await _dbContext.Set<RetirementPeriodHistory>().AsQueryable()
@ -121,16 +147,39 @@ namespace BMA.EHR.Application.Repositories.Reports
profiles = profiles.OrderBy(x => x.order).ToList();
}
var mapProfiles = new List<ProfileRetireJsonRequest>();
string previousRoot = null;
string previousPosTypeName = null;
string previousPosLevelName = null;
if (profiles.Count > 0)
{
mapProfiles = profiles.Select((profile, index) => new ProfileRetireJsonRequest
mapProfiles = profiles
.OrderBy(x => rootOrder.ToObject<List<string>>().IndexOf(x.root))
.ThenBy(x => posTypeNameOrder.ToObject<List<string>>().IndexOf(x.posTypeName ?? ""))
.ThenBy(x => posLevelNameOrder.ToObject<List<string>>().IndexOf(x.posLevelName ?? ""))
.Select((profile, index) =>
{
order = (index + 1).ToString().ToThaiNumber(),
fullName = $"{profile.prefix}{profile.firstName} {profile.lastName}",
root = profile.root,
position = profile.position != "" && profile.position != null ? profile.position : "-",
posNo = profile.posNo != "" && profile.posNo != null ? profile.posNo?.ToThaiNumber() : "-",
reason = profile.reason != "" && profile.reason != null ? profile.reason : "-",
bool isDuplicateRoot = profile.root == previousRoot;
previousRoot = profile.root;
bool isDuplicatePosType = profile.posTypeName == previousPosTypeName;
previousPosTypeName = profile.posTypeName;
bool isDuplicatePosLevel = profile.posLevelName == previousPosLevelName;
previousPosLevelName = profile.posLevelName;
return new ProfileRetireJsonRequest
{
order = (index + 1).ToString().ToThaiNumber(),
fullName = $"{profile.prefix}{profile.firstName} {profile.lastName}",
root = (isDuplicateRoot ? "" : profile.root + "\n") +
(isDuplicatePosType ? "" : profile.posTypeName + "\n") +
(isDuplicatePosLevel ? "" : profile.posLevelName),
child = (profile.posExecutiveName == null ? "" : profile.posExecutiveName + "\n") +
(profile.child4 == null ? "" : profile.child4 + "\n") +
(profile.child3 == null ? "" : profile.child3 + "\n") +
(profile.child2 == null ? "" : profile.child2 + "\n") +
(profile.child1 == null ? "" : profile.child1),
position = profile.position != "" && profile.position != null ? profile.position : "-",
posNo = profile.posNo != "" && profile.posNo != null ? profile.posNo?.ToThaiNumber() : "-",
reason = profile.reason != "" && profile.reason != null ? profile.reason : "-",
};
}).ToList();
}
string SignDate = retireHistorys.SignDate != null ? DateTime.Parse(retireHistorys.SignDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber() : "-";
@ -208,16 +257,39 @@ namespace BMA.EHR.Application.Repositories.Reports
// retires.Add(data);
// }
var mapProfiles = new List<ProfileRetireJsonRequest>();
string previousRoot = null;
string previousPosTypeName = null;
string previousPosLevelName = null;
if (profile_retire.Count > 0)
{
mapProfiles = profile_retire.Select((profile, index) => new ProfileRetireJsonRequest
mapProfiles = profile_retire
.OrderBy(x => rootOrder.ToObject<List<string>>().IndexOf(x.root))
.ThenBy(x => posTypeNameOrder.ToObject<List<string>>().IndexOf(x.posTypeName ?? ""))
.ThenBy(x => posLevelNameOrder.ToObject<List<string>>().IndexOf(x.posLevelName ?? ""))
.Select((profile, index) =>
{
order = (index + 1).ToString().ToThaiNumber(),
fullName = $"{profile.prefix}{profile.firstName} {profile.lastName}",
root = profile.root,
position = profile.position != "" && profile.position != null ? profile.position : "-",
posNo = profile.posNo != "" && profile.posNo != null ? profile.posNo?.ToThaiNumber() : "-",
reason = profile.reason != "" && profile.reason != null ? profile.reason : "-",
bool isDuplicateRoot = profile.root == previousRoot;
previousRoot = profile.root;
bool isDuplicatePosType = profile.posTypeName == previousPosTypeName;
previousPosTypeName = profile.posTypeName;
bool isDuplicatePosLevel = profile.posLevelName == previousPosLevelName;
previousPosLevelName = profile.posLevelName;
return new ProfileRetireJsonRequest
{
order = (index + 1).ToString().ToThaiNumber(),
fullName = $"{profile.prefix}{profile.firstName} {profile.lastName}",
root = (isDuplicateRoot ? "" : profile.root + "\n") +
(isDuplicatePosType ? "" : profile.posTypeName + "\n") +
(isDuplicatePosLevel ? "" : profile.posLevelName),
child = (profile.posExecutiveName == null ? "" : profile.posExecutiveName + "\n") +
(profile.child4 == null ? "" : profile.child4 + "\n") +
(profile.child3 == null ? "" : profile.child3 + "\n") +
(profile.child2 == null ? "" : profile.child2 + "\n") +
(profile.child1 == null ? "" : profile.child1),
position = profile.position != "" && profile.position != null ? profile.position : "-",
posNo = profile.posNo != "" && profile.posNo != null ? profile.posNo?.ToThaiNumber() : "-",
reason = profile.reason != "" && profile.reason != null ? profile.reason : "-",
};
}).ToList();
}
string SignDate = retire.SignDate != null ? DateTime.Parse(retire.SignDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber() : "-";

View file

@ -8,6 +8,7 @@
public string? posNo { get; set; }
public string? root { get; set; }
public string? reason { get; set; }
public string? child { get; set; }
}
}

View file

@ -154,7 +154,7 @@ var app = builder.Build();
app.UseStaticFiles();
app.MapControllers();
app.UseMiddleware<ErrorHandlerMiddleware>();
app.UseMiddleware<RequestLoggingMiddleware>();
//app.UseMiddleware<RequestLoggingMiddleware>();
app.UseHangfireDashboard("/hangfire", new DashboardOptions()
{

View file

@ -461,7 +461,7 @@ namespace BMA.EHR.Placement.Service.Controllers
(org.result.child2 == null ? "" : org.result.child2 + "\n") +
(org.result.child1 == null ? "" : org.result.child1 + "\n") +
(org.result.root == null ? "" : org.result.root);
placementAppointment.OrganizationPositionOld = org.result.position + "\n" + placementAppointment.OrganizationOld;
placementAppointment.OrganizationPositionOld = org.result.position + "\n" + (placementAppointment.PositionExecutiveOld == null ? "" : placementAppointment.PositionExecutiveOld + "\n") + placementAppointment.OrganizationOld;
placementAppointment.AmountOld = org.result.salary;
}
await _context.PlacementAppointments.AddAsync(placementAppointment);
@ -758,7 +758,7 @@ namespace BMA.EHR.Placement.Service.Controllers
placementProfiles.ForEach(profile =>
{
profile.Status = "REPORT";
profile.typeCommand = "APPOINTED";
profile.typeCommand = "APPOINT";
});
await _context.SaveChangesAsync();
return Success();
@ -813,18 +813,14 @@ namespace BMA.EHR.Placement.Service.Controllers
No = r.Sequence.ToString().ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Education = p.EducationOld == null ? "-" : p.EducationOld,
OldOc = (p.positionOld == null ? "" : $"{p.positionOld}\n") +
(p.child4Old == null ? "" : $"{p.child4Old}\n") +
(p.child3Old == null ? "" : $"{p.child3Old}\n") +
(p.child2Old == null ? "" : $"{p.child2Old}\n") +
(p.child1Old == null ? "" : $"{p.child1Old}\n") +
(p.rootOld == null ? "" : $"{p.rootOld}"),
OldOc = p.OrganizationPositionOld,
OldPositionType = p.PositionTypeOld == null ? "-" : p.PositionTypeOld,
OldPositionLevel = p.PositionLevelOld == null ? "-" : p.PositionLevelOld,
OldPositionNumber = p.PositionNumberOld == null ? "-" : p.PositionNumberOld.ToThaiNumber(),
OldSalary = p.AmountOld == null ? "-" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
LeaveDate = "-",
NewOc = (p.position == null ? "" : $"{p.position}\n") +
(p.PositionExecutive == null ? "" : $"{p.PositionExecutive}\n") +
(p.child4 == null ? "" : $"{p.child4}\n") +
(p.child3 == null ? "" : $"{p.child3}\n") +
(p.child2 == null ? "" : $"{p.child2}\n") +
@ -1027,18 +1023,14 @@ namespace BMA.EHR.Placement.Service.Controllers
No = r.Sequence.ToString().ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Education = p.EducationOld == null ? "-" : p.EducationOld,
OldOc = (p.positionOld == null ? "" : $"{p.positionOld}\n") +
(p.child4Old == null ? "" : $"{p.child4Old}\n") +
(p.child3Old == null ? "" : $"{p.child3Old}\n") +
(p.child2Old == null ? "" : $"{p.child2Old}\n") +
(p.child1Old == null ? "" : $"{p.child1Old}\n") +
(p.rootOld == null ? "" : $"{p.rootOld}"),
OldOc = p.OrganizationPositionOld,
OldPositionType = p.PositionTypeOld == null ? "-" : p.PositionTypeOld,
OldPositionLevel = p.PositionLevelOld == null ? "-" : p.PositionLevelOld,
OldPositionNumber = p.PositionNumberOld == null ? "-" : p.PositionNumberOld.ToThaiNumber(),
OldSalary = p.AmountOld == null ? "-" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
LeaveDate = "-",
NewOc = (p.position == null ? "" : $"{p.position}\n") +
(p.PositionExecutive == null ? "" : $"{p.PositionExecutive}\n") +
(p.child4 == null ? "" : $"{p.child4}\n") +
(p.child3 == null ? "" : $"{p.child3}\n") +
(p.child2 == null ? "" : $"{p.child2}\n") +
@ -1243,16 +1235,12 @@ namespace BMA.EHR.Placement.Service.Controllers
{
No = r.Sequence.ToString().ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
OldOrganization = (p.positionOld == null ? "" : $"{p.positionOld}\n") +
(p.child4Old == null ? "" : $"{p.child4Old}\n") +
(p.child3Old == null ? "" : $"{p.child3Old}\n") +
(p.child2Old == null ? "" : $"{p.child2Old}\n") +
(p.child1Old == null ? "" : $"{p.child1Old}\n") +
(p.rootOld == null ? "" : $"{p.rootOld}"),
OldOrganization = p.OrganizationPositionOld,
OldPositionLevel = p.PositionLevelOld == null ? "-" : p.PositionLevelOld.ToThaiNumber(),
OldPositionNumber = p.PositionNumberOld == null ? "-" : p.PositionNumberOld.ToThaiNumber(),
OldSalary = p.AmountOld == null ? "-" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewOc = (p.position == null ? "" : $"{p.position}\n") +
(p.PositionExecutive == null ? "" : $"{p.PositionExecutive}\n") +
(p.child4 == null ? "" : $"{p.child4}\n") +
(p.child3 == null ? "" : $"{p.child3}\n") +
(p.child2 == null ? "" : $"{p.child2}\n") +
@ -1447,13 +1435,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
No = r.Sequence.ToString().ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
OldOc = (p.positionOld == null ? "" : $"{p.positionOld}\n") +
(p.child4Old == null ? "" : $"{p.child4Old}\n") +
(p.child3Old == null ? "" : $"{p.child3Old}\n") +
(p.child2Old == null ? "" : $"{p.child2Old}\n") +
(p.child1Old == null ? "" : $"{p.child1Old}\n") +
(p.rootOld == null ? "" : $"{p.rootOld}"),
OldPositionNumber = p.posMasterNoOld == null ? "-" :
OldOc = p.OrganizationPositionOld,
OldPositionNumber = p.posMasterNoOld == null ? "-" :
p.child4Old != null ? $"{p.child4ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.child3Old != null ? $"{p.child3ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.child2Old != null ? $"{p.child2ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
@ -1461,6 +1444,7 @@ namespace BMA.EHR.Placement.Service.Controllers
p.rootOld != null ? $"{p.rootShortNameOld}{p.posMasterNoOld}".ToThaiNumber() : "-",
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewOc = (p.position == null ? "" : $"{p.position}\n") +
(p.PositionExecutive == null ? "" : $"{p.PositionExecutive}\n") +
(p.child4 == null ? "" : $"{p.child4}\n") +
(p.child3 == null ? "" : $"{p.child3}\n") +
(p.child2 == null ? "" : $"{p.child2}\n") +
@ -1662,12 +1646,7 @@ namespace BMA.EHR.Placement.Service.Controllers
No = r.Sequence.ToString().ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Education = p.EducationOld == null ? "-" : p.EducationOld,
OldOc = (p.positionOld == null ? "" : $"{p.positionOld}\n") +
(p.child4Old == null ? "" : $"{p.child4Old}\n") +
(p.child3Old == null ? "" : $"{p.child3Old}\n") +
(p.child2Old == null ? "" : $"{p.child2Old}\n") +
(p.child1Old == null ? "" : $"{p.child1Old}\n") +
(p.rootOld == null ? "" : $"{p.rootOld}"),
OldOc = p.OrganizationPositionOld,
OldPositionType = p.posTypeNameOld == null ? "-" : p.posTypeNameOld,
OldPositionLevel = p.posLevelNameOld == null ? "-" : p.posLevelNameOld,
OldPositionNumber = p.posMasterNoOld == null ? "-" :
@ -1679,6 +1658,7 @@ namespace BMA.EHR.Placement.Service.Controllers
OldSalary = p.AmountOld == null ? "-" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
PositionDate = p.PositionDate == null ? "-" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
NewOc = (p.position == null ? "" : $"{p.position}\n") +
(p.PositionExecutive == null ? "" : $"{p.PositionExecutive}\n") +
(p.child4 == null ? "" : $"{p.child4}\n") +
(p.child3 == null ? "" : $"{p.child3}\n") +
(p.child2 == null ? "" : $"{p.child2}\n") +

View file

@ -488,7 +488,7 @@ namespace BMA.EHR.Placement.Service.Controllers
(org.result.child2 == null ? "" : org.result.child2 + "\n") +
(org.result.child1 == null ? "" : org.result.child1 + "\n") +
(org.result.root == null ? "" : org.result.root);
placementAppointment.OrganizationPositionOld = org.result.position + "\n" + placementAppointment.OrganizationOld;
placementAppointment.OrganizationPositionOld = org.result.position + "\n" + (placementAppointment.PositionExecutiveOld == null ? "" : placementAppointment.PositionExecutiveOld + "\n") + placementAppointment.OrganizationOld;
}
await _context.PlacementAppointments.AddAsync(placementAppointment);
await _context.SaveChangesAsync();

View file

@ -1560,12 +1560,12 @@ namespace BMA.EHR.Placement.Service.Controllers
// .ThenInclude(x => x.PlacementType)
.Where(x => req.refIds.Contains(x.Id.ToString()))
// .Where(x => x.Placement!.PlacementType!.Name != "สอบแข่งขัน")
// .Where(x => x.typeCommand.Trim().ToUpper() == "APPOINTED")
// .Where(x => x.typeCommand.Trim().ToUpper() == "APPOINT")
.ToListAsync();
placementProfiles.ForEach(profile =>
{
profile.PlacementStatus = "REPORT";
profile.typeCommand = "APPOINTED";
profile.typeCommand = "APPOINT";
});
await _context.SaveChangesAsync();
return Success();
@ -1615,7 +1615,7 @@ namespace BMA.EHR.Placement.Service.Controllers
// .ThenInclude(x => x.PlacementType)
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
// .Where(x => x.Placement!.PlacementType!.Name != "สอบแข่งขัน")
// .Where(x => x.typeCommand.Trim().ToUpper() == "APPOINTED")
// .Where(x => x.typeCommand.Trim().ToUpper() == "APPOINT")
.ToList()
join r in req.refIds
on p.Id.ToString() equals r.refId
@ -1629,7 +1629,8 @@ namespace BMA.EHR.Placement.Service.Controllers
PositionName = p.positionName == null ? "-" : p.positionName,
ExamNumber = p.ExamNumber == null ? "-" : p.ExamNumber.Value.ToString().ToThaiNumber(),
PlacementName = $"{p.Placement.Name.ToThaiNumber()} ครั้งที่ {p.Placement.Round.ToThaiNumber()} {p.Placement.Year.ToThaiYear().ToString().ToThaiNumber()}",
Oc = (p.positionName == null ? "" : $"{p.positionName}\n") +
Oc = (p.positionName == null ? "" : $"{p.positionName}\n") +
(p.PositionExecutive == null ? "" : $"{p.PositionExecutive}\n") +
(p.child4 == null ? "" : $"{p.child4}\n") +
(p.child3 == null ? "" : $"{p.child3}\n") +
(p.child2 == null ? "" : $"{p.child2}\n") +
@ -1890,12 +1891,12 @@ namespace BMA.EHR.Placement.Service.Controllers
// .ThenInclude(x => x.PlacementType)
.Where(x => req.refIds.Contains(x.Id.ToString()))
// .Where(x => x.Placement!.PlacementType!.Name != "สอบคัดเลือก")
// .Where(x => x.typeCommand.Trim().ToUpper() == "APPOINTED")
// .Where(x => x.typeCommand.Trim().ToUpper() == "APPOINT")
.ToListAsync();
placementProfiles.ForEach(profile =>
{
profile.PlacementStatus = "REPORT";
profile.typeCommand = "APPOINTED";
profile.typeCommand = "APPOINT";
});
await _context.SaveChangesAsync();
return Success();
@ -1945,7 +1946,7 @@ namespace BMA.EHR.Placement.Service.Controllers
// .ThenInclude(x => x.PlacementType)
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
// .Where(x => x.Placement!.PlacementType!.Name != "สอบแข่งขัน")
// .Where(x => x.typeCommand.Trim().ToUpper() == "APPOINTED")
// .Where(x => x.typeCommand.Trim().ToUpper() == "APPOINT")
.ToList()
join r in req.refIds
on p.Id.ToString() equals r.refId
@ -1960,6 +1961,7 @@ namespace BMA.EHR.Placement.Service.Controllers
ExamNumber = p.ExamNumber == null ? "-" : p.ExamNumber.Value.ToString().ToThaiNumber(),
PlacementName = $"{p.Placement.Name.ToThaiNumber()} ครั้งที่ {p.Placement.Round.ToThaiNumber()} {p.Placement.Year.ToThaiYear().ToString().ToThaiNumber()}",
Oc = (p.positionName == null ? "" : $"{p.positionName}\n") +
(p.PositionExecutive == null ? "" : $"{p.PositionExecutive}\n") +
(p.child4 == null ? "" : $"{p.child4}\n") +
(p.child3 == null ? "" : $"{p.child3}\n") +
(p.child2 == null ? "" : $"{p.child2}\n") +
@ -2283,6 +2285,7 @@ namespace BMA.EHR.Placement.Service.Controllers
Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "-" :
p.PlacementEducations.FirstOrDefault().Degree,
OldOc = (p.positionNameOld == null ? "" : $"{p.positionNameOld}\n") +
(p.PositionExecutiveOld == null ? "" : $"{p.PositionExecutiveOld}\n") +
(p.child4Old == null ? "" : $"{p.child4Old}\n") +
(p.child3Old == null ? "" : $"{p.child3Old}\n") +
(p.child2Old == null ? "" : $"{p.child2Old}\n") +
@ -2299,6 +2302,7 @@ namespace BMA.EHR.Placement.Service.Controllers
OldSalary = p.AmountOld == null ? "-" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
OldPosition = p.positionNameOld == null ? "-" : p.positionNameOld,
NewOc = (p.positionName == null ? "" : $"{p.positionName}\n") +
(p.PositionExecutive == null ? "" : $"{p.PositionExecutive}\n") +
(p.child4 == null ? "" : $"{p.child4}\n") +
(p.child3 == null ? "" : $"{p.child3}\n") +
(p.child2 == null ? "" : $"{p.child2}\n") +
@ -2513,6 +2517,7 @@ namespace BMA.EHR.Placement.Service.Controllers
Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "-" :
p.PlacementEducations.FirstOrDefault().Degree,
OldOc = (p.positionNameOld == null ? "" : $"{p.positionNameOld}\n") +
(p.PositionExecutiveOld == null ? "" : $"{p.PositionExecutiveOld}\n") +
(p.child4Old == null ? "" : $"{p.child4Old}\n") +
(p.child3Old == null ? "" : $"{p.child3Old}\n") +
(p.child2Old == null ? "" : $"{p.child2Old}\n") +
@ -2529,6 +2534,7 @@ namespace BMA.EHR.Placement.Service.Controllers
p.nodeOld == "0" ? $"{p.rootShortNameOld}{p.posMasterNoOld}".ToThaiNumber() : "-",
OldSalary = p.AmountOld == null ? "-" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewOc = (p.positionName == null ? "" : $"{p.positionName}\n") +
(p.PositionExecutive == null ? "" : $"{p.PositionExecutive}\n") +
(p.child4 == null ? "" : $"{p.child4}\n") +
(p.child3 == null ? "" : $"{p.child3}\n") +
(p.child2 == null ? "" : $"{p.child2}\n") +
@ -2732,6 +2738,7 @@ namespace BMA.EHR.Placement.Service.Controllers
Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "-" :
p.PlacementEducations.FirstOrDefault().Degree,
OldOc = (p.positionNameOld == null ? "" : $"{p.positionNameOld}\n") +
(p.PositionExecutiveOld == null ? "" : $"{p.PositionExecutiveOld}\n") +
(p.child4Old == null ? "" : $"{p.child4Old}\n") +
(p.child3Old == null ? "" : $"{p.child3Old}\n") +
(p.child2Old == null ? "" : $"{p.child2Old}\n") +
@ -2748,6 +2755,7 @@ namespace BMA.EHR.Placement.Service.Controllers
OldSalary = p.Amount == null ? "-" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
LeaveDate = "-",
NewOc = (p.positionName == null ? "" : $"{p.positionName}\n") +
(p.PositionExecutive == null ? "" : $"{p.PositionExecutive}\n") +
(p.child4 == null ? "" : $"{p.child4}\n") +
(p.child3 == null ? "" : $"{p.child3}\n") +
(p.child2 == null ? "" : $"{p.child2}\n") +
@ -3007,11 +3015,11 @@ namespace BMA.EHR.Placement.Service.Controllers
x.Status.Trim().ToUpper() == "DONE")
.Count();
var pp_appoint = placementProfiles.FirstOrDefault(x => x.TypeCommand == "APPOINTED")?.Count ?? 0;
var pp_slip = placementProfiles.FirstOrDefault(x => x.TypeCommand == "APPOINT")?.Count ?? 0;
var pp_appoint = placementProfiles.FirstOrDefault(x => x.TypeCommand == "APPOINT")?.Count ?? 0;
var pp_slip = placementProfiles.FirstOrDefault(x => x.TypeCommand == "SLIP")?.Count ?? 0;
var pp_move = placementProfiles.FirstOrDefault(x => x.TypeCommand == "MOVE")?.Count ?? 0;
var pa_appoint = placementAppointments.FirstOrDefault(x => x.TypeCommand == "APPOINTED")?.Count ?? 0;
var pa_appoint = placementAppointments.FirstOrDefault(x => x.TypeCommand == "APPOINT")?.Count ?? 0;
var pa_slip = placementAppointments.FirstOrDefault(x => x.TypeCommand == "SLIP")?.Count ?? 0;
var pa_move = placementAppointments.FirstOrDefault(x => x.TypeCommand == "MOVE")?.Count ?? 0;
@ -3134,11 +3142,11 @@ namespace BMA.EHR.Placement.Service.Controllers
x.Status.Trim().ToUpper() == "DONE")
.Count();
var pp_appoint = placementProfiles.FirstOrDefault(x => x.TypeCommand == "APPOINTED")?.Count ?? 0;
var pp_appoint = placementProfiles.FirstOrDefault(x => x.TypeCommand == "APPOINT")?.Count ?? 0;
var pp_slip = placementProfiles.FirstOrDefault(x => x.TypeCommand == "APPOIN")?.Count ?? 0;
var pp_move = placementProfiles.FirstOrDefault(x => x.TypeCommand == "MOVE")?.Count ?? 0;
var pa_appoint = placementAppointments.FirstOrDefault(x => x.TypeCommand == "APPOINTED")?.Count ?? 0;
var pa_appoint = placementAppointments.FirstOrDefault(x => x.TypeCommand == "APPOINT")?.Count ?? 0;
var pa_slip = placementAppointments.FirstOrDefault(x => x.TypeCommand == "SLIP")?.Count ?? 0;
var pa_move = placementAppointments.FirstOrDefault(x => x.TypeCommand == "MOVE")?.Count ?? 0;
@ -3287,7 +3295,7 @@ namespace BMA.EHR.Placement.Service.Controllers
(node == 4 ? x.child4DnaId.Contains(item.child4DnaId) : true))
.Count();
//var pa_appoint = placementAppointments.FirstOrDefault(x => x.TypeCommand == "APPOINTED")?.Count ?? 0;
//var pa_appoint = placementAppointments.FirstOrDefault(x => x.TypeCommand == "APPOINT")?.Count ?? 0;
var pa_appoint = pae_count;
var pa_slip = placementAppointments.FirstOrDefault(x => x.TypeCommand == "SLIP")?.Count ?? 0;
var pa_move = placementAppointments.FirstOrDefault(x => x.TypeCommand == "MOVE")?.Count ?? 0;
@ -3336,7 +3344,7 @@ namespace BMA.EHR.Placement.Service.Controllers
(node == 4 ? x.child4DnaId.Contains(item.child4DnaId) : true))
.Count();
//var pa_appoint = placementAppointments.FirstOrDefault(x => x.TypeCommand == "APPOINTED")?.Count ?? 0;
//var pa_appoint = placementAppointments.FirstOrDefault(x => x.TypeCommand == "APPOINT")?.Count ?? 0;
var pa_appoint = pae_count;
var pa_slip = placementAppointments.FirstOrDefault(x => x.TypeCommand == "SLIP")?.Count ?? 0;
var pa_move = placementAppointments.FirstOrDefault(x => x.TypeCommand == "MOVE")?.Count ?? 0;

View file

@ -411,7 +411,7 @@ namespace BMA.EHR.Placement.Service.Controllers
(org.result.child2 == null ? "" : org.result.child2 + "\n") +
(org.result.child1 == null ? "" : org.result.child1 + "\n") +
(org.result.root == null ? "" : org.result.root);
placementOfficer.OrganizationPositionOld = org.result.position + "\n" + placementOfficer.OrganizationOld;
placementOfficer.OrganizationPositionOld = org.result.position + "\n" + (placementOfficer.PositionExecutiveOld == null ? "" : placementOfficer.PositionExecutiveOld + "\n") + placementOfficer.OrganizationOld;
}
await _context.PlacementOfficers.AddAsync(placementOfficer);
await _context.SaveChangesAsync();
@ -614,12 +614,7 @@ namespace BMA.EHR.Placement.Service.Controllers
{
No = r.Sequence.ToString().ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
PositionName = (p.PositionOld == null ? "" : $"{p.PositionOld}\n") +
(p.child4Old == null ? "" : $"{p.child4Old}\n") +
(p.child3Old == null ? "" : $"{p.child3Old}\n") +
(p.child2Old == null ? "" : $"{p.child2Old}\n") +
(p.child1Old == null ? "" : $"{p.child1Old}\n") +
(p.rootOld == null ? "" : $"{p.rootOld}"),
PositionName = p.OrganizationPositionOld,
Organization = p.Organization == null ? "" : p.Organization,
StartDate = p.DateStart == null ? "" : p.DateStart.Value.ToThaiShortDate2().ToThaiNumber(),
EndDate = p.DateEnd == null ? "" : p.DateEnd.Value.ToThaiShortDate2().ToThaiNumber(),

View file

@ -501,12 +501,12 @@ namespace BMA.EHR.Placement.Service.Controllers
placementReceive.PositionLevelOld = org.result.posLevelName;
placementReceive.PositionTypeOld = org.result.posTypeName;
placementReceive.PositionNumberOld = org.result.nodeShortName + org.result.posMasterNo;
placementReceive.OrganizationOld = (org.result.child4 == null ? "" : org.result.child4 + " ") +
(org.result.child3 == null ? "" : org.result.child3 + " ") +
(org.result.child2 == null ? "" : org.result.child2 + " ") +
(org.result.child1 == null ? "" : org.result.child1 + " ") +
placementReceive.OrganizationOld = (org.result.child4 == null ? "" : org.result.child4 + "\n") +
(org.result.child3 == null ? "" : org.result.child3 + "\n") +
(org.result.child2 == null ? "" : org.result.child2 + "\n") +
(org.result.child1 == null ? "" : org.result.child1 + "\n") +
(org.result.root == null ? "" : org.result.root);
placementReceive.OrganizationPositionOld = org.result.position + "\n" + placementReceive.OrganizationOld;
placementReceive.OrganizationPositionOld = org.result.position + "\n" + (placementReceive.PositionExecutiveOld == null ? "" : placementReceive.PositionExecutiveOld + "\n") + placementReceive.OrganizationOld;
}
}
await _context.PlacementReceives.AddAsync(placementReceive);
@ -941,6 +941,7 @@ namespace BMA.EHR.Placement.Service.Controllers
Education = p.EducationOld == null ? "-" : p.EducationOld,
OldOrg = p.OrganizationPositionOld ?? "-",
OldOc = (p.PositionOld == null ? "" : $"{p.PositionOld}\n") +
(p.PositionExecutiveOld == null ? "" : $"{p.PositionExecutiveOld}\n") +
(p.child4Old == null ? "" : $"{p.child4Old}\n") +
(p.child3Old == null ? "" : $"{p.child3Old}\n") +
(p.child2Old == null ? "" : $"{p.child2Old}\n") +
@ -950,6 +951,7 @@ namespace BMA.EHR.Placement.Service.Controllers
OldPositionLevel = p.PositionLevelOld ?? "-",
OldSalary = p.AmountOld == null ? "-" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewOc = (p.position == null ? "" : $"{p.position}\n") +
(p.PositionExecutive == null ? "" : $"{p.PositionExecutive}\n") +
(p.child4 == null ? "" : $"{p.child4}\n") +
(p.child3 == null ? "" : $"{p.child3}\n") +
(p.child2 == null ? "" : $"{p.child2}\n") +

View file

@ -283,12 +283,12 @@ namespace BMA.EHR.Placement.Service.Controllers
placementRepatriation.PositionLevelOld = org.result.posLevelName;
placementRepatriation.PositionTypeOld = org.result.posTypeName;
placementRepatriation.PositionNumberOld = org.result.nodeShortName + org.result.posMasterNo;
placementRepatriation.OrganizationOld = (org.result.child4 == null ? "" : org.result.child4 + " ") +
(org.result.child3 == null ? "" : org.result.child3 + " ") +
(org.result.child2 == null ? "" : org.result.child2 + " ") +
(org.result.child1 == null ? "" : org.result.child1 + " ") +
placementRepatriation.OrganizationOld = (org.result.child4 == null ? "" : org.result.child4 + "\n") +
(org.result.child3 == null ? "" : org.result.child3 + "\n") +
(org.result.child2 == null ? "" : org.result.child2 + "\n") +
(org.result.child1 == null ? "" : org.result.child1 + "\n") +
(org.result.root == null ? "" : org.result.root);
placementRepatriation.OrganizationPositionOld = org.result.position + "\n" + placementRepatriation.OrganizationOld;
placementRepatriation.OrganizationPositionOld = org.result.position + "\n" + (placementRepatriation.PositionExecutiveOld == null ? "" : placementRepatriation.PositionExecutiveOld + "\n") + placementRepatriation.OrganizationOld;
}
await _context.PlacementRepatriations.AddAsync(placementRepatriation);
await _context.SaveChangesAsync();

View file

@ -541,12 +541,12 @@ namespace BMA.EHR.Placement.Service.Controllers
placementTransfer.PositionLevelOld = org.result.posLevelName;
placementTransfer.PositionTypeOld = org.result.posTypeName;
placementTransfer.PositionNumberOld = org.result.nodeShortName + org.result.posMasterNo;
placementTransfer.OrganizationOld = (org.result.child4 == null ? "" : org.result.child4 + " ") +
(org.result.child3 == null ? "" : org.result.child3 + " ") +
(org.result.child2 == null ? "" : org.result.child2 + " ") +
(org.result.child1 == null ? "" : org.result.child1 + " ") +
placementTransfer.OrganizationOld = (org.result.child4 == null ? "" : org.result.child4 + "\n") +
(org.result.child3 == null ? "" : org.result.child3 + "\n") +
(org.result.child2 == null ? "" : org.result.child2 + "\n") +
(org.result.child1 == null ? "" : org.result.child1 + "\n") +
(org.result.root == null ? "" : org.result.root);
placementTransfer.OrganizationPositionOld = org.result.position + "\n" + placementTransfer.OrganizationOld;
placementTransfer.OrganizationPositionOld = org.result.position + "\n" + (placementTransfer.PositionExecutiveOld == null ? "" : placementTransfer.PositionExecutiveOld + "\n") + placementTransfer.OrganizationOld;
}
await _context.PlacementTransfers.AddAsync(placementTransfer);
await _context.SaveChangesAsync();
@ -805,12 +805,7 @@ namespace BMA.EHR.Placement.Service.Controllers
{
No = r.Sequence.ToString().ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
OldOc = (p.PositionOld == null ? "" : $"{p.PositionOld}\n") +
(p.child4Old == null ? "" : $"{p.child4Old}\n") +
(p.child3Old == null ? "" : $"{p.child3Old}\n") +
(p.child2Old == null ? "" : $"{p.child2Old}\n") +
(p.child1Old == null ? "" : $"{p.child1Old}\n") +
(p.rootOld == null ? "" : $"{p.rootOld}"),
OldOc = p.OrganizationPositionOld,
PositionType = p.PositionTypeOld == null ? "-" : p.PositionTypeOld,
PositionLevel = p.PositionLevelOld == null ? "-" : p.PositionLevelOld,
PositionNumber = p.PositionNumberOld == null ? "-" : p.PositionNumberOld.ToThaiNumber(),

View file

@ -44,7 +44,7 @@ namespace BMA.EHR.Report.Service.Controllers
[HttpGet("{exportType}/{Id}")]
public async Task<ActionResult<ResponseObject>> GetProfileRetirement([FromRoute] Guid Id, string exportType = "pdf")
{
var retire = await _service.GetProfileRetirementdAsync(Id);
var retire = await _service.GetProfileRetirementdAsync(Id,token);
if (retire != null)
{
var reportfile = string.Empty;

View file

@ -2127,7 +2127,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
[HttpGet("31/{exportType}/{Id}")]
public async Task<ActionResult<ResponseObject>> GetProfileRetirement([FromRoute] Guid Id, string exportType = "pdf")
{
var retire = await _service.GetProfileRetirementdAsync(Id);
var retire = await _service.GetProfileRetirementdAsync(Id,token);
if (retire != null)
{
var reportfile = string.Empty;

View file

@ -403,7 +403,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
IsSendMail = true,
IsSendInbox = true,
IsSendNotification = true,
// OrganizationName = retirementDeceased.OrganizationName,
OrganizationName = retirementDeceased.root == null ? "" : retirementDeceased.root,
PositionName = retirementDeceased.position == null ? "" : retirementDeceased.position,
profileId = req.ProfileId,
CreatedFullName = FullName ?? "System Administrator",
@ -413,6 +413,74 @@ namespace BMA.EHR.Retirement.Service.Controllers
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
});
var pathUrl = $"{_configuration["API"]}/org/command/find-higher";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _res = await client.PostAsJsonAsync(pathUrl, new
{
persons = new List<object>
{
new { profileId = req.ProfileId }
}
});
var _result = await _res.Content.ReadAsStringAsync();
var highers = JsonConvert.DeserializeObject<RetirementDeceasedAddNotiHigherRequest>(_result);
if (highers != null && highers.result != null)
{
foreach (var higher in highers.result)
{
if (higher.profileId != null)
{
//var payload_attach = new List<PayloadAttachment>();
//payload_attach.Add(new PayloadAttachment
//{
// name = "หนังสือเวียนถึงแก่กรรม",
// url = $"{_configuration["APIV2"]}/report/deceased/copy/36/{retirementDeceased.Id}"
//});
//var payload = new CommandPayload()
//{
// attachments = payload_attach
//};
//var payload_str = JsonConvert.SerializeObject(payload);
await _repositoryNoti.PushNotificationAsync(
Guid.Parse(higher.profileId),
$"หนังสือเวียนถึงแก่กรรมของ {higher.prefix}{higher.firstName} {higher.lastName}",
$"แจ้งข่าวการถึงแก่กรรมของ {retirementDeceased.prefix}{retirementDeceased.firstName} {retirementDeceased.lastName}",
//payload_str,
"",
"",
true,
true
);
}
retirementDeceased.RetirementDeceasedNotis.Add(new RetirementDeceasedNoti
{
profileId = higher.profileId,
CitizenId = higher.citizenId,
Prefix = higher.prefix,
FirstName = higher.firstName,
LastName = higher.lastName,
OrganizationName = higher.organizationName,
PositionName = higher.positionName,
IsSendMail = true,
IsSendInbox = true,
IsSendNotification = true,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
});
}
}
}
await _context.SaveChangesAsync();
return Success();

View file

@ -330,7 +330,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
(org.result.child2 == null ? "" : org.result.child2 + "\n") +
(org.result.child1 == null ? "" : org.result.child1 + "\n") +
(org.result.root == null ? "" : org.result.root);
retirementOther.OrganizationPositionOld = org.result.position + "\n" + retirementOther.OrganizationOld;
retirementOther.OrganizationPositionOld = org.result.position + "\n" + (retirementOther.PositionExecutiveOld == null ? "" : retirementOther.PositionExecutiveOld + "\n") + retirementOther.OrganizationOld;
retirementOther.EducationOld = org.result.education;
retirementOther.AmountOld = org.result.salary;
}
@ -825,12 +825,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
No = r.Sequence.ToString().ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Education = p.EducationOld == null ? "-" : p.EducationOld,
OldOc = (p.PositionOld == null ? "" : $"{p.PositionOld}\n") +
(p.child4Old == null ? "" : $"{p.child4Old}\n") +
(p.child3Old == null ? "" : $"{p.child3Old}\n") +
(p.child2Old == null ? "" : $"{p.child2Old}\n") +
(p.child1Old == null ? "" : $"{p.child1Old}\n") +
(p.rootOld == null ? "" : $"{p.rootOld}"),
OldOc = p.OrganizationPositionOld,
OldPositionType = p.PositionTypeOld == null ? "-" : p.PositionTypeOld,
OldPositionLevel = p.PositionLevelOld == null ? "-" : p.PositionLevelOld,
OldPositionNumber = p.PositionNumberOld == null ? "-" : p.PositionNumberOld.ToThaiNumber(),
@ -838,6 +833,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
LeaveDate = p.LeaveDate == null ? "-" : p.LeaveDate.Value.ToThaiShortDate2().ToThaiNumber(),
MilitaryDate = p.MilitaryDate == null ? "-" : p.MilitaryDate.Value.ToThaiShortDate2().ToThaiNumber(),
NewOc = (p.PositionOld == null ? "" : $"{p.PositionOld}\n") +
(p.PositionExecutiveOld == null ? "" : $"{p.PositionExecutiveOld}\n") +
(p.child4Old == null ? "" : $"{p.child4Old}\n") +
(p.child3Old == null ? "" : $"{p.child3Old}\n") +
(p.child2Old == null ? "" : $"{p.child2Old}\n") +

View file

@ -308,7 +308,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
(org.result.child2 == null ? "" : org.result.child2 + "\n") +
(org.result.child1 == null ? "" : org.result.child1 + "\n") +
(org.result.root == null ? "" : org.result.root);
retirementOut.OrganizationPositionOld = org.result.position + "\n" + retirementOut.OrganizationOld;
retirementOut.OrganizationPositionOld = org.result.position + "\n" + (retirementOut.PositionExecutiveOld == null ? "" : retirementOut.PositionExecutiveOld + "\n") + retirementOut.OrganizationOld;
retirementOut.AmountOld = org.result.salary;
}
}
@ -363,7 +363,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
(org.result.child2 == null ? "" : org.result.child2 + "\n") +
(org.result.child1 == null ? "" : org.result.child1 + "\n") +
(org.result.root == null ? "" : org.result.root);
retirementOut.OrganizationPositionOld = org.result.position + "\n" + retirementOut.OrganizationOld;
retirementOut.OrganizationPositionOld = org.result.position + "\n" + (retirementOut.PositionExecutiveOld == null ? "" : retirementOut.PositionExecutiveOld + "\n") + retirementOut.OrganizationOld;
retirementOut.AmountOld = org.result.salary;
}
}

View file

@ -948,7 +948,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
(org.result.child2 == null ? "" : org.result.child2 + "\n") +
(org.result.child1 == null ? "" : org.result.child1 + "\n") +
(org.result.root == null ? "" : org.result.root);
retirementResign.OrganizationPositionOld = org.result.position + "\n" + retirementResign.OrganizationOld;
retirementResign.OrganizationPositionOld = org.result.position + "\n" + (retirementResign.PositionExecutiveOld == null ? "" : retirementResign.PositionExecutiveOld + "\n") + retirementResign.OrganizationOld;
}
await _context.RetirementResigns.AddAsync(retirementResign);
await _context.SaveChangesAsync();
@ -2357,7 +2357,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
PositionName = p.PositionOld ?? "-",
Organization = p.OrganizationPositionOld ?? "-",
Oc = (p.PositionOld == null ? "" : $"{p.PositionOld}\n") +
Oc = (p.PositionOld == null ? "" : $"{p.PositionOld}\n") +
(p.PositionExecutiveOld == null ? "" : $"{p.PositionExecutiveOld}\n") +
(p.child4Old == null ? "" : $"{p.child4Old}\n") +
(p.child3Old == null ? "" : $"{p.child3Old}\n") +
(p.child2Old == null ? "" : $"{p.child2Old}\n") +

View file

@ -161,7 +161,7 @@ var app = builder.Build();
app.UseStaticFiles();
app.MapControllers();
app.UseMiddleware<ErrorHandlerMiddleware>();
app.UseMiddleware<RequestLoggingMiddleware>();
//app.UseMiddleware<RequestLoggingMiddleware>();
app.UseHangfireDashboard("/hangfire", new DashboardOptions()
{

View file

@ -0,0 +1,20 @@
using BMA.EHR.Domain.Models.MetaData;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Retirement.Service.Requests
{
public class RetirementDeceasedAddNotiHigherRequest
{
public List<HigherResponse> result { get; set; } = new List<HigherResponse>();
}
public class HigherResponse
{
public string citizenId { get; set; } = string.Empty;
public string prefix { get; set; } = string.Empty;
public string firstName { get; set; } = string.Empty;
public string lastName { get; set; } = string.Empty;
public string organizationName { get; set; } = string.Empty;
public string positionName { get; set; } = string.Empty;
public string profileId { get; set; } = string.Empty;
}
}