Merge branch 'develop' into working

This commit is contained in:
Suphonchai Phoonsawat 2024-06-27 19:31:42 +07:00
commit def2b8f7fe
11 changed files with 1650 additions and 1056 deletions

View file

@ -92,7 +92,7 @@ namespace BMA.EHR.Application.Repositories.Commands
Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "" :
p.PlacementEducations.FirstOrDefault().Degree,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId,
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Oc = p.root == null ? "" : p.root,
PositionName = p.positionName == null ? "" : p.positionName,
@ -151,7 +151,7 @@ namespace BMA.EHR.Application.Repositories.Commands
Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "" :
p.PlacementEducations.FirstOrDefault().Degree,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId,
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Oc = p.root == null ? "" : p.root,
PositionName = p.positionName == null ? "" : p.positionName,
@ -215,7 +215,7 @@ namespace BMA.EHR.Application.Repositories.Commands
Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "" :
p.PlacementEducations.FirstOrDefault().Degree,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId,
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
OldOc = pf.Oc == null ? "" : pf.Oc.Replace("/", " "),
Probation = pf.IsProbation ? "(อยู่ระหว่างปฏิบัติหน้าที่ราชการ)" : "",
@ -285,7 +285,7 @@ namespace BMA.EHR.Application.Repositories.Commands
Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "" :
p.PlacementEducations.FirstOrDefault().Degree,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId,
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
OldOc = pf.Oc == null ? "" : pf.Oc.Replace("/", " "),
OldPositionName = pf.Position == null ? "" : pf.Position.Name,
@ -351,13 +351,13 @@ namespace BMA.EHR.Application.Repositories.Commands
{
Education = p.EducationOld == null ? "-" : p.EducationOld,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId,
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
OldOc = p.rootOld == null ? "" : p.rootOld,
OldPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
OldPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld,
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
OldSalaryDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
NewOc = p.root == null ? "" : p.root,
@ -421,13 +421,13 @@ namespace BMA.EHR.Application.Repositories.Commands
// pf.Educations.OrderByDescending(x => x.StartDate).FirstOrDefault().Degree,
Education = p.EducationOld == null ? "-" : p.EducationOld,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId,
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
OldOc = p.rootOld == null ? "" : p.rootOld,
OldPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
OldPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld,
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
OldSalaryDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
NewOc = p.root == null ? "" : p.root,
@ -475,20 +475,20 @@ namespace BMA.EHR.Application.Repositories.Commands
{
Education = p.EducationOld == null ? "-" : p.EducationOld,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId,
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
OldOc = p.rootOld == null ? "" : p.rootOld,
OldPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
OldPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld,
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
OldSalaryDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
NewOc = p.rootOld == null ? "" : p.rootOld,
NewPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
NewPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
NewPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
NewPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld,
NewPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
LeaveDate = p.LeaveDate == null ? "" : p.LeaveDate.Value.ToThaiShortDate2().ToThaiNumber(),
@ -525,20 +525,20 @@ namespace BMA.EHR.Application.Repositories.Commands
{
Education = p.EducationOld == null ? "-" : p.EducationOld,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId,
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
OldOc = p.rootOld == null ? "" : p.rootOld,
OldPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
OldPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld,
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
OldSalaryDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
NewOc = p.rootOld == null ? "" : p.rootOld,
NewPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
NewPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
NewPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
NewPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld,
NewPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
LeaveDate = p.LeaveDate == null ? "" : p.LeaveDate.Value.ToThaiShortDate2().ToThaiNumber(),
@ -570,7 +570,7 @@ namespace BMA.EHR.Application.Repositories.Commands
IssuerOrganizationName = r.Command.IssuerOrganizationName,
AuthorizedUserFullName = r.Command.AuthorizedUserFullName,
AuthorizedPosition = r.Command.AuthorizedPosition,
CitizenId = r.CitizenId,
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
PlacementCommandIssuer = r.Command.PlacementCommandIssuer ?? "",
PlacementCommandNo = r.Command.PlacementCommandNo == null ? "" : r.Command.PlacementCommandNo.ToThaiNumber(),
@ -606,7 +606,7 @@ namespace BMA.EHR.Application.Repositories.Commands
IssuerOrganizationName = r.Command.IssuerOrganizationName,
AuthorizedUserFullName = r.Command.AuthorizedUserFullName,
AuthorizedPosition = r.Command.AuthorizedPosition,
CitizenId = r.CitizenId,
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
PlacementCommandIssuer = r.Command.PlacementCommandIssuer ?? "",
PlacementCommandNo = r.Command.PlacementCommandNo == null ? "" : r.Command.PlacementCommandNo.ToThaiNumber(),
@ -647,13 +647,13 @@ namespace BMA.EHR.Application.Repositories.Commands
select new CommandType13Response
{
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId,
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Organization = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
PositionName = p.PositionOld == null ? "" : p.PositionOld,
PositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
PositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
PositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld,
PositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
Salary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
//Salary = pf.Salaries == null || pf.Salaries.Count == 0 ? "" : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
ActiveDate = p.Date == null ? "" : p.Date.Value.ToThaiShortDate2().ToThaiNumber(),
@ -695,7 +695,7 @@ namespace BMA.EHR.Application.Repositories.Commands
{
Education = p.EducationOld == null ? "-" : p.EducationOld,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId,
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
OldOc = p.OrganizationPositionOld ?? "",
OldPositionName = p.OrganizationPositionOld ?? "",
@ -744,7 +744,7 @@ namespace BMA.EHR.Application.Repositories.Commands
select new CommandType15Response
{
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId,
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
PositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
// PositionName = p.Profile.Position == null ? "" : p.Profile.Position.Name,
@ -836,7 +836,7 @@ namespace BMA.EHR.Application.Repositories.Commands
select new CommandType17Response
{
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId,
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
PositionName = p.PositionOld ?? "",
Organization = p.OrganizationPositionOld ?? "",
@ -888,7 +888,7 @@ namespace BMA.EHR.Application.Repositories.Commands
IssuerOrganizationName = r.Command.IssuerOrganizationName,
AuthorizedUserFullName = r.Command.AuthorizedUserFullName,
AuthorizedPosition = r.Command.AuthorizedPosition,
CitizenId = r.CitizenId,
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
// PositionName = p.Profile.Position == null ? "" : p.Profile.Position.Name,
Organization = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
@ -943,7 +943,7 @@ namespace BMA.EHR.Application.Repositories.Commands
IssuerOrganizationName = r.Command.IssuerOrganizationName,
AuthorizedUserFullName = r.Command.AuthorizedUserFullName,
AuthorizedPosition = r.Command.AuthorizedPosition,
CitizenId = r.CitizenId,
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
PositionName = p.Profile.Position == null ? "" : p.Profile.Position.Name,
Organization = p.OrganizationPositionOld ?? "",
@ -997,7 +997,7 @@ namespace BMA.EHR.Application.Repositories.Commands
IssuerOrganizationName = r.Command.IssuerOrganizationName,
AuthorizedUserFullName = r.Command.AuthorizedUserFullName,
AuthorizedPosition = r.Command.AuthorizedPosition,
CitizenId = r.CitizenId,
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
PositionName = p.Profile.Position == null ? "" : p.Profile.Position.Name,
Organization = p.OrganizationPositionOld ?? "",
@ -1060,7 +1060,7 @@ namespace BMA.EHR.Application.Repositories.Commands
select new CommandType21Response
{
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId.ToThaiNumber(),
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Organization = r.Organization == null ? "" : r.Organization.ToThaiNumber(),
PositionName = r.PositionName == null ? "" : r.PositionName.ToThaiNumber(),
@ -1192,7 +1192,7 @@ namespace BMA.EHR.Application.Repositories.Commands
select new CommandType21Response
{
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId.ToThaiNumber(),
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Organization = p.OrganizationPositionOld ?? "",
PositionName = p.PositionOld ?? "",
@ -1311,7 +1311,7 @@ namespace BMA.EHR.Application.Repositories.Commands
{
fullName = $"{org.result.prefix}{org.result.firstName} {org.result.lastName}",
positionname = org.result.position,
positionno = org.result.posNo,
positionno = org.result.posNo == null ? null : org.result.posNo.ToThaiNumber(),
organizationname = org.result.organization,
salary = org.result.salary == null ? null : org.result.salary.Value.ToNumericNoDecimalText().ToString(),
};

View file

@ -2764,7 +2764,7 @@ namespace BMA.EHR.Application.Repositories.Commands
isProbation = true,
isLeave = false,
dateRetire = (DateTime?)null,
dateAppoint = placementProfile.RecruitDate == null ? (DateTime?)null : placementProfile.RecruitDate,
dateAppoint = command.CommandAffectDate == null ? null : command.CommandAffectDate,
dateStart = command.CommandAffectDate == null ? null : command.CommandAffectDate,
govAgeAbsent = 0,
govAgePlus = 0,
@ -5562,6 +5562,10 @@ namespace BMA.EHR.Application.Repositories.Commands
{
PersonId = x.RefPlacementProfileId,
Id = x.RefDisciplineId,
CommandAffectDate = command.CommandAffectDate,
CommandNo = command.CommandNo,
CommandYear = command.CommandYear.ToInteger().ToThaiYear(),
Detail = "คำสั่งลงโทษ ตัดเงินเดือน"
});
var _baseAPI = _configuration["API"];
@ -5710,6 +5714,10 @@ namespace BMA.EHR.Application.Repositories.Commands
{
PersonId = x.RefPlacementProfileId,
Id = x.RefDisciplineId,
CommandAffectDate = command.CommandAffectDate,
CommandNo = command.CommandNo,
CommandYear = command.CommandYear.ToInteger().ToThaiYear(),
Detail = "คำสั่งลงโทษ ตัดเงินเดือน"
});
var _baseAPI = _configuration["API"];
@ -6346,6 +6354,10 @@ namespace BMA.EHR.Application.Repositories.Commands
{
PersonId = x.RefPlacementProfileId,
Id = x.RefDisciplineId,
CommandAffectDate = command.CommandAffectDate,
CommandNo = command.CommandNo,
CommandYear = command.CommandYear.ToInteger().ToThaiYear(),
Detail = "คำสั่งลงโทษ ตัดเงินเดือน"
});
var baseAPI = _configuration["API"];
@ -6475,6 +6487,10 @@ namespace BMA.EHR.Application.Repositories.Commands
{
PersonId = x.RefPlacementProfileId,
Id = x.RefDisciplineId,
CommandAffectDate = command.CommandAffectDate,
CommandNo = command.CommandNo,
CommandYear = command.CommandYear.ToInteger().ToThaiYear(),
Detail = "คำสั่งลงโทษ ตัดเงินเดือน"
});
var baseAPI = _configuration["API"];
@ -6605,6 +6621,10 @@ namespace BMA.EHR.Application.Repositories.Commands
{
PersonId = x.RefPlacementProfileId,
Id = x.RefDisciplineId,
CommandAffectDate = command.CommandAffectDate,
CommandNo = command.CommandNo,
CommandYear = command.CommandYear.ToInteger().ToThaiYear(),
Detail = "คำสั่งลงโทษ ตัดเงินเดือน"
});
var baseAPI = _configuration["API"];
@ -6735,6 +6755,10 @@ namespace BMA.EHR.Application.Repositories.Commands
{
PersonId = x.RefPlacementProfileId,
Id = x.RefDisciplineId,
CommandAffectDate = command.CommandAffectDate,
CommandNo = command.CommandNo,
CommandYear = command.CommandYear.ToInteger().ToThaiYear(),
Detail = "คำสั่งลงโทษ ตัดเงินเดือน"
});
var baseAPI = _configuration["API"];
@ -6865,6 +6889,10 @@ namespace BMA.EHR.Application.Repositories.Commands
{
PersonId = x.RefPlacementProfileId,
Id = x.RefDisciplineId,
CommandAffectDate = command.CommandAffectDate,
CommandNo = command.CommandNo,
CommandYear = command.CommandYear.ToInteger().ToThaiYear(),
Detail = "คำสั่งลงโทษ ลดขั้นเงินเดือน"
});
var baseAPI = _configuration["API"];
@ -6995,6 +7023,10 @@ namespace BMA.EHR.Application.Repositories.Commands
{
PersonId = x.RefPlacementProfileId,
Id = x.RefDisciplineId,
CommandAffectDate = command.CommandAffectDate,
CommandNo = command.CommandNo,
CommandYear = command.CommandYear.ToInteger().ToThaiYear(),
Detail = "คำสั่งเพิ่มโทษ"
});
var baseAPI = _configuration["API"];
@ -7125,6 +7157,10 @@ namespace BMA.EHR.Application.Repositories.Commands
{
PersonId = x.RefPlacementProfileId,
Id = x.RefDisciplineId,
CommandAffectDate = command.CommandAffectDate,
CommandNo = command.CommandNo,
CommandYear = command.CommandYear.ToInteger().ToThaiYear(),
Detail = "คำสั่งงดโทษ"
});
var baseAPI = _configuration["API"];
@ -7255,6 +7291,10 @@ namespace BMA.EHR.Application.Repositories.Commands
{
PersonId = x.RefPlacementProfileId,
Id = x.RefDisciplineId,
CommandAffectDate = command.CommandAffectDate,
CommandNo = command.CommandNo,
CommandYear = command.CommandYear.ToInteger().ToThaiYear(),
Detail = "คำสั่งยุติเรื่อง"
});
var baseAPI = _configuration["API"];

View file

@ -1,4 +1,6 @@
using System.Drawing;
using System.Net.Http.Headers;
using System.Net.Http.Json;
using BMA.EHR.Application.Common.Interfaces;
using BMA.EHR.Application.Messaging;
using BMA.EHR.Domain.Models.HR;
@ -404,7 +406,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
throw new Exception("คำขอนี้ยังไม่ได้รับการอนุมัติจากผู้บังคับบัญชา ไม่สามารถทำรายการได้");
}
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(rawData.KeycloakUserId,AccessToken);
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(rawData.KeycloakUserId, AccessToken);
if (profile == null)
{
throw new Exception(GlobalMessages.DataNotFound);
@ -421,19 +423,38 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
// insert to profile leave
var profileLeave = new ProfileLeave
// var profileLeave = new ProfileLeave
// {
// DateStartLeave = rawData.LeaveStartDate,
// DateEndLeave = rawData.LeaveEndDate,
// TotalLeave = rawData.LeaveTotal,
// Status = "approve",
// Reason = rawData.LeaveDetail,
// ProfileId = profile.Id, // change from profile object to id
// TypeLeave = leaveType
// };
// _appDbContext.Set<ProfileLeave>().Add(profileLeave);
var _baseAPI = _configuration["API"];
var apiUrlSalary = $"{_baseAPI}/org/profile/leave";
using (var client = new HttpClient())
{
DateStartLeave = rawData.LeaveStartDate,
DateEndLeave = rawData.LeaveEndDate,
TotalLeave = rawData.LeaveTotal,
Status = "approve",
Reason = rawData.LeaveDetail,
ProfileId = profile.Id, // change from profile object to id
TypeLeave = leaveType
};
_appDbContext.Set<ProfileLeave>().Add(profileLeave);
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
{
profileId = profile.Id,
leaveTypeId = leaveType?.Id ?? null,
dateLeaveStart = rawData.LeaveStartDate,
dateLeaveEnd = rawData.LeaveEndDate,
leaveDays = 0,//หน้า fe ไม่ได้ใช้
leaveCount = 0,//หน้า fe ไม่ได้ใช้
totalLeave = rawData.LeaveTotal,
status = "approve",
reason = rawData.LeaveDetail,
});
// var _result = await _res.Content.ReadAsStringAsync();
}
await _appDbContext.SaveChangesAsync();
// insert to process timestamp

View file

@ -11,6 +11,8 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Swashbuckle.AspNetCore.Annotations;
using System.Configuration;
using System.Net.Http.Headers;
using System.Security.Claims;
namespace BMA.EHR.DisciplineResult.Service.Controllers
@ -26,15 +28,18 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
private readonly DisciplineDbContext _context;
private readonly MinIODisciplineService _documentService;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly IConfiguration _configuration;
public DisciplineResultController(DisciplineDbContext context,
MinIODisciplineService documentService,
IHttpContextAccessor httpContextAccessor)
IHttpContextAccessor httpContextAccessor,
IConfiguration configuration)
{
// _repository = repository;
_context = context;
_documentService = documentService;
_httpContextAccessor = httpContextAccessor;
_configuration = configuration;
}
#region " Properties "
@ -42,6 +47,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
#endregion
@ -465,6 +471,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
foreach (var d in req.result)
{
var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Include(x=>x.DisciplineDisciplinary)
.Where(x => x.Status == "REPORT")
.Where(x => x.Id == d.id)
.FirstOrDefaultAsync();
@ -472,6 +479,24 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
{
data.Status = "NEW";
data.CommandTypeId = null;
var baseAPI = _configuration["API"];
var apiUrlDiscipline = $"{baseAPI}org/profile/discipline";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlDiscipline);
var _res = await client.PostAsJsonAsync(apiUrlDiscipline, new
{
profileId = d.personId,
date = d.commandAffectDate,
detail = data.DisciplineDisciplinary.Title,
level = data.DisciplineDisciplinary.DisciplinaryFaultLevel,
refCommandDate = "",
refCommandNo = $"{d.commandNo}/{d.commandYear}",
unStigma = d.detail,
});
var _result = await _res.Content.ReadAsStringAsync();
}
}
await _context.SaveChangesAsync();
}
@ -492,6 +517,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
foreach (var d in req.result)
{
var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Include(x => x.DisciplineDisciplinary)
.Where(x => x.StatusDiscard == "REPORT")
.Where(x => x.Id == d.id)
.FirstOrDefaultAsync();
@ -499,6 +525,24 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
{
data.StatusDiscard = "NEW";
data.CommandTypeDiscardId = null;
var baseAPI = _configuration["API"];
var apiUrlDiscipline = $"{baseAPI}org/profile/discipline";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlDiscipline);
var _res = await client.PostAsJsonAsync(apiUrlDiscipline, new
{
profileId = d.personId,
date = d.commandAffectDate,
detail = data.DisciplineDisciplinary.Title,
level = data.DisciplineDisciplinary.DisciplinaryFaultLevel,
refCommandDate = "",
refCommandNo = $"{d.commandNo}/{d.commandYear}",
unStigma = d.detail,
});
var _result = await _res.Content.ReadAsStringAsync();
}
}
await _context.SaveChangesAsync();
}
@ -519,17 +563,58 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
foreach (var d in req.result)
{
var data1 = await _context.DisciplineInvestigate_ProfileComplaints
.Include(x => x.DisciplineInvestigate)
.Where(x => x.IsReport == "REPORT")
.Where(x => x.Id == d.id)
.FirstOrDefaultAsync();
if (data1 != null)
{
data1.IsReport = "NEW";
var baseAPI = _configuration["API"];
var apiUrlDiscipline = $"{baseAPI}org/profile/discipline";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlDiscipline);
var _res = await client.PostAsJsonAsync(apiUrlDiscipline, new
{
profileId = d.personId,
date = d.commandAffectDate,
detail = data1.DisciplineInvestigate.Title,
level = "",
refCommandDate = "",
refCommandNo = $"{d.commandNo}/{d.commandYear}",
unStigma = d.detail,
});
var _result = await _res.Content.ReadAsStringAsync();
}
}
var data2 = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Include(x => x.DisciplineDisciplinary)
.Where(x => x.IsReport == "REPORT")
.Where(x => x.Id == d.id)
.FirstOrDefaultAsync();
if (data2 != null)
data2.IsReport = "NEW";
if (data2 != null) {
data2.IsReport = "NEW";
var baseAPI = _configuration["API"];
var apiUrlDiscipline = $"{baseAPI}org/profile/discipline";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlDiscipline);
var _res = await client.PostAsJsonAsync(apiUrlDiscipline, new
{
profileId = d.personId,
date = d.commandAffectDate,
detail = data2.DisciplineDisciplinary.Title,
level = data2.DisciplineDisciplinary.DisciplinaryFaultLevel,
refCommandDate = "",
refCommandNo = $"{d.commandNo}/{d.commandYear}",
unStigma = d.detail,
});
var _result = await _res.Content.ReadAsStringAsync();
}
}
await _context.SaveChangesAsync();
}
return Success();
@ -549,11 +634,31 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
foreach (var d in req.result)
{
var data = await _context.DisciplineReport_Profiles
.Include(x => x.DisciplineDisciplinary)
.Where(x => x.Status == "REPORT")
.Where(x => x.Id == d.id)
.FirstOrDefaultAsync();
if (data != null)
if (data != null) {
data.Status = "DONE";
var baseAPI = _configuration["API"];
var apiUrlDiscipline = $"{baseAPI}org/profile/discipline";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlDiscipline);
var _res = await client.PostAsJsonAsync(apiUrlDiscipline, new
{
profileId = d.personId,
date = d.commandAffectDate,
detail = data.DisciplineDisciplinary.Title,
level = data.DisciplineDisciplinary.DisciplinaryFaultLevel,
refCommandDate = "",
refCommandNo = $"{d.commandNo}/{d.commandYear}",
unStigma = d.detail,
});
var _result = await _res.Content.ReadAsStringAsync();
}
}
await _context.SaveChangesAsync();
}
return Success();

View file

@ -13,5 +13,10 @@ namespace BMA.EHR.Discipline.Service.Requests
public Guid id { get; set; } = Guid.Empty;
public Guid personId { get; set; } = Guid.Empty;
public Guid? commandId { get; set; } = Guid.Empty;
public DateTime? commandAffectDate { get; set; }
public string? commandNo { get; set; }
public string? commandYear { get; set; }
public string? detail { get; set; }
}
}

View file

@ -662,24 +662,24 @@ namespace BMA.EHR.Placement.Service.Controllers
return Success();
}
// /// <summary>
// /// หน่วยงานที่ถูกเลือกไปแล้ว
// /// </summary>
// /// <returns></returns>
// /// <response code="200"></response>
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
// [HttpGet("use")]
// public async Task<ActionResult<ResponseObject>> GetAppointmentsUse()
// {
// var appointments = await _context.PlacementAppointments
// // .Where(x => x.PositionNumber != null)
// // .Where(x => x.Profile.ProfileType == "officer")
// // .Select(x => x.PositionNumber.Id)
// .ToListAsync();
// return Success(appointments);
// }
/// <summary>
/// หน่วยงานที่ถูกเลือกไปแล้ว
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("use")]
public async Task<ActionResult<ResponseObject>> GetAppointmentsUse()
{
var appointments = await _context.PlacementAppointments
.Where(x => x.posmasterId != null)
.Where(x => x.Status != "DONE")
.Where(x => x.type == "OFFICER")
.Select(x => x.posmasterId)
.ToListAsync();
return Success(appointments);
}
}
}

View file

@ -648,24 +648,24 @@ namespace BMA.EHR.Placement.Service.Controllers
return Success();
}
// /// <summary>
// /// หน่วยงานที่ถูกเลือกไปแล้ว
// /// </summary>
// /// <returns></returns>
// /// <response code="200"></response>
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
// [HttpGet("use")]
// public async Task<ActionResult<ResponseObject>> GetAppointmentsUse()
// {
// var appointments = await _context.PlacementAppointments
// .Where(x => x.PositionNumber != null)
// .Where(x => x.Profile.ProfileType == "employee" && x.Profile.EmployeeClass == "perm")
// .Select(x => x.PositionNumber.Id)
// .ToListAsync();
// return Success(appointments);
// }
/// <summary>
/// หน่วยงานที่ถูกเลือกไปแล้ว
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("use")]
public async Task<ActionResult<ResponseObject>> GetAppointmentsUse()
{
var appointments = await _context.PlacementAppointments
.Where(x => x.posmasterId != null)
.Where(x => x.Status != "DONE")
.Where(x => x.type == "EMPLOYEE")
.Select(x => x.posmasterId)
.ToListAsync();
return Success(appointments);
}
}
}

View file

@ -1045,17 +1045,6 @@ namespace BMA.EHR.Placement.Service.Controllers
return Success();
}
[HttpGet("position/use")]
public async Task<ActionResult<ResponseObject>> GetPositionUse()
{
var position = await _context.PlacementProfiles
.Where(x => x.PositionNumber != null)
.Select(x => x.PositionNumber)
.ToListAsync();
return Success(position);
}
[HttpPut("position/{personalId:length(36)}")]
public async Task<ActionResult<ResponseObject>> UpdatePositionDraft([FromBody] List<Guid> items, Guid personalId)
{
@ -1283,5 +1272,24 @@ namespace BMA.EHR.Placement.Service.Controllers
return Success();
}
/// <summary>
/// หน่วยงานที่ถูกเลือกไปแล้ว
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("use")]
public async Task<ActionResult<ResponseObject>> GetPositionUse()
{
var position = await _context.PlacementProfiles
.Where(x => x.posmasterId != null)
.Where(x => x.PlacementStatus != "CONTAIN")
.Select(x => x.posmasterId)
.ToListAsync();
return Success(position);
}
}
}

View file

@ -794,23 +794,23 @@ namespace BMA.EHR.Placement.Service.Controllers
return Success();
}
// /// <summary>
// /// หน่วยงานที่ถูกเลือกไปแล้ว
// /// </summary>
// /// <returns></returns>
// /// <response code="200"></response>
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
// [HttpGet("use")]
// public async Task<ActionResult<ResponseObject>> GetReceiveUse()
// {
// var receives = await _context.PlacementReceives
// .Where(x => x.PositionNumber != null)
// .Select(x => x.PositionNumber.Id)
// .ToListAsync();
// return Success(receives);
// }
/// <summary>
/// หน่วยงานที่ถูกเลือกไปแล้ว
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("use")]
public async Task<ActionResult<ResponseObject>> GetPositionUse()
{
var position = await _context.PlacementReceives
.Where(x => x.posmasterId != null)
.Where(x => x.Status != "DONE")
.Select(x => x.posmasterId)
.ToListAsync();
return Success(position);
}
}
}

View file

@ -525,24 +525,5 @@ namespace BMA.EHR.Placement.Service.Controllers
return Success();
}
/// <summary>
/// หน่วยงานที่ถูกเลือกไปแล้ว
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("use")]
public async Task<ActionResult<ResponseObject>> GetRelocationUse()
{
var relocation = await _context.PlacementRelocations
.Where(x => x.PositionNumber != null)
.Select(x => x.PositionNumber.Id)
.ToListAsync();
return Success(relocation);
}
}
}

File diff suppressed because it is too large Load diff