From c694f08dbe5a921e5ee230a5e5caa1c3e50a5b51 Mon Sep 17 00:00:00 2001 From: Bright Date: Thu, 10 Oct 2024 13:45:43 +0700 Subject: [PATCH] no message --- .../Controllers/PlacementController.cs | 390 +----------------- .../Controllers/PlacementReceiveController.cs | 91 +++- 2 files changed, 75 insertions(+), 406 deletions(-) diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs index 56d6394a..23f99565 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs @@ -1580,195 +1580,6 @@ namespace BMA.EHR.Placement.Service.Controllers /// เมื่อเกิดข้อผิดพลาดในการทำงาน [HttpPost("recruit/report/excecute")] public async Task> PostReportExecuteRecruit([FromBody] ReportExecuteRequest req) - { - // create new profile - foreach (var recv in req.refIds) - { - // query placement Profile - var placementProfile = await _context.PlacementProfiles - .Include(x => x.PlacementCertificates) - .Include(x => x.PlacementEducations) - .ThenInclude(x => x.EducationLevel) - .FirstOrDefaultAsync(x => x.Id == Guid.Parse(recv.refId)); - - if (placementProfile == null) - continue; - - /*ข้อมูล Profile ใหม่*/ - var apiUrl = $"{_configuration["API"]}/org/profile/all"; - var profileId = string.Empty; - using (var client = new HttpClient()) - { - client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", "")); - client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]); - var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl); - var _res = await client.PostAsJsonAsync(apiUrl, new - { - rank = string.Empty, - prefix = placementProfile.Prefix == null ? string.Empty : placementProfile.Prefix, - firstName = placementProfile.Firstname == null ? string.Empty : placementProfile.Firstname, - lastName = placementProfile.Lastname == null ? string.Empty : placementProfile.Lastname, - citizenId = placementProfile.CitizenId == null ? string.Empty : placementProfile.CitizenId, - position = placementProfile.positionName == null ? string.Empty : placementProfile.positionName, - posLevelId = placementProfile.posLevelId == null ? string.Empty : placementProfile.posLevelId, - posTypeId = placementProfile.posTypeId == null ? string.Empty : placementProfile.posTypeId, - email = placementProfile.Email == null ? string.Empty : placementProfile.Email, - phone = placementProfile.MobilePhone == null ? string.Empty : placementProfile.MobilePhone, - keycloak = string.Empty, - isProbation = true, - isLeave = false, - dateRetire = (DateTime?)null, - dateAppoint = recv.commandAffectDate, - dateStart = recv.commandAffectDate, - govAgeAbsent = 0, - govAgePlus = 0, - birthDate = placementProfile.DateOfBirth == null ? (DateTime?)null : placementProfile.DateOfBirth, - reasonSameDate = (DateTime?)null, - ethnicity = placementProfile.Race == null ? string.Empty : placementProfile.Race, - telephoneNumber = placementProfile.Telephone == null ? string.Empty : placementProfile.Telephone, - nationality = placementProfile.Nationality == null ? string.Empty : placementProfile.Nationality, - gender = placementProfile.Gender == null ? string.Empty : placementProfile.Gender, - relationship = placementProfile.Relationship == null ? string.Empty : placementProfile.Relationship, - religion = placementProfile.Religion == null ? string.Empty : placementProfile.Religion, - bloodGroup = string.Empty, - registrationAddress = placementProfile.RegistAddress == null ? string.Empty : placementProfile.RegistAddress, - registrationProvinceId = (String?)null, - registrationDistrictId = (String?)null, - registrationSubDistrictId = (String?)null, - registrationZipCode = placementProfile.RegistZipCode == null ? string.Empty : placementProfile.RegistZipCode, - currentAddress = placementProfile.CurrentAddress == null ? string.Empty : placementProfile.CurrentAddress, - currentProvinceId = (String?)null, - currentDistrictId = (String?)null, - currentSubDistrictId = (String?)null, - currentZipCode = placementProfile.CurrentZipCode == null ? string.Empty : placementProfile.CurrentZipCode, - }); - var _result = await _res.Content.ReadAsStringAsync(); - profileId = JsonConvert.DeserializeObject(_result).result; - } - - if (placementProfile.PlacementEducations != null) - { - var apiUrlEdu = $"{_configuration["API"]}/org/profile/educations"; - using (var client = new HttpClient()) - { - client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", "")); - client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]); - foreach (var edu in placementProfile.PlacementEducations) - { - var _res = await client.PostAsJsonAsync(apiUrlEdu, new - { - profileId = profileId, - country = edu.Country == null ? string.Empty : edu.Country, - degree = edu.Degree == null ? string.Empty : edu.Degree, - duration = edu.Duration == null ? string.Empty : edu.Duration, - durationYear = edu.DurationYear == null ? 0 : edu.DurationYear, - field = edu.Field == null ? string.Empty : edu.Field, - finishDate = edu.FinishDate == null ? (DateTime?)null : edu.FinishDate, - fundName = edu.FundName == null ? string.Empty : edu.FundName, - gpa = edu.Gpa == null ? string.Empty : edu.Gpa, - institute = edu.Institute == null ? string.Empty : edu.Institute, - other = edu.Other == null ? string.Empty : edu.Other, - startDate = edu.StartDate == null ? (DateTime?)null : edu.StartDate, - endDate = edu.EndDate == null ? (DateTime?)null : edu.EndDate, - educationLevel = edu.EducationLevel == null ? string.Empty : edu.EducationLevel.Name, - educationLevelId = string.Empty, - positionPath = edu.PositionPath == null ? null : edu.PositionPath, - positionPathId = string.Empty, - isDate = edu.IsDate, - isEducation = edu.IsEducation, - note = string.Empty, - }); - var _result = await _res.Content.ReadAsStringAsync(); - } - } - } - - if (placementProfile.PlacementCertificates != null) - { - var apiUrlCer = $"{_configuration["API"]}/org/profile/certificate"; - using (var client = new HttpClient()) - { - client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", "")); - client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]); - foreach (var cer in placementProfile.PlacementCertificates) - { - var _res = await client.PostAsJsonAsync(apiUrlCer, new - { - profileId = profileId, - expireDate = cer.ExpireDate == null ? (DateTime?)null : cer.ExpireDate, - issueDate = cer.IssueDate == null ? (DateTime?)null : cer.IssueDate, - certificateNo = cer.CertificateNo == null ? string.Empty : cer.CertificateNo, - certificateType = cer.CertificateType == null ? string.Empty : cer.CertificateType, - issuer = cer.Issuer == null ? string.Empty : cer.Issuer, - }); - var _result = await _res.Content.ReadAsStringAsync(); - } - } - } - - var apiUrlSalary = $"{_configuration["API"]}/org/profile/salary"; - using (var client = new HttpClient()) - { - client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", "")); - client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]); - var _res = await client.PostAsJsonAsync(apiUrlSalary, new - { - profileId = profileId, - date = recv.commandAffectDate, - 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.posLevelName == null ? string.Empty : placementProfile.posLevelName, - refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}", - templateDoc = recv.templateDoc, - }); - var _result = await _res.Content.ReadAsStringAsync(); - } - - var baseAPIOrg = _configuration["API"]; - var apiUrlOrg = $"{baseAPIOrg}/org/pos/report/current"; - using (var client = new HttpClient()) - { - client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", "")); - client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]); - var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlOrg); - var _res = await client.PostAsJsonAsync(apiUrlOrg, new - { - posmasterId = placementProfile.posmasterId, - positionId = placementProfile.positionId, - profileId = profileId, - }); - var _result = await _res.Content.ReadAsStringAsync(); - } - // update placementstatus - placementProfile.PlacementStatus = "DONE";//DONE - - await _context.SaveChangesAsync(); - } - return Success(); - } - - /// - /// ออกคำสั่ง C-PM-01 บรรจุและแต่งตั้งผู้สอบแข่งขันได้ (NEW) - /// - /// - /// - /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง - /// ไม่ได้ Login เข้าระบบ - /// เมื่อเกิดข้อผิดพลาดในการทำงาน - [HttpPost("recruit/report/excecute-new")] - public async Task> PostReportExecuteRecruitNew([FromBody] ReportExecuteRequest req) { try { @@ -1863,9 +1674,9 @@ namespace BMA.EHR.Placement.Service.Controllers { profileId = string.Empty, date = r.commandAffectDate, - amount = p.Amount, - positionSalaryAmount = p.PositionSalaryAmount, - mouthSalaryAmount = p.MouthSalaryAmount, + amount = r.amount, + positionSalaryAmount = r.positionSalaryAmount, + mouthSalaryAmount = r.mouthSalaryAmount, posNo = p.posMasterNo == null ? "" : p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}" : p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}" : @@ -2025,195 +1836,6 @@ namespace BMA.EHR.Placement.Service.Controllers /// เมื่อเกิดข้อผิดพลาดในการทำงาน [HttpPost("candidate/report/excecute")] public async Task> PostReportExecuteCandidate([FromBody] ReportExecuteRequest req) - { - // create new profile - foreach (var recv in req.refIds) - { - // query placement Profile - var placementProfile = await _context.PlacementProfiles - .Include(x => x.PlacementCertificates) - .Include(x => x.PlacementEducations) - .ThenInclude(x => x.EducationLevel) - .FirstOrDefaultAsync(x => x.Id == Guid.Parse(recv.refId)); - - if (placementProfile == null) - continue; - - /*ข้อมูล Profile ใหม่*/ - var apiUrl = $"{_configuration["API"]}/org/profile/all"; - var profileId = string.Empty; - using (var client = new HttpClient()) - { - client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", "")); - client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]); - var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl); - var _res = await client.PostAsJsonAsync(apiUrl, new - { - rank = string.Empty, - prefix = placementProfile.Prefix == null ? string.Empty : placementProfile.Prefix, - firstName = placementProfile.Firstname == null ? string.Empty : placementProfile.Firstname, - lastName = placementProfile.Lastname == null ? string.Empty : placementProfile.Lastname, - citizenId = placementProfile.CitizenId == null ? string.Empty : placementProfile.CitizenId, - position = placementProfile.positionName == null ? string.Empty : placementProfile.positionName, - posLevelId = placementProfile.posLevelId == null ? string.Empty : placementProfile.posLevelId, - posTypeId = placementProfile.posTypeId == null ? string.Empty : placementProfile.posTypeId, - email = placementProfile.Email == null ? string.Empty : placementProfile.Email, - phone = placementProfile.MobilePhone == null ? string.Empty : placementProfile.MobilePhone, - keycloak = string.Empty, - isProbation = true, - isLeave = false, - dateRetire = (DateTime?)null, - dateAppoint = recv.commandAffectDate, - dateStart = recv.commandAffectDate, - govAgeAbsent = 0, - govAgePlus = 0, - birthDate = placementProfile.DateOfBirth == null ? (DateTime?)null : placementProfile.DateOfBirth, - reasonSameDate = (DateTime?)null, - ethnicity = placementProfile.Race == null ? string.Empty : placementProfile.Race, - telephoneNumber = placementProfile.Telephone == null ? string.Empty : placementProfile.Telephone, - nationality = placementProfile.Nationality == null ? string.Empty : placementProfile.Nationality, - gender = placementProfile.Gender == null ? string.Empty : placementProfile.Gender, - relationship = placementProfile.Relationship == null ? string.Empty : placementProfile.Relationship, - religion = placementProfile.Religion == null ? string.Empty : placementProfile.Religion, - bloodGroup = string.Empty, - registrationAddress = placementProfile.RegistAddress == null ? string.Empty : placementProfile.RegistAddress, - registrationProvinceId = (String?)null, - registrationDistrictId = (String?)null, - registrationSubDistrictId = (String?)null, - registrationZipCode = placementProfile.RegistZipCode == null ? string.Empty : placementProfile.RegistZipCode, - currentAddress = placementProfile.CurrentAddress == null ? string.Empty : placementProfile.CurrentAddress, - currentProvinceId = (String?)null, - currentDistrictId = (String?)null, - currentSubDistrictId = (String?)null, - currentZipCode = placementProfile.CurrentZipCode == null ? string.Empty : placementProfile.CurrentZipCode, - }); - var _result = await _res.Content.ReadAsStringAsync(); - profileId = JsonConvert.DeserializeObject(_result).result; - } - - if (placementProfile.PlacementEducations != null) - { - var apiUrlEdu = $"{_configuration["API"]}/org/profile/educations"; - using (var client = new HttpClient()) - { - client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", "")); - client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]); - foreach (var edu in placementProfile.PlacementEducations) - { - var _res = await client.PostAsJsonAsync(apiUrlEdu, new - { - profileId = profileId, - country = edu.Country == null ? string.Empty : edu.Country, - degree = edu.Degree == null ? string.Empty : edu.Degree, - duration = edu.Duration == null ? string.Empty : edu.Duration, - durationYear = edu.DurationYear == null ? 0 : edu.DurationYear, - field = edu.Field == null ? string.Empty : edu.Field, - finishDate = edu.FinishDate == null ? (DateTime?)null : edu.FinishDate, - fundName = edu.FundName == null ? string.Empty : edu.FundName, - gpa = edu.Gpa == null ? string.Empty : edu.Gpa, - institute = edu.Institute == null ? string.Empty : edu.Institute, - other = edu.Other == null ? string.Empty : edu.Other, - startDate = edu.StartDate == null ? (DateTime?)null : edu.StartDate, - endDate = edu.EndDate == null ? (DateTime?)null : edu.EndDate, - educationLevel = edu.EducationLevel == null ? string.Empty : edu.EducationLevel.Name, - educationLevelId = string.Empty, - positionPath = edu.PositionPath == null ? null : edu.PositionPath, - positionPathId = string.Empty, - isDate = edu.IsDate, - isEducation = edu.IsEducation, - note = string.Empty, - }); - var _result = await _res.Content.ReadAsStringAsync(); - } - } - } - - if (placementProfile.PlacementCertificates != null) - { - var apiUrlCer = $"{_configuration["API"]}/org/profile/certificate"; - using (var client = new HttpClient()) - { - client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", "")); - client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]); - foreach (var cer in placementProfile.PlacementCertificates) - { - var _res = await client.PostAsJsonAsync(apiUrlCer, new - { - profileId = profileId, - expireDate = cer.ExpireDate == null ? (DateTime?)null : cer.ExpireDate, - issueDate = cer.IssueDate == null ? (DateTime?)null : cer.IssueDate, - certificateNo = cer.CertificateNo == null ? string.Empty : cer.CertificateNo, - certificateType = cer.CertificateType == null ? string.Empty : cer.CertificateType, - issuer = cer.Issuer == null ? string.Empty : cer.Issuer, - }); - var _result = await _res.Content.ReadAsStringAsync(); - } - } - } - - var apiUrlSalary = $"{_configuration["API"]}/org/profile/salary"; - using (var client = new HttpClient()) - { - client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", "")); - client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]); - var _res = await client.PostAsJsonAsync(apiUrlSalary, new - { - profileId = profileId, - date = recv.commandAffectDate, - 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.posLevelName == null ? string.Empty : placementProfile.posLevelName, - refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}", - templateDoc = recv.templateDoc, - }); - var _result = await _res.Content.ReadAsStringAsync(); - } - - var baseAPIOrg = _configuration["API"]; - var apiUrlOrg = $"{baseAPIOrg}/org/pos/report/current"; - using (var client = new HttpClient()) - { - client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", "")); - client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]); - var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlOrg); - var _res = await client.PostAsJsonAsync(apiUrlOrg, new - { - posmasterId = placementProfile.posmasterId, - positionId = placementProfile.positionId, - profileId = profileId, - }); - var _result = await _res.Content.ReadAsStringAsync(); - } - // update placementstatus - placementProfile.PlacementStatus = "DONE";//DONE - - await _context.SaveChangesAsync(); - } - return Success(); - } - - /// - /// ออกคำสั่ง C-PM-02 บรรจุและแต่งตั้งผู้ได้รับคัดเลือก (NEW) - /// - /// - /// - /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง - /// ไม่ได้ Login เข้าระบบ - /// เมื่อเกิดข้อผิดพลาดในการทำงาน - [HttpPost("candidate/report/excecute-new")] - public async Task> PostReportExecuteCandidateNew([FromBody] ReportExecuteRequest req) { try { @@ -2308,9 +1930,9 @@ namespace BMA.EHR.Placement.Service.Controllers { profileId = string.Empty, date = r.commandAffectDate, - amount = p.Amount, - positionSalaryAmount = p.PositionSalaryAmount, - mouthSalaryAmount = p.MouthSalaryAmount, + amount = r.amount, + positionSalaryAmount = r.positionSalaryAmount, + mouthSalaryAmount = r.mouthSalaryAmount, posNo = p.posMasterNo == null ? "" : p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}" : p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}" : diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs index 86fee36d..7a9f7c9d 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs @@ -998,31 +998,78 @@ namespace BMA.EHR.Placement.Service.Controllers on p.Id.ToString() equals r.refId select new { - profileId = p.profileId, - date = r.commandAffectDate, - amount = r.amount, - positionSalaryAmount = r.positionSalaryAmount, - mouthSalaryAmount = r.mouthSalaryAmount, - posNo = p.posMasterNo == null ? "" : - p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}" : - p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}" : - p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}" : - p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}" : - p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}" : "", - position = p.position, - positionLine = "", - positionPathSide = "", - positionExecutive = "", - positionType = p.posTypeName, - positionLevel = p.posLevelName, - refCommandNo = $"{r.commandNo}/{r.commandYear.ToThaiYear()}", - templateDoc = r.templateDoc, - posmasterId = p.posmasterId, - positionId = p.positionId, + bodyProfile = new + { + rank = string.Empty, + prefix = p.prefix == null ? string.Empty : p.prefix, + firstName = p.firstName == null ? string.Empty : p.firstName, + lastName = p.lastName == null ? string.Empty : p.lastName, + citizenId = p.citizenId == null ? string.Empty : p.citizenId, + position = p.position == null ? string.Empty : p.position, + posLevelId = p.posLevelId == null ? string.Empty : p.posLevelId, + posTypeId = p.posTypeId == null ? string.Empty : p.posTypeId, + email = (String?)null, + phone = (String?)null, + keycloak = string.Empty, + isProbation = true, + isLeave = false, + dateRetire = (DateTime?)null, + dateAppoint = r.commandAffectDate, + dateStart = r.commandAffectDate, + govAgeAbsent = 0, + govAgePlus = 0, + birthDate = p.DateOfBirth == null ? (DateTime?)null : p.DateOfBirth, + reasonSameDate = (DateTime?)null, + ethnicity = p.Race == null ? string.Empty : p.Race, + telephoneNumber = (String?)null, + nationality = p.Nationality == null ? string.Empty : p.Nationality, + gender = p.Gender == null ? string.Empty : p.Gender, + relationship = p.Relationship == null ? string.Empty : p.Relationship, + religion = p.Religion == null ? string.Empty : p.Religion, + bloodGroup = string.Empty, + registrationAddress = (String?)null, + registrationProvinceId = (String?)null, + registrationDistrictId = (String?)null, + registrationSubDistrictId = (String?)null, + registrationZipCode = (String?)null, + currentAddress = (String?)null, + currentProvinceId = (String?)null, + currentDistrictId = (String?)null, + currentSubDistrictId = (String?)null, + currentZipCode = (String?)null, + }, + bodySalarys = new + { + profileId = string.Empty, + date = r.commandAffectDate, + amount = r.amount, + positionSalaryAmount = r.positionSalaryAmount, + mouthSalaryAmount = r.mouthSalaryAmount, + posNo = p.posMasterNo == null ? "" : + p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}" : + p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}" : + p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}" : + p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}" : + p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}" : "", + position = p.position == null ? string.Empty : p.position, + positionLine = string.Empty, + positionPathSide = string.Empty, + positionExecutive = string.Empty, + positionType = p.posTypeName == null ? string.Empty : p.posTypeName, + positionLevel = p.posLevelName == null ? string.Empty : p.posLevelName, + refCommandNo = $"{r.commandNo}/{r.commandYear.ToThaiYear()}", + templateDoc = r.templateDoc + }, + bodyPosition = new + { + posmasterId = p.posmasterId, + positionId = p.positionId + } }).ToList(); var baseAPIOrg = _configuration["API"]; - var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-current"; + //var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-current"; + var apiUrlOrg = $"{_configuration["API"]}/org/command/excexute/create-officer-profile"; using (var client = new HttpClient()) { client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));