Exemple #1
0
        private bool CheckId(string id)
        {
            if (!string.IsNullOrEmpty(id))
            {
                id = id.Trim();

                if (id.Length == 18)
                {
                    Regex re = new Regex(@"^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$");

                    if (re.IsMatch(id))
                    {
                        if (IdCardChecker.Check(id))
                        {
                            return(true);
                        }
                    }
                }
                else
                {
                    return(false);
                }
            }

            return(false);
        }
Exemple #2
0
 public void Test_Check()
 {
     bool result1 = IdCardChecker.Check("110101199003074290");
     bool result2 = IdCardChecker.Check("110101199003074290");
     bool result3 = IdCardChecker.Check("110101199003074291");
 }