add authname
This commit is contained in:
parent
fc747782d4
commit
3bb7864789
6 changed files with 62 additions and 58 deletions
|
|
@ -122,25 +122,25 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
if (_data == null)
|
if (_data == null)
|
||||||
return Error("ไม่พบข้อมูลในระบบ");
|
return Error("ไม่พบข้อมูลในระบบ");
|
||||||
|
|
||||||
if (_data.AuthName == null || _data.AuthName == "")
|
// if (_data.AuthName == null || _data.AuthName == "")
|
||||||
{
|
// {
|
||||||
var apiUrl = $"{_configuration["API"]}/org/find/head/officer";
|
// var apiUrl = $"{_configuration["API"]}/org/find/head/officer";
|
||||||
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 ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
// var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var _res = await client.SendAsync(_req);
|
// var _res = await client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
// var _result = await _res.Content.ReadAsStringAsync();
|
||||||
if (_res.IsSuccessStatusCode)
|
// if (_res.IsSuccessStatusCode)
|
||||||
{
|
// {
|
||||||
var org = JsonConvert.DeserializeObject<dynamic>(_result);
|
// var org = JsonConvert.DeserializeObject<dynamic>(_result);
|
||||||
_data.AuthName = org.result.name == null ? "" : org.result.name;
|
// _data.AuthName = org.result.name == null ? "" : org.result.name;
|
||||||
_data.AuthPosition = org.result.position == null ? "" : org.result.position;
|
// _data.AuthPosition = org.result.position == null ? "" : org.result.position;
|
||||||
await _context.SaveChangesAsync();
|
// await _context.SaveChangesAsync();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
var data = await _context.Disables.AsQueryable()
|
var data = await _context.Disables.AsQueryable()
|
||||||
.Include(x => x.PeriodExam)
|
.Include(x => x.PeriodExam)
|
||||||
|
|
@ -159,8 +159,8 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
FullName = $"{p.Prefix}{p.FirstName} {p.LastName}",
|
FullName = $"{p.Prefix}{p.FirstName} {p.LastName}",
|
||||||
ExamResult = sr == null ? "" : sr.ExamStatus,
|
ExamResult = sr == null ? "" : sr.ExamStatus,
|
||||||
EndDate = p.PeriodExam.RegisterEndDate == null ? "" : (p.PeriodExam.RegisterEndDate.Value.ToThaiFullDate3()),
|
EndDate = p.PeriodExam.RegisterEndDate == null ? "" : (p.PeriodExam.RegisterEndDate.Value.ToThaiFullDate3()),
|
||||||
AuthName = p.AuthName,
|
AuthName = p.PeriodExam.AuthName,
|
||||||
AuthPosition = p.AuthPosition
|
AuthPosition = p.PeriodExam.AuthPosition
|
||||||
})
|
})
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,25 +83,25 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
if (_data == null)
|
if (_data == null)
|
||||||
return Error("ไม่พบข้อมูลในระบบ");
|
return Error("ไม่พบข้อมูลในระบบ");
|
||||||
|
|
||||||
if (_data.AuthName == null || _data.AuthName == "")
|
// if (_data.AuthName == null || _data.AuthName == "")
|
||||||
{
|
// {
|
||||||
var apiUrl = $"{_configuration["API"]}/org/find/head/officer";
|
// var apiUrl = $"{_configuration["API"]}/org/find/head/officer";
|
||||||
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 ", ""));
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
// var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
var _res = await client.SendAsync(_req);
|
// var _res = await client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
// var _result = await _res.Content.ReadAsStringAsync();
|
||||||
if (_res.IsSuccessStatusCode)
|
// if (_res.IsSuccessStatusCode)
|
||||||
{
|
// {
|
||||||
var org = JsonConvert.DeserializeObject<dynamic>(_result);
|
// var org = JsonConvert.DeserializeObject<dynamic>(_result);
|
||||||
_data.AuthName = org.result.name == null ? "" : org.result.name;
|
// _data.AuthName = org.result.name == null ? "" : org.result.name;
|
||||||
_data.AuthPosition = org.result.position == null ? "" : org.result.position;
|
// _data.AuthPosition = org.result.position == null ? "" : org.result.position;
|
||||||
await _context.SaveChangesAsync();
|
// await _context.SaveChangesAsync();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
var data = await _context.Recruits.AsQueryable()
|
var data = await _context.Recruits.AsQueryable()
|
||||||
.Include(x => x.RecruitImport)
|
.Include(x => x.RecruitImport)
|
||||||
|
|
@ -120,8 +120,8 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
FullName = $"{p.Prefix}{p.FirstName} {p.LastName}",
|
FullName = $"{p.Prefix}{p.FirstName} {p.LastName}",
|
||||||
ExamResult = sr == null ? "" : sr.ExamStatus,
|
ExamResult = sr == null ? "" : sr.ExamStatus,
|
||||||
EndDate = p.RecruitImport.RegisterEndDate == null ? "-" : p.RecruitImport.RegisterEndDate.Value.ToThaiFullDate3(),
|
EndDate = p.RecruitImport.RegisterEndDate == null ? "-" : p.RecruitImport.RegisterEndDate.Value.ToThaiFullDate3(),
|
||||||
AuthName = p.AuthName,
|
AuthName = p.RecruitImport.AuthName,
|
||||||
AuthPosition = p.AuthPosition
|
AuthPosition = p.RecruitImport.AuthPosition
|
||||||
})
|
})
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
if (data == null)
|
if (data == null)
|
||||||
|
|
|
||||||
|
|
@ -80,8 +80,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Models.Disables
|
||||||
public string? PositionName { get; set; }
|
public string? PositionName { get; set; }
|
||||||
public string? PositionType { get; set; }
|
public string? PositionType { get; set; }
|
||||||
public string? PositionLevel { get; set; }
|
public string? PositionLevel { get; set; }
|
||||||
public string? AuthName { get; set; }
|
// public string? AuthName { get; set; }
|
||||||
public string? AuthPosition { get; set; }
|
// public string? AuthPosition { get; set; }
|
||||||
|
|
||||||
[Comment("บัญชีสอบ")]
|
[Comment("บัญชีสอบ")]
|
||||||
public string? HddPosition { get; set; } = string.Empty;
|
public string? HddPosition { get; set; } = string.Empty;
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
|
||||||
|
|
||||||
[Comment("สำนัก")]
|
[Comment("สำนัก")]
|
||||||
public string? Category { get; set; }
|
public string? Category { get; set; }
|
||||||
|
public string? AuthName { get; set; }
|
||||||
|
public string? AuthPosition { get; set; }
|
||||||
|
|
||||||
[Comment("รายชื่อคนสม้ครในรอบ")]
|
[Comment("รายชื่อคนสม้ครในรอบ")]
|
||||||
public List<Candidate> Candidate { get; set; } = new List<Candidate>();
|
public List<Candidate> Candidate { get; set; } = new List<Candidate>();
|
||||||
|
|
|
||||||
|
|
@ -80,8 +80,8 @@ namespace BMA.EHR.Recruit.Service.Models.Recruits
|
||||||
public string? PositionName { get; set; }
|
public string? PositionName { get; set; }
|
||||||
public string? PositionType { get; set; }
|
public string? PositionType { get; set; }
|
||||||
public string? PositionLevel { get; set; }
|
public string? PositionLevel { get; set; }
|
||||||
public string? AuthName { get; set; }
|
// public string? AuthName { get; set; }
|
||||||
public string? AuthPosition { get; set; }
|
// public string? AuthPosition { get; set; }
|
||||||
|
|
||||||
[Comment("บัญชีสอบ")]
|
[Comment("บัญชีสอบ")]
|
||||||
public string? HddPosition { get; set; } = string.Empty;
|
public string? HddPosition { get; set; } = string.Empty;
|
||||||
|
|
|
||||||
|
|
@ -6,16 +6,16 @@ using BMA.EHR.Report.Service.Models;
|
||||||
|
|
||||||
namespace BMA.EHR.Recruit.Service.Models.Recruits
|
namespace BMA.EHR.Recruit.Service.Models.Recruits
|
||||||
{
|
{
|
||||||
public class RecruitImport : EntityBase
|
public class RecruitImport : EntityBase
|
||||||
{
|
{
|
||||||
[Required, Comment("ปีที่จัดการสอบ"), Column(Order = 1)]
|
[Required, Comment("ปีที่จัดการสอบ"), Column(Order = 1)]
|
||||||
public int Year { get; set; }
|
public int Year { get; set; }
|
||||||
|
|
||||||
[Required, MaxLength(250), Comment("ชื่อการสอบ"), Column(Order = 2)]
|
[Required, MaxLength(250), Comment("ชื่อการสอบ"), Column(Order = 2)]
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
[Required, Comment("ครั้งที่"), Column(Order = 3)]
|
[Required, Comment("ครั้งที่"), Column(Order = 3)]
|
||||||
public int Order { get; set; } = 1;
|
public int Order { get; set; } = 1;
|
||||||
|
|
||||||
[Column(Order = 4, TypeName = "text"), Comment("รายละเอียด")]
|
[Column(Order = 4, TypeName = "text"), Comment("รายละเอียด")]
|
||||||
public string? Detail { get; set; }
|
public string? Detail { get; set; }
|
||||||
|
|
@ -46,15 +46,17 @@ namespace BMA.EHR.Recruit.Service.Models.Recruits
|
||||||
|
|
||||||
[Column(Order = 13, TypeName = "text"), Comment("หมายเหตุ")]
|
[Column(Order = 13, TypeName = "text"), Comment("หมายเหตุ")]
|
||||||
public string? Note { get; set; }
|
public string? Note { get; set; }
|
||||||
|
public string? AuthName { get; set; }
|
||||||
|
public string? AuthPosition { get; set; }
|
||||||
|
|
||||||
public DateTime? AnnouncementDate { get; set; }
|
public DateTime? AnnouncementDate { get; set; }
|
||||||
|
|
||||||
public Document ImportFile { get; set; } = new Document();
|
public Document ImportFile { get; set; } = new Document();
|
||||||
|
|
||||||
public List<Recruit> Recruits { get; set; } = new List<Recruit>();
|
public List<Recruit> Recruits { get; set; } = new List<Recruit>();
|
||||||
|
|
||||||
public ScoreImport ScoreImport { get; set; }
|
public ScoreImport ScoreImport { get; set; }
|
||||||
|
|
||||||
public List<RecruitImportHistory> ImportHostories { get; set; } = new List<RecruitImportHistory>();
|
public List<RecruitImportHistory> ImportHostories { get; set; } = new List<RecruitImportHistory>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue