no message

This commit is contained in:
Kittapath 2024-06-25 09:27:34 +07:00
parent c1cfaa3b6d
commit 468bd38e0b
9 changed files with 247 additions and 166 deletions

View file

@ -2765,7 +2765,7 @@ namespace BMA.EHR.Application.Repositories.Commands
isLeave = false,
dateRetire = (DateTime?)null,
dateAppoint = placementProfile.RecruitDate == null ? (DateTime?)null : placementProfile.RecruitDate,
dateStart = (DateTime?)null,
dateStart = command.CommandAffectDate == null ? null : command.CommandAffectDate,
govAgeAbsent = 0,
govAgePlus = 0,
birthDate = placementProfile.DateOfBirth == null ? (DateTime?)null : placementProfile.DateOfBirth,
@ -2858,17 +2858,22 @@ namespace BMA.EHR.Application.Repositories.Commands
{
profileId = profileId,
date = command.CommandAffectDate == null ? (DateTime?)null : command.CommandAffectDate,
amount = recv.Amount == null ? null : recv.Amount,
positionSalaryAmount = placementProfile.PositionSalaryAmount == null ? null : placementProfile.PositionSalaryAmount,
mouthSalaryAmount = placementProfile.MouthSalaryAmount == null ? null : placementProfile.MouthSalaryAmount,
posNo = placementProfile.PosNumber == null ? string.Empty : placementProfile.PosNumber.ToString(),
amount = placementProfile.Amount,
positionSalaryAmount = placementProfile.PositionSalaryAmount,
mouthSalaryAmount = placementProfile.MouthSalaryAmount,
posNo = placementProfile.posMasterNo == null ? "" :
placementProfile.node == 4 ? $"{placementProfile.child4ShortName}{placementProfile.posMasterNo}" :
placementProfile.node == 3 ? $"{placementProfile.child3ShortName}{placementProfile.posMasterNo}" :
placementProfile.node == 2 ? $"{placementProfile.child2ShortName}{placementProfile.posMasterNo}" :
placementProfile.node == 1 ? $"{placementProfile.child1ShortName}{placementProfile.posMasterNo}" :
placementProfile.node == 0 ? $"{placementProfile.rootShortName}{placementProfile.posMasterNo}" : "",
position = placementProfile.positionName == null ? string.Empty : placementProfile.positionName,
positionLine = string.Empty,
positionPathSide = string.Empty,
positionExecutive = string.Empty,
positionType = placementProfile.posTypeName == null ? string.Empty : placementProfile.posTypeName,
positionLevel = placementProfile.PositionLevel == null ? string.Empty : placementProfile.PositionLevel.Name,
refCommandNo = string.Empty,
positionLevel = placementProfile.posLevelName == null ? string.Empty : placementProfile.posLevelName,
refCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
templateDoc = string.Empty,
});
var _result = await _res.Content.ReadAsStringAsync();
@ -2884,7 +2889,7 @@ namespace BMA.EHR.Application.Repositories.Commands
{
posmasterId = placementProfile.posmasterId,
positionId = placementProfile.positionId,
profileId = placementProfile.profileId,
profileId = profileId,
});
var _result = await _res.Content.ReadAsStringAsync();
}
@ -3012,8 +3017,8 @@ namespace BMA.EHR.Application.Repositories.Commands
profileId = placementProfile.profileId,
date = command.CommandAffectDate,
amount = recv.Amount,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
positionSalaryAmount = recv.PositionSalaryAmount,
mouthSalaryAmount = recv.MouthSalaryAmount,
posNo = placementProfile.posMasterNo == null ? "" :
placementProfile.node == 4 ? $"{placementProfile.child4ShortName}{placementProfile.posMasterNo}" :
placementProfile.node == 3 ? $"{placementProfile.child3ShortName}{placementProfile.posMasterNo}" :
@ -3026,7 +3031,7 @@ namespace BMA.EHR.Application.Repositories.Commands
positionExecutive = "",
positionType = placementProfile.posTypeName,
positionLevel = placementProfile.posLevelName,
refCommandNo = command.CommandNo,
refCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
SalaryRef = "คำสั่งแต่งตั้ง คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
@ -3167,8 +3172,8 @@ namespace BMA.EHR.Application.Repositories.Commands
profileId = placementProfile.profileId,
date = command.CommandAffectDate,
amount = recv.Amount,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
positionSalaryAmount = recv.PositionSalaryAmount,
mouthSalaryAmount = recv.MouthSalaryAmount,
posNo = placementProfile.posMasterNo == null ? "" :
placementProfile.node == 4 ? $"{placementProfile.child4ShortName}{placementProfile.posMasterNo}" :
placementProfile.node == 3 ? $"{placementProfile.child3ShortName}{placementProfile.posMasterNo}" :
@ -3181,7 +3186,7 @@ namespace BMA.EHR.Application.Repositories.Commands
positionExecutive = "",
positionType = placementProfile.posTypeName,
positionLevel = placementProfile.posLevelName,
refCommandNo = command.CommandNo,
refCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
SalaryRef = "คำสั่งย้าย คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
@ -3324,8 +3329,8 @@ namespace BMA.EHR.Application.Repositories.Commands
profileId = placementProfile.profileId,
date = command.CommandAffectDate,
amount = recv.Amount,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
positionSalaryAmount = recv.PositionSalaryAmount,
mouthSalaryAmount = recv.MouthSalaryAmount,
posNo = placementProfile.posMasterNo == null ? "" :
placementProfile.node == 4 ? $"{placementProfile.child4ShortName}{placementProfile.posMasterNo}" :
placementProfile.node == 3 ? $"{placementProfile.child3ShortName}{placementProfile.posMasterNo}" :
@ -3338,7 +3343,7 @@ namespace BMA.EHR.Application.Repositories.Commands
positionExecutive = "",
positionType = placementProfile.posTypeName,
positionLevel = placementProfile.posLevelName,
refCommandNo = command.CommandNo,
refCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
templateDoc = "คำสั่งแต่งตั้ง คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
@ -3483,8 +3488,8 @@ namespace BMA.EHR.Application.Repositories.Commands
profileId = placementProfile.profileId,
date = command.CommandAffectDate,
amount = recv.Amount,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
positionSalaryAmount = recv.PositionSalaryAmount,
mouthSalaryAmount = recv.MouthSalaryAmount,
posNo = placementProfile.posMasterNo == null ? "" :
placementProfile.node == 4 ? $"{placementProfile.child4ShortName}{placementProfile.posMasterNo}" :
placementProfile.node == 3 ? $"{placementProfile.child3ShortName}{placementProfile.posMasterNo}" :
@ -3497,7 +3502,7 @@ namespace BMA.EHR.Application.Repositories.Commands
positionExecutive = "",
positionType = placementProfile.posTypeName,
positionLevel = placementProfile.posLevelName,
refCommandNo = command.CommandNo,
refCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
templateDoc = "คำสั่งเลื่อน คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
@ -3639,8 +3644,8 @@ namespace BMA.EHR.Application.Repositories.Commands
profileId = placementProfile.profileId,
date = command.CommandAffectDate,
amount = recv.Amount,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
positionSalaryAmount = recv.PositionSalaryAmount,
mouthSalaryAmount = recv.MouthSalaryAmount,
posNo = placementProfile.posMasterNo == null ? "" :
placementProfile.node == 4 ? $"{placementProfile.child4ShortName}{placementProfile.posMasterNo}" :
placementProfile.node == 3 ? $"{placementProfile.child3ShortName}{placementProfile.posMasterNo}" :
@ -3653,7 +3658,7 @@ namespace BMA.EHR.Application.Repositories.Commands
positionExecutive = "",
positionType = placementProfile.posTypeName,
positionLevel = placementProfile.posLevelName,
refCommandNo = command.CommandNo,
refCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
templateDoc = "คำสั่งย้าย คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
@ -3796,8 +3801,8 @@ namespace BMA.EHR.Application.Repositories.Commands
profileId = placementProfile.profileId,
date = command.CommandAffectDate,
amount = recv.Amount,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
positionSalaryAmount = recv.PositionSalaryAmount,
mouthSalaryAmount = recv.MouthSalaryAmount,
posNo = placementProfile.PositionNumberOld,
position = placementProfile.PositionOld,
positionLine = "",
@ -3805,7 +3810,7 @@ namespace BMA.EHR.Application.Repositories.Commands
positionExecutive = "",
positionType = placementProfile.PositionTypeOld,
positionLevel = placementProfile.PositionLevelOld,
refCommandNo = command.CommandNo,
refCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
templateDoc = "คำสั่งบรรจุและแต่งตั้งข้าราชการฯ กลับเข้ารับราชการ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
@ -3822,7 +3827,7 @@ namespace BMA.EHR.Application.Repositories.Commands
{
isLeave = false,
leaveReason = _null,
leaveDate = _null,
dateLeave = _null,
});
var _result = await _res.Content.ReadAsStringAsync();
}
@ -3948,8 +3953,8 @@ namespace BMA.EHR.Application.Repositories.Commands
profileId = placementProfile.profileId,
date = command.CommandAffectDate,
amount = recv.Amount,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
positionSalaryAmount = recv.PositionSalaryAmount,
mouthSalaryAmount = recv.MouthSalaryAmount,
posNo = placementProfile.PositionNumberOld,
position = placementProfile.PositionOld,
positionLine = "",
@ -3957,7 +3962,7 @@ namespace BMA.EHR.Application.Repositories.Commands
positionExecutive = "",
positionType = placementProfile.PositionTypeOld,
positionLevel = placementProfile.PositionLevelOld,
refCommandNo = command.CommandNo,
refCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
templateDoc = "คำสั่งบรรจุและแต่งตั้งผู้ออกไปรับราชการทหารกลับเข้ารับราชการ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
@ -3974,7 +3979,7 @@ namespace BMA.EHR.Application.Repositories.Commands
{
isLeave = false,
leaveReason = _null,
leaveDate = _null,
dateLeave = _null,
});
var _result = await _res.Content.ReadAsStringAsync();
}
@ -4536,7 +4541,7 @@ namespace BMA.EHR.Application.Repositories.Commands
// {
// isLeave = true,
// leaveReason = "คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ",
// leaveDate = command.CommandAffectDate,
// dateLeave = command.CommandAffectDate,
// });
// var _result = await _res.Content.ReadAsStringAsync();
// }
@ -4550,8 +4555,8 @@ namespace BMA.EHR.Application.Repositories.Commands
profileId = data.profileId,
date = command.CommandAffectDate,
amount = recv.Amount,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
positionSalaryAmount = recv.PositionSalaryAmount,
mouthSalaryAmount = recv.MouthSalaryAmount,
posNo = data.PositionNumberOld,
position = data.PositionOld,
positionLine = "",
@ -4559,7 +4564,7 @@ namespace BMA.EHR.Application.Repositories.Commands
positionExecutive = "",
positionType = data.PositionTypeOld,
positionLevel = data.PositionLevelOld,
refCommandNo = command.CommandNo,
refCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
templateDoc = "คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
@ -4703,8 +4708,8 @@ namespace BMA.EHR.Application.Repositories.Commands
profileId = placementProfile.profileId,
date = command.CommandAffectDate,
amount = recv.Amount,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
positionSalaryAmount = recv.PositionSalaryAmount,
mouthSalaryAmount = recv.MouthSalaryAmount,
posNo = placementProfile.posMasterNo == null ? "" :
placementProfile.node == 4 ? $"{placementProfile.child4ShortName}{placementProfile.posMasterNo}" :
placementProfile.node == 3 ? $"{placementProfile.child3ShortName}{placementProfile.posMasterNo}" :
@ -4717,7 +4722,7 @@ namespace BMA.EHR.Application.Repositories.Commands
positionExecutive = "",
positionType = placementProfile.posTypeName,
positionLevel = placementProfile.posLevelName,
refCommandNo = command.CommandNo,
refCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
templateDoc = "รับโอนข้าราชการกรุงเทพมหานครสามัญ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
@ -4863,8 +4868,8 @@ namespace BMA.EHR.Application.Repositories.Commands
profileId = data.profileId,
date = command.CommandAffectDate,
amount = recv.Amount,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
positionSalaryAmount = recv.PositionSalaryAmount,
mouthSalaryAmount = recv.MouthSalaryAmount,
posNo = data.PositionNumberOld,
position = data.PositionOld,
positionLine = "",
@ -4872,7 +4877,7 @@ namespace BMA.EHR.Application.Repositories.Commands
positionExecutive = "",
positionType = data.PositionTypeOld,
positionLevel = data.PositionLevelOld,
refCommandNo = command.CommandNo,
refCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
templateDoc = "คำสั่งให้ช่วยราชการ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
@ -5017,8 +5022,8 @@ namespace BMA.EHR.Application.Repositories.Commands
profileId = data.profileId,
date = command.CommandAffectDate,
amount = recv.Amount,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
positionSalaryAmount = recv.PositionSalaryAmount,
mouthSalaryAmount = recv.MouthSalaryAmount,
posNo = data.PositionNumberOld,
position = data.PositionOld,
positionLine = "",
@ -5026,7 +5031,7 @@ namespace BMA.EHR.Application.Repositories.Commands
positionExecutive = "",
positionType = data.PositionTypeOld,
positionLevel = data.PositionLevelOld,
refCommandNo = command.CommandNo,
refCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
templateDoc = "คำสั่งส่งตัวกลับ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
@ -5172,7 +5177,7 @@ namespace BMA.EHR.Application.Repositories.Commands
{
isLeave = true,
leaveReason = "ลาออกจากราชการ",
leaveDate = command.CommandAffectDate,
dateLeave = command.CommandAffectDate,
});
var _result = await _res.Content.ReadAsStringAsync();
}
@ -5187,8 +5192,8 @@ namespace BMA.EHR.Application.Repositories.Commands
profileId = data.profileId,
date = command.CommandAffectDate,
amount = recv.Amount,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
positionSalaryAmount = recv.PositionSalaryAmount,
mouthSalaryAmount = recv.MouthSalaryAmount,
posNo = data.PositionNumberOld,
position = data.PositionOld,
positionLine = "",
@ -5196,7 +5201,7 @@ namespace BMA.EHR.Application.Repositories.Commands
positionExecutive = "",
positionType = data.PositionTypeOld,
positionLevel = data.PositionLevelOld,
refCommandNo = command.CommandNo,
refCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
templateDoc = "คำสั่งอนุญาตให้ข้าราชการลาออกจากราชการ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
@ -5342,7 +5347,7 @@ namespace BMA.EHR.Application.Repositories.Commands
{
isLeave = true,
leaveReason = "ได้รับโทษทางวินัย ให้ออกจากราชการ",
leaveDate = command.CommandAffectDate,
dateLeave = command.CommandAffectDate,
});
var _result = await _res.Content.ReadAsStringAsync();
}
@ -5357,8 +5362,8 @@ namespace BMA.EHR.Application.Repositories.Commands
profileId = data.profileId,
date = command.CommandAffectDate,
amount = recv.Amount,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
positionSalaryAmount = recv.PositionSalaryAmount,
mouthSalaryAmount = recv.MouthSalaryAmount,
posNo = data.PositionNumberOld,
position = data.PositionOld,
positionLine = "",
@ -5366,7 +5371,7 @@ namespace BMA.EHR.Application.Repositories.Commands
positionExecutive = "",
positionType = data.PositionTypeOld,
positionLevel = data.PositionLevelOld,
refCommandNo = command.CommandNo,
refCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
templateDoc = "คำสั่งให้ออกจากราชการ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
@ -5926,9 +5931,9 @@ namespace BMA.EHR.Application.Repositories.Commands
{
profileEmployeeId = data.profileId,
date = command.CommandAffectDate,
amount = data.Amount,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
amount = recv.Amount,
positionSalaryAmount = recv.PositionSalaryAmount,
mouthSalaryAmount = recv.MouthSalaryAmount,
posNo = data.posMasterNo == null ? "" :
data.node == 4 ? $"{data.child4ShortName}{data.posMasterNo}" :
data.node == 3 ? $"{data.child3ShortName}{data.posMasterNo}" :
@ -5938,7 +5943,7 @@ namespace BMA.EHR.Application.Repositories.Commands
position = data.position,
positionType = data.posTypeName,
positionLevel = data.posLevelName,
refCommandNo = command.CommandNo,
refCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
templateDoc = "คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน) คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
@ -6085,7 +6090,7 @@ namespace BMA.EHR.Application.Repositories.Commands
{
isLeave = true,
leaveReason = "ลาออกจากราชการ",
leaveDate = command.CommandAffectDate,
dateLeave = command.CommandAffectDate,
});
var _result = await _res.Content.ReadAsStringAsync();
}
@ -6213,9 +6218,9 @@ namespace BMA.EHR.Application.Repositories.Commands
{
profileEmployeeId = data.profileId,
date = command.CommandAffectDate,
amount = data.Amount,
positionSalaryAmount = 0,
mouthSalaryAmount = 0,
amount = recv.Amount,
positionSalaryAmount = recv.PositionSalaryAmount,
mouthSalaryAmount = recv.MouthSalaryAmount,
posNo = data.posMasterNo == null ? "" :
data.node == 4 ? $"{data.child4ShortName}{data.posMasterNo}" :
data.node == 3 ? $"{data.child3ShortName}{data.posMasterNo}" :
@ -6225,7 +6230,7 @@ namespace BMA.EHR.Application.Repositories.Commands
position = data.position,
positionType = data.posTypeName,
positionLevel = data.posLevelName,
refCommandNo = command.CommandNo,
refCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
templateDoc = "คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
});
var _result = await _res.Content.ReadAsStringAsync();
@ -9463,38 +9468,38 @@ namespace BMA.EHR.Application.Repositories.Commands
// }
// }
// var Salaries = await _dbContext.Set<ProfileSalary>()
// .Where(x => x.Profile.Id == profile.Id)
// .ToListAsync();
// if (Salaries.Count > 0)
// {
// var apiUrlSalary = $"{_baseAPI}/org/profile/salary";
// using (var client = new HttpClient())
// {
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
// foreach (var salary in Salaries)
// {
// var _res = await client.PostAsJsonAsync(apiUrlSalary, new
// {
// profileId = profile.Id,
// date = salary.Date,
// amount = salary.Amount,
// positionSalaryAmount = salary.PositionSalaryAmount,
// mouthSalaryAmount = salary.MouthSalaryAmount,
// posNo = salary.PosNoName,
// position = salary.PositionName,
// positionLine = salary.PositionLineName,
// positionPathSide = salary.PositionPathSideName,
// positionExecutive = salary.PositionExecutiveName,
// positionType = salary.PositionTypeName,
// positionLevel = salary.PositionLevelName,
// refCommandNo = salary.RefCommandNo,
// templateDoc = salary.SalaryRef,
// });
// var _result = await _res.Content.ReadAsStringAsync();
// }
// }
// }
var Salaries = await _dbContext.Set<ProfileSalary>()
.Where(x => x.Profile.Id == profile.Id)
.ToListAsync();
if (Salaries.Count > 0)
{
var apiUrlSalary = $"{_baseAPI}/org/profile/salary";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
foreach (var salary in Salaries)
{
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
{
profileId = profile.Id,
date = salary.Date,
amount = salary.Amount,
positionSalaryAmount = salary.PositionSalaryAmount,
mouthSalaryAmount = salary.MouthSalaryAmount,
posNo = salary.PosNoName,
position = salary.PositionName,
positionLine = salary.PositionLineName,
positionPathSide = salary.PositionPathSideName,
positionExecutive = salary.PositionExecutiveName,
positionType = salary.PositionTypeName,
positionLevel = salary.PositionLevelName,
refCommandNo = salary.RefCommandNo,
templateDoc = salary.SalaryRef,
});
var _result = await _res.Content.ReadAsStringAsync();
}
}
}
// if (profile.Nopaids.Count > 0)
// {
@ -9569,39 +9574,39 @@ namespace BMA.EHR.Application.Repositories.Commands
// }
// }
var Insignias = await _dbContext.Set<ProfileInsignia>()
.Include(x => x.Insignia)
.Where(x => x.Profile.Id == profile.Id)
.ToListAsync();
if (Insignias.Count > 0)
{
var apiUrlInsig = $"{_baseAPI}/org/dotnet/insignia/Dumb";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
foreach (var insignia in Insignias)
{
var _res = await client.PostAsJsonAsync(apiUrlInsig, new
{
profileId = profile.Id,
year = insignia.Year,
no = insignia.No,
volume = insignia.Volume,
section = insignia.Section,
page = insignia.Page,
receiveDate = insignia.ReceiveDate,
insigniaId = insignia.Insignia.Id, //where in node
dateAnnounce = insignia.DateAnnounce,
issue = insignia.Issue,
volumeNo = insignia.VolumeNo,
refCommandDate = insignia.RefCommandDate,
refCommandNo = insignia.RefCommandNo,
note = insignia.Note,
});
var _result = await _res.Content.ReadAsStringAsync();
}
}
}
// var Insignias = await _dbContext.Set<ProfileInsignia>()
// .Include(x => x.Insignia)
// .Where(x => x.Profile.Id == profile.Id)
// .ToListAsync();
// if (Insignias.Count > 0)
// {
// var apiUrlInsig = $"{_baseAPI}/org/dotnet/insignia/Dumb";
// using (var client = new HttpClient())
// {
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
// foreach (var insignia in Insignias)
// {
// var _res = await client.PostAsJsonAsync(apiUrlInsig, new
// {
// profileId = profile.Id,
// year = insignia.Year,
// no = insignia.No,
// volume = insignia.Volume,
// section = insignia.Section,
// page = insignia.Page,
// receiveDate = insignia.ReceiveDate,
// insigniaId = insignia.Insignia.Id, //where in node
// dateAnnounce = insignia.DateAnnounce,
// issue = insignia.Issue,
// volumeNo = insignia.VolumeNo,
// refCommandDate = insignia.RefCommandDate,
// refCommandNo = insignia.RefCommandNo,
// note = insignia.Note,
// });
// var _result = await _res.Content.ReadAsStringAsync();
// }
// }
// }
// if (profile.Honors.Count > 0)
// {

View file

@ -6,7 +6,9 @@ using BMA.EHR.Domain.Models.Notifications;
using BMA.EHR.Domain.Shared;
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using System.Net.Http.Headers;
using System.Text.RegularExpressions;
namespace BMA.EHR.Application.Repositories.MessageQueue
@ -17,16 +19,19 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
private readonly IApplicationDBContext _dbContext;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly IConfiguration _configuration;
#endregion
#region " Constructor and Destuctor "
public InboxRepository(IApplicationDBContext dbContext,
IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
IHttpContextAccessor httpContextAccessor,
IConfiguration configuration) : base(dbContext, httpContextAccessor)
{
_dbContext = dbContext;
_httpContextAccessor = httpContextAccessor;
_configuration = configuration;
}
#endregion
@ -37,17 +42,35 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
{
try
{
var profile = await _dbContext.Set<Profile>()
.FirstOrDefaultAsync(p => p.KeycloakId == Guid.Parse(UserId!));
// var profile = await _dbContext.Set<Profile>()
// .FirstOrDefaultAsync(p => p.KeycloakId == Guid.Parse(UserId!));
if (profile == null)
// if (profile == null)
// {
// return new List<InboxResponse>();
// // throw new Exception(GlobalMessages.DataNotFound);
// }
var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
var profileId = "";
using (var client = new HttpClient())
{
return new List<InboxResponse>();
// throw new Exception(GlobalMessages.DataNotFound);
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
if (org == null || org.result == null)
return new List<InboxResponse>();
profileId = org.result.rootId == null ? "" : org.result.profileId;
}
if (profileId == null || profileId == "")
return new List<InboxResponse>();
var data_search = await _dbContext.Set<Inbox>()
.Where(x => x.ReceiverUserId == profile.Id)
.Where(x => x.ReceiverUserId == Guid.Parse(profileId))
.Where(x => x.DeleteDate == null)
.OrderByDescending(x => x.ReceiveDate)
.Select(x => new InboxResponse

View file

@ -7,7 +7,9 @@ using BMA.EHR.Domain.Models.Notifications;
using BMA.EHR.Domain.Shared;
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using System.Net.Http.Headers;
using System.Text.RegularExpressions;
namespace BMA.EHR.Application.Repositories.MessageQueue
@ -19,6 +21,7 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
private readonly IApplicationDBContext _dbContext;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly EmailSenderService _emailSenderService;
private readonly IConfiguration _configuration;
#endregion
@ -26,11 +29,13 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
public NotificationRepository(IApplicationDBContext dbContext,
EmailSenderService emailSenderService,
IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
IHttpContextAccessor httpContextAccessor,
IConfiguration configuration) : base(dbContext, httpContextAccessor)
{
_dbContext = dbContext;
_httpContextAccessor = httpContextAccessor;
_emailSenderService = emailSenderService;
_configuration = configuration;
}
#endregion
@ -50,8 +55,26 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
// // throw new Exception(GlobalMessages.DataNotFound);
// }
var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
var profileId = "";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
if (org == null || org.result == null)
return new List<InboxResponse>();
profileId = org.result.rootId == null ? "" : org.result.profileId;
}
if (profileId == null || profileId == "")
return new List<InboxResponse>();
var data_search = await _dbContext.Set<Notification>()
.Where(x => x.KeycloakUserId == UserId)
.Where(x => x.ReceiverUserId == Guid.Parse(profileId))
.Where(x => x.DeleteDate == null)
.OrderByDescending(x => x.ReceiveDate)
.ToListAsync();
@ -107,9 +130,26 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
// {
// return 0;
// }
var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
var profileId = "";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
if (org == null || org.result == null)
return 0;
profileId = org.result.rootId == null ? "" : org.result.profileId;
}
if (profileId == null || profileId == "")
return 0;
var data_search = await _dbContext.Set<Notification>()
.Where(x => x.KeycloakUserId == UserId)
.Where(x => x.ReceiverUserId == Guid.Parse(profileId))
.Where(x => x.DeleteDate == null)
.Where(x => x.IsOpen == false)
.OrderByDescending(x => x.ReceiveDate)