Merge branch 'develop' of github.com:Frappet/BMA-EHR-BackEnd into develop
This commit is contained in:
commit
2a3a151f34
1 changed files with 70 additions and 0 deletions
|
|
@ -404,6 +404,41 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
LastUpdateUserId = UserId ?? "",
|
LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdatedAt = DateTime.Now,
|
LastUpdatedAt = DateTime.Now,
|
||||||
};
|
};
|
||||||
|
if (placementReceive.citizenId.Length != 13)
|
||||||
|
{
|
||||||
|
return Error("กรุณากรอกข้อมูลรหัสบัตรประจำตัวประชาชนให้ครบ 13 หลัก", 500);
|
||||||
|
}
|
||||||
|
int[] citizenIdDigits = placementReceive.citizenId.Select(c => int.Parse(c.ToString())).ToArray();
|
||||||
|
int cal =
|
||||||
|
citizenIdDigits[0] * 13 +
|
||||||
|
citizenIdDigits[1] * 12 +
|
||||||
|
citizenIdDigits[2] * 11 +
|
||||||
|
citizenIdDigits[3] * 10 +
|
||||||
|
citizenIdDigits[4] * 9 +
|
||||||
|
citizenIdDigits[5] * 8 +
|
||||||
|
citizenIdDigits[6] * 7 +
|
||||||
|
citizenIdDigits[7] * 6 +
|
||||||
|
citizenIdDigits[8] * 5 +
|
||||||
|
citizenIdDigits[9] * 4 +
|
||||||
|
citizenIdDigits[10] * 3 +
|
||||||
|
citizenIdDigits[11] * 2;
|
||||||
|
|
||||||
|
int calStp2 = cal % 11;
|
||||||
|
int chkDigit = 11 - calStp2;
|
||||||
|
|
||||||
|
if (chkDigit == 10)
|
||||||
|
{
|
||||||
|
chkDigit = 1;
|
||||||
|
}
|
||||||
|
else if (chkDigit == 11)
|
||||||
|
{
|
||||||
|
chkDigit = chkDigit % 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (citizenIdDigits[12] != chkDigit)
|
||||||
|
{
|
||||||
|
return Error("ข้อมูลรหัสบัตรประจำตัวประชาชนไม่ถูกต้อง", 500);
|
||||||
|
}
|
||||||
|
|
||||||
var apiUrl = $"{_configuration["API"]}org/profile/citizenid/position/{req.citizenId}";
|
var apiUrl = $"{_configuration["API"]}org/profile/citizenid/position/{req.citizenId}";
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
|
|
@ -629,6 +664,41 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
.FirstOrDefaultAsync(x => x.Id == id);
|
.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
if (uppdated == null)
|
if (uppdated == null)
|
||||||
return Error(GlobalMessages.PlacementReceiveNotFound, 404);
|
return Error(GlobalMessages.PlacementReceiveNotFound, 404);
|
||||||
|
if (req.citizenId.Length != 13)
|
||||||
|
{
|
||||||
|
return Error("กรุณากรอกข้อมูลรหัสบัตรประจำตัวประชาชนให้ครบ 13 หลัก", 500);
|
||||||
|
}
|
||||||
|
int[] citizenIdDigits = req.citizenId.Select(c => int.Parse(c.ToString())).ToArray();
|
||||||
|
int cal =
|
||||||
|
citizenIdDigits[0] * 13 +
|
||||||
|
citizenIdDigits[1] * 12 +
|
||||||
|
citizenIdDigits[2] * 11 +
|
||||||
|
citizenIdDigits[3] * 10 +
|
||||||
|
citizenIdDigits[4] * 9 +
|
||||||
|
citizenIdDigits[5] * 8 +
|
||||||
|
citizenIdDigits[6] * 7 +
|
||||||
|
citizenIdDigits[7] * 6 +
|
||||||
|
citizenIdDigits[8] * 5 +
|
||||||
|
citizenIdDigits[9] * 4 +
|
||||||
|
citizenIdDigits[10] * 3 +
|
||||||
|
citizenIdDigits[11] * 2;
|
||||||
|
|
||||||
|
int calStp2 = cal % 11;
|
||||||
|
int chkDigit = 11 - calStp2;
|
||||||
|
|
||||||
|
if (chkDigit == 10)
|
||||||
|
{
|
||||||
|
chkDigit = 1;
|
||||||
|
}
|
||||||
|
else if (chkDigit == 11)
|
||||||
|
{
|
||||||
|
chkDigit = chkDigit % 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (citizenIdDigits[12] != chkDigit)
|
||||||
|
{
|
||||||
|
return Error("ข้อมูลรหัสบัตรประจำตัวประชาชนไม่ถูกต้อง", 500);
|
||||||
|
}
|
||||||
|
|
||||||
if (req.RelationshipId != null)
|
if (req.RelationshipId != null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue