diff --git a/Controllers/ProfileReportController.cs b/Controllers/ProfileReportController.cs
index 91ea18c..4570c78 100644
--- a/Controllers/ProfileReportController.cs
+++ b/Controllers/ProfileReportController.cs
@@ -57,7 +57,7 @@ namespace BMA.EHR.Report.Service.Controllers
#region " Methods "
///
- /// แสดงหนังสือรับรอง
+ /// แสดงประวัติการรับราชการแบบย่อ
///
/// รหัสข้อมูลข้าราชการ
///
@@ -266,7 +266,15 @@ namespace BMA.EHR.Report.Service.Controllers
}
}
-
+ ///
+ /// แสดงรายงาน กก.1
+ ///
+ /// รหัสข้อมูลข้าราชการ
+ ///
+ /// เมื่อแสดงรายงานสำเร็จ
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
[HttpGet("kk1/{id:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
@@ -594,6 +602,16 @@ namespace BMA.EHR.Report.Service.Controllers
}
}
+
+ ///
+ /// แสดงรายงาน กพ.7
+ ///
+ /// รหัสข้อมูลข้าราชการ
+ ///
+ /// เมื่อแสดงรายงานสำเร็จ
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
[HttpGet("kp7/{id:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
diff --git a/Services/ProfileService.cs b/Services/ProfileService.cs
index 90d8d55..d525dc9 100644
--- a/Services/ProfileService.cs
+++ b/Services/ProfileService.cs
@@ -6,46 +6,46 @@ using System.Text.RegularExpressions;
namespace BMA.EHR.Profile.Service.Services
{
- public class OrganizationItem
- {
- public Guid Id { get; set; }
+ public class OrganizationItem
+ {
+ public Guid Id { get; set; }
- public string Name { get; set; } = string.Empty;
+ public string Name { get; set; } = string.Empty;
- public int Order { get; set; } = 0;
- }
+ public int Order { get; set; } = 0;
+ }
- public class ProfileService
- {
- private readonly EHRDbContext _context;
+ public class ProfileService
+ {
+ private readonly EHRDbContext _context;
- public ProfileService(EHRDbContext context)
- {
- _context = context;
- }
+ public ProfileService(EHRDbContext context)
+ {
+ _context = context;
+ }
- public string ConvertRelationshipToEng(string thai_text)
- {
- switch (thai_text)
- {
- case "หย่า":
- case "หย่าร้าง": return "divorced";
- case "โสด": return "single";
- case "สมรส": return "married";
- case "แยกกันอยู่": return "seperated";
- default: return "na";
- }
- }
+ public string ConvertRelationshipToEng(string thai_text)
+ {
+ switch (thai_text)
+ {
+ case "หย่า":
+ case "หย่าร้าง": return "divorced";
+ case "โสด": return "single";
+ case "สมรส": return "married";
+ case "แยกกันอยู่": return "seperated";
+ default: return "na";
+ }
+ }
- public string ConvertGenderToEng(string thai_text)
- {
- switch (thai_text)
- {
- case "ชาย": return "male";
- case "หญิง": return "female";
- default: return "na";
- }
- }
+ public string ConvertGenderToEng(string thai_text)
+ {
+ switch (thai_text)
+ {
+ case "ชาย": return "male";
+ case "หญิง": return "female";
+ default: return "na";
+ }
+ }
#region " Organizations "
@@ -156,8 +156,8 @@ namespace BMA.EHR.Profile.Service.Services
{
ret = oc.Name + " " + ret;
}
-
- ret = ret.Substring(0, ret.Length - 1);
+ if (ret.Length > 0)
+ ret = ret.Substring(0, ret.Length - 1);
return ret;
}
@@ -415,99 +415,99 @@ namespace BMA.EHR.Profile.Service.Services
#region " Profiles "
public async Task GetProfileById(Guid profileId)
- {
- try
- {
- var profile = await _context.Profiles.AsQueryable()
- // .Include(p => p.Organization)
- .Include(p => p.Position)
- // .ThenInclude(p => p.PositionPath)
- // .Include(p => p.PositionNumber)
+ {
+ try
+ {
+ var profile = await _context.Profiles.AsQueryable()
+ // .Include(p => p.Organization)
+ .Include(p => p.Position)
+ // .ThenInclude(p => p.PositionPath)
+ // .Include(p => p.PositionNumber)
- .Include(p => p.Certificates)
- .Include(p => p.Disciplines)
- .Include(p => p.Educations)
- .Include(p => p.Honors)
- .Include(p => p.Insignias)
- .Include(p => p.Trainings)
+ .Include(p => p.Certificates)
+ .Include(p => p.Disciplines)
+ .Include(p => p.Educations)
+ .Include(p => p.Honors)
+ .Include(p => p.Insignias)
+ .Include(p => p.Trainings)
- // .Include(p => p.Salaries)
- // .ThenInclude(s => s.SalaryPosition)
- // .Include(s => s.Salaries)
- // .ThenInclude(s => s.SalaryOrganization)
- // .Include(p => p.Salaries)
- // .ThenInclude(s => s.SalaryPositionNumber)
- // .Include(p => p.Salaries)
- // .ThenInclude(s => s.SalaryPositionLevel)
- // .Include(p => p.Salaries)
- // .ThenInclude(s => s.SalaryPositionType)
- .Include(x => x.Avatar)
+ // .Include(p => p.Salaries)
+ // .ThenInclude(s => s.SalaryPosition)
+ // .Include(s => s.Salaries)
+ // .ThenInclude(s => s.SalaryOrganization)
+ // .Include(p => p.Salaries)
+ // .ThenInclude(s => s.SalaryPositionNumber)
+ // .Include(p => p.Salaries)
+ // .ThenInclude(s => s.SalaryPositionLevel)
+ // .Include(p => p.Salaries)
+ // .ThenInclude(s => s.SalaryPositionType)
+ .Include(x => x.Avatar)
- // .Include(x => x.PositionType)
- // .Include(x => x.PositionLevel)
- .Include(x => x.Childrens)
- .FirstOrDefaultAsync(p => p.Id == profileId);
+ // .Include(x => x.PositionType)
+ // .Include(x => x.PositionLevel)
+ .Include(x => x.Childrens)
+ .FirstOrDefaultAsync(p => p.Id == profileId);
- return profile;
- }
- catch
- {
- throw;
- }
- }
+ return profile;
+ }
+ catch
+ {
+ throw;
+ }
+ }
- public bool ValidateProfileById(string profileId)
- {
- var idcardno = profileId;
+ public bool ValidateProfileById(string profileId)
+ {
+ var idcardno = profileId;
- if (string.IsNullOrEmpty(idcardno))
- {
- return false;
- }
+ if (string.IsNullOrEmpty(idcardno))
+ {
+ return false;
+ }
- if (idcardno.Length != 13)
- {
- return false;
- }
+ if (idcardno.Length != 13)
+ {
+ return false;
+ }
- bool isDigit = Regex.IsMatch(idcardno, @"^[0-9]*$");
- if (!isDigit)
- {
- return false;
- }
+ bool isDigit = Regex.IsMatch(idcardno, @"^[0-9]*$");
+ if (!isDigit)
+ {
+ return false;
+ }
- int sum = 0;
- for (int i = 0; i < 12; i++)
- {
- sum += Convert.ToInt32(idcardno.Substring(i, 1)) * (13 - i);
- }
+ int sum = 0;
+ for (int i = 0; i < 12; i++)
+ {
+ sum += Convert.ToInt32(idcardno.Substring(i, 1)) * (13 - i);
+ }
- int checksum = (11 - (sum % 11)) % 10;
- if (checksum != Convert.ToInt32(idcardno.Substring(12)))
- {
- return false;
- }
+ int checksum = (11 - (sum % 11)) % 10;
+ if (checksum != Convert.ToInt32(idcardno.Substring(12)))
+ {
+ return false;
+ }
- return true;
+ return true;
- }
+ }
- public async Task CheckExistCitizenId(string profileId)
- {
- try
- {
- var profile = await _context.Profiles.AsQueryable().Where(p => p.CitizenId == profileId).FirstOrDefaultAsync();
+ public async Task CheckExistCitizenId(string profileId)
+ {
+ try
+ {
+ var profile = await _context.Profiles.AsQueryable().Where(p => p.CitizenId == profileId).FirstOrDefaultAsync();
- return profile != null;
- }
- catch
- {
- throw;
- }
- }
+ return profile != null;
+ }
+ catch
+ {
+ throw;
+ }
+ }
- #endregion
- }
+ #endregion
+ }
}