Merge branch 'develop' into working
This commit is contained in:
commit
fb5ffde9d3
30 changed files with 49951 additions and 51 deletions
87
.github/workflows/release_Retirement.yaml
vendored
Normal file
87
.github/workflows/release_Retirement.yaml
vendored
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
name: release-dev
|
||||
run-name: release-dev ${{ github.actor }}
|
||||
on:
|
||||
# push:
|
||||
# tags:
|
||||
# - 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
# tags-ignore:
|
||||
# - '2.*'
|
||||
# Allow run workflow manually from Action tab
|
||||
workflow_dispatch:
|
||||
env:
|
||||
REGISTRY: docker.frappet.com
|
||||
IMAGE_NAME: ehr/bma-ehr-retirement-service
|
||||
DEPLOY_HOST: frappet.com
|
||||
COMPOSE_PATH: /home/frappet/docker/bma-ehr-retirement
|
||||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
|
||||
jobs:
|
||||
# act workflow_dispatch -W .github/workflows/release_retirement.yaml --input IMAGE_VER=test-v6.1 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
# skip Set up QEMU because it fail on act and container
|
||||
- name: Gen Version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER='${GITHUB_REF/refs\/tags\//}'
|
||||
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: Test 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: 22
|
||||
script: |
|
||||
cd "${{env.COMPOSE_PATH}}"
|
||||
docker-compose pull
|
||||
docker-compose up -d
|
||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: success()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Success✅✅✅
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: failure()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Failure❌❌❌
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
87
.github/workflows/release_insignia.yaml
vendored
Normal file
87
.github/workflows/release_insignia.yaml
vendored
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
name: release-dev
|
||||
run-name: release-dev ${{ github.actor }}
|
||||
on:
|
||||
# push:
|
||||
# tags:
|
||||
# - 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
# tags-ignore:
|
||||
# - '2.*'
|
||||
# Allow run workflow manually from Action tab
|
||||
workflow_dispatch:
|
||||
env:
|
||||
REGISTRY: docker.frappet.com
|
||||
IMAGE_NAME: ehr/bma-ehr-insignia-service
|
||||
DEPLOY_HOST: frappet.com
|
||||
COMPOSE_PATH: /home/frappet/docker/bma-ehr-insignia
|
||||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
|
||||
jobs:
|
||||
# act workflow_dispatch -W .github/workflows/release_insignia.yaml --input IMAGE_VER=test-v6.1 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
# skip Set up QEMU because it fail on act and container
|
||||
- name: Gen Version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER='${GITHUB_REF/refs\/tags\//}'
|
||||
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: Test 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.Insignia.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: 22
|
||||
script: |
|
||||
cd "${{env.COMPOSE_PATH}}"
|
||||
docker-compose pull
|
||||
docker-compose up -d
|
||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: success()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Success✅✅✅
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: failure()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Failure❌❌❌
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
87
.github/workflows/release_orgEmployee.yaml
vendored
Normal file
87
.github/workflows/release_orgEmployee.yaml
vendored
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
name: release-dev
|
||||
run-name: release-dev ${{ github.actor }}
|
||||
on:
|
||||
# push:
|
||||
# tags:
|
||||
# - 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
# tags-ignore:
|
||||
# - '2.*'
|
||||
# Allow run workflow manually from Action tab
|
||||
workflow_dispatch:
|
||||
env:
|
||||
REGISTRY: docker.frappet.com
|
||||
IMAGE_NAME: ehr/bma-ehr-ore-employee-service
|
||||
DEPLOY_HOST: frappet.com
|
||||
COMPOSE_PATH: /home/frappet/docker/bma-ehr-ore-employee
|
||||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
|
||||
jobs:
|
||||
# act workflow_dispatch -W .github/workflows/release_ore-employee.yaml --input IMAGE_VER=test-v6.1 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
# skip Set up QEMU because it fail on act and container
|
||||
- name: Gen Version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER='${GITHUB_REF/refs\/tags\//}'
|
||||
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: Test 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.OrganizationEmployee.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: 22
|
||||
script: |
|
||||
cd "${{env.COMPOSE_PATH}}"
|
||||
docker-compose pull
|
||||
docker-compose up -d
|
||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: success()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Success✅✅✅
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: failure()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Failure❌❌❌
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
87
.github/workflows/release_placement.yaml
vendored
Normal file
87
.github/workflows/release_placement.yaml
vendored
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
name: release-dev
|
||||
run-name: release-dev ${{ github.actor }}
|
||||
on:
|
||||
# push:
|
||||
# tags:
|
||||
# - 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
# tags-ignore:
|
||||
# - '2.*'
|
||||
# Allow run workflow manually from Action tab
|
||||
workflow_dispatch:
|
||||
env:
|
||||
REGISTRY: docker.frappet.com
|
||||
IMAGE_NAME: ehr/bma-ehr-placement-service
|
||||
DEPLOY_HOST: frappet.com
|
||||
COMPOSE_PATH: /home/frappet/docker/bma-ehr-placement
|
||||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
|
||||
jobs:
|
||||
# act workflow_dispatch -W .github/workflows/release_placement.yaml --input IMAGE_VER=test-v6.1 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
# skip Set up QEMU because it fail on act and container
|
||||
- name: Gen Version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER='${GITHUB_REF/refs\/tags\//}'
|
||||
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: Test 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.Placement.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: 22
|
||||
script: |
|
||||
cd "${{env.COMPOSE_PATH}}"
|
||||
docker-compose pull
|
||||
docker-compose up -d
|
||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: success()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Success✅✅✅
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: failure()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Failure❌❌❌
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
|
|
@ -1842,14 +1842,14 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
// TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||
// Send noti inbox and email
|
||||
var subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
var body = $"คุณได้รับบรรจุเป็นข้าราชการกรุงเทพมหานครสามัญ ตามคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
var body = $"คุณได้รับรรจุเป็นข้าราชการกรุงเทพมหานครสามัญ ตามคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
_emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||
|
||||
|
||||
var inbox = new Inbox
|
||||
{
|
||||
Subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คุณได้รับบรรจุเป็นข้าราชการกรุงเทพมหานครสามัญ ตามคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คุณได้รับรรจุเป็นข้าราชการกรุงเทพมหานครสามัญ ตามคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = profile.Id,
|
||||
Payload = payload_str,
|
||||
};
|
||||
|
|
@ -1857,7 +1857,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"คุณได้รับบรรจุเป็นข้าราชการกรุงเทพมหานครสามัญ ตามคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คุณได้รับรรจุเป็นข้าราชการกรุงเทพมหานครสามัญ ตามคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = profile.Id,
|
||||
Type = "LINK",
|
||||
Payload = payload_str,
|
||||
|
|
@ -1879,7 +1879,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var inbox = new Inbox
|
||||
{
|
||||
Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คำสั่งบบรรจุเป็นข้าราชการกรุงเทพมหานครสามัญ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คำสั่งบรรจุเป็นข้าราชการกรุงเทพมหานครสามัญ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Payload = payload_str,
|
||||
};
|
||||
|
|
@ -1891,14 +1891,14 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
// TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||
// Send noti inbox and email
|
||||
var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
var body = $"คำสั่งบบรรจุเป็นข้าราชการกรุงเทพมหานครสามัญ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
var body = $"คำสั่งบรรจุเป็นข้าราชการกรุงเทพมหานครสามัญ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
_emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||
}
|
||||
|
||||
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"คำสั่งบบรรจุเป็นข้าราชการกรุงเทพมหานครสามัญ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คำสั่งบรรจุเป็นข้าราชการกรุงเทพมหานครสามัญ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Type = "LINK",
|
||||
Payload = payload_str,
|
||||
|
|
@ -3200,7 +3200,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
if (lastSarary.Order != null)
|
||||
order = lastSarary.Order.Value + 1;
|
||||
|
||||
|
||||
|
||||
|
||||
var salary = new ProfileSalary
|
||||
{
|
||||
|
|
@ -6496,12 +6496,24 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
PositionSalaryAmount = 0,
|
||||
MonthSalaryAmount = 0
|
||||
};
|
||||
var profile = await _dbContext.Set<Profile>()
|
||||
.Include(x => x.Salaries)
|
||||
.FirstOrDefaultAsync(p => p.CitizenId == cmdReceiver.CitizenId);
|
||||
Double SalaryAmount = 0;
|
||||
Double PositionSalaryAmount = 0;
|
||||
Double MonthSalaryAmount = 0;
|
||||
if (profile != null && profile.Salaries.Count() > 0)
|
||||
{
|
||||
SalaryAmount = cmdReceiver.Amount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value : 0;
|
||||
PositionSalaryAmount = cmdReceiver.PositionSalaryAmount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount.Value : 0;
|
||||
MonthSalaryAmount = cmdReceiver.MouthSalaryAmount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().MouthSalaryAmount.Value : 0;
|
||||
}
|
||||
|
||||
return new PlacementSalaryResponse
|
||||
{
|
||||
SalaryAmount = cmdReceiver.Amount ?? 0,
|
||||
PositionSalaryAmount = cmdReceiver.PositionSalaryAmount ?? 0,
|
||||
MonthSalaryAmount = cmdReceiver.MouthSalaryAmount ?? 0
|
||||
SalaryAmount = cmdReceiver.Amount != null ? cmdReceiver.Amount.Value : SalaryAmount,
|
||||
PositionSalaryAmount = cmdReceiver.PositionSalaryAmount != null ? cmdReceiver.PositionSalaryAmount.Value : PositionSalaryAmount,
|
||||
MonthSalaryAmount = cmdReceiver.MouthSalaryAmount != null ? cmdReceiver.MouthSalaryAmount.Value : MonthSalaryAmount,
|
||||
};
|
||||
}
|
||||
catch
|
||||
|
|
@ -6520,12 +6532,24 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
|
||||
if (placementProfile == null)
|
||||
throw new Exception($"Invalid placement profile: {placementProfileId}");
|
||||
var profile = await _dbContext.Set<Profile>()
|
||||
.Include(x => x.Salaries)
|
||||
.FirstOrDefaultAsync(p => p.CitizenId == placementProfile.CitizenId);
|
||||
Double SalaryAmount = 0;
|
||||
Double PositionSalaryAmount = 0;
|
||||
Double MonthSalaryAmount = 0;
|
||||
if (profile != null && profile.Salaries.Count() > 0)
|
||||
{
|
||||
SalaryAmount = placementProfile.Amount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value : 0;
|
||||
PositionSalaryAmount = placementProfile.PositionSalaryAmount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount.Value : 0;
|
||||
MonthSalaryAmount = placementProfile.MouthSalaryAmount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().MouthSalaryAmount.Value : 0;
|
||||
}
|
||||
|
||||
return new PlacementSalaryResponse
|
||||
{
|
||||
SalaryAmount = placementProfile.Amount ?? 0,
|
||||
PositionSalaryAmount = placementProfile.PositionSalaryAmount ?? 0,
|
||||
MonthSalaryAmount = placementProfile.MouthSalaryAmount ?? 0
|
||||
SalaryAmount = placementProfile.Amount != null ? placementProfile.Amount.Value : SalaryAmount,
|
||||
PositionSalaryAmount = placementProfile.PositionSalaryAmount != null ? placementProfile.PositionSalaryAmount.Value : PositionSalaryAmount,
|
||||
MonthSalaryAmount = placementProfile.MouthSalaryAmount != null ? placementProfile.MouthSalaryAmount.Value : MonthSalaryAmount,
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
p.IsActive == true &&
|
||||
p.IsLeave == false &&
|
||||
p.DateAppoint != null &&
|
||||
|
||||
|
||||
p.ProfileType == "employee" &&
|
||||
p.EmployeeClass == "perm"
|
||||
)
|
||||
|
|
@ -259,7 +259,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
LastInsignia = p.Insignias.Count == 0 ? "" : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name,
|
||||
LastInsigniaId = p.Insignias.Count == 0 ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Id,
|
||||
Salary = p.Salaries.Count() == 0 ? null : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||
SalaryCondition = p.Salaries.Count() == 0 ? null : p.Salaries.Where(x => x.Date <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||
SalaryCondition = p.Salaries.Count() == 0 ? null : p.Salaries.Where(x => x.Date <= new DateTime(period.Year, 4, 29)).OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||
PostionSalaryAmount = p.Salaries.Count() == 0 ? null : p.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount,
|
||||
//FirstRecvInsigniaYear1 = p.Insignias.Count == 0 ? 0 :
|
||||
// p.Insignias.Where(x => x.Insignia.Name == "เบญจมาภรณ์มงกุฎไทย").OrderBy(x => x.Year).FirstOrDefault() == null ? 0 :
|
||||
|
|
@ -273,8 +273,8 @@ namespace BMA.EHR.Application.Repositories
|
|||
var s1 = ((from p in inst_profile
|
||||
where p.ProfileDateAppoint <= new DateTime(period.Year - 8, 5, 29)
|
||||
&& p.LastInsigniaId == Guid.Parse("00000000-0000-0000-0000-000000000000")
|
||||
&& (p.SalaryCondition >= 8340
|
||||
&& p.SalaryCondition < 15050 )
|
||||
&& (p.SalaryCondition >= 8340
|
||||
&& p.SalaryCondition < 15050)
|
||||
select p)
|
||||
.ToList()
|
||||
.Select(p => new InsigniaResultSet
|
||||
|
|
@ -891,6 +891,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
p.IsLeave == false &&
|
||||
p.DateAppoint != null &&
|
||||
p.PositionType != null &&
|
||||
p.ProfileType == "officer" &&
|
||||
p.PositionType.Name == "ทั่วไป" //
|
||||
)
|
||||
.Select(p => new
|
||||
|
|
@ -962,6 +963,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
|
||||
&& p.PositionLevel.Name == "ปฏิบัติงาน" // ปฏิบัติงาน
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("เบญจมาภรณ์ช้างเผือก")
|
||||
|
|
@ -1036,6 +1038,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป1
|
||||
&& p.PositionLevel.Name == "ปฏิบัติงาน" // ปฏิบัติงาน1
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("จัตุรถาภรณ์มงกุฎไทย")
|
||||
|
|
@ -1104,6 +1107,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป1
|
||||
&& p.PositionLevel.Name == "ปฏิบัติงาน" // ปฏิบัติงาน1
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("จัตุรถาภรณ์ช้างเผือก")
|
||||
|
|
@ -1285,6 +1289,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
|
||||
&& p.PositionLevel.Name == "ชำนาญงาน" // ชำนาญงาน
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ตริตาภรณ์มงกุฎไทย")
|
||||
|
|
@ -1357,6 +1362,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
|
||||
&& p.PositionLevel.Name == "ชำนาญงาน" // ชำนาญงาน
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ตริตาภรณ์ช้างเผือก")
|
||||
|
|
@ -1501,6 +1507,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
|
||||
&& p.PositionLevel.Name == "อาวุโส" // อาวุโส
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์มงกุฎไทย")
|
||||
|
|
@ -1573,6 +1580,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
|
||||
&& p.PositionLevel.Name == "อาวุโส" // อาวุโส
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก")
|
||||
|
|
@ -1718,6 +1726,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
|
||||
&& (p.PositionLevel.Name == "อาวุโส" || p.PositionLevel.Name == "อาวุโส (เฉพาะสายงาน)") // อาวุโส
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก")
|
||||
|
|
@ -1790,6 +1799,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
|
||||
&& (p.PositionLevel.Name == "อาวุโส" || p.PositionLevel.Name == "อาวุโส (เฉพาะสายงาน)") // อาวุโส
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย")
|
||||
|
|
@ -1868,6 +1878,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "ทั่วไป" // ทั่วไป
|
||||
&& (p.PositionLevel.Name == "อาวุโส" || p.PositionLevel.Name == "อาวุโส (เฉพาะสายงาน)") // อาวุโส
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์ช้างเผือก")
|
||||
|
|
@ -2035,7 +2046,8 @@ namespace BMA.EHR.Application.Repositories
|
|||
p.IsLeave == false &&
|
||||
p.DateAppoint != null &&
|
||||
p.PositionType != null &&
|
||||
p.PositionType.Name == "วิชาการ" // ประเภทวิชาการ
|
||||
p.PositionType.Name == "วิชาการ" && // ประเภทวิชาการ
|
||||
p.ProfileType == "officer"
|
||||
)
|
||||
.Select(p => new
|
||||
{
|
||||
|
|
@ -2160,6 +2172,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.PositionLevel.Name == "ชำนาญการ" // ชำนาญการ
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ตริตาภรณ์ช้างเผือก")
|
||||
|
|
@ -2230,6 +2243,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.PositionLevel.Name == "ชำนาญการ" // ชำนาญการ
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์มงกุฎไทย")
|
||||
|
|
@ -2301,6 +2315,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.PositionLevel.Name == "ชำนาญการ" // ชำนาญการ
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก")
|
||||
|
|
@ -2461,6 +2476,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.PositionLevel.Name == "ชำนาญการพิเศษ" // ชำนาญการพิเศษ
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก")
|
||||
|
|
@ -2531,6 +2547,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.PositionLevel.Name == "ชำนาญการพิเศษ" // ชำนาญการพิเศษ
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย")
|
||||
|
|
@ -2683,6 +2700,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.PositionLevel.Name == "เชี่ยวชาญ" // เชี่ยวชสญ
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก")
|
||||
|
|
@ -2753,6 +2771,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.PositionLevel.Name == "เชี่ยวชาญ" // เชี่ยวชาญ
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย")
|
||||
|
|
@ -2828,6 +2847,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.PositionLevel.Name == "เชี่ยวชาญ" // เชี่ยวชาญ
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์ช้างเผือก")
|
||||
|
|
@ -2991,6 +3011,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionType != null
|
||||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.ProfileType == "officer"
|
||||
&& (p.PositionLevel.Name == "ทรงคุณวุฒิ" || p.PositionLevel.Name == "ทรงคุณวุฒิ (เฉพาะสายงาน)") // ทรงคุณวุฒิ
|
||||
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
|
|
@ -3074,6 +3095,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionType != null
|
||||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.ProfileType == "officer"
|
||||
&& (p.PositionLevel.Name == "ทรงคุณวุฒิ" || p.PositionLevel.Name == "ทรงคุณวุฒิ (เฉพาะสายงาน)") // ทรงคุณวุฒิ
|
||||
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
|
|
@ -3159,6 +3181,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionType != null
|
||||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.ProfileType == "officer"
|
||||
&& (p.PositionLevel.Name == "ทรงคุณวุฒิ" || p.PositionLevel.Name == "ทรงคุณวุฒิ (เฉพาะสายงาน)") // ทรงคุณวุฒิ
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
|
|
@ -3332,6 +3355,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionType != null
|
||||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.ProfileType == "officer"
|
||||
&& (p.PositionLevel.Name == "ทรงคุณวุฒิ" || p.PositionLevel.Name == "ทรงคุณวุฒิ (เฉพาะสายงาน)") // ทรงคุณวุฒิ
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
|
|
@ -3414,6 +3438,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionType != null
|
||||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.ProfileType == "officer"
|
||||
&& (p.PositionLevel.Name == "ทรงคุณวุฒิ" || p.PositionLevel.Name == "ทรงคุณวุฒิ (เฉพาะสายงาน)") // ทรงคุณวุฒิ
|
||||
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
|
|
@ -3498,6 +3523,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionType != null
|
||||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.ProfileType == "officer"
|
||||
&& (p.PositionLevel.Name == "ทรงคุณวุฒิ" || p.PositionLevel.Name == "ทรงคุณวุฒิ (เฉพาะสายงาน)") // ทรงคุณวุฒิ
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
|
|
@ -3668,6 +3694,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "อำนวยการ" // อำนวยการ
|
||||
&& p.PositionLevel.Name == "ต้น" // ต้น
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก")
|
||||
|
|
@ -3738,6 +3765,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "วิชาการ" // วิชาการ
|
||||
&& p.PositionLevel.Name == "ชำนาญการพิเศษ" // ชำนาญการพิเศษ
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย")
|
||||
|
|
@ -3883,6 +3911,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "อำนวยการ" // อำนวยการ
|
||||
&& p.PositionLevel.Name == "สูง" // สูง
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย")
|
||||
|
|
@ -3957,6 +3986,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "อำนวยการ" // อำนวยการ
|
||||
&& p.PositionLevel.Name == "สูง" // สูง
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์ช้างเผือก")
|
||||
|
|
@ -4031,6 +4061,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "อำนวยการ" // อำนวยการ
|
||||
&& p.PositionLevel.Name == "สูง" // สูง
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("มหาวชิรมงกุฎ")
|
||||
|
|
@ -4193,6 +4224,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "บริหาร" // บริหาร
|
||||
&& p.PositionLevel.Name == "ต้น" // ต้น
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย")
|
||||
|
|
@ -4267,6 +4299,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "บริหาร" // บริหาร
|
||||
&& p.PositionLevel.Name == "ต้น" // ต้น
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์ช้างเผือก")
|
||||
|
|
@ -4341,6 +4374,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "บริหาร" // บริหาร
|
||||
&& p.PositionLevel.Name == "ต้น" // ต้น
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("มหาวชิรมงกุฎ")
|
||||
|
|
@ -4475,6 +4509,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "บริหาร" // บริหาร
|
||||
&& p.PositionLevel.Name == "สูง" // สูง
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์ช้างเผือก")
|
||||
|
|
@ -4557,6 +4592,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "บริหาร" // บริหาร
|
||||
&& p.PositionLevel.Name == "สูง" // สูง
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("มหาวชิรมงกุฎ")
|
||||
|
|
@ -4639,6 +4675,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.PositionLevel != null
|
||||
&& p.PositionType.Name == "บริหาร" // บริหาร
|
||||
&& p.PositionLevel.Name == "สูง" // สูง
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา"))
|
||||
.OrderByDescending(x => x.Year)
|
||||
.FirstOrDefault().Insignia.Name.Contains("มหาปรมาภรณ์ช้างเผือก")
|
||||
|
|
@ -4788,6 +4825,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
allOc.Contains(p.OcId == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OcId.Value) &&
|
||||
p.IsActive == true &&
|
||||
p.IsLeave == false &&
|
||||
p.ProfileType == "officer" &&
|
||||
p.DateAppoint != null
|
||||
)
|
||||
.Select(p => new
|
||||
|
|
@ -4841,6 +4879,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.IsLeave == false
|
||||
&& p.DateAppoint != null
|
||||
&& p.PositionLevel.Name == "ชำนาญการ"
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name.Contains("ตริตาภรณ์ช้างเผือก")
|
||||
select new
|
||||
{
|
||||
|
|
@ -4891,6 +4930,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.IsLeave == false
|
||||
&& p.DateAppoint != null
|
||||
&& p.PositionLevel.Name == "ชำนาญการ"
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์มงกุฎไทย")
|
||||
select new
|
||||
{
|
||||
|
|
@ -4940,6 +4980,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.IsLeave == false
|
||||
&& p.DateAppoint != null
|
||||
&& p.PositionLevel.Name == "ชำนาญการ"
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก")
|
||||
select new
|
||||
{
|
||||
|
|
@ -4989,6 +5030,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& allOc.Contains(p.OcId == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OcId.Value)
|
||||
&& p.IsLeave == false
|
||||
&& p.DateAppoint != null
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name.Contains("ทวีติยาภรณ์ช้างเผือก")
|
||||
select p)
|
||||
.ToList()
|
||||
|
|
@ -5023,6 +5065,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.IsLeave == false
|
||||
&& p.DateAppoint != null
|
||||
&& p.PositionLevel.Name == "ชำนาญการพิเศษ"
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย")
|
||||
select new
|
||||
{
|
||||
|
|
@ -5074,6 +5117,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.IsLeave == false
|
||||
&& p.DateAppoint != null
|
||||
&& p.PositionLevel.Name == "เชี่ยวชาญ"
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์มงกุฎไทย")
|
||||
select new
|
||||
{
|
||||
|
|
@ -5124,6 +5168,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.IsLeave == false
|
||||
&& p.DateAppoint != null
|
||||
&& p.PositionLevel.Name == "เชี่ยวชาญ"
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name.Contains("ประถมาภรณ์ช้างเผือก")
|
||||
select new
|
||||
{
|
||||
|
|
@ -5174,6 +5219,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
&& p.IsLeave == false
|
||||
&& p.DateAppoint != null
|
||||
&& p.PositionLevel.Name == "เชี่ยวชาญ"
|
||||
&& p.ProfileType == "officer"
|
||||
&& !p.Insignias.Where(x => !x.Insignia.Name.Contains("เหรียญจักรพรรดิมาลา")).OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name.Contains("มหาวชิรมงกุฎ")
|
||||
select new
|
||||
{
|
||||
|
|
@ -5261,6 +5307,8 @@ namespace BMA.EHR.Application.Repositories
|
|||
{
|
||||
var result_candidate = new List<InsigniaResultSet>();
|
||||
|
||||
var employee_type1 = await GetEmployeeInsignia_Type1(periodId, ocId);
|
||||
var employee_type2 = await GetEmployeeInsignia_Type2(periodId, ocId);
|
||||
var type1_level1 = await GetInsigniaCandidate_Type1_Level1(periodId, ocId);
|
||||
var type1_level2 = await GetInsigniaCandidate_Type1_Level2(periodId, ocId);
|
||||
var type1_level3 = await GetInsigniaCandidate_Type1_Level3(periodId, ocId);
|
||||
|
|
@ -5362,6 +5410,18 @@ namespace BMA.EHR.Application.Repositories
|
|||
if (old == null)
|
||||
result_candidate.Add(r);
|
||||
}
|
||||
foreach (var r in employee_type2)
|
||||
{
|
||||
var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId);
|
||||
if (old == null)
|
||||
result_candidate.Add(r);
|
||||
}
|
||||
foreach (var r in employee_type1)
|
||||
{
|
||||
var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId);
|
||||
if (old == null)
|
||||
result_candidate.Add(r);
|
||||
}
|
||||
foreach (var r in type_coin)
|
||||
{
|
||||
var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using System.Reflection.Metadata;
|
||||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Domain.Extensions;
|
||||
using BMA.EHR.Domain.Models.Organizations;
|
||||
using BMA.EHR.Domain.Models.Retirement;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories.Reports
|
||||
|
|
@ -17,11 +21,11 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public RetireReportRepository(IApplicationDBContext dbContext, IWebHostEnvironment hostEnvironment)
|
||||
public RetireReportRepository(IApplicationDBContext dbContext,
|
||||
IWebHostEnvironment hostEnvironment)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_hostingEnvironment = hostEnvironment;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -49,7 +53,8 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
// throw;
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
#region รายงานประกาศเกษียณ
|
||||
public async Task<dynamic> GetProfileRetirementdAsync(Guid retireId)
|
||||
{
|
||||
var retire = await _dbContext.Set<RetirementPeriod>()
|
||||
|
|
@ -122,6 +127,133 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
return new { retire.Id, retire.CreatedAt, Year = retire.Year.ToThaiYear().ToString().ToThaiNumber(), retire.Round, retire.Type, retire.TypeReport, Total = profile_retire.Count.ToString().ToThaiNumber(), profile = profile_retire };
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region รายงานบันทึกการถึงแก่กรรม
|
||||
public async Task<dynamic> GetRetirementDeceasedAsync(Guid id)
|
||||
{
|
||||
var data = await _dbContext.Set<RetirementDeceased>().AsQueryable()
|
||||
.Where(x => x.Id == id)
|
||||
.Select(p => new
|
||||
{
|
||||
p.Id,
|
||||
ProfileId = p.Profile.Id,
|
||||
Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
|
||||
PrefixId = p.Profile.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Prefix.Id,
|
||||
p.Profile.FirstName,
|
||||
p.Profile.LastName,
|
||||
Position = p.Profile.Position == null ? null : p.Profile.Position.Name,
|
||||
PositionId = p.Profile.Position == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Position.Id,
|
||||
PositionType = p.Profile.PositionType == null ? null : p.Profile.PositionType.Name,
|
||||
PositionTypeId = p.Profile.PositionType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.PositionType.Id,
|
||||
p.Profile.PositionLine,
|
||||
p.Profile.PositionLineId,
|
||||
PositionLevel = p.Profile.PositionLevel == null ? null : p.Profile.PositionLevel.Name,
|
||||
PositionLevelId = p.Profile.PositionLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.PositionLevel.Id,
|
||||
p.Profile.PositionExecutive,
|
||||
p.Profile.PositionExecutiveId,
|
||||
Organization = p.Profile.Oc,
|
||||
OrganizationId = p.Profile.OcId,
|
||||
p.Number,
|
||||
p.Date,
|
||||
p.Location,
|
||||
p.Reason,
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
if (data == null)
|
||||
return null;
|
||||
|
||||
string Date = string.IsNullOrEmpty(data.Date.ToString()) ? "วันที่ - เดือน - พ.ศ. -" : DateTime.Parse(data.Date.ToString()).ToThaiFullDate().ToString().ToThaiNumber();
|
||||
return new
|
||||
{
|
||||
data.Prefix,
|
||||
data.FirstName,
|
||||
data.LastName,
|
||||
data.Position,
|
||||
data.PositionExecutive,
|
||||
data.PositionType,
|
||||
data.PositionLine,
|
||||
data.PositionLevel,
|
||||
data.Organization,
|
||||
data.PositionId,
|
||||
data.PositionExecutiveId,
|
||||
data.PositionTypeId,
|
||||
data.PositionLineId,
|
||||
data.PositionLevelId,
|
||||
data.OrganizationId,
|
||||
data.Number,
|
||||
Date,
|
||||
data.Location,
|
||||
data.Reason,
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region หัวกระดาษหนังสือเวียน
|
||||
public async Task<dynamic> GetHeadRetirementDeceasedAsync(Guid id)
|
||||
{
|
||||
var data = await _dbContext.Set<RetirementDeceased>().AsQueryable()
|
||||
.Include(x => x.Profile)
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
var oc = "";
|
||||
if (data == null)
|
||||
return new
|
||||
{
|
||||
Oc = oc,
|
||||
Number = $"กท /",
|
||||
Date = "",
|
||||
Subject = "ข้าราชการถึงแก่กรรม",
|
||||
Send = "หัวหน้าสำนักงาน ก.ก.",
|
||||
};
|
||||
|
||||
if (data.Profile.OcId != null)
|
||||
{
|
||||
var organization = await _dbContext.Set<OrganizationEntity>().AsQueryable()
|
||||
.Where(x => x.Id == data.Profile.OcId)
|
||||
.FirstOrDefaultAsync();
|
||||
if (organization != null)
|
||||
{
|
||||
var organizationAgency = await _dbContext.Set<OrganizationEntity>().AsQueryable()
|
||||
.Where(x => x.Id == organization.OrganizationAgencyId)
|
||||
.FirstOrDefaultAsync();
|
||||
if (organizationAgency != null)
|
||||
{
|
||||
var agency = await _dbContext.Set<OrganizationEntity>().AsQueryable()
|
||||
.Where(x => x.Id == organizationAgency.Id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (agency != null)
|
||||
{
|
||||
oc = agency.OrganizationOrganization?.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new
|
||||
{
|
||||
Oc = oc,
|
||||
Number = $"กท /{data.CreatedAt.Year.ToThaiYear()}",
|
||||
Date = data.CreatedAt.ToThaiFullDate().ToString().ToThaiNumber(),
|
||||
Subject = "ข้าราชการถึงแก่กรรม",
|
||||
Send = "หัวหน้าสำนักงาน ก.ก.",
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region บันทึกหนังสือเวียน
|
||||
public async Task UploadFileRetirementDeceasedAsync(Guid id, Domain.Models.Documents.Document file)
|
||||
{
|
||||
var data = await _dbContext.Set<RetirementDeceased>().AsQueryable()
|
||||
.Include(x => x.Profile)
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (data != null)
|
||||
data.DocumentForward = file;
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Domain.Models.Retirement;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
|
@ -9,17 +10,83 @@ namespace BMA.EHR.Application.Repositories
|
|||
{
|
||||
private readonly IApplicationDBContext _dbContext;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
public RetirementRepository(IApplicationDBContext dbContext, IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
public RetirementRepository(IApplicationDBContext dbContext,
|
||||
NotificationRepository repositoryNoti,
|
||||
IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
}
|
||||
|
||||
// public async Task<IEnumerable<Retirement>> FindByNameAsync(string name)
|
||||
// {
|
||||
// var data = await _dbContext.Set<Retirement>().Where(x => x.Name == name).ToListAsync();
|
||||
//ปลดออก
|
||||
public async Task NotifyDischarge()
|
||||
{
|
||||
var cronjobNotis = await _dbContext.Set<RetirementDischarge>()
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Prefix)
|
||||
.Where(x => x.Date != null && x.Date.Value.Date == DateTime.Now.Date)
|
||||
.AsQueryable()
|
||||
.ToListAsync();
|
||||
foreach (var cronjobNoti in cronjobNotis)
|
||||
{
|
||||
cronjobNoti.Profile.IsLeave = true;
|
||||
cronjobNoti.Profile.LeaveReason = "DISCHARGE";
|
||||
cronjobNoti.Profile.LeaveDate = DateTime.Now;
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08db721d-ada0-4e64-89d3-7584a893d8b8"),
|
||||
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}",
|
||||
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}"
|
||||
// );
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
// return data;
|
||||
// }
|
||||
//ไล่ออก
|
||||
public async Task NotifyExpulsion()
|
||||
{
|
||||
var cronjobNotis = await _dbContext.Set<RetirementExpulsion>()
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Prefix)
|
||||
.Where(x => x.Date != null && x.Date.Value.Date == DateTime.Now.Date)
|
||||
.AsQueryable()
|
||||
.ToListAsync();
|
||||
foreach (var cronjobNoti in cronjobNotis)
|
||||
{
|
||||
cronjobNoti.Profile.IsLeave = true;
|
||||
cronjobNoti.Profile.LeaveReason = "DISMISS";
|
||||
cronjobNoti.Profile.LeaveDate = DateTime.Now;
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08db721d-ada0-4e64-89d3-7584a893d8b8"),
|
||||
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}",
|
||||
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}"
|
||||
// );
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
//ให้ออก
|
||||
public async Task NotifyOut()
|
||||
{
|
||||
var cronjobNotis = await _dbContext.Set<RetirementOut>()
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Prefix)
|
||||
.Where(x => x.Date != null && x.Date.Value.Date == DateTime.Now.Date)
|
||||
.AsQueryable()
|
||||
.ToListAsync();
|
||||
foreach (var cronjobNoti in cronjobNotis)
|
||||
{
|
||||
cronjobNoti.Profile.IsLeave = true;
|
||||
cronjobNoti.Profile.LeaveReason = "LAYOFF";
|
||||
cronjobNoti.Profile.LeaveDate = DateTime.Now;
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08db721d-ada0-4e64-89d3-7584a893d8b8"),
|
||||
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}",
|
||||
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}"
|
||||
// );
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ namespace BMA.EHR.Domain.Models.Retirement
|
|||
{
|
||||
[Comment("ใบมรณบัตร")]
|
||||
public Document? Document { get; set; }
|
||||
[Comment("หนังสือเวียน")]
|
||||
public Document? DocumentForward { get; set; }
|
||||
[Comment("เลขที่ใบมรณบัตร")]
|
||||
public string? Number { get; set; } = string.Empty;
|
||||
[Comment("วันที่เสียชีวิต")]
|
||||
|
|
|
|||
|
|
@ -41,5 +41,8 @@ namespace BMA.EHR.Domain.Models.Retirement
|
|||
|
||||
[Comment("ชื่อตำแหน่งของผู้รับสำเนาคำสั่ง")]
|
||||
public string PositionName { get; set; } = string.Empty;
|
||||
|
||||
[Comment("Fk Table Document")]
|
||||
public Document? Document { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ namespace BMA.EHR.Domain.Models.Retirement
|
|||
public string Type { get; set; } = string.Empty;
|
||||
[Comment("เอกสารประกาศ")]
|
||||
public Document? Document { get; set; }
|
||||
[Comment("รายละเอียดมติ อกก")]
|
||||
public string Detail { get; set; } = "มาตรา ๑๖ และมาตรา ๒๑ แห่งพระราชบัญญัตบำเหน็จบำนาญข้าราชการส่วนท้องถิ่น พ.ศ.๒๕๗๗ มาตรา ๘ แห่งพระราชบัญญัติบัเหน็จบำนาญข้าราชการกรุงเทพมหานคร พ.ศ.๒๕๕๔ ประกอบกับมติ ก.ก. ครั้งที่๑๑/๒๕๕๕ เมื่อวันที่ ๑๕ พฤศจิกายน ๒๕๕๕และมติ อ.ก.ก. สามัญข้ารายการสามัญครั้งที่ ๑/๒๕๖๕ เมื่อวันที่ ๒๑ กุมภาพันธ์ ๒๕๖๕";
|
||||
public virtual List<RetirementPeriodHistory> RetirementPeriodHistorys { get; set; } = new List<RetirementPeriodHistory>();
|
||||
public virtual List<RetirementProfile> RetirementProfiles { get; set; } = new List<RetirementProfile>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ namespace BMA.EHR.Domain.Models.Retirement
|
|||
public string ProfileFile { get; set; }
|
||||
[Comment("เอกสารประกาศ")]
|
||||
public Document? Document { get; set; }
|
||||
[Comment("รายละเอียดมติ อกก")]
|
||||
public string Detail { get; set; } = "มาตรา ๑๖ และมาตรา ๒๑ แห่งพระราชบัญญัตบำเหน็จบำนาญข้าราชการส่วนท้องถิ่น พ.ศ.๒๕๗๗ มาตรา ๘ แห่งพระราชบัญญัติบัเหน็จบำนาญข้าราชการกรุงเทพมหานคร พ.ศ.๒๕๕๔ ประกอบกับมติ ก.ก. ครั้งที่๑๑/๒๕๕๕ เมื่อวันที่ ๑๕ พฤศจิกายน ๒๕๕๕และมติ อ.ก.ก. สามัญข้ารายการสามัญครั้งที่ ๑/๒๕๖๕ เมื่อวันที่ ๒๑ กุมภาพันธ์ ๒๕๖๕";
|
||||
public RetirementPeriod RetirementPeriod { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
16281
BMA.EHR.Infrastructure/Migrations/20230913075447_update table retirementperiod add detail.Designer.cs
generated
Normal file
16281
BMA.EHR.Infrastructure/Migrations/20230913075447_update table retirementperiod add detail.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,42 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class updatetableretirementperiodadddetail : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Detail",
|
||||
table: "RetirementPeriods",
|
||||
type: "longtext",
|
||||
nullable: false,
|
||||
comment: "รายละเอียดมติ อกก")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Detail",
|
||||
table: "RetirementPeriodHistorys",
|
||||
type: "longtext",
|
||||
nullable: false,
|
||||
comment: "รายละเอียดมติ อกก")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Detail",
|
||||
table: "RetirementPeriods");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Detail",
|
||||
table: "RetirementPeriodHistorys");
|
||||
}
|
||||
}
|
||||
}
|
||||
16292
BMA.EHR.Infrastructure/Migrations/20230913144418_update table retirementperiod add Document.Designer.cs
generated
Normal file
16292
BMA.EHR.Infrastructure/Migrations/20230913144418_update table retirementperiod add Document.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,50 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class updatetableretirementperiodaddDocument : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "DocumentId",
|
||||
table: "RetirementDeceasedNotis",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RetirementDeceasedNotis_DocumentId",
|
||||
table: "RetirementDeceasedNotis",
|
||||
column: "DocumentId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_RetirementDeceasedNotis_Documents_DocumentId",
|
||||
table: "RetirementDeceasedNotis",
|
||||
column: "DocumentId",
|
||||
principalTable: "Documents",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_RetirementDeceasedNotis_Documents_DocumentId",
|
||||
table: "RetirementDeceasedNotis");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_RetirementDeceasedNotis_DocumentId",
|
||||
table: "RetirementDeceasedNotis");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DocumentId",
|
||||
table: "RetirementDeceasedNotis");
|
||||
}
|
||||
}
|
||||
}
|
||||
16303
BMA.EHR.Infrastructure/Migrations/20230913163953_update table retirementperiod add Documentforward.Designer.cs
generated
Normal file
16303
BMA.EHR.Infrastructure/Migrations/20230913163953_update table retirementperiod add Documentforward.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,50 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class updatetableretirementperiodaddDocumentforward : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "DocumentForwardId",
|
||||
table: "RetirementDeceaseds",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RetirementDeceaseds_DocumentForwardId",
|
||||
table: "RetirementDeceaseds",
|
||||
column: "DocumentForwardId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_RetirementDeceaseds_Documents_DocumentForwardId",
|
||||
table: "RetirementDeceaseds",
|
||||
column: "DocumentForwardId",
|
||||
principalTable: "Documents",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_RetirementDeceaseds_Documents_DocumentForwardId",
|
||||
table: "RetirementDeceaseds");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_RetirementDeceaseds_DocumentForwardId",
|
||||
table: "RetirementDeceaseds");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DocumentForwardId",
|
||||
table: "RetirementDeceaseds");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -12717,6 +12717,9 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasColumnType("datetime(6)")
|
||||
.HasComment("วันที่เสียชีวิต");
|
||||
|
||||
b.Property<Guid?>("DocumentForwardId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("DocumentId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
|
|
@ -12760,6 +12763,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DocumentForwardId");
|
||||
|
||||
b.HasIndex("DocumentId");
|
||||
|
||||
b.HasIndex("ProfileId");
|
||||
|
|
@ -12801,6 +12806,9 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasColumnOrder(101)
|
||||
.HasComment("User Id ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<Guid?>("DocumentId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
|
|
@ -12868,6 +12876,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DocumentId");
|
||||
|
||||
b.HasIndex("ReceiveUserId");
|
||||
|
||||
b.HasIndex("RetirementDeceasedId");
|
||||
|
|
@ -13466,6 +13476,11 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasColumnOrder(101)
|
||||
.HasComment("User Id ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<string>("Detail")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("รายละเอียดมติ อกก");
|
||||
|
||||
b.Property<Guid?>("DocumentId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
|
|
@ -13540,6 +13555,11 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasColumnOrder(101)
|
||||
.HasComment("User Id ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<string>("Detail")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("รายละเอียดมติ อกก");
|
||||
|
||||
b.Property<Guid?>("DocumentId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
|
|
@ -15734,6 +15754,10 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementDeceased", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "DocumentForward")
|
||||
.WithMany()
|
||||
.HasForeignKey("DocumentForwardId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document")
|
||||
.WithMany()
|
||||
.HasForeignKey("DocumentId");
|
||||
|
|
@ -15746,11 +15770,17 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
b.Navigation("Document");
|
||||
|
||||
b.Navigation("DocumentForward");
|
||||
|
||||
b.Navigation("Profile");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementDeceasedNoti", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document")
|
||||
.WithMany()
|
||||
.HasForeignKey("DocumentId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "ReceiveUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("ReceiveUserId")
|
||||
|
|
@ -15763,6 +15793,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Document");
|
||||
|
||||
b.Navigation("ReceiveUser");
|
||||
|
||||
b.Navigation("RetirementDeceased");
|
||||
|
|
|
|||
|
|
@ -581,6 +581,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
person.MouthSalaryAmount = null;
|
||||
person.PositionSalaryAmount = null;
|
||||
person.RecruitDate = null;
|
||||
person.ReportingDate = null;
|
||||
person.RejectReason = req.Note;
|
||||
person.PlacementStatus = "DISCLAIM";
|
||||
person.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
|
|
@ -686,6 +687,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
person.MouthSalaryAmount = req.MouthSalaryAmount;
|
||||
person.PositionSalaryAmount = req.PositionSalaryAmount;
|
||||
person.RecruitDate = req.ContainDate;
|
||||
person.ReportingDate = req.ContainDate;
|
||||
person.PlacementStatus = "PREPARE-CONTAIN";
|
||||
person.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
person.LastUpdateUserId = UserId ?? "";
|
||||
|
|
@ -1118,6 +1120,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
profile.MouthSalaryAmount = null;
|
||||
profile.PositionSalaryAmount = null;
|
||||
profile.RecruitDate = null;
|
||||
profile.ReportingDate = null;
|
||||
_context.SaveChanges();
|
||||
|
||||
return Success();
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ using DocumentFormat.OpenXml.Drawing;
|
|||
using Telerik.Reporting;
|
||||
using Telerik.Reporting.Processing;
|
||||
using System.IO;
|
||||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Report.Service.Requests;
|
||||
|
||||
namespace BMA.EHR.Report.Service.Controllers
|
||||
{
|
||||
|
|
@ -26,18 +28,25 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
private readonly IWebHostEnvironment _hostingEnvironment;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly GenericReportGenerator _reportGenerator;
|
||||
|
||||
private readonly RetireReportRepository _repository;
|
||||
private readonly MinIOService _documentService;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constuctor and Destructor "
|
||||
|
||||
public DeceasedReportController(IWebHostEnvironment hostingEnvironment, IConfiguration configuration, GenericReportGenerator reportGenerator)
|
||||
public DeceasedReportController(IWebHostEnvironment hostingEnvironment,
|
||||
IConfiguration configuration,
|
||||
MinIOService documentService,
|
||||
GenericReportGenerator reportGenerator,
|
||||
RetireReportRepository repository)
|
||||
{
|
||||
|
||||
|
||||
_hostingEnvironment = hostingEnvironment;
|
||||
_configuration = configuration;
|
||||
_reportGenerator = reportGenerator;
|
||||
_repository = repository;
|
||||
_documentService = documentService;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -55,23 +64,74 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("36/{exportType}/{id}")]
|
||||
public IActionResult GetDeceasedConvertReportAsync(Guid id, string exportType = "pdf")
|
||||
public async Task<ActionResult<ResponseObject>> GetDeceasedReportAsync(Guid id, string exportType = "pdf")
|
||||
{
|
||||
try
|
||||
{
|
||||
var mimeType = "";
|
||||
switch (exportType.Trim().ToLower())
|
||||
var data = await _repository.GetRetirementDeceasedAsync(id);
|
||||
if (data != null)
|
||||
{
|
||||
case "pdf": mimeType = "application/pdf"; break;
|
||||
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
||||
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
||||
var mimeType = "";
|
||||
switch (exportType.Trim().ToLower())
|
||||
{
|
||||
case "pdf": mimeType = "application/pdf"; break;
|
||||
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
||||
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
||||
}
|
||||
|
||||
var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"36-บันทึกเวียนแจ้งการถึงแก่กรรม.trdp");
|
||||
ReportPackager reportPacker = new ReportPackager();
|
||||
Telerik.Reporting.Report? report = null;
|
||||
using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||
{
|
||||
report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream);
|
||||
}
|
||||
report.DataSource = data;
|
||||
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||
{
|
||||
ReportDocument = report,
|
||||
};
|
||||
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||
RenderingResult result = reportProcessor.RenderReport($"{exportType}", instanceReportSource, deviceInfo);
|
||||
return File(result.DocumentBytes, mimeType, $"deceased.{exportType.Trim().ToLower()}");
|
||||
}
|
||||
else
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"36-บันทึกเวียนแจ้งการถึงแก่กรรม.trdp");
|
||||
var contentData = _reportGenerator.GenerateReport(rptFile, exportType);
|
||||
|
||||
return File(contentData, mimeType, $"deceased.{exportType.Trim().ToLower()}");
|
||||
|
||||
/// <summary>
|
||||
/// อัปไฟล์บันทึกเวียนแจ้งการถึงแก่กรรม
|
||||
/// </summary>
|
||||
/// <param name="id">id </param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("attachment/36/{id}")]
|
||||
public async Task<ActionResult<ResponseObject>> UploadDeceasedReportAsync([FromForm] FileRequest req, Guid id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = await _repository.GetRetirementDeceasedAsync(id);
|
||||
if (data == null)
|
||||
return NotFound();
|
||||
// check upload file
|
||||
if (Request.Form.Files == null || Request.Form.Files.Count == 0)
|
||||
{
|
||||
return Error(GlobalMessages.NoFileToUpload);
|
||||
}
|
||||
var file = Request.Form.Files[0];
|
||||
var cover = await _documentService.UploadFileAsync(file);
|
||||
await _repository.UploadFileRetirementDeceasedAsync(id, cover);
|
||||
return Success();
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
|
|||
Binary file not shown.
10
BMA.EHR.Report.Service/Requests/FileRequest.cs
Normal file
10
BMA.EHR.Report.Service/Requests/FileRequest.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Report.Service.Requests
|
||||
{
|
||||
public class FileRequest
|
||||
{
|
||||
public List<FormFile>? File { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -13,6 +13,9 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AWSSDK.S3" Version="3.7.201.7" />
|
||||
<PackageReference Include="Hangfire" Version="1.8.5" />
|
||||
<PackageReference Include="Hangfire.AspNetCore" Version="1.8.5" />
|
||||
<PackageReference Include="Hangfire.MySqlStorage" Version="2.0.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.9" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.9" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.1.0" />
|
||||
|
|
|
|||
|
|
@ -167,6 +167,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
Round = x.Round,
|
||||
Total = x.Total,
|
||||
TypeReport = x.TypeReport,
|
||||
Detail = x.Detail,
|
||||
Json = true,
|
||||
Document = x.Document == null ? false : true,
|
||||
})
|
||||
|
|
@ -188,6 +189,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
Round = retire.Round,
|
||||
Total = retire.RetirementProfiles.Count(),
|
||||
TypeReport = retire.TypeReport,
|
||||
Detail = retire.Detail,
|
||||
Json = false,
|
||||
Document = retire.Document == null ? false : true,
|
||||
});
|
||||
|
|
@ -306,6 +308,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
RetirementPeriod = retire,
|
||||
Round = retire.Round,
|
||||
TypeReport = retire.TypeReport,
|
||||
Detail = retire.Detail,
|
||||
Year = retire.Year,
|
||||
Type = retire.Type,
|
||||
Document = retire.Document,
|
||||
|
|
@ -429,7 +432,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
posNoEmployee = x.Profile.PosNoEmployee,
|
||||
})
|
||||
.ToListAsync();
|
||||
return Success(new { retire.Id, retire.CreatedAt, retire.Year, retire.Round, retire.Type, retire.TypeReport, profile = profile_new });
|
||||
return Success(new { retire.Id, retire.CreatedAt, retire.Year, retire.Round, retire.Type, retire.TypeReport, retire.Detail, profile = profile_new });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -464,7 +467,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
var responseTask = client.GetAsync(url);
|
||||
var results = responseTask.Result;
|
||||
var filehis = profileHistorys.Document == null ? null : await _documentService.ImagesPath(profileHistorys.Document.Id);
|
||||
return Success(new { Json = true, profileHistorys.Id, profileHistorys.CreatedAt, profileHistorys.Year, profileHistorys.Round, profileHistorys.Type, profileHistorys.TypeReport, profile = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ProfileJsonRequest>>(results.Content.ReadAsStringAsync().Result), File = filehis });
|
||||
return Success(new { Json = true, profileHistorys.Id, profileHistorys.CreatedAt, profileHistorys.Year, profileHistorys.Round, profileHistorys.Type, profileHistorys.TypeReport, profileHistorys.Detail, profile = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ProfileJsonRequest>>(results.Content.ReadAsStringAsync().Result), File = filehis });
|
||||
}
|
||||
}
|
||||
var profile_new = await _context.RetirementProfiles
|
||||
|
|
@ -492,7 +495,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
})
|
||||
.ToListAsync();
|
||||
var file = retire.Document == null ? null : await _documentService.ImagesPath(retire.Document.Id);
|
||||
return Success(new { Json = false, retire.Id, retire.CreatedAt, retire.Year, retire.Round, retire.Type, retire.TypeReport, profile = profile_new, File = file });
|
||||
return Success(new { Json = false, retire.Id, retire.CreatedAt, retire.Year, retire.Round, retire.Type, retire.TypeReport, retire.Detail, profile = profile_new, File = file });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -561,7 +564,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
var data = new RetirementProfile
|
||||
{
|
||||
Order = num,
|
||||
Remove = "PENDING",
|
||||
Remove = "ADD",
|
||||
RetirementPeriod = retire,
|
||||
Profile = profile,
|
||||
CreatedUserId = UserId ?? "System Administrator",
|
||||
|
|
@ -709,7 +712,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
var retire = await _context.RetirementPeriods
|
||||
.FirstOrDefaultAsync(x => x.Id == retireId);
|
||||
if (retire == null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
return Error(GlobalMessages.RetirementNotFound, 404);
|
||||
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
|
||||
{
|
||||
var file = Request.Form.Files[0];
|
||||
|
|
@ -744,10 +747,40 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
.Include(x => x.Document)
|
||||
.FirstOrDefaultAsync(x => x.Id == retireId);
|
||||
if (retire == null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
return Error(GlobalMessages.RetirementNotFound, 404);
|
||||
if (retire.Document == null)
|
||||
return Success(false);
|
||||
return Success(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// แก้ไขข้อความมติ อ.ก.ก.
|
||||
/// </summary>
|
||||
/// <param name="retireId">Id ประกาศ</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("detail/{retireId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateDetailRetirement([FromForm] RetirementDetailRequest req, Guid retireId)
|
||||
{
|
||||
var retire = await _context.RetirementPeriods
|
||||
.FirstOrDefaultAsync(x => x.Id == retireId);
|
||||
if (retire == null)
|
||||
{
|
||||
var retireHistory = await _context.RetirementPeriodHistorys
|
||||
.FirstOrDefaultAsync(x => x.Id == retireId);
|
||||
if (retireHistory == null)
|
||||
return Error(GlobalMessages.RetirementNotFound, 404);
|
||||
retireHistory.Detail = req.Detail;
|
||||
}
|
||||
else
|
||||
{
|
||||
retire.Detail = req.Detail;
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
return Success(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Application.Repositories.Reports;
|
||||
using BMA.EHR.Application.Responses;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Extensions;
|
||||
using BMA.EHR.Domain.Models.HR;
|
||||
|
|
@ -12,6 +14,7 @@ using BMA.EHR.Retirement.Service.Requests;
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using System.Reflection.Metadata;
|
||||
using System.Security.Claims;
|
||||
|
|
@ -29,21 +32,27 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
{
|
||||
private readonly RetirementRepository _repository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly RetireReportRepository _repositoryRetireReport;
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly MinIOService _documentService;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
public RetirementDeceasedController(RetirementRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
RetireReportRepository repositoryRetireReport,
|
||||
ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
IConfiguration configuration,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_repositoryRetireReport = repositoryRetireReport;
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
#region " Properties "
|
||||
|
|
@ -527,6 +536,30 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
.ThenInclude(x => x.Prefix)
|
||||
.Where(x => x.RetirementDeceased.Id == id)
|
||||
.ToListAsync();
|
||||
|
||||
var retirementDeceased = await _context.RetirementDeceaseds.AsQueryable()
|
||||
.Include(x => x.DocumentForward)
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (retirementDeceased == null)
|
||||
return Error(GlobalMessages.RetirementDeceasedNotFound, 404);
|
||||
if (retirementDeceased.DocumentForward == null)
|
||||
return Error(GlobalMessages.NoFileToUpload, 404);
|
||||
|
||||
// create command payload
|
||||
var payload_attach = new List<PayloadAttachment>();
|
||||
payload_attach.Add(new PayloadAttachment
|
||||
{
|
||||
name = "หนังสือเวียนถึงแก่กรรม",
|
||||
url = $"{_configuration["API"]}/order/download/attachment/{retirementDeceased.DocumentForward.Id}"
|
||||
});
|
||||
|
||||
var payload = new CommandPayload()
|
||||
{
|
||||
attachments = payload_attach
|
||||
};
|
||||
|
||||
var payload_str = JsonConvert.SerializeObject(payload);
|
||||
foreach (var item in items)
|
||||
{
|
||||
var prefix = item.RetirementDeceased.Profile.Prefix == null ? "" : item.RetirementDeceased.Profile.Prefix.Name;
|
||||
|
|
@ -537,7 +570,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
item.ReceiveUser.Id,
|
||||
$"หนังสือเวียนถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
||||
$"แจ้งข่าวการถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
||||
"",
|
||||
payload_str,
|
||||
profile.IsSendInbox,
|
||||
profile.IsSendMail
|
||||
);
|
||||
|
|
@ -551,7 +584,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
item.ReceiveUser.Id,
|
||||
$"หนังสือเวียนถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
||||
$"แจ้งข่าวการถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
||||
"",
|
||||
payload_str,
|
||||
item.IsSendInbox,
|
||||
item.IsSendMail
|
||||
);
|
||||
|
|
|
|||
16
BMA.EHR.Retirement.Service/Filters/CustomAuthorizeFilter.cs
Normal file
16
BMA.EHR.Retirement.Service/Filters/CustomAuthorizeFilter.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using Hangfire.Dashboard;
|
||||
|
||||
namespace BMA.EHR.Retirement.Service.Filters
|
||||
{
|
||||
public class CustomAuthorizeFilter : IDashboardAuthorizationFilter
|
||||
{
|
||||
public bool Authorize([NotNull] DashboardContext context)
|
||||
{
|
||||
//var httpcontext = context.GetHttpContext();
|
||||
//return httpcontext.User.Identity.IsAuthenticated;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -10,11 +10,17 @@ using Microsoft.AspNetCore.Mvc.Versioning;
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.IdentityModel.Logging;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Hangfire;
|
||||
using Hangfire.Common;
|
||||
using Hangfire.MySql;
|
||||
using Serilog;
|
||||
using Serilog.Exceptions;
|
||||
using Serilog.Sinks.Elasticsearch;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Transactions;
|
||||
using BMA.EHR.Retirement.Service.Filters;
|
||||
using BMA.EHR.Application.Repositories;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
{
|
||||
|
|
@ -89,6 +95,30 @@ var builder = WebApplication.CreateBuilder(args);
|
|||
builder.Services.AddSwaggerGen();
|
||||
builder.Services.ConfigureOptions<ConfigureSwaggerOptions>();
|
||||
|
||||
// Register DbContext
|
||||
var defaultConnection = builder.Configuration.GetConnectionString("DefaultConnection");
|
||||
builder.Services.AddDbContext<ApplicationDBContext>(options =>
|
||||
options.UseMySql(defaultConnection, ServerVersion.AutoDetect(defaultConnection)));
|
||||
builder.Services.AddHealthChecks();
|
||||
// Add Hangfire services.
|
||||
builder.Services.AddHangfire(configuration => configuration
|
||||
.SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
|
||||
.UseSimpleAssemblyNameTypeSerializer()
|
||||
.UseRecommendedSerializerSettings()
|
||||
.UseStorage(
|
||||
new MySqlStorage(
|
||||
defaultConnection,
|
||||
new MySqlStorageOptions
|
||||
{
|
||||
TransactionIsolationLevel = IsolationLevel.ReadCommitted,
|
||||
QueuePollInterval = TimeSpan.FromSeconds(15),
|
||||
JobExpirationCheckInterval = TimeSpan.FromHours(1),
|
||||
CountersAggregateInterval = TimeSpan.FromMinutes(5),
|
||||
PrepareSchemaIfNecessary = true,
|
||||
DashboardJobListLimit = 50000,
|
||||
TransactionTimeout = TimeSpan.FromMinutes(1),
|
||||
TablesPrefix = "Hangfire"
|
||||
})));
|
||||
builder.Services.AddHealthChecks();
|
||||
}
|
||||
|
||||
|
|
@ -120,6 +150,17 @@ var app = builder.Build();
|
|||
app.UseStaticFiles();
|
||||
app.MapControllers();
|
||||
app.UseMiddleware<ErrorHandlerMiddleware>();
|
||||
app.UseHangfireDashboard("/hangfire", new DashboardOptions()
|
||||
{
|
||||
Authorization = new[] { new CustomAuthorizeFilter() }
|
||||
});
|
||||
var manager = new RecurringJobManager();
|
||||
if (manager != null)
|
||||
{
|
||||
manager.AddOrUpdate("แจ้งเตือนระบบปลดออก", Job.FromExpression<RetirementRepository>(x => x.NotifyDischarge()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local);
|
||||
manager.AddOrUpdate("แจ้งเตือนระบบไล่ออก", Job.FromExpression<RetirementRepository>(x => x.NotifyExpulsion()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local);
|
||||
manager.AddOrUpdate("แจ้งเตือนระบบให้ออก", Job.FromExpression<RetirementRepository>(x => x.NotifyOut()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local);
|
||||
}
|
||||
|
||||
// apply migrations
|
||||
await using var scope = app.Services.CreateAsyncScope();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Retirement.Service.Requests
|
||||
{
|
||||
public class RetirementDetailRequest
|
||||
{
|
||||
public string Detail { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -32,5 +32,6 @@
|
|||
"SecretKey": "P@ssw0rd",
|
||||
"BucketName": "bma-recruit"
|
||||
},
|
||||
"Protocol": "HTTPS"
|
||||
"Protocol": "HTTPS",
|
||||
"API": "https://bma-ehr.frappet.synology.me/api/v1"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue