no message
This commit is contained in:
parent
7655b11690
commit
dd170565b5
1 changed files with 53 additions and 60 deletions
|
|
@ -1785,10 +1785,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
string? _null = null;
|
||||
dynamic? resultData = null;
|
||||
if (data.Count != 0)
|
||||
{
|
||||
resultData = (from p in data
|
||||
var resultData = (from p in data
|
||||
join r in req.refIds
|
||||
on p.Id.ToString() equals r.refId
|
||||
select new
|
||||
|
|
@ -1805,67 +1802,63 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
level = "",
|
||||
unStigma = "คำสั่งยุติเรื่อง"
|
||||
}).ToList();
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave-discipline";
|
||||
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(apiUrlOrg, new
|
||||
{
|
||||
data = resultData,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
data.ForEach(profile => profile.IsReport = "NEW");
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave-discipline";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var data1 = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
|
||||
.Include(x => x.DisciplineDisciplinary)
|
||||
.Where(x => x.IsReport == "REPORT")
|
||||
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
resultData = (from p in data1
|
||||
join r in req.refIds
|
||||
on p.Id.ToString() equals r.refId
|
||||
select new
|
||||
{
|
||||
profileId = p.PersonId,
|
||||
date = r.commandAffectDate,
|
||||
refCommandNo = $"{r.commandNo}/{r.commandYear}",
|
||||
salaryRef = r.templateDoc,
|
||||
isLeave = false,
|
||||
leaveReason = _null,
|
||||
dateLeave = _null,
|
||||
refCommandDate = DateTime.Now,
|
||||
detail = p.DisciplineDisciplinary.Title,
|
||||
level = p.DisciplineDisciplinary.DisciplinaryFaultLevel,
|
||||
unStigma = "คำสั่งยุติเรื่อง"
|
||||
}).ToList();
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave-discipline";
|
||||
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(apiUrlOrg, new
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
data = resultData,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
data1.ForEach(profile => profile.IsReport = "NEW");
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
data = resultData,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
data.ForEach(profile => profile.IsReport = "NEW");
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
var data1 = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
|
||||
.Include(x => x.DisciplineDisciplinary)
|
||||
.Where(x => x.IsReport == "REPORT")
|
||||
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
var resultData1 = (from p in data1
|
||||
join r in req.refIds
|
||||
on p.Id.ToString() equals r.refId
|
||||
select new
|
||||
{
|
||||
profileId = p.PersonId,
|
||||
date = r.commandAffectDate,
|
||||
refCommandNo = $"{r.commandNo}/{r.commandYear}",
|
||||
salaryRef = r.templateDoc,
|
||||
isLeave = false,
|
||||
leaveReason = _null,
|
||||
dateLeave = _null,
|
||||
refCommandDate = DateTime.Now,
|
||||
detail = p.DisciplineDisciplinary.Title,
|
||||
level = p.DisciplineDisciplinary.DisciplinaryFaultLevel,
|
||||
unStigma = "คำสั่งยุติเรื่อง"
|
||||
}).ToList();
|
||||
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(apiUrlOrg, new
|
||||
{
|
||||
data = resultData1,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
data1.ForEach(profile => profile.IsReport = "NEW");
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return Success();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue