api get รายชื่อผู้เกษียณอายุราชการ
Some checks failed
release-dev / release-dev (push) Failing after 10s
Some checks failed
release-dev / release-dev (push) Failing after 10s
This commit is contained in:
parent
f81806f59f
commit
59edf6a716
3 changed files with 67 additions and 72 deletions
|
|
@ -105,43 +105,49 @@ namespace BMA.EHR.Application.Repositories
|
|||
}
|
||||
|
||||
//เกษียณอายุราชการ
|
||||
public async Task ExecuteRetirement()
|
||||
{
|
||||
var retirePeriodOfficer = await _dbContext.Set<RetirementPeriod>()
|
||||
.Include(x => x.RetirementRawProfiles.Where(y => y.Remove != "REMOVE"))
|
||||
.Where(x => x.Year == /*DateTime.Now.Year*/2026)
|
||||
.Where(x => x.Type.Trim().ToUpper().Contains("OFFICER"))
|
||||
.FirstOrDefaultAsync();
|
||||
//public async Task ExecuteRetirement()
|
||||
//{
|
||||
// var retirePeriodOfficer = await _dbContext.Set<RetirementPeriod>()
|
||||
// .Include(x => x.RetirementRawProfiles.Where(y => y.Remove != "REMOVE"))
|
||||
// .Where(x => x.Year == DateTime.Now.Year)
|
||||
// .Where(x => x.Type.Trim().ToUpper().Contains("OFFICER"))
|
||||
// .FirstOrDefaultAsync();
|
||||
|
||||
var body = retirePeriodOfficer.RetirementProfiles
|
||||
.Select(x => new {
|
||||
profileId = x.profileId,
|
||||
//lastUpdateUserId = UserId,
|
||||
//lastUpdateFullName = FullName,
|
||||
})
|
||||
.ToList();
|
||||
// if (retirePeriodOfficer == null)
|
||||
// return;
|
||||
|
||||
//ข้าราชการ
|
||||
//var apiUrl = $"{_configuration["API"]}/org/unauthorize/retirement";
|
||||
var apiUrl = $"http://localhost:13001/api/v1/org/unauthorize/retirement";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var jsonBody = JsonConvert.SerializeObject(body);
|
||||
var content = new StringContent(jsonBody, Encoding.UTF8, "application/json");
|
||||
var _req = new HttpRequestMessage(HttpMethod.Patch, apiUrl)
|
||||
{
|
||||
Content = content
|
||||
};
|
||||
var response = await client.SendAsync(_req);
|
||||
var responseContent = await response.Content.ReadAsStringAsync();
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
// var body = new
|
||||
// {
|
||||
// data = retirePeriodOfficer.RetirementRawProfiles
|
||||
// .Select(x => new
|
||||
// {
|
||||
// profileId = x.profileId
|
||||
// })
|
||||
// .ToList()
|
||||
// };
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// //ข้าราชการ
|
||||
// //var apiUrl = $"{_configuration["API"]}/org/unauthorize/retirement";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
|
||||
// var jsonBody = JsonConvert.SerializeObject(body);
|
||||
// var content = new StringContent(jsonBody, Encoding.UTF8, "application/json");
|
||||
|
||||
// var _req = new HttpRequestMessage(HttpMethod.Patch, apiUrl)
|
||||
// {
|
||||
// Content = content
|
||||
// };
|
||||
// var response = await client.SendAsync(_req);
|
||||
// var responseContent = await response.Content.ReadAsStringAsync();
|
||||
// if (!response.IsSuccessStatusCode)
|
||||
// {
|
||||
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
public void TestMethod()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue