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

View file

@ -6,7 +6,9 @@ using BMA.EHR.Domain.Models.Notifications;
using BMA.EHR.Domain.Shared; using BMA.EHR.Domain.Shared;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Net.Http.Headers;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
namespace BMA.EHR.Application.Repositories.MessageQueue namespace BMA.EHR.Application.Repositories.MessageQueue
@ -17,16 +19,19 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
private readonly IApplicationDBContext _dbContext; private readonly IApplicationDBContext _dbContext;
private readonly IHttpContextAccessor _httpContextAccessor; private readonly IHttpContextAccessor _httpContextAccessor;
private readonly IConfiguration _configuration;
#endregion #endregion
#region " Constructor and Destuctor " #region " Constructor and Destuctor "
public InboxRepository(IApplicationDBContext dbContext, public InboxRepository(IApplicationDBContext dbContext,
IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor) IHttpContextAccessor httpContextAccessor,
IConfiguration configuration) : base(dbContext, httpContextAccessor)
{ {
_dbContext = dbContext; _dbContext = dbContext;
_httpContextAccessor = httpContextAccessor; _httpContextAccessor = httpContextAccessor;
_configuration = configuration;
} }
#endregion #endregion
@ -37,17 +42,35 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
{ {
try try
{ {
var profile = await _dbContext.Set<Profile>() // var profile = await _dbContext.Set<Profile>()
.FirstOrDefaultAsync(p => p.KeycloakId == Guid.Parse(UserId!)); // .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())
{ {
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>(); return new List<InboxResponse>();
// throw new Exception(GlobalMessages.DataNotFound); profileId = org.result.rootId == null ? "" : org.result.profileId;
} }
if (profileId == null || profileId == "")
return new List<InboxResponse>();
var data_search = await _dbContext.Set<Inbox>() 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) .Where(x => x.DeleteDate == null)
.OrderByDescending(x => x.ReceiveDate) .OrderByDescending(x => x.ReceiveDate)
.Select(x => new InboxResponse .Select(x => new InboxResponse

View file

@ -7,7 +7,9 @@ using BMA.EHR.Domain.Models.Notifications;
using BMA.EHR.Domain.Shared; using BMA.EHR.Domain.Shared;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Net.Http.Headers;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
namespace BMA.EHR.Application.Repositories.MessageQueue namespace BMA.EHR.Application.Repositories.MessageQueue
@ -19,6 +21,7 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
private readonly IApplicationDBContext _dbContext; private readonly IApplicationDBContext _dbContext;
private readonly IHttpContextAccessor _httpContextAccessor; private readonly IHttpContextAccessor _httpContextAccessor;
private readonly EmailSenderService _emailSenderService; private readonly EmailSenderService _emailSenderService;
private readonly IConfiguration _configuration;
#endregion #endregion
@ -26,11 +29,13 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
public NotificationRepository(IApplicationDBContext dbContext, public NotificationRepository(IApplicationDBContext dbContext,
EmailSenderService emailSenderService, EmailSenderService emailSenderService,
IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor) IHttpContextAccessor httpContextAccessor,
IConfiguration configuration) : base(dbContext, httpContextAccessor)
{ {
_dbContext = dbContext; _dbContext = dbContext;
_httpContextAccessor = httpContextAccessor; _httpContextAccessor = httpContextAccessor;
_emailSenderService = emailSenderService; _emailSenderService = emailSenderService;
_configuration = configuration;
} }
#endregion #endregion
@ -50,8 +55,26 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
// // throw new Exception(GlobalMessages.DataNotFound); // // 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>() 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.DeleteDate == null)
.OrderByDescending(x => x.ReceiveDate) .OrderByDescending(x => x.ReceiveDate)
.ToListAsync(); .ToListAsync();
@ -107,9 +130,26 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
// { // {
// return 0; // 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>() 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.DeleteDate == null)
.Where(x => x.IsOpen == false) .Where(x => x.IsOpen == false)
.OrderByDescending(x => x.ReceiveDate) .OrderByDescending(x => x.ReceiveDate)

View file

@ -42,5 +42,5 @@
"MailFrom": "saraban.csc.rd@bangkok.go.th", "MailFrom": "saraban.csc.rd@bangkok.go.th",
"Port": "25" "Port": "25"
}, },
"API": "https://bma-ehr.frappet.synology.me/api/v1" "API": "https://bma-ehr.frappet.com/api/v1"
} }

View file

@ -20,7 +20,7 @@ namespace BMA.EHR.Domain.Models.Retirement
[Comment("เอกสารประกาศ")] [Comment("เอกสารประกาศ")]
public Document? Document { get; set; } public Document? Document { get; set; }
[Comment("รายละเอียดมติ อกก")] [Comment("รายละเอียดมติ อกก")]
public string Detail { get; set; } = "มาตรา ๑๖ และมาตรา ๒๑ แห่งพระราชบัญญัตบำเหน็จบำนาญข้าราชการส่วนท้องถิ่น พ.ศ.๒๕๗๗ มาตรา ๘ แห่งพระราชบัญญัติบเหน็จบำนาญข้าราชการกรุงเทพมหานคร พ.ศ.๒๕๕๔ ประกอบกับมติ ก.ก. ครั้งที่๑๑/๒๕๕๕ เมื่อวันที่ ๑๕ พฤศจิกายน ๒๕๕๕และมติ อ.ก.ก. สามัญข้ารายการสามัญครั้งที่ ๑/๒๕๖๕ เมื่อวันที่ ๒๑ กุมภาพันธ์ ๒๕๖๕"; public string Detail { get; set; } = "มาตรา ๑๖ และมาตรา ๒๑ แห่งพระราชบัญญัตบำเหน็จบำนาญข้าราชการส่วนท้องถิ่น พ.ศ.๒๕๗๗ มาตรา ๘ แห่งพระราชบัญญัติบเหน็จบำนาญข้าราชการกรุงเทพมหานคร พ.ศ.๒๕๕๔ ประกอบกับมติ ก.ก. ครั้งที่๑๑/๒๕๕๕ เมื่อวันที่ ๑๕ พฤศจิกายน ๒๕๕๕และมติ อ.ก.ก. สามัญข้ารายการสามัญครั้งที่ ๑/๒๕๖๕ เมื่อวันที่ ๒๑ กุมภาพันธ์ ๒๕๖๕";
public virtual List<RetirementPeriodHistory> RetirementPeriodHistorys { get; set; } = new List<RetirementPeriodHistory>(); public virtual List<RetirementPeriodHistory> RetirementPeriodHistorys { get; set; } = new List<RetirementPeriodHistory>();
public virtual List<RetirementProfile> RetirementProfiles { get; set; } = new List<RetirementProfile>(); public virtual List<RetirementProfile> RetirementProfiles { get; set; } = new List<RetirementProfile>();
} }

View file

@ -24,7 +24,7 @@ namespace BMA.EHR.Domain.Models.Retirement
[Comment("เอกสารประกาศ")] [Comment("เอกสารประกาศ")]
public Document? Document { get; set; } public Document? Document { get; set; }
[Comment("รายละเอียดมติ อกก")] [Comment("รายละเอียดมติ อกก")]
public string Detail { get; set; } = "มาตรา ๑๖ และมาตรา ๒๑ แห่งพระราชบัญญัตบำเหน็จบำนาญข้าราชการส่วนท้องถิ่น พ.ศ.๒๕๗๗ มาตรา ๘ แห่งพระราชบัญญัติบเหน็จบำนาญข้าราชการกรุงเทพมหานคร พ.ศ.๒๕๕๔ ประกอบกับมติ ก.ก. ครั้งที่๑๑/๒๕๕๕ เมื่อวันที่ ๑๕ พฤศจิกายน ๒๕๕๕และมติ อ.ก.ก. สามัญข้ารายการสามัญครั้งที่ ๑/๒๕๖๕ เมื่อวันที่ ๒๑ กุมภาพันธ์ ๒๕๖๕"; public string Detail { get; set; } = "มาตรา ๑๖ และมาตรา ๒๑ แห่งพระราชบัญญัตบำเหน็จบำนาญข้าราชการส่วนท้องถิ่น พ.ศ.๒๕๗๗ มาตรา ๘ แห่งพระราชบัญญัติบเหน็จบำนาญข้าราชการกรุงเทพมหานคร พ.ศ.๒๕๕๔ ประกอบกับมติ ก.ก. ครั้งที่๑๑/๒๕๕๕ เมื่อวันที่ ๑๕ พฤศจิกายน ๒๕๕๕และมติ อ.ก.ก. สามัญข้ารายการสามัญครั้งที่ ๑/๒๕๖๕ เมื่อวันที่ ๒๑ กุมภาพันธ์ ๒๕๖๕";
public RetirementPeriod RetirementPeriod { get; set; } public RetirementPeriod RetirementPeriod { get; set; }
} }
} }

View file

@ -54,7 +54,7 @@ namespace BMA.EHR.Report.Service.Controllers
#region " C-PM-01 " #region " C-PM-01 "
private async Task<byte[]> GenerateCommandReportType01_Cover(Guid commandId, string exportType) private async Task<dynamic> GenerateCommandReportType01_Cover(Guid commandId, string exportType)
{ {
try try
{ {
@ -83,34 +83,40 @@ namespace BMA.EHR.Report.Service.Controllers
AuthorizedPosition = raw_data.AuthorizedPosition, AuthorizedPosition = raw_data.AuthorizedPosition,
Subject = $"เรื่อง {raw_data.CommandSubject}", Subject = $"เรื่อง {raw_data.CommandSubject}",
}; };
var content = new
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"01-คำสั่งบรรจุและแต่งตั้งผู้สอบแข่งขันได้-1.trdp");
ReportPackager reportPackager = new ReportPackager();
Telerik.Reporting.Report? report = null;
using (var sourceStream = System.IO.File.OpenRead(rptFile))
{ {
report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); template = "01-คำสั่งบรรจุและแต่งตั้งผู้สอบแข่งขันได้-1",
} reportName = "01-คำสั่งบรรจุและแต่งตั้งผู้สอบแข่งขันได้-1",
data = command
report.DataSource = command;
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
if (exportType == "docx")
deviceInfo["OutputFormat"] = "DOCX";
InstanceReportSource instanceReportSource = new InstanceReportSource()
{
ReportDocument = report
}; };
// var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"01-คำสั่งบรรจุและแต่งตั้งผู้สอบแข่งขันได้-1.trdp");
ReportProcessor reportProcessor = new ReportProcessor(_configuration); // ReportPackager reportPackager = new ReportPackager();
RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo); // Telerik.Reporting.Report? report = null;
// using (var sourceStream = System.IO.File.OpenRead(rptFile))
// {
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
// }
var content = result.DocumentBytes; // report.DataSource = command;
return content; // System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
// if (exportType == "docx")
// deviceInfo["OutputFormat"] = "DOCX";
// InstanceReportSource instanceReportSource = new InstanceReportSource()
// {
// ReportDocument = report
// };
// ReportProcessor reportProcessor = new ReportProcessor(_configuration);
// RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo);
// var content = result.DocumentBytes;
return command;
} }
catch catch
{ {
@ -2640,7 +2646,14 @@ namespace BMA.EHR.Report.Service.Controllers
throw new Exception(GlobalMessages.CommandNotFound); throw new Exception(GlobalMessages.CommandNotFound);
var contentData = await GenerateCommandReportType01_Cover(id, exportType); var contentData = await GenerateCommandReportType01_Cover(id, exportType);
return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); var data = new
{
template = "Type01_Cover",
reportName = "Type01_Cover",
data = contentData
};
return Success(data);
// return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
} }
catch catch
{ {

View file

@ -338,7 +338,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
{ {
Round = round, Round = round,
TypeReport = null, TypeReport = null,
Detail = "มาตรา ๑๖ และมาตรา ๒๑ แห่งพระราชบัญญัตบำเหน็จบำนาญข้าราชการส่วนท้องถิ่น พ.ศ.๒๕๗๗ มาตรา ๘ แห่งพระราชบัญญัติบเหน็จบำนาญข้าราชการกรุงเทพมหานคร พ.ศ.๒๕๕๔ ประกอบกับมติ ก.ก. ครั้งที่๑๑/๒๕๕๕ เมื่อวันที่ ๑๕ พฤศจิกายน ๒๕๕๕และมติ อ.ก.ก. สามัญข้ารายการสามัญครั้งที่ ๑/๒๕๖๕ เมื่อวันที่ ๒๑ กุมภาพันธ์ ๒๕๖๕", Detail = "มาตรา ๑๖ และมาตรา ๒๑ แห่งพระราชบัญญัตบำเหน็จบำนาญข้าราชการส่วนท้องถิ่น พ.ศ.๒๕๗๗ มาตรา ๘ แห่งพระราชบัญญัติบเหน็จบำนาญข้าราชการกรุงเทพมหานคร พ.ศ.๒๕๕๔ ประกอบกับมติ ก.ก. ครั้งที่๑๑/๒๕๕๕ เมื่อวันที่ ๑๕ พฤศจิกายน ๒๕๕๕และมติ อ.ก.ก. สามัญข้ารายการสามัญครั้งที่ ๑/๒๕๖๕ เมื่อวันที่ ๒๑ กุมภาพันธ์ ๒๕๖๕",
Type = req.Type.Trim().ToUpper(), Type = req.Type.Trim().ToUpper(),
Year = req.Year, Year = req.Year,
CreatedFullName = FullName ?? "System Administrator", CreatedFullName = FullName ?? "System Administrator",

View file

@ -319,7 +319,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
retirementDeceased.posLevelName = org.result.posLevelName; retirementDeceased.posLevelName = org.result.posLevelName;
} }
await _context.RetirementDeceaseds.AddAsync(retirementDeceased); await _context.RetirementDeceaseds.AddAsync(retirementDeceased);
await _context.SaveChangesAsync(); //await _context.SaveChangesAsync();
var _baseAPI = _configuration["API"]; var _baseAPI = _configuration["API"];
var _apiUrl = $"{_baseAPI}org/profile/leave/{req.ProfileId}"; var _apiUrl = $"{_baseAPI}org/profile/leave/{req.ProfileId}";
@ -420,7 +420,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
}); });
// } // }
// } // }
await _context.SaveChangesAsync(); //await _context.SaveChangesAsync();
return Success(); return Success();
} }