Merge branch 'develop'
This commit is contained in:
commit
9f985b0bfc
41 changed files with 2579 additions and 207 deletions
107
.github/workflows/release_metadata.yaml
vendored
Normal file
107
.github/workflows/release_metadata.yaml
vendored
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
name: release-dev
|
||||
run-name: release-dev ${{ github.actor }}
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "metadata-[0-9]+.[0-9]+.[0-9]+"
|
||||
workflow_dispatch:
|
||||
env:
|
||||
REGISTRY: docker.frappet.com
|
||||
IMAGE_NAME: ehr/bma-ehr-metadata-service
|
||||
DEPLOY_HOST: frappet.com
|
||||
DEPLOY_PORT: 10102
|
||||
# COMPOSE_PATH: /home/frappet/docker/bma-ehr
|
||||
COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-metadata
|
||||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
|
||||
jobs:
|
||||
# act workflow_dispatch -W .github/workflows/release_metadata.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.MetaData.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: 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 }}
|
||||
|
|
@ -419,6 +419,16 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
rawData.LeaveCancelStatus = "REJECT";
|
||||
rawData.LeaveCancelComment = Reason;
|
||||
|
||||
// fix issue : ระบบลา (User) >> กรณีขอยกเลิกการลา แต่ผู้บังคับบัญชาไม่อนุมัติ (สถานะการลาไม่อัปเดต) #846
|
||||
if (rawData.ApproveStep == "st4")
|
||||
{
|
||||
rawData.LeaveStatus = "APPROVE";
|
||||
}
|
||||
else
|
||||
{
|
||||
rawData.LeaveStatus = "NEW";
|
||||
}
|
||||
|
||||
await UpdateAsync(rawData);
|
||||
|
||||
// TODO: remove วันลา
|
||||
|
|
|
|||
|
|
@ -223,7 +223,22 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
|||
}
|
||||
if (IsSendMail == true)
|
||||
{
|
||||
_emailSenderService.SendMail(Subject, Body, "kittapath@frappet.com");
|
||||
var apiUrl = $"{_configuration["API"]}/org/dotnet/email/{ReceiverUserId}";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var _res = await client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
var org = JsonConvert.DeserializeObject<ResultRequest>(_result);
|
||||
if (org != null && org.result != null)
|
||||
_emailSenderService.SendMail(Subject, Body, org.result);
|
||||
}
|
||||
}
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
//}
|
||||
|
|
@ -250,25 +265,40 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
|||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
/* if (IsSendInbox == true)
|
||||
{
|
||||
_dbContext.Set<Inbox>().Add(new Inbox
|
||||
{
|
||||
Subject = Subject,
|
||||
Body = Body,
|
||||
ReceiverUserId = ReceiverUserId,
|
||||
Payload = Payload,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
}*/
|
||||
/* if (IsSendInbox == true)
|
||||
{
|
||||
_dbContext.Set<Inbox>().Add(new Inbox
|
||||
{
|
||||
Subject = Subject,
|
||||
Body = Body,
|
||||
ReceiverUserId = ReceiverUserId,
|
||||
Payload = Payload,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
}*/
|
||||
if (IsSendMail == true)
|
||||
{
|
||||
_emailSenderService.SendMail(Subject, Body, "kittapath@frappet.com");
|
||||
var apiUrl = $"{_configuration["API"]}/org/dotnet/email/{ReceiverUserId}";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var _res = await client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
var org = JsonConvert.DeserializeObject<ResultRequest>(_result);
|
||||
if (org != null && org.result != null)
|
||||
_emailSenderService.SendMail(Subject, Body, org.result);
|
||||
}
|
||||
}
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
|
@ -327,7 +357,22 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
|||
}
|
||||
if (IsSendMail == true)
|
||||
{
|
||||
_emailSenderService.SendMail(Subject, Body, "kittapath@frappet.com");
|
||||
var apiUrl = $"{_configuration["API"]}/org/dotnet/email/{ReceiverUserId}";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var _res = await client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
var org = JsonConvert.DeserializeObject<ResultRequest>(_result);
|
||||
if (org != null && org.result != null)
|
||||
_emailSenderService.SendMail(Subject, Body, org.result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
|
@ -343,6 +388,11 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
|||
public Guid ReceiverUserId { get; set; }
|
||||
public string NotiLink { get; set; }
|
||||
}
|
||||
|
||||
public class ResultRequest
|
||||
{
|
||||
public string result { get; set; }
|
||||
}
|
||||
public async Task PushNotificationsLinkAsync(NotisLinkRequest[] ReceiverUserIds, string Subject, string Body, string Payload = "", bool IsSendInbox = false, bool IsSendMail = false)
|
||||
{
|
||||
try
|
||||
|
|
@ -380,7 +430,22 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
|||
}
|
||||
if (IsSendMail == true)
|
||||
{
|
||||
_emailSenderService.SendMail(Subject, Body, "kittapath@frappet.com");
|
||||
var apiUrl = $"{_configuration["API"]}/org/dotnet/email/{ReceiverUserId.ReceiverUserId}";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var _res = await client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
var org = JsonConvert.DeserializeObject<ResultRequest>(_result);
|
||||
if (org != null && org.result != null)
|
||||
_emailSenderService.SendMail(Subject, Body, org.result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
|
@ -435,7 +500,22 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
|||
}
|
||||
if (data.IsSendMail == true)
|
||||
{
|
||||
_emailSenderService.SendMail(Subject, Body, "kittapath@frappet.com");
|
||||
var apiUrl = $"{_configuration["API"]}/org/dotnet/email/{data.ReceiverUserId}";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var _res = await client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
var org = JsonConvert.DeserializeObject<ResultRequest>(_result);
|
||||
if (org != null && org.result != null)
|
||||
_emailSenderService.SendMail(Subject, Body, org.result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
|
@ -482,7 +562,22 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
|||
}
|
||||
if (IsSendMail == true)
|
||||
{
|
||||
_emailSenderService.SendMail(Subject, Body, "kittapath@frappet.com");
|
||||
var apiUrl = $"{_configuration["API"]}/org/dotnet/email/{ReceiverUserId}";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var _res = await client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
var org = JsonConvert.DeserializeObject<ResultRequest>(_result);
|
||||
if (org != null && org.result != null)
|
||||
_emailSenderService.SendMail(Subject, Body, org.result);
|
||||
}
|
||||
}
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -172,7 +172,8 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
|||
Id = x.Id,//id ข้อมูลเรื่องร้องเรียน
|
||||
RespondentType = x.RespondentType,//ผู้ถูกร้องเรียน
|
||||
Persons = x.DisciplineComplaint_Profiles
|
||||
.OrderByDescending(p => p.CreatedAt)
|
||||
.OrderByDescending(p => p.profileType)
|
||||
.ThenByDescending(p => p.CreatedAt)
|
||||
.Select(p => new
|
||||
{
|
||||
Id = p.Id,
|
||||
|
|
|
|||
|
|
@ -481,7 +481,8 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
}).ToList(),
|
||||
RespondentType = x.RespondentType,//ผู้ถูกสืบสวน
|
||||
Persons = x.DisciplineDisciplinary_ProfileComplaintInvestigates
|
||||
.OrderByDescending(p => p.CreatedAt)
|
||||
.OrderByDescending(p => p.profileType)
|
||||
.ThenByDescending(p => p.CreatedAt)
|
||||
.Select(p => new
|
||||
{
|
||||
Id = p.Id,
|
||||
|
|
|
|||
|
|
@ -314,7 +314,8 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
|||
}).ToList(),
|
||||
RespondentType = x.RespondentType,//ผู้ถูกสืบสวน
|
||||
Persons = x.DisciplineInvestigate_ProfileComplaints
|
||||
.OrderByDescending(p => p.CreatedAt)
|
||||
.OrderByDescending(p => p.profileType)
|
||||
.ThenByDescending(p => p.CreatedAt)
|
||||
.Select(p => new
|
||||
{
|
||||
Id = p.Id,
|
||||
|
|
|
|||
|
|
@ -148,7 +148,8 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
IdComplaint = x.DisciplineInvestigate.DisciplineComplaint.Id,//id ข้อมูลเรื่องร้องเรียน
|
||||
RespondentType = x.RespondentType,//ผู้ถูกสืบสวน
|
||||
Persons = x.DisciplineDisciplinary_ProfileComplaintInvestigates.Where(x => x.IsReport == "NEW")
|
||||
.OrderByDescending(p => p.CreatedAt)
|
||||
.OrderByDescending(p => p.profileType)
|
||||
.ThenByDescending(p => p.CreatedAt)
|
||||
.Select(p => new
|
||||
{
|
||||
Id = p.Id,
|
||||
|
|
@ -822,6 +823,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
positionSalaryAmount = r.positionSalaryAmount,
|
||||
mouthSalaryAmount = r.mouthSalaryAmount,
|
||||
isGovernment = false,
|
||||
profileType = p.profileType,
|
||||
}).ToList();
|
||||
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
|
|
@ -919,6 +921,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
positionSalaryAmount = r.positionSalaryAmount,
|
||||
mouthSalaryAmount = r.mouthSalaryAmount,
|
||||
isGovernment = false,
|
||||
profileType = p.profileType,
|
||||
}).ToList();
|
||||
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
|
|
@ -1088,7 +1091,8 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
amount = r.amount,
|
||||
positionSalaryAmount = r.positionSalaryAmount,
|
||||
mouthSalaryAmount = r.mouthSalaryAmount,
|
||||
isGovernment = false
|
||||
isGovernment = false,
|
||||
profileType = p.profileType,
|
||||
}).ToList();
|
||||
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
|
|
@ -1201,7 +1205,8 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
amount = r.amount,
|
||||
positionSalaryAmount = r.positionSalaryAmount,
|
||||
mouthSalaryAmount = r.mouthSalaryAmount,
|
||||
isGovernment = false
|
||||
isGovernment = false,
|
||||
profileType = p.profileType,
|
||||
}).ToList();
|
||||
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
|
|
@ -1313,6 +1318,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
amount = r.amount,
|
||||
positionSalaryAmount = r.positionSalaryAmount,
|
||||
mouthSalaryAmount = r.mouthSalaryAmount,
|
||||
profileType = p.profileType,
|
||||
}).ToList();
|
||||
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
|
|
@ -1424,6 +1430,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
amount = r.amount,
|
||||
positionSalaryAmount = r.positionSalaryAmount,
|
||||
mouthSalaryAmount = r.mouthSalaryAmount,
|
||||
profileType = p.profileType,
|
||||
}).ToList();
|
||||
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
|
|
@ -1535,6 +1542,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
amount = r.amount,
|
||||
positionSalaryAmount = r.positionSalaryAmount,
|
||||
mouthSalaryAmount = r.mouthSalaryAmount,
|
||||
profileType = p.profileType,
|
||||
}).ToList();
|
||||
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
|
|
@ -1646,6 +1654,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
amount = r.amount,
|
||||
positionSalaryAmount = r.positionSalaryAmount,
|
||||
mouthSalaryAmount = r.mouthSalaryAmount,
|
||||
profileType = p.profileType,
|
||||
}).ToList();
|
||||
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
|
|
@ -1757,6 +1766,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
amount = r.amount,
|
||||
positionSalaryAmount = r.positionSalaryAmount,
|
||||
mouthSalaryAmount = r.mouthSalaryAmount,
|
||||
profileType = p.profileType,
|
||||
}).ToList();
|
||||
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
|
|
@ -1884,6 +1894,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
amount = r.amount,
|
||||
positionSalaryAmount = r.positionSalaryAmount,
|
||||
mouthSalaryAmount = r.mouthSalaryAmount,
|
||||
profileType = p.profileType,
|
||||
}).ToList();
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave-discipline";
|
||||
|
|
|
|||
|
|
@ -131,7 +131,8 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers
|
|||
profileType = x.profileType,
|
||||
CreatedAt = x.CreatedAt,
|
||||
})
|
||||
.OrderByDescending(x => x.CreatedAt)
|
||||
.OrderByDescending(x => x.profileType)
|
||||
.ThenByDescending(x => x.CreatedAt)
|
||||
.ThenByDescending(x => x.CitizenId)
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
|
|
|
|||
|
|
@ -1034,12 +1034,12 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
if (timeStamps.CheckOut != null)
|
||||
{
|
||||
if (timeStamps.CheckOutStatus == "ABSENT")
|
||||
remarkStr = "ขาดราชการ";
|
||||
remarkStr = "ขาดราชการ" + (!timeStamps.IsLocationCheckOut ? $" (นอกสถานที่:{ timeStamps.CheckOutLocationName })".Trim() : "") ;
|
||||
else if (timeStamps.CheckInStatus == "ABSENT")
|
||||
remarkStr = "ขาดราชการ";
|
||||
remarkStr = "ขาดราชการ" + (!timeStamps.IsLocationCheckIn ? $" (นอกสถานที่:{timeStamps.CheckInLocationName})".Trim() : "");
|
||||
else if (timeStamps.CheckInStatus == "LATE")
|
||||
{
|
||||
remarkStr = "สาย";
|
||||
remarkStr = "สาย" + (!timeStamps.IsLocationCheckIn ? $" (นอกสถานที่:{timeStamps.CheckInLocationName})".Trim() : "");
|
||||
lateTotal += 1;
|
||||
}
|
||||
else
|
||||
|
|
@ -1048,10 +1048,10 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
else
|
||||
{
|
||||
if (timeStamps.CheckInStatus == "ABSENT")
|
||||
remarkStr = "ขาดราชการ";
|
||||
remarkStr = "ขาดราชการ" + (!timeStamps.IsLocationCheckIn ? $" (นอกสถานที่:{timeStamps.CheckInLocationName})".Trim() : "");
|
||||
else if (timeStamps.CheckInStatus == "LATE")
|
||||
{
|
||||
remarkStr = "สาย";
|
||||
remarkStr = "สาย" + (!timeStamps.IsLocationCheckIn ? $" (นอกสถานที่:{timeStamps.CheckInLocationName})".Trim() : "");
|
||||
lateTotal += 1;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
310
BMA.EHR.MetaData.Service/Controllers/HolidayController.cs
Normal file
310
BMA.EHR.MetaData.Service/Controllers/HolidayController.cs
Normal file
|
|
@ -0,0 +1,310 @@
|
|||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using BMA.EHR.MetaData.Service.Request;
|
||||
using BMA.EHR.MetaData.Service.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
namespace BMA.EHR.MetaData.Service.Controllers
|
||||
{
|
||||
[Route("api/v{version:apiVersion}/metadata/holiday")]
|
||||
[ApiVersion("1.0")]
|
||||
[ApiController]
|
||||
[Produces("application/json")]
|
||||
[Authorize]
|
||||
[SwaggerTag("จัดการข้อมูลปฏิทินวันหยุด")]
|
||||
public class HolidayController : BaseController
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly HolidayService _holidayService;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public HolidayController(HolidayService holidayService)
|
||||
{
|
||||
_holidayService = holidayService;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
/// <summary>
|
||||
/// อ่านข้อมูลจาก Relational Db โดยแสดงเฉพาะข้อมูลที่ Active เท่านั้น ตามปี
|
||||
/// </summary>
|
||||
/// <param name="year">ปี่ที่ต้องการ</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("{year:int}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetsAsync(int year)
|
||||
{
|
||||
try
|
||||
{
|
||||
var items1 = await _holidayService.GetNormalAsync(year);
|
||||
var items2 = await _holidayService.Get6DayAsync(year);
|
||||
|
||||
return Success(new { Normal = items1, SixDays = items2 });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// อ่านข้อมูลจาก Relational Db โดยแสดงเฉพาะข้อมูลที่ Active เท่านั้น ตามเดือน
|
||||
/// </summary>
|
||||
/// <param name="year">ปี่ที่ต้องการ</param>
|
||||
/// <param name="month">เดือนที่ต้องการ</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("{year:int}/{month:int}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetsAsyncByMonth(int year, int month)
|
||||
{
|
||||
try
|
||||
{
|
||||
var items1 = await _holidayService.GetNormalByMonthAsync(year, month);
|
||||
var items2 = await _holidayService.Get6DayByMonthAsync(year, month);
|
||||
|
||||
return Success(new { Normal = items1, SixDays = items2 });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// สร้างรายการวันหยุดใหม่แบบรายการเดียว
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">ทำรายการสำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> CreateAsync(Holiday inserted)
|
||||
{
|
||||
try
|
||||
{
|
||||
// create normal
|
||||
await _holidayService.CreateAsync(inserted);
|
||||
|
||||
// create 6days
|
||||
await _holidayService.Create6DayAsync(inserted);
|
||||
|
||||
//save database
|
||||
await _holidayService.SaveDatabase();
|
||||
|
||||
return Success(inserted);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// สร้างรายการวันหยุดใหม่แบบหลายรายการ
|
||||
/// </summary>
|
||||
/// <param name="inserted">ช่วงวันที่ที่ต้องการเพิ่ม</param>
|
||||
/// <param name="category">ประเภทวันหยุด ส่งค่ามาเป็น normal / 6day</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">ทำรายการสำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("range/add/{category}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> CreateRangeAsync(List<Holiday> inserted, string category)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _holidayService.CreateRangeAsync(inserted, category);
|
||||
|
||||
return Success(inserted);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// แก้ไขรายการวันหยุด
|
||||
/// </summary>
|
||||
/// <param name="id">รหัส</param>
|
||||
/// <param name="updated">ข้อมูลที่ต้องการแก้ไข</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">ทำรายการสำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("{category}/{id:length(36)}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateAsync(string id, Holiday updated)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _holidayService.UpdateAsync(Guid.Parse(id), updated);
|
||||
|
||||
return Success(updated);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// แก้ไขรายการวันหยุด
|
||||
/// </summary>
|
||||
/// <param name="data">Group ข่อมูลที่แก้ไข</param>
|
||||
/// <param name="category">ประเภทวันหยุด ส่งค่ามาเป็น normal / 6day</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">ทำรายการสำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("range/edit/{category}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateRangeAsync(HolidayUpdateRequest data, string category)
|
||||
{
|
||||
try
|
||||
{
|
||||
var isNormal = category.ToUpper() == "NORMAL";
|
||||
await _holidayService.UpdateRangeAsync(data.history, data.updated, isNormal);
|
||||
|
||||
return Success(data.updated);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ลบรายการวันหยุด
|
||||
/// </summary>
|
||||
/// <param name="id">รหัส</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">ทำรายการสำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpDelete("{id:length(36)}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> DeleteAsync(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _holidayService.DeleteAsync(Guid.Parse(id));
|
||||
|
||||
return Success();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ลบรายการวันหยุด
|
||||
/// </summary>
|
||||
/// <param name="delete">ช่วงวันที่ที่ต้องการลบ</param>
|
||||
/// <param name="category">ประเภทวันหยุด ส่งค่ามาเป็น normal / 6day</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">ทำรายการสำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("range/delete/{category}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> DeleteRangeAsync(List<Holiday> delete, string category)
|
||||
{
|
||||
try
|
||||
{
|
||||
var isNormal = category.ToUpper() == "NORMAL";
|
||||
await _holidayService.DeleteRangeAsync(delete, isNormal);
|
||||
|
||||
return Success();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// คัดลอกข้อมูลวันหยุด โดยระบุปีที่ต้องการคัดลอก และ ปีที่ต้องการบันทึก
|
||||
/// </summary>
|
||||
/// <param name="request">Request Body</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("copy")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> CopyAsync([FromBody] HolidayCopyRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _holidayService.CopyAsync(request.FromYear, request.ToYear);
|
||||
|
||||
return Success();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// สรุปวันหยุดในแต่ละปี
|
||||
/// </summary>
|
||||
/// <param name="year">ปี่ที่ต้องการ</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("summary/{year:int}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetDataGroupMonthAsync(int year)
|
||||
{
|
||||
try
|
||||
{
|
||||
var items = await _holidayService.GetDataGroupMonthAsync(year);
|
||||
|
||||
return Success(items);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.MetaData.Service.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
namespace BMA.EHR.MetaData.Service.Controllers
|
||||
{
|
||||
[Route("api/v{version:apiVersion}/metadata/position-executive")]
|
||||
[ApiVersion("1.0")]
|
||||
[ApiController]
|
||||
[Produces("application/json")]
|
||||
[Authorize]
|
||||
[SwaggerTag("จัดการข้อมูลประเภทตำแหน่ง เพื่อนำไปใช้งานในระบบ")]
|
||||
public class PositionExecutiveController : BaseController
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly PositionExecutiveService _positionExecutiveService;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public PositionExecutiveController(PositionExecutiveService positionExecutiveService)
|
||||
{
|
||||
_positionExecutiveService = positionExecutiveService;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
/// <summary>
|
||||
/// อ่านข้อมูลจาก Relational Db โดยแสดงเฉพาะข้อมูลที่ Active เท่านั้น
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetsAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
var items = await _positionExecutiveService.GetsAsync(showAll: false);
|
||||
|
||||
return Success(items);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.MetaData.Service.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
namespace BMA.EHR.MetaData.Service.Controllers
|
||||
{
|
||||
[Route("api/v{version:apiVersion}/metadata/position-executive-side")]
|
||||
[ApiVersion("1.0")]
|
||||
[ApiController]
|
||||
[Produces("application/json")]
|
||||
[Authorize]
|
||||
[SwaggerTag("จัดการข้อมูลด้านการบริหาร เพื่อนำไปใช้งานในระบบ")]
|
||||
public class PositionExecutiveSideController : BaseController
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly PositionExecutiveSideService _positionExecutiveSideService;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public PositionExecutiveSideController(PositionExecutiveSideService positionExecutiveSideService)
|
||||
{
|
||||
_positionExecutiveSideService = positionExecutiveSideService;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
/// <summary>
|
||||
/// อ่านข้อมูลจาก Relational Db โดยแสดงเฉพาะข้อมูลที่ Active เท่านั้น
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetsAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
var items = await _positionExecutiveSideService.GetsAsync(showAll: false);
|
||||
|
||||
return Success(items);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.MetaData.Service.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
namespace BMA.EHR.MetaData.Service.Controllers
|
||||
{
|
||||
[Route("api/v{version:apiVersion}/metadata/position-level")]
|
||||
[ApiVersion("1.0")]
|
||||
[ApiController]
|
||||
[Produces("application/json")]
|
||||
[Authorize]
|
||||
[SwaggerTag("จัดการข้อมูลระดับตำแหน่ง เพื่อนำไปใช้งานในระบบ")]
|
||||
public class PositionLevelController : BaseController
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly PositionLevelService _positionLevelService;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public PositionLevelController(PositionLevelService positionLevelService)
|
||||
{
|
||||
_positionLevelService = positionLevelService;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
/// <summary>
|
||||
/// อ่านข้อมูลจาก Relational Db โดยแสดงเฉพาะข้อมูลที่ Active เท่านั้น
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetsAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
var items = await _positionLevelService.GetsAsync(showAll: false);
|
||||
|
||||
return Success(items);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.MetaData.Service.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
namespace BMA.EHR.MetaData.Service.Controllers
|
||||
{
|
||||
[Route("api/v{version:apiVersion}/metadata/position-line")]
|
||||
[ApiVersion("1.0")]
|
||||
[ApiController]
|
||||
[Produces("application/json")]
|
||||
[Authorize]
|
||||
[SwaggerTag("จัดการข้อมูลสายงานตำแหน่ง เพื่อนำไปใช้งานในระบบ")]
|
||||
public class PositionLineController : BaseController
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly PositionLineService _positionLineService;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public PositionLineController(PositionLineService positionLineService)
|
||||
{
|
||||
_positionLineService = positionLineService;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
/// <summary>
|
||||
/// อ่านข้อมูลจาก Relational Db โดยแสดงเฉพาะข้อมูลที่ Active เท่านั้น
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetsAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
var items = await _positionLineService.GetsAsync(showAll: false);
|
||||
|
||||
return Success(items);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.MetaData.Service.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
namespace BMA.EHR.MetaData.Service.Controllers
|
||||
{
|
||||
[Route("api/v{version:apiVersion}/metadata/position-path")]
|
||||
[ApiVersion("1.0")]
|
||||
[ApiController]
|
||||
[Produces("application/json")]
|
||||
[Authorize]
|
||||
[SwaggerTag("จัดการข้อมูลสายงาน เพื่อนำไปใช้งานในระบบ")]
|
||||
public class PositionPathController : BaseController
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly PositionPathService _positionPathService;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public PositionPathController(PositionPathService positionPathService)
|
||||
{
|
||||
_positionPathService = positionPathService;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
/// <summary>
|
||||
/// อ่านข้อมูลจาก Relational Db โดยแสดงเฉพาะข้อมูลที่ Active เท่านั้น
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetsAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
var items = await _positionPathService.GetsAsync(showAll: false);
|
||||
|
||||
return Success(items);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.MetaData.Service.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
namespace BMA.EHR.MetaData.Service.Controllers
|
||||
{
|
||||
[Route("api/v{version:apiVersion}/metadata/position-path-side")]
|
||||
[ApiVersion("1.0")]
|
||||
[ApiController]
|
||||
[Produces("application/json")]
|
||||
[Authorize]
|
||||
[SwaggerTag("จัดการข้อมูลด้าน/สาขา เพื่อนำไปใช้งานในระบบ")]
|
||||
public class PositionPathSideController : BaseController
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly PositionPathSideService _positionPathSideService;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public PositionPathSideController(PositionPathSideService positionPathSideService)
|
||||
{
|
||||
_positionPathSideService = positionPathSideService;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
/// <summary>
|
||||
/// อ่านข้อมูลจาก Relational Db โดยแสดงเฉพาะข้อมูลที่ Active เท่านั้น
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetsAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
var items = await _positionPathSideService.GetsAsync(showAll: false);
|
||||
|
||||
return Success(items);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.MetaData.Service.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
|
||||
namespace BMA.EHR.MetaData.Service.Controllers
|
||||
{
|
||||
[Route("api/v{version:apiVersion}/metadata/position-type")]
|
||||
[ApiVersion("1.0")]
|
||||
[ApiController]
|
||||
[Produces("application/json")]
|
||||
[Authorize]
|
||||
[SwaggerTag("จัดการข้อมูลประเภทตำแหน่ง เพื่อนำไปใช้งานในระบบ")]
|
||||
public class PositionTypeController : BaseController
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly PositionTypeService _positionTypeService;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public PositionTypeController(PositionTypeService positionTypeService)
|
||||
{
|
||||
_positionTypeService = positionTypeService;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
/// <summary>
|
||||
/// อ่านข้อมูลจาก Relational Db โดยแสดงเฉพาะข้อมูลที่ Active เท่านั้น
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetsAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
var items = await _positionTypeService.GetsAsync(showAll: false);
|
||||
|
||||
return Success(items);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace BMA.EHR.MetaData.Service.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class PrefixController : BaseController
|
||||
{
|
||||
private readonly PrefixRepository _repository;
|
||||
|
||||
public PrefixController(PrefixRepository repository)
|
||||
{
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<ResponseObject>> Get()
|
||||
{
|
||||
var data = await _repository.GetAllAsync();
|
||||
|
||||
return Success(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ using BMA.EHR.Domain.Middlewares;
|
|||
using BMA.EHR.Infrastructure;
|
||||
using BMA.EHR.Infrastructure.Persistence;
|
||||
using BMA.EHR.MetaData.Service;
|
||||
using BMA.EHR.MetaData.Service.Services;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.ApiExplorer;
|
||||
|
|
@ -18,35 +19,35 @@ using System.Text;
|
|||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
{
|
||||
var issuer = builder.Configuration["Jwt:Issuer"];
|
||||
var key = builder.Configuration["Jwt:Key"];
|
||||
var issuer = builder.Configuration["Jwt:Issuer"];
|
||||
var key = builder.Configuration["Jwt:Key"];
|
||||
|
||||
|
||||
IdentityModelEventSource.ShowPII = true;
|
||||
IdentityModelEventSource.ShowPII = true;
|
||||
|
||||
builder.Services.AddHttpContextAccessor();
|
||||
builder.Services.AddHttpContextAccessor();
|
||||
|
||||
builder.Services.AddApiVersioning(opt =>
|
||||
{
|
||||
opt.DefaultApiVersion = new ApiVersion(1, 0);
|
||||
opt.AssumeDefaultVersionWhenUnspecified = true;
|
||||
opt.ReportApiVersions = true;
|
||||
opt.ApiVersionReader = ApiVersionReader.Combine(new UrlSegmentApiVersionReader(),
|
||||
new HeaderApiVersionReader("x-api-version"),
|
||||
new MediaTypeApiVersionReader("x-api-version"));
|
||||
});
|
||||
builder.Services.AddApiVersioning(opt =>
|
||||
{
|
||||
opt.DefaultApiVersion = new ApiVersion(1, 0);
|
||||
opt.AssumeDefaultVersionWhenUnspecified = true;
|
||||
opt.ReportApiVersions = true;
|
||||
opt.ApiVersionReader = ApiVersionReader.Combine(new UrlSegmentApiVersionReader(),
|
||||
new HeaderApiVersionReader("x-api-version"),
|
||||
new MediaTypeApiVersionReader("x-api-version"));
|
||||
});
|
||||
|
||||
builder.Services.AddVersionedApiExplorer(setup =>
|
||||
{
|
||||
setup.GroupNameFormat = "'v'VVV";
|
||||
setup.SubstituteApiVersionInUrl = true;
|
||||
});
|
||||
builder.Services.AddVersionedApiExplorer(setup =>
|
||||
{
|
||||
setup.GroupNameFormat = "'v'VVV";
|
||||
setup.SubstituteApiVersionInUrl = true;
|
||||
});
|
||||
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
|
||||
// Authorization
|
||||
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(opt =>
|
||||
{
|
||||
// Authorization
|
||||
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(opt =>
|
||||
{
|
||||
opt.RequireHttpsMetadata = false; //false for dev
|
||||
opt.Authority = issuer;
|
||||
opt.TokenValidationParameters = new()
|
||||
|
|
@ -59,103 +60,111 @@ var builder = WebApplication.CreateBuilder(args);
|
|||
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(key))
|
||||
};
|
||||
});
|
||||
builder.Services.AddAuthorization();
|
||||
builder.Services.AddAuthorization();
|
||||
|
||||
// use serilog
|
||||
ConfigureLogs();
|
||||
builder.Host.UseSerilog();
|
||||
// use serilog
|
||||
ConfigureLogs();
|
||||
builder.Host.UseSerilog();
|
||||
|
||||
// Add config CORS
|
||||
builder.Services.AddCors(options => options.AddDefaultPolicy(builder =>
|
||||
{
|
||||
builder
|
||||
.AllowAnyOrigin()
|
||||
.AllowAnyMethod()
|
||||
.AllowAnyHeader()
|
||||
.SetIsOriginAllowedToAllowWildcardSubdomains();
|
||||
}));
|
||||
// Add config CORS
|
||||
builder.Services.AddCors(options => options.AddDefaultPolicy(builder =>
|
||||
{
|
||||
builder
|
||||
.AllowAnyOrigin()
|
||||
.AllowAnyMethod()
|
||||
.AllowAnyHeader()
|
||||
.SetIsOriginAllowedToAllowWildcardSubdomains();
|
||||
}));
|
||||
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddApplication();
|
||||
builder.Services.AddPersistence(builder.Configuration);
|
||||
// Add services to the container.
|
||||
builder.Services.AddApplication();
|
||||
builder.Services.AddPersistence(builder.Configuration);
|
||||
|
||||
builder.Services.AddControllers(options =>
|
||||
{
|
||||
options.SuppressAsyncSuffixInActionNames = false;
|
||||
})
|
||||
.AddNewtonsoftJson(x => x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);
|
||||
builder.Services.AddTransient<HolidayService>();
|
||||
builder.Services.AddTransient<PositionExecutiveService>();
|
||||
builder.Services.AddTransient<PositionExecutiveSideService>();
|
||||
builder.Services.AddTransient<PositionLevelService>();
|
||||
builder.Services.AddTransient<PositionLineService>();
|
||||
builder.Services.AddTransient<PositionPathService>();
|
||||
builder.Services.AddTransient<PositionPathSideService>();
|
||||
builder.Services.AddTransient<PositionTypeService>();
|
||||
builder.Services.AddControllers(options =>
|
||||
{
|
||||
options.SuppressAsyncSuffixInActionNames = false;
|
||||
})
|
||||
.AddNewtonsoftJson(x => x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);
|
||||
|
||||
builder.Services.AddSwaggerGen();
|
||||
builder.Services.ConfigureOptions<ConfigureSwaggerOptions>();
|
||||
builder.Services.AddSwaggerGen();
|
||||
builder.Services.ConfigureOptions<ConfigureSwaggerOptions>();
|
||||
|
||||
builder.Services.AddHealthChecks();
|
||||
builder.Services.AddHealthChecks();
|
||||
}
|
||||
|
||||
var app = builder.Build();
|
||||
{
|
||||
var apiVersionDescriptionProvider = app.Services.GetRequiredService<IApiVersionDescriptionProvider>();
|
||||
var apiVersionDescriptionProvider = app.Services.GetRequiredService<IApiVersionDescriptionProvider>();
|
||||
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI(options =>
|
||||
{
|
||||
foreach (var description in apiVersionDescriptionProvider.ApiVersionDescriptions)
|
||||
{
|
||||
options.SwaggerEndpoint($"/swagger/{description.GroupName}/swagger.json",
|
||||
description.GroupName.ToUpperInvariant());
|
||||
}
|
||||
});
|
||||
}
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI(options =>
|
||||
{
|
||||
foreach (var description in apiVersionDescriptionProvider.ApiVersionDescriptions)
|
||||
{
|
||||
options.SwaggerEndpoint($"/swagger/{description.GroupName}/swagger.json",
|
||||
description.GroupName.ToUpperInvariant());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
app.MapHealthChecks("/health");
|
||||
|
||||
app.MapHealthChecks("/health");
|
||||
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseCors();
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
app.UseDefaultFiles();
|
||||
app.UseStaticFiles();
|
||||
app.MapControllers();
|
||||
app.UseCors();
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
app.UseDefaultFiles();
|
||||
app.UseStaticFiles();
|
||||
app.MapControllers();
|
||||
app.UseMiddleware<ErrorHandlerMiddleware>();
|
||||
|
||||
// apply migrations
|
||||
await using var scope = app.Services.CreateAsyncScope();
|
||||
await using var db = scope.ServiceProvider.GetRequiredService<ApplicationDBContext>();
|
||||
await db.Database.MigrateAsync();
|
||||
await using var db = scope.ServiceProvider.GetRequiredService<ApplicationDBContext>();
|
||||
await db.Database.MigrateAsync();
|
||||
|
||||
app.Run();
|
||||
app.Run();
|
||||
}
|
||||
|
||||
void ConfigureLogs()
|
||||
{
|
||||
var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
.AddJsonFile(
|
||||
$"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json",
|
||||
optional: true)
|
||||
.Build();
|
||||
var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
.AddJsonFile(
|
||||
$"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json",
|
||||
optional: true)
|
||||
.Build();
|
||||
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.Enrich.FromLogContext()
|
||||
.MinimumLevel.Error()
|
||||
.WriteTo.Console()
|
||||
.Enrich.WithExceptionDetails()
|
||||
.WriteTo.Elasticsearch(ConfigureElasticSink(configuration, environment ?? ""))
|
||||
.Enrich.WithProperty("Environment", environment)
|
||||
.ReadFrom.Configuration(configuration)
|
||||
.CreateLogger();
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.Enrich.FromLogContext()
|
||||
.MinimumLevel.Error()
|
||||
.WriteTo.Console()
|
||||
.Enrich.WithExceptionDetails()
|
||||
.WriteTo.Elasticsearch(ConfigureElasticSink(configuration, environment ?? ""))
|
||||
.Enrich.WithProperty("Environment", environment)
|
||||
.ReadFrom.Configuration(configuration)
|
||||
.CreateLogger();
|
||||
}
|
||||
|
||||
ElasticsearchSinkOptions ConfigureElasticSink(IConfigurationRoot configuration, string environment)
|
||||
{
|
||||
return new ElasticsearchSinkOptions(new Uri(configuration["ElasticConfiguration:Uri"] ?? ""))
|
||||
{
|
||||
AutoRegisterTemplate = true,
|
||||
IndexFormat = $"{Assembly.GetExecutingAssembly()?.GetName()?.Name?.ToLower().Replace(".", "-")}-{environment?.ToLower().Replace(".", "-")}"
|
||||
};
|
||||
return new ElasticsearchSinkOptions(new Uri(configuration["ElasticConfiguration:Uri"] ?? ""))
|
||||
{
|
||||
AutoRegisterTemplate = true,
|
||||
IndexFormat = $"{Assembly.GetExecutingAssembly()?.GetName()?.Name?.ToLower().Replace(".", "-")}-{environment?.ToLower().Replace(".", "-")}"
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
9
BMA.EHR.MetaData.Service/Request/HolidayCopyRequest.cs
Normal file
9
BMA.EHR.MetaData.Service/Request/HolidayCopyRequest.cs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
namespace BMA.EHR.MetaData.Service.Request
|
||||
{
|
||||
public class HolidayCopyRequest
|
||||
{
|
||||
public int FromYear { get; set; } = DateTime.Now.Year;
|
||||
|
||||
public int ToYear { get; set; } = DateTime.Now.Year;
|
||||
}
|
||||
}
|
||||
14
BMA.EHR.MetaData.Service/Request/HolidayRequest.cs
Normal file
14
BMA.EHR.MetaData.Service/Request/HolidayRequest.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
namespace BMA.EHR.MetaData.Service.Request
|
||||
{
|
||||
public class HolidayRequest
|
||||
{
|
||||
public DateTime dateStart { get; set; } = DateTime.Now;
|
||||
|
||||
public DateTime dateEnd { get; set; } = DateTime.Now;
|
||||
|
||||
public int Year { get; set; } = DateTime.Now.Year;
|
||||
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
}
|
||||
13
BMA.EHR.MetaData.Service/Request/HolidayUpdateRequest.cs
Normal file
13
BMA.EHR.MetaData.Service/Request/HolidayUpdateRequest.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
|
||||
namespace BMA.EHR.MetaData.Service.Request
|
||||
{
|
||||
public class HolidayUpdateRequest
|
||||
{
|
||||
public List<Holiday> history { get; set; }
|
||||
|
||||
public List<Holiday> updated { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
11
BMA.EHR.MetaData.Service/Response/DashboardResponseItem.cs
Normal file
11
BMA.EHR.MetaData.Service/Response/DashboardResponseItem.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
namespace BMA.EHR.MetaData.Service.Response
|
||||
{
|
||||
public class DashboardResponseItem
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
|
||||
public string? Name { get; set; }
|
||||
|
||||
public int? Count { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
namespace BMA.EHR.MetaData.Service.Response
|
||||
{
|
||||
public class GetOrganizationTypeResponse
|
||||
{
|
||||
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public string Name { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
13
BMA.EHR.MetaData.Service/Response/ResponseObject.cs
Normal file
13
BMA.EHR.MetaData.Service/Response/ResponseObject.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
using System.Net;
|
||||
|
||||
namespace BMA.EHR.MetaData.Service.Response
|
||||
{
|
||||
public class ResponseObject
|
||||
{
|
||||
public int Status { get; set; }
|
||||
|
||||
public string? Message { get; set; }
|
||||
|
||||
public object? Result { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
namespace BMA.EHR.MetaData.Service.Response
|
||||
{
|
||||
public class SummaryHolidayByMonthResponseItem
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
|
||||
public int? Count { get; set; }
|
||||
|
||||
public string? Month { get; set; }
|
||||
|
||||
public string? MonthFull { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
678
BMA.EHR.MetaData.Service/Services/HolidayService.cs
Normal file
678
BMA.EHR.MetaData.Service/Services/HolidayService.cs
Normal file
|
|
@ -0,0 +1,678 @@
|
|||
using System.Security.Claims;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
using BMA.EHR.Infrastructure.Persistence;
|
||||
using BMA.EHR.MetaData.Service.Response;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using BMA.EHR.Domain.Extensions;
|
||||
|
||||
namespace BMA.EHR.MetaData.Service.Services
|
||||
{
|
||||
public class HolidayService
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public HolidayService(ApplicationDBContext context,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_context = context;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Properties "
|
||||
|
||||
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||
|
||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
#region " Private "
|
||||
|
||||
private async Task<bool> IsHoliday(DateTime date)
|
||||
{
|
||||
var holidays = (await GetsAsync(date.Date.Year))
|
||||
.Where(d => d.Category.ToUpper() == "NORMAL")
|
||||
.Select(d => d.HolidayDate.Date).ToList();
|
||||
|
||||
if (holidays.Any())
|
||||
{
|
||||
return holidays.Contains(date);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
private async Task<bool> IsHoliday6Days(DateTime date)
|
||||
{
|
||||
var holidays = (await GetsAsync(date.Date.Year))
|
||||
.Where(d => d.Category.ToUpper() != "NORMAL")
|
||||
.Select(d => d.HolidayDate.Date).ToList();
|
||||
|
||||
if (holidays.Any())
|
||||
{
|
||||
return holidays.Contains(date);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
private async Task<bool> IsWeekend(DateTime date)
|
||||
{
|
||||
var res = date.DayOfWeek == DayOfWeek.Saturday
|
||||
|| date.DayOfWeek == DayOfWeek.Sunday;
|
||||
|
||||
return await Task.FromResult(res);
|
||||
}
|
||||
|
||||
private async Task<bool> IsWeekend6Days(DateTime date)
|
||||
{
|
||||
var res = date.DayOfWeek == DayOfWeek.Sunday;
|
||||
|
||||
return await Task.FromResult(res);
|
||||
}
|
||||
|
||||
private async Task<DateTime> GetNextWorkingDay(DateTime date)
|
||||
{
|
||||
while ((await IsHoliday(date)) || (await IsWeekend(date)))
|
||||
{
|
||||
date = date.AddDays(1);
|
||||
}
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
private async Task<DateTime> GetNextWorkingDay6Days(DateTime date)
|
||||
{
|
||||
while ((await IsHoliday6Days(date)) || (await IsWeekend6Days(date)))
|
||||
{
|
||||
date = date.AddDays(1);
|
||||
}
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
private async Task<Boolean> CheckWorkingDay(DateTime date)
|
||||
{
|
||||
|
||||
while ((await IsHoliday(date)) || (await IsWeekend(date)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private async Task<Boolean> CheckWorkingDay6Days(DateTime date)
|
||||
{
|
||||
|
||||
while ((await IsHoliday6Days(date)) || (await IsWeekend6Days(date)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public async Task<IEnumerable<Holiday>> GetsAsync(int year, bool showSpecial = true)
|
||||
{
|
||||
var holidays = _context.Holidays.AsQueryable()
|
||||
.Where(x => x.Year == year.ToCeYear());
|
||||
|
||||
if (!showSpecial)
|
||||
{
|
||||
holidays = holidays.Where(x => !x.IsSpecial);
|
||||
}
|
||||
|
||||
return await holidays.OrderBy(d => d.HolidayDate.Date).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Holiday>> GetNormalAsync(int year, bool showSpecial = true)
|
||||
{
|
||||
var holidays = _context.Holidays.AsQueryable()
|
||||
.Where(x => x.Category.ToUpper() == "NORMAL")
|
||||
.Where(x => x.Year == year.ToCeYear());
|
||||
|
||||
if (!showSpecial)
|
||||
{
|
||||
holidays = holidays.Where(x => !x.IsSpecial);
|
||||
}
|
||||
|
||||
return await holidays.OrderBy(d => d.HolidayDate.Date).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Holiday>> Get6DayAsync(int year, bool showSpecial = true)
|
||||
{
|
||||
var holidays = _context.Holidays.AsQueryable()
|
||||
.Where(x => x.Category.ToUpper() != "NORMAL")
|
||||
.Where(x => x.Year == year.ToCeYear());
|
||||
|
||||
if (!showSpecial)
|
||||
{
|
||||
holidays = holidays.Where(x => !x.IsSpecial);
|
||||
}
|
||||
|
||||
return await holidays.OrderBy(d => d.HolidayDate.Date).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Holiday>> GetsAsyncByMonth(int year, int month)
|
||||
{
|
||||
return await _context.Holidays.AsQueryable()
|
||||
.Where(x => x.Year == year.ToCeYear())
|
||||
.Where(x => x.HolidayDate.Month == month)
|
||||
.OrderBy(d => d.HolidayDate.Date)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Holiday>> GetNormalByMonthAsync(int year, int month)
|
||||
{
|
||||
return await _context.Holidays.AsQueryable()
|
||||
.Where(x => x.Category.ToUpper() == "NORMAL")
|
||||
.Where(x => x.Year == year.ToCeYear())
|
||||
.Where(x => x.HolidayDate.Month == month)
|
||||
.OrderBy(d => d.HolidayDate.Date)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Holiday>> Get6DayByMonthAsync(int year, int month)
|
||||
{
|
||||
return await _context.Holidays.AsQueryable()
|
||||
.Where(x => x.Category.ToUpper() != "NORMAL")
|
||||
.Where(x => x.Year == year.ToCeYear())
|
||||
.Where(x => x.HolidayDate.Month == month)
|
||||
.OrderBy(d => d.HolidayDate.Date)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<Holiday?> GetByIdAsync(Guid id)
|
||||
{
|
||||
return await _context.Holidays.FirstOrDefaultAsync(x => x.Id == id);
|
||||
}
|
||||
|
||||
public async Task DeleteAsync(Guid id)
|
||||
{
|
||||
var existData = await _context.Holidays.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (existData != null)
|
||||
{
|
||||
_context.Holidays.Remove(existData);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task DeleteRangeAsync(List<Holiday> holidays, bool isNormal = true)
|
||||
{
|
||||
foreach (var holiday in holidays)
|
||||
{
|
||||
if (isNormal)
|
||||
{
|
||||
var existData = await _context.Holidays.AsQueryable()
|
||||
.Where(h => h.Category.ToUpper() == "NORMAL")
|
||||
.FirstOrDefaultAsync(x => DateTime.Compare(x.HolidayDate.Date, holiday.HolidayDate.Date) == 0);
|
||||
if (existData != null)
|
||||
{
|
||||
_context.Holidays.Remove(existData);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var existData = await _context.Holidays.AsQueryable()
|
||||
.Where(h => h.Category.ToUpper() != "NORMAL")
|
||||
.FirstOrDefaultAsync(x => DateTime.Compare(x.HolidayDate.Date, holiday.HolidayDate.Date) == 0);
|
||||
if (existData != null)
|
||||
{
|
||||
_context.Holidays.Remove(existData);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task UpdateAsync(Guid id, Holiday updated)
|
||||
{
|
||||
var existData = await _context.Holidays.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (existData != null)
|
||||
{
|
||||
// if (!existData.Compare(updated))
|
||||
if (existData.Name != updated.Name)
|
||||
{
|
||||
existData.Name = updated.Name;
|
||||
// existData.Year = updated.Year.ToCeYear();
|
||||
existData.HolidayDate = updated.HolidayDate.Date;
|
||||
// existData.HolidayDate = await GetNextWorkingDay(updated.HolidayDate.Date);
|
||||
existData.OriginalDate = updated.OriginalDate;
|
||||
existData.LastUpdatedAt = DateTime.Now;
|
||||
existData.LastUpdateUserId = UserId ?? "";
|
||||
existData.LastUpdateFullName = FullName ?? "";
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task UpdateRangeAsync(List<Holiday> historys, List<Holiday> holidays, bool isNormal = true)
|
||||
{
|
||||
if (isNormal)
|
||||
{
|
||||
// foreach (var holiday in holidays)
|
||||
// {
|
||||
// var dupData = await _context.Holidays.AsQueryable()
|
||||
// .Where(h => h.Category.ToUpper() == "NORMAL")
|
||||
// .FirstOrDefaultAsync(h => h.Year == holiday.Year && h.Name == holiday.Name && DateTime.Compare(h.HolidayDate.Date, holiday.HolidayDate.Date) != 0);
|
||||
// if (dupData != null)
|
||||
// throw new Exception(GlobalMessages.NameDupicate);
|
||||
// }
|
||||
|
||||
foreach (var history in historys)
|
||||
{
|
||||
var existData = await _context.Holidays.AsQueryable()
|
||||
.Where(h => h.Category.ToUpper() == "NORMAL")
|
||||
.FirstOrDefaultAsync(x => DateTime.Compare(x.HolidayDate.Date, history.HolidayDate.Date) == 0);
|
||||
if (existData != null)
|
||||
{
|
||||
_context.Holidays.Remove(existData);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var holiday in holidays)
|
||||
{
|
||||
// if (!(await IsHoliday(holiday.HolidayDate.Date)) && !(await IsWeekend(holiday.HolidayDate.Date)))
|
||||
// {
|
||||
await CreateAsync(holiday);
|
||||
// }
|
||||
}
|
||||
// apply to database
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
// foreach (var holiday in holidays)
|
||||
// {
|
||||
// var dupData = await _context.Holidays.AsQueryable()
|
||||
// .Where(h => h.Category.ToUpper() != "NORMAL")
|
||||
// .FirstOrDefaultAsync(h => h.Year == holiday.Year && h.Name == holiday.Name && DateTime.Compare(h.HolidayDate.Date, holiday.HolidayDate.Date) != 0);
|
||||
// if (dupData != null)
|
||||
// throw new Exception(GlobalMessages.NameDupicate);
|
||||
// }
|
||||
|
||||
foreach (var history in historys)
|
||||
{
|
||||
var existData = await _context.Holidays.AsQueryable()
|
||||
.Where(h => h.Category.ToUpper() != "NORMAL")
|
||||
.FirstOrDefaultAsync(x => DateTime.Compare(x.HolidayDate.Date, history.HolidayDate.Date) == 0);
|
||||
if (existData != null)
|
||||
{
|
||||
_context.Holidays.Remove(existData);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var holiday in holidays)
|
||||
{
|
||||
// if (!(await IsHoliday6Days(holiday.HolidayDate.Date)) && !(await IsWeekend6Days(holiday.HolidayDate.Date)))
|
||||
// {
|
||||
await Create6DayAsync(holiday);
|
||||
// }
|
||||
}
|
||||
// apply to database
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async Task CreateAsync(Holiday inserted)
|
||||
{
|
||||
var existData = await _context.Holidays.AsQueryable()
|
||||
.Where(d => d.Category.ToUpper() == "NORMAL")
|
||||
.FirstOrDefaultAsync(h => h.Year == inserted.Year && DateTime.Compare(h.HolidayDate.Date, inserted.HolidayDate.Date) == 0);
|
||||
|
||||
if (existData != null)
|
||||
throw new Exception(GlobalMessages.DataExist5);
|
||||
|
||||
// var dupData = await _context.Holidays.AsQueryable()
|
||||
// .Where(d => d.Category.ToUpper() == "NORMAL")
|
||||
// .FirstOrDefaultAsync(h => h.Year == inserted.Year && h.Name == inserted.Name);
|
||||
|
||||
// if (dupData != null)
|
||||
// throw new Exception(GlobalMessages.NameDupicate);
|
||||
|
||||
inserted.Id = Guid.NewGuid();
|
||||
inserted.Year = inserted.Year.ToCeYear();
|
||||
inserted.HolidayDate = inserted.HolidayDate.Date;
|
||||
// inserted.HolidayDate = await GetNextWorkingDay(inserted.HolidayDate.Date);
|
||||
inserted.OriginalDate = inserted.HolidayDate.Date;
|
||||
inserted.CreatedUserId = UserId ?? "";
|
||||
inserted.CreatedFullName = FullName ?? "System Administrator";
|
||||
inserted.CreatedAt = DateTime.Now;
|
||||
inserted.LastUpdatedAt = DateTime.Now;
|
||||
inserted.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
inserted.LastUpdateUserId = UserId ?? "";
|
||||
inserted.Category = "NORMAL";
|
||||
|
||||
await _context.Holidays.AddAsync(inserted);
|
||||
|
||||
// apply to database
|
||||
// await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task Create6DayAsync(Holiday inserted)
|
||||
{
|
||||
var existData = await _context.Holidays.AsQueryable()
|
||||
.Where(d => d.Category.ToUpper() != "NORMAL")
|
||||
.FirstOrDefaultAsync(h => h.Year == inserted.Year && DateTime.Compare(h.HolidayDate.Date, inserted.HolidayDate.Date) == 0);
|
||||
|
||||
if (existData != null)
|
||||
throw new Exception(GlobalMessages.DataExist6);
|
||||
|
||||
// var dupData = await _context.Holidays.AsQueryable()
|
||||
// .Where(d => d.Category.ToUpper() != "NORMAL")
|
||||
// .FirstOrDefaultAsync(h => h.Year == inserted.Year && h.Name == inserted.Name);
|
||||
|
||||
// if (dupData != null)
|
||||
// throw new Exception(GlobalMessages.NameDupicate);
|
||||
|
||||
inserted.Id = Guid.NewGuid();
|
||||
inserted.Year = inserted.Year.ToCeYear();
|
||||
inserted.HolidayDate = inserted.HolidayDate.Date;
|
||||
// inserted.HolidayDate = await GetNextWorkingDay6Days(inserted.HolidayDate.Date);
|
||||
inserted.OriginalDate = inserted.HolidayDate.Date;
|
||||
inserted.CreatedUserId = UserId ?? "";
|
||||
inserted.CreatedFullName = FullName ?? "System Administrator";
|
||||
inserted.CreatedAt = DateTime.Now;
|
||||
inserted.LastUpdatedAt = DateTime.Now;
|
||||
inserted.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
inserted.LastUpdateUserId = UserId ?? "";
|
||||
inserted.Category = "6DAYS";
|
||||
|
||||
await _context.Holidays.AddAsync(inserted);
|
||||
|
||||
// apply to database
|
||||
// await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task CreateRangeAsync(List<Holiday> holidays, string category)
|
||||
{
|
||||
foreach (var holiday in holidays)
|
||||
{
|
||||
if (category.ToUpper() == "NORMAL" || category.ToUpper() == "ALL")
|
||||
{
|
||||
var existData1 = await _context.Holidays.AsQueryable()
|
||||
.Where(d => d.Category.ToUpper() == "NORMAL")
|
||||
.FirstOrDefaultAsync(h => h.Year == holiday.Year && DateTime.Compare(h.HolidayDate.Date, holiday.HolidayDate.Date) == 0);
|
||||
|
||||
if (existData1 != null)
|
||||
throw new Exception(GlobalMessages.DataExist5);
|
||||
|
||||
// var dupData1 = await _context.Holidays.AsQueryable()
|
||||
// .Where(d => d.Category.ToUpper() != "NORMAL")
|
||||
// .FirstOrDefaultAsync(h => h.Year == holiday.Year && h.Name == holiday.Name);
|
||||
|
||||
// if (dupData1 != null)
|
||||
// throw new Exception(GlobalMessages.NameDupicate);
|
||||
|
||||
// create for normal
|
||||
var inserted = new Holiday
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Year = holiday.Year.ToCeYear(),
|
||||
Name = holiday.Name,
|
||||
HolidayDate = holiday.HolidayDate.Date,
|
||||
OriginalDate = holiday.HolidayDate.Date,
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
Category = "NORMAL",
|
||||
};
|
||||
|
||||
await _context.Holidays.AddAsync(inserted);
|
||||
}
|
||||
|
||||
if (category.ToUpper() == "6DAYS" || category.ToUpper() == "ALL")
|
||||
{
|
||||
var existData2 = await _context.Holidays.AsQueryable()
|
||||
.Where(d => d.Category.ToUpper() != "NORMAL")
|
||||
.FirstOrDefaultAsync(h => h.Year == holiday.Year && DateTime.Compare(h.HolidayDate.Date, holiday.HolidayDate.Date) == 0);
|
||||
|
||||
if (existData2 != null)
|
||||
throw new Exception(GlobalMessages.DataExist6);
|
||||
|
||||
// var dupData2 = await _context.Holidays.AsQueryable()
|
||||
// .Where(d => d.Category.ToUpper() != "6DAYS")
|
||||
// .FirstOrDefaultAsync(h => h.Year == holiday.Year && h.Name == holiday.Name);
|
||||
|
||||
// if (dupData2 != null)
|
||||
// throw new Exception(GlobalMessages.NameDupicate);
|
||||
|
||||
// create for 6days
|
||||
var inserted2 = new Holiday
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Year = holiday.Year.ToCeYear(),
|
||||
Name = holiday.Name,
|
||||
HolidayDate = holiday.HolidayDate.Date,
|
||||
OriginalDate = holiday.HolidayDate.Date,
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
Category = "6DAYS",
|
||||
};
|
||||
await _context.Holidays.AddAsync(inserted2);
|
||||
}
|
||||
}
|
||||
// apply to database
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task CopyAsync(int fromYear, int toYear)
|
||||
{
|
||||
if (toYear <= fromYear)
|
||||
throw new Exception(GlobalMessages.HolidayOfYearNotCopy);
|
||||
|
||||
var source = await GetsAsync(fromYear.ToCeYear());
|
||||
if (source == null)
|
||||
throw new Exception(GlobalMessages.HolidayOfYearNotFound);
|
||||
|
||||
// JACK EDIT : เพิ่ม Logic การตรวจเช็คว่าปีที่จะ Copy ไปมีในฐานข้อมูลแล้วหรือไม่?
|
||||
var dest = await GetsAsync(toYear.ToCeYear());
|
||||
if (dest.Count() > 0)
|
||||
throw new Exception(GlobalMessages.DestinationHolidayIsExist);
|
||||
source = source.Where(x => x.Category == "NORMAL");
|
||||
foreach (var holiday in source)
|
||||
{
|
||||
// create for normal
|
||||
var inserted = new Holiday
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Year = toYear.ToCeYear(),
|
||||
Name = holiday.Name,
|
||||
HolidayDate = await GetNextWorkingDay(holiday.OriginalDate.AddYears(toYear - fromYear)),
|
||||
OriginalDate = holiday.OriginalDate.AddYears(toYear - fromYear),
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedFullName = FullName ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
Category = "NORMAL"
|
||||
};
|
||||
|
||||
await _context.Holidays.AddAsync(inserted);
|
||||
|
||||
|
||||
// create for 6days
|
||||
var inserted2 = new Holiday
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Year = toYear.ToCeYear(),
|
||||
Name = holiday.Name,
|
||||
HolidayDate = await GetNextWorkingDay6Days(holiday.OriginalDate.AddYears(toYear - fromYear)),
|
||||
OriginalDate = holiday.OriginalDate.AddYears(toYear - fromYear),
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedFullName = FullName ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
Category = "6DAYS"
|
||||
};
|
||||
await _context.Holidays.AddAsync(inserted2);
|
||||
|
||||
// apply to database
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SaveDatabase()
|
||||
{
|
||||
// apply to database
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task<List<SummaryHolidayByMonthResponseItem>> GetDataGroupMonthAsync(int year)
|
||||
{
|
||||
var res = new List<SummaryHolidayByMonthResponseItem>
|
||||
{new SummaryHolidayByMonthResponseItem
|
||||
{
|
||||
Id = 1,
|
||||
Count = _context.Holidays.AsQueryable()
|
||||
.Where(h => h.Category.ToUpper() == "NORMAL")
|
||||
.Where(x => x.Year == year.ToCeYear())
|
||||
.Where(x => x.HolidayDate.Month == 1)
|
||||
.OrderBy(d => d.Name).Count(),
|
||||
Month = "ม.ค.",
|
||||
MonthFull = "มกราคม",
|
||||
},new SummaryHolidayByMonthResponseItem
|
||||
{
|
||||
Id = 2,
|
||||
Count = _context.Holidays.AsQueryable()
|
||||
.Where(h => h.Category.ToUpper() == "NORMAL")
|
||||
.Where(x => x.Year == year.ToCeYear())
|
||||
.Where(x => x.HolidayDate.Month == 2)
|
||||
.OrderBy(d => d.Name).Count(),
|
||||
Month = "ก.พ.",
|
||||
MonthFull = "กุมภาพันธ์",
|
||||
},new SummaryHolidayByMonthResponseItem
|
||||
{
|
||||
Id = 3,
|
||||
Count = _context.Holidays.AsQueryable()
|
||||
.Where(h => h.Category.ToUpper() == "NORMAL")
|
||||
.Where(x => x.Year == year.ToCeYear())
|
||||
.Where(x => x.HolidayDate.Month == 3)
|
||||
.OrderBy(d => d.Name).Count(),
|
||||
Month = "มี.ค.",
|
||||
MonthFull = "มีนาคม",
|
||||
},new SummaryHolidayByMonthResponseItem
|
||||
{
|
||||
Id = 4,
|
||||
Count = _context.Holidays.AsQueryable()
|
||||
.Where(h => h.Category.ToUpper() == "NORMAL")
|
||||
.Where(x => x.Year == year.ToCeYear())
|
||||
.Where(x => x.HolidayDate.Month == 4)
|
||||
.OrderBy(d => d.Name).Count(),
|
||||
Month = "เม.ย.",
|
||||
MonthFull = "เมษายน",
|
||||
},new SummaryHolidayByMonthResponseItem
|
||||
{
|
||||
Id = 5,
|
||||
Count = _context.Holidays.AsQueryable()
|
||||
.Where(h => h.Category.ToUpper() == "NORMAL")
|
||||
.Where(x => x.Year == year.ToCeYear())
|
||||
.Where(x => x.HolidayDate.Month == 5)
|
||||
.OrderBy(d => d.Name).Count(),
|
||||
Month = "พ.ค.",
|
||||
MonthFull = "พฤษภาคม",
|
||||
},new SummaryHolidayByMonthResponseItem
|
||||
{
|
||||
Id = 6,
|
||||
Count = _context.Holidays.AsQueryable()
|
||||
.Where(h => h.Category.ToUpper() == "NORMAL")
|
||||
.Where(x => x.Year == year.ToCeYear())
|
||||
.Where(x => x.HolidayDate.Month == 6)
|
||||
.OrderBy(d => d.Name).Count(),
|
||||
Month = "มิ.ย.",
|
||||
MonthFull = "มิถุนายน",
|
||||
},new SummaryHolidayByMonthResponseItem
|
||||
{
|
||||
Id = 7,
|
||||
Count = _context.Holidays.AsQueryable()
|
||||
.Where(h => h.Category.ToUpper() == "NORMAL")
|
||||
.Where(x => x.Year == year.ToCeYear())
|
||||
.Where(x => x.HolidayDate.Month == 7)
|
||||
.OrderBy(d => d.Name).Count(),
|
||||
Month = "ก.ค.",
|
||||
MonthFull = "กรกฎาคม",
|
||||
},new SummaryHolidayByMonthResponseItem
|
||||
{
|
||||
Id = 8,
|
||||
Count = _context.Holidays.AsQueryable()
|
||||
.Where(h => h.Category.ToUpper() == "NORMAL")
|
||||
.Where(x => x.Year == year.ToCeYear())
|
||||
.Where(x => x.HolidayDate.Month == 8)
|
||||
.OrderBy(d => d.Name).Count(),
|
||||
Month = "ส.ค.",
|
||||
MonthFull = "สิงหาคม",
|
||||
},new SummaryHolidayByMonthResponseItem
|
||||
{
|
||||
Id = 9,
|
||||
Count = _context.Holidays.AsQueryable()
|
||||
.Where(h => h.Category.ToUpper() == "NORMAL")
|
||||
.Where(x => x.Year == year.ToCeYear())
|
||||
.Where(x => x.HolidayDate.Month == 9)
|
||||
.OrderBy(d => d.Name).Count(),
|
||||
Month = "ก.ย.",
|
||||
MonthFull = "กันยายน",
|
||||
},new SummaryHolidayByMonthResponseItem
|
||||
{
|
||||
Id = 10,
|
||||
Count = _context.Holidays.AsQueryable()
|
||||
.Where(h => h.Category.ToUpper() == "NORMAL")
|
||||
.Where(x => x.Year == year.ToCeYear())
|
||||
.Where(x => x.HolidayDate.Month == 10)
|
||||
.OrderBy(d => d.Name).Count(),
|
||||
Month = "ต.ค.",
|
||||
MonthFull = "ตุลาคม",
|
||||
},new SummaryHolidayByMonthResponseItem
|
||||
{
|
||||
Id = 11,
|
||||
Count = _context.Holidays.AsQueryable()
|
||||
.Where(h => h.Category.ToUpper() == "NORMAL")
|
||||
.Where(x => x.Year == year.ToCeYear())
|
||||
.Where(x => x.HolidayDate.Month == 11)
|
||||
.OrderBy(d => d.Name).Count(),
|
||||
Month = "พ.ย.",
|
||||
MonthFull = "พฤศจิกายน",
|
||||
},new SummaryHolidayByMonthResponseItem
|
||||
{
|
||||
Id = 12,
|
||||
Count = _context.Holidays.AsQueryable()
|
||||
.Where(h => h.Category.ToUpper() == "NORMAL")
|
||||
.Where(x => x.Year == year.ToCeYear())
|
||||
.Where(x => x.HolidayDate.Month == 12)
|
||||
.OrderBy(d => d.Name).Count(),
|
||||
Month = "ธ.ค.",
|
||||
MonthFull = "ธันวาคม",
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return await Task.FromResult(res);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
using System.Security.Claims;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using BMA.EHR.Infrastructure.Persistence;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.MetaData.Service.Services
|
||||
{
|
||||
public class PositionExecutiveService
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public PositionExecutiveService(ApplicationDBContext context,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_context = context;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Properties "
|
||||
|
||||
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||
|
||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
public async Task<IEnumerable<PositionExecutive>> GetsAsync(bool showAll = true)
|
||||
{
|
||||
if (showAll)
|
||||
return await _context.PositionExecutives.AsQueryable()
|
||||
.OrderBy(d => d.Name)
|
||||
.ToListAsync();
|
||||
else
|
||||
return await _context.PositionExecutives.AsQueryable()
|
||||
.Where(p => p.IsActive)
|
||||
.OrderBy(d => d.Name)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<PositionExecutive?> GetByIdAsync(Guid id)
|
||||
{
|
||||
return await _context.PositionExecutives.FirstOrDefaultAsync(x => x.Id == id);
|
||||
}
|
||||
|
||||
public async Task UpdateAsync(Guid id, PositionExecutive updated)
|
||||
{
|
||||
var existData = await _context.PositionExecutives.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (existData != null)
|
||||
{
|
||||
if (existData.Name != updated.Name || existData.IsActive != updated.IsActive)
|
||||
{
|
||||
existData.Name = updated.Name;
|
||||
existData.IsActive = updated.IsActive;
|
||||
existData.LastUpdatedAt = DateTime.Now;
|
||||
existData.LastUpdateUserId = UserId ?? "";
|
||||
existData.LastUpdateFullName = FullName ?? "";
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task CreateAsync(PositionExecutive inserted)
|
||||
{
|
||||
inserted.CreatedUserId = UserId ?? "";
|
||||
inserted.CreatedFullName = FullName ?? "System Administrator";
|
||||
inserted.CreatedAt = DateTime.Now;
|
||||
inserted.LastUpdatedAt = DateTime.Now;
|
||||
inserted.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
inserted.LastUpdateUserId = UserId ?? "";
|
||||
|
||||
await _context.PositionExecutives.AddAsync(inserted);
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
using System.Security.Claims;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using BMA.EHR.Infrastructure.Persistence;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
|
||||
namespace BMA.EHR.MetaData.Service.Services
|
||||
{
|
||||
public class PositionExecutiveSideService
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public PositionExecutiveSideService(ApplicationDBContext context,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_context = context;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Properties "
|
||||
|
||||
public string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||
|
||||
public string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
public async Task<IEnumerable<PositionExecutiveSide>> GetsAsync(bool showAll = true)
|
||||
{
|
||||
if (showAll)
|
||||
return await _context.PositionExecutiveSides.AsQueryable()
|
||||
.OrderBy(d => d.Name)
|
||||
.ToListAsync();
|
||||
else
|
||||
return await _context.PositionExecutiveSides.AsQueryable()
|
||||
.Where(p => p.IsActive)
|
||||
.OrderBy(d => d.Name)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<PositionExecutiveSide?> GetByIdAsync(Guid id)
|
||||
{
|
||||
return await _context.PositionExecutiveSides.FirstOrDefaultAsync(x => x.Id == id);
|
||||
}
|
||||
|
||||
public async Task UpdateAsync(Guid id, PositionExecutiveSide updated)
|
||||
{
|
||||
var existData = await _context.PositionExecutiveSides.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (existData != null)
|
||||
{
|
||||
if (existData.Name != updated.Name || existData.Note != updated.Note || existData.IsActive != updated.IsActive)
|
||||
{
|
||||
existData.Name = updated.Name;
|
||||
existData.IsActive = updated.IsActive;
|
||||
existData.Note = updated.Note;
|
||||
existData.LastUpdatedAt = DateTime.Now;
|
||||
existData.LastUpdateUserId = UserId ?? "";
|
||||
existData.LastUpdateFullName = FullName ?? "";
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task CreateAsync(PositionExecutiveSide inserted)
|
||||
{
|
||||
inserted.CreatedUserId = UserId ?? "";
|
||||
inserted.CreatedFullName = FullName ?? "System Administrator";
|
||||
inserted.CreatedAt = DateTime.Now;
|
||||
inserted.LastUpdatedAt = DateTime.Now;
|
||||
inserted.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
inserted.LastUpdateUserId = UserId ?? "";
|
||||
|
||||
await _context.PositionExecutiveSides.AddAsync(inserted);
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
90
BMA.EHR.MetaData.Service/Services/PositionLevelService.cs
Normal file
90
BMA.EHR.MetaData.Service/Services/PositionLevelService.cs
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
using System.Security.Claims;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using BMA.EHR.Infrastructure.Persistence;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
|
||||
namespace BMA.EHR.MetaData.Service.Services
|
||||
{
|
||||
public class PositionLevelService
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public PositionLevelService(ApplicationDBContext context,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_context = context;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Properties "
|
||||
|
||||
public string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||
|
||||
public string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
public async Task<IEnumerable<PositionLevel>> GetsAsync(bool showAll = true)
|
||||
{
|
||||
if (showAll)
|
||||
return await _context.PositionLevels.AsQueryable()
|
||||
.OrderBy(d => d.Level)
|
||||
.ToListAsync();
|
||||
else
|
||||
return await _context.PositionLevels.AsQueryable()
|
||||
.Where(p => p.IsActive)
|
||||
.OrderBy(d => d.Level)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<PositionLevel?> GetByIdAsync(Guid id)
|
||||
{
|
||||
return await _context.PositionLevels.FirstOrDefaultAsync(x => x.Id == id);
|
||||
}
|
||||
|
||||
public async Task UpdateAsync(Guid id, PositionLevel updated)
|
||||
{
|
||||
var existData = await _context.PositionLevels.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (existData != null)
|
||||
{
|
||||
if (existData.Name != updated.Name || existData.ShortName != updated.ShortName || existData.Level != updated.Level || existData.IsActive != updated.IsActive)
|
||||
{
|
||||
existData.Level = updated.Level;
|
||||
existData.Name = updated.Name;
|
||||
existData.ShortName = updated.ShortName;
|
||||
existData.IsActive = updated.IsActive;
|
||||
existData.LastUpdatedAt = DateTime.Now;
|
||||
existData.LastUpdateUserId = UserId ?? "";
|
||||
existData.LastUpdateFullName = FullName ?? "";
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task CreateAsync(PositionLevel inserted)
|
||||
{
|
||||
inserted.CreatedUserId = UserId ?? "";
|
||||
inserted.CreatedFullName = FullName ?? "System Administrator";
|
||||
inserted.CreatedAt = DateTime.Now;
|
||||
inserted.LastUpdatedAt = DateTime.Now;
|
||||
inserted.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
inserted.LastUpdateUserId = UserId ?? "";
|
||||
|
||||
await _context.PositionLevels.AddAsync(inserted);
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
89
BMA.EHR.MetaData.Service/Services/PositionLineService.cs
Normal file
89
BMA.EHR.MetaData.Service/Services/PositionLineService.cs
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
using System.Security.Claims;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using BMA.EHR.Infrastructure.Persistence;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
|
||||
namespace BMA.EHR.MetaData.Service.Services
|
||||
{
|
||||
public class PositionLineService
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public PositionLineService(ApplicationDBContext context,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_context = context;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Properties "
|
||||
|
||||
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||
|
||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
public async Task<IEnumerable<PositionLine>> GetsAsync(bool showAll = true)
|
||||
{
|
||||
if (showAll)
|
||||
return await _context.PositionLines.AsQueryable()
|
||||
.OrderBy(d => d.Name)
|
||||
.ToListAsync();
|
||||
else
|
||||
return await _context.PositionLines.AsQueryable()
|
||||
.Where(p => p.IsActive)
|
||||
.OrderBy(d => d.Name)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<PositionLine?> GetByIdAsync(Guid id)
|
||||
{
|
||||
return await _context.PositionLines.FirstOrDefaultAsync(x => x.Id == id);
|
||||
}
|
||||
|
||||
public async Task UpdateAsync(Guid id, PositionLine updated)
|
||||
{
|
||||
var existData = await _context.PositionLines.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (existData != null)
|
||||
{
|
||||
if (existData.Name != updated.Name || existData.IsActive != updated.IsActive)
|
||||
{
|
||||
existData.Name = updated.Name;
|
||||
existData.IsActive = updated.IsActive;
|
||||
existData.LastUpdatedAt = DateTime.Now;
|
||||
existData.LastUpdateUserId = UserId ?? "";
|
||||
existData.LastUpdateFullName = FullName ?? "";
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task CreateAsync(PositionLine inserted)
|
||||
{
|
||||
inserted.CreatedUserId = UserId ?? "";
|
||||
inserted.CreatedFullName = FullName ?? "System Administrator";
|
||||
inserted.CreatedAt = DateTime.Now;
|
||||
inserted.LastUpdatedAt = DateTime.Now;
|
||||
inserted.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
inserted.LastUpdateUserId = UserId ?? "";
|
||||
|
||||
await _context.PositionLines.AddAsync(inserted);
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
89
BMA.EHR.MetaData.Service/Services/PositionPathService.cs
Normal file
89
BMA.EHR.MetaData.Service/Services/PositionPathService.cs
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
using System.Security.Claims;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using BMA.EHR.Infrastructure.Persistence;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
|
||||
namespace BMA.EHR.MetaData.Service.Services
|
||||
{
|
||||
public class PositionPathService
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public PositionPathService(ApplicationDBContext context,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_context = context;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Properties "
|
||||
|
||||
public string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||
|
||||
public string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
public async Task<IEnumerable<PositionPath>> GetsAsync(bool showAll = true)
|
||||
{
|
||||
if (showAll)
|
||||
return await _context.PositionPaths.AsQueryable()
|
||||
.OrderBy(d => d.Name)
|
||||
.ToListAsync();
|
||||
else
|
||||
return await _context.PositionPaths.AsQueryable()
|
||||
.Where(p => p.IsActive)
|
||||
.OrderBy(d => d.Name)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<PositionPath?> GetByIdAsync(Guid id)
|
||||
{
|
||||
return await _context.PositionPaths.FirstOrDefaultAsync(x => x.Id == id);
|
||||
}
|
||||
|
||||
public async Task UpdateAsync(Guid id, PositionPath updated)
|
||||
{
|
||||
var existData = await _context.PositionPaths.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (existData != null)
|
||||
{
|
||||
if (existData.Name != updated.Name || existData.Note != updated.Note || existData.IsActive != updated.IsActive)
|
||||
{
|
||||
existData.Name = updated.Name;
|
||||
existData.IsActive = updated.IsActive;
|
||||
existData.Note = updated.Note;
|
||||
existData.LastUpdatedAt = DateTime.Now;
|
||||
existData.LastUpdateUserId = UserId ?? "";
|
||||
existData.LastUpdateFullName = FullName ?? "";
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task CreateAsync(PositionPath inserted)
|
||||
{
|
||||
inserted.CreatedUserId = UserId ?? "";
|
||||
inserted.CreatedFullName = FullName ?? "System Administrator";
|
||||
inserted.CreatedAt = DateTime.Now;
|
||||
inserted.LastUpdatedAt = DateTime.Now;
|
||||
inserted.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
inserted.LastUpdateUserId = UserId ?? "";
|
||||
|
||||
await _context.PositionPaths.AddAsync(inserted);
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
89
BMA.EHR.MetaData.Service/Services/PositionPathSideService.cs
Normal file
89
BMA.EHR.MetaData.Service/Services/PositionPathSideService.cs
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
using System.Security.Claims;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using BMA.EHR.Infrastructure.Persistence;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
|
||||
namespace BMA.EHR.MetaData.Service.Services
|
||||
{
|
||||
public class PositionPathSideService
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public PositionPathSideService(ApplicationDBContext context,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_context = context;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Properties "
|
||||
|
||||
public string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||
|
||||
public string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
public async Task<IEnumerable<PositionPathSide>> GetsAsync(bool showAll = true)
|
||||
{
|
||||
if (showAll)
|
||||
return await _context.PositionPathSides.AsQueryable()
|
||||
.OrderBy(d => d.Name)
|
||||
.ToListAsync();
|
||||
else
|
||||
return await _context.PositionPathSides.AsQueryable()
|
||||
.Where(p => p.IsActive)
|
||||
.OrderBy(d => d.Name)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<PositionPathSide?> GetByIdAsync(Guid id)
|
||||
{
|
||||
return await _context.PositionPathSides.FirstOrDefaultAsync(x => x.Id == id);
|
||||
}
|
||||
|
||||
public async Task UpdateAsync(Guid id, PositionPathSide updated)
|
||||
{
|
||||
var existData = await _context.PositionPathSides.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (existData != null)
|
||||
{
|
||||
if (existData.Name != updated.Name || existData.Note != updated.Note || existData.IsActive != updated.IsActive)
|
||||
{
|
||||
existData.Name = updated.Name;
|
||||
existData.IsActive = updated.IsActive;
|
||||
existData.Note = updated.Note;
|
||||
existData.LastUpdatedAt = DateTime.Now;
|
||||
existData.LastUpdateUserId = UserId ?? "";
|
||||
existData.LastUpdateFullName = FullName ?? "";
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task CreateAsync(PositionPathSide inserted)
|
||||
{
|
||||
inserted.CreatedUserId = UserId ?? "";
|
||||
inserted.CreatedFullName = FullName ?? "System Administrator";
|
||||
inserted.CreatedAt = DateTime.Now;
|
||||
inserted.LastUpdatedAt = DateTime.Now;
|
||||
inserted.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
inserted.LastUpdateUserId = UserId ?? "";
|
||||
|
||||
await _context.PositionPathSides.AddAsync(inserted);
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
88
BMA.EHR.MetaData.Service/Services/PositionTypeService.cs
Normal file
88
BMA.EHR.MetaData.Service/Services/PositionTypeService.cs
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
using System.Security.Claims;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using BMA.EHR.Infrastructure.Persistence;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
|
||||
namespace BMA.EHR.MetaData.Service.Services
|
||||
{
|
||||
public class PositionTypeService
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public PositionTypeService(ApplicationDBContext context,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_context = context;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Properties "
|
||||
|
||||
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||
|
||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
public async Task<IEnumerable<PositionType>> GetsAsync(bool showAll = true)
|
||||
{
|
||||
if (showAll)
|
||||
return await _context.PositionTypes.AsQueryable()
|
||||
.OrderBy(d => d.Name)
|
||||
.ToListAsync();
|
||||
else
|
||||
return await _context.PositionTypes.AsQueryable()
|
||||
.Where(p => p.IsActive)
|
||||
.OrderBy(d => d.Name)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<PositionType?> GetByIdAsync(Guid id)
|
||||
{
|
||||
return await _context.PositionTypes.FirstOrDefaultAsync(x => x.Id == id);
|
||||
}
|
||||
|
||||
public async Task UpdateAsync(Guid id, PositionType updated)
|
||||
{
|
||||
var existData = await _context.PositionTypes.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (existData != null)
|
||||
{
|
||||
if (existData.Name != updated.Name || existData.IsActive != updated.IsActive)
|
||||
{
|
||||
existData.Name = updated.Name;
|
||||
existData.IsActive = updated.IsActive;
|
||||
existData.LastUpdatedAt = DateTime.Now;
|
||||
existData.LastUpdateUserId = UserId ?? "";
|
||||
existData.LastUpdateFullName = FullName ?? "";
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task CreateAsync(PositionType inserted)
|
||||
{
|
||||
inserted.CreatedUserId = UserId ?? "";
|
||||
inserted.CreatedFullName = FullName ?? "System Administrator";
|
||||
inserted.CreatedAt = DateTime.Now;
|
||||
inserted.LastUpdatedAt = DateTime.Now;
|
||||
inserted.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
inserted.LastUpdateUserId = UserId ?? "";
|
||||
|
||||
await _context.PositionTypes.AddAsync(inserted);
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -1,38 +1,36 @@
|
|||
{
|
||||
"Serilog": {
|
||||
"MinimumLevel": {
|
||||
"Default": "Information",
|
||||
"Override": {
|
||||
"Microsoft": "Information",
|
||||
"System": "Warning"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ElasticConfiguration": {
|
||||
"Uri": "http://localhost:9200"
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
|
||||
// "DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||
"DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||
"ExamConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_exam_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||
},
|
||||
"Jwt": {
|
||||
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
||||
"Issuer": "https://identity.frappet.com/realms/bma-ehr"
|
||||
},
|
||||
"EPPlus": {
|
||||
"ExcelPackage": {
|
||||
"LicenseContext": "NonCommercial"
|
||||
}
|
||||
},
|
||||
"MinIO": {
|
||||
"Endpoint": "https://s3.frappet.com/",
|
||||
"AccessKey": "frappet",
|
||||
"SecretKey": "P@ssw0rd",
|
||||
"BucketName": "bma-recruit"
|
||||
},
|
||||
"Protocol": "HTTPS",
|
||||
"API_KEY": "fKRL16yyEgbyTEJdsMw2h64tGSCmkW685PRtM3CygzX1JOSdptT9UJtpgWwKM8FybRTJups3GTFwj27ZRvlPdIkv3XgCoVJaD5LmR06ozuEPvCCRSdp2WFthg08V5xHc56fTPfZLpr1VmXrhd6dvYhHIqKkQUJR02Rlkss11cLRWEQOssEFVA4xdu2J5DIRO1EM5m7wRRvEwcDB4mYRXD9HH52SMq6iYqUWEWsMwLdbk7QW9yYESUEuzMW5gWrb6vIeWZxJV5bTz1PcWUyR7eO9Fyw1F5DiQYc9JgzTC1mW7cv31fEtTtrfbJYKIb5EbWilqIEUKC6A0UKBDDek35ML0006cqRVm0pvdOH6jeq7VQyYrhdXe59dBEyhYGUIfozoVBvW7Up4QBuOMjyPjSqJPlMBKwaseptfrblxQV1AOOivSBpf1ZcQyOZ8JktRtKUDSuXsmG0lsXwFlI3JCeSHdpVdgZWFYcJPegqfrB6KotR02t9AVkpLs1ZWrixwz"
|
||||
}
|
||||
"Serilog": {
|
||||
"MinimumLevel": {
|
||||
"Default": "Information",
|
||||
"Override": {
|
||||
"Microsoft": "Information",
|
||||
"System": "Warning"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ElasticConfiguration": {
|
||||
"Uri": "http://localhost:9200"
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||
"ExamConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_exam_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||
},
|
||||
"Jwt": {
|
||||
"Key": "Hp3234M8rH1KjIdvhlUStayo6vIUOIeI76NKyIsiXJ8",
|
||||
"Issuer": "https://id.frappet.synology.me/realms/bma-ehr"
|
||||
},
|
||||
"EPPlus": {
|
||||
"ExcelPackage": {
|
||||
"LicenseContext": "NonCommercial"
|
||||
}
|
||||
},
|
||||
"MinIO": {
|
||||
"Endpoint": "https://s3.frappet.com/",
|
||||
"AccessKey": "frappet",
|
||||
"SecretKey": "P@ssw0rd",
|
||||
"BucketName": "bma-recruit"
|
||||
},
|
||||
"Protocol": "HTTPS",
|
||||
"API_KEY": "fKRL16yyEgbyTEJdsMw2h64tGSCmkW685PRtM3CygzX1JOSdptT9UJtpgWwKM8FybRTJups3GTFwj27ZRvlPdIkv3XgCoVJaD5LmR06ozuEPvCCRSdp2WFthg08V5xHc56fTPfZLpr1VmXrhd6dvYhHIqKkQUJR02Rlkss11cLRWEQOssEFVA4xdu2J5DIRO1EM5m7wRRvEwcDB4mYRXD9HH52SMq6iYqUWEWsMwLdbk7QW9yYESUEuzMW5gWrb6vIeWZxJV5bTz1PcWUyR7eO9Fyw1F5DiQYc9JgzTC1mW7cv31fEtTtrfbJYKIb5EbWilqIEUKC6A0UKBDDek35ML0006cqRVm0pvdOH6jeq7VQyYrhdXe59dBEyhYGUIfozoVBvW7Up4QBuOMjyPjSqJPlMBKwaseptfrblxQV1AOOivSBpf1ZcQyOZ8JktRtKUDSuXsmG0lsXwFlI3JCeSHdpVdgZWFYcJPegqfrB6KotR02t9AVkpLs1ZWrixwz"
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"realm": "bma-ehr",
|
||||
"auth-server-url": "https://identity.frappet.com",
|
||||
"auth-server-url": "https://id.frappet.synology.me",
|
||||
"ssl-required": "external",
|
||||
"resource": "bma-ehr",
|
||||
"public-client": true
|
||||
|
|
|
|||
|
|
@ -341,15 +341,15 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
|
||||
data.CreatedAt,
|
||||
data.Reason,
|
||||
data.EducationOld,
|
||||
educationOld = data.EducationOld == "/" || data.EducationOld == null ? null : data.EducationOld,
|
||||
data.salary,
|
||||
data.PositionTypeOld,
|
||||
data.PositionLevelOld,
|
||||
data.PositionNumberOld,
|
||||
data.OrganizationPositionOld,
|
||||
organizationPositionOld = data.OrganizationPositionOld == "/" || data.OrganizationPositionOld == null ? null : data.OrganizationPositionOld,
|
||||
data.PositionDate,
|
||||
data.AmountOld,
|
||||
data.OrganizationOld,
|
||||
organizationOld = data.OrganizationOld == "/" || data.OrganizationOld == null ? null : data.OrganizationOld,
|
||||
data.positionOld,
|
||||
// Docs = placementAppointmentDocs,
|
||||
data.typeCommand,
|
||||
|
|
|
|||
|
|
@ -161,10 +161,10 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
if (org.result.isOfficer == false)
|
||||
{
|
||||
rootId = org.result.rootId == null ? "" : org.result.rootId;
|
||||
child1Id = org.result.child1Id == null ? "" : org.result.child1Id;
|
||||
child2Id = org.result.child2Id == null ? "" : org.result.child2Id;
|
||||
child3Id = org.result.child3Id == null ? "" : org.result.child3Id;
|
||||
child4Id = org.result.child4Id == null ? "" : org.result.child4Id;
|
||||
// child1Id = org.result.child1Id == null ? "" : org.result.child1Id;
|
||||
// child2Id = org.result.child2Id == null ? "" : org.result.child2Id;
|
||||
// child3Id = org.result.child3Id == null ? "" : org.result.child3Id;
|
||||
// child4Id = org.result.child4Id == null ? "" : org.result.child4Id;
|
||||
var data1 = await _context.PlacementProfiles
|
||||
.Where(x => x.Placement.Id == examId)
|
||||
.Where(x => x.Draft == true)
|
||||
|
|
@ -633,10 +633,10 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
if (org.result.isOfficer == false)
|
||||
{
|
||||
rootId = org.result.rootId == null ? "" : org.result.rootId;
|
||||
child1Id = org.result.child1Id == null ? "" : org.result.child1Id;
|
||||
child2Id = org.result.child2Id == null ? "" : org.result.child2Id;
|
||||
child3Id = org.result.child3Id == null ? "" : org.result.child3Id;
|
||||
child4Id = org.result.child4Id == null ? "" : org.result.child4Id;
|
||||
// child1Id = org.result.child1Id == null ? "" : org.result.child1Id;
|
||||
// child2Id = org.result.child2Id == null ? "" : org.result.child2Id;
|
||||
// child3Id = org.result.child3Id == null ? "" : org.result.child3Id;
|
||||
// child4Id = org.result.child4Id == null ? "" : org.result.child4Id;
|
||||
var placement = await _context.Placements
|
||||
.Where(x => x.Id == examId)
|
||||
.Select(x => new
|
||||
|
|
@ -1318,7 +1318,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
profile.nodeId = null;
|
||||
profile.posmasterId = null;
|
||||
profile.positionId = null;
|
||||
profile.Draft = false;
|
||||
profile.Draft = null;
|
||||
profile.typeCommand = null;
|
||||
profile.PlacementStatus = "UN-CONTAIN";
|
||||
_context.SaveChanges();
|
||||
|
|
@ -2785,5 +2785,49 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
}
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// report1
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("report1")]
|
||||
public async Task<ActionResult<ResponseObject>> report1(string? nodeId = null, int? node = 0, DateOnly? startDate = null, DateOnly? startEnd = null)
|
||||
{
|
||||
var data = new
|
||||
{
|
||||
template = "placement01",
|
||||
reportName = "xlsx-report",
|
||||
data = ""
|
||||
};
|
||||
|
||||
return Success(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// report2
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("report2")]
|
||||
public async Task<ActionResult<ResponseObject>> report2(string? nodeId = null, int? node = 0, DateOnly? startDate = null, DateOnly? startEnd = null)
|
||||
{
|
||||
|
||||
var data = new
|
||||
{
|
||||
template = "placement02",
|
||||
reportName = "xlsx-report",
|
||||
data = ""
|
||||
|
||||
};
|
||||
|
||||
return Success(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -335,14 +335,14 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
|
||||
data.CreatedAt,
|
||||
data.Reason,
|
||||
data.EducationOld,
|
||||
educationOld = data.EducationOld == "/" || data.EducationOld == null ? null : data.EducationOld,
|
||||
data.AmountOld,
|
||||
data.PositionOld,
|
||||
data.OrganizationOld,
|
||||
organizationOld = data.OrganizationOld == "/" || data.OrganizationOld == null ? null : data.OrganizationOld,
|
||||
data.PositionTypeOld,
|
||||
data.PositionLevelOld,
|
||||
data.PositionNumberOld,
|
||||
data.OrganizationPositionOld,
|
||||
organizationPositionOld = data.OrganizationPositionOld == "/" || data.OrganizationPositionOld == null ? null: data.OrganizationPositionOld,
|
||||
data.IsActive,
|
||||
|
||||
data.rootOld,
|
||||
|
|
|
|||
|
|
@ -576,7 +576,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
(org.result.child3 == null ? "" : org.result.child3 + "/") +
|
||||
(org.result.child2 == null ? "" : org.result.child2 + "/") +
|
||||
(org.result.child1 == null ? "" : org.result.child1 + "/") +
|
||||
(org.result.root == null ? "" : org.result.root + "/");
|
||||
(org.result.root == null ? "" : org.result.root);
|
||||
retirementDeceased.RetirementDeceasedNotis.Add(retirementDeceasedNoti);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
var child2Id = "";
|
||||
var child3Id = "";
|
||||
var child4Id = "";
|
||||
var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
|
||||
var apiUrl = $"{_configuration["API"]}/org/permission/checkOrg/{UserId}";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue