20210830
This commit is contained in:
@@ -590,5 +590,20 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取年龄
|
||||
/// </summary>
|
||||
/// <param name="birthDate"></param>
|
||||
/// <param name="now"></param>
|
||||
/// <returns></returns>
|
||||
public static int CalculateAgeCorrect(DateTime birthDate)
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
int age = now.Year - birthDate.Year;
|
||||
if (now.Month < birthDate.Month || (now.Month == birthDate.Month && now.Day < birthDate.Day)) age--;
|
||||
return age;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,10 @@ namespace BLL
|
||||
/// <returns>验证成功为True,否则为False</returns>
|
||||
public static bool CheckIDCard(string Id)
|
||||
{
|
||||
if (string.IsNullOrEmpty(Id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (Id.Length == 18)
|
||||
{
|
||||
bool check = CheckIDCard18(Id);
|
||||
|
||||
Reference in New Issue
Block a user