Skip to content

Commit

Permalink
Add Date of birth field
Browse files Browse the repository at this point in the history
  • Loading branch information
pichid committed Apr 2, 2020
1 parent 08a5ff8 commit 2633298
Show file tree
Hide file tree
Showing 12 changed files with 11 additions and 165 deletions.
1 change: 1 addition & 0 deletions ThaiNationalIDCard.NET.Example.ConsoleApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ static void Main(string[] args)
Console.WriteLine($"CitizenID: {personalPhoto.CitizenID}");
Console.WriteLine($"ThaiPersonalInfo: {personalPhoto.ThaiPersonalInfo}");
Console.WriteLine($"EnglishPersonalInfo: {personalPhoto.EnglishPersonalInfo}");
Console.WriteLine($"DateOfBirth: {personalPhoto.DateOfBirth}");
Console.WriteLine($"Sex: {personalPhoto.Sex}");
Console.WriteLine($"AddressInfo: {personalPhoto.AddressInfo}");
Console.WriteLine($"IssueDate: {personalPhoto.IssueDate}");
Expand Down

This file was deleted.

20 changes: 0 additions & 20 deletions ThaiNationalIDCard.NET.Example.WebApi/Program.cs

This file was deleted.

This file was deleted.

42 changes: 0 additions & 42 deletions ThaiNationalIDCard.NET.Example.WebApi/Startup.cs

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions ThaiNationalIDCard.NET.Example.WebApi/appsettings.json

This file was deleted.

1 change: 1 addition & 0 deletions ThaiNationalIDCard.NET/Models/Personal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public class Personal
public string CitizenID { get; set; }
public PersonalInfo ThaiPersonalInfo { get; set; }
public PersonalInfo EnglishPersonalInfo { get; set; }
public DateTime DateOfBirth { get; set; }
public string Sex { get; set; }
public AddressInfo AddressInfo { get; set; }
public DateTime IssueDate { get; set; }
Expand Down
1 change: 1 addition & 0 deletions ThaiNationalIDCard.NET/Models/PersonalPhoto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public PersonalPhoto(Personal personal)
CitizenID = personal.CitizenID;
ThaiPersonalInfo = personal.ThaiPersonalInfo;
EnglishPersonalInfo = personal.EnglishPersonalInfo;
DateOfBirth = personal.DateOfBirth;
Sex = personal.Sex;
AddressInfo = personal.AddressInfo;
IssueDate = personal.IssueDate;
Expand Down
1 change: 1 addition & 0 deletions ThaiNationalIDCard.NET/ThaiNationalIDCard.NET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<PackageProjectUrl>https://github.com/bencomtech/ThaiNationalIDCard.NET</PackageProjectUrl>
<RepositoryUrl>https://github.com/bencomtech/ThaiNationalIDCard.NET</RepositoryUrl>
<Copyright />
<Version>1.0.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
7 changes: 7 additions & 0 deletions ThaiNationalIDCard.NET/ThaiNationalIDCardReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ private Personal GetPersonalInfo()

personal.ThaiPersonalInfo = new PersonalInfo(thaiPersonalInfo);
personal.EnglishPersonalInfo = new PersonalInfo(englishPersonalInfo);

string dateOfBirth = personalInfo.Substring(200, 8);
personal.DateOfBirth = new DateTime(Convert.ToInt32(dateOfBirth.Substring(0, 4)) - 543
, Convert.ToInt32(dateOfBirth.Substring(4, 2))
, Convert.ToInt32(dateOfBirth.Substring(6, 2))
);

personal.Sex = personalInfo.Substring(208, 1);

string addressInfo = GetUTF8FromAsciiBytes(SendCommand(apdu.AddressInfoCommand));
Expand Down

0 comments on commit 2633298

Please sign in to comment.