Exemple #1
0
        /// <summary>
        /// 生成统一社会信用代码
        /// </summary>
        /// <param name="areaNumber"></param>
        /// <param name="code"></param>
        /// <returns></returns>
        public string GenerateRegistrationNo(int areaNumber, ManagementCode code)
        {
            ManagementKindCode kind = ManagementKindCode.NonSpecific;
            var query = ManagementKindCodes.Where(c => c / 100 == (int)code);

            if (query.Any())
            {
                kind = (ManagementKindCode)query.OrderBy(g => Guid.NewGuid()).First();
            }
            return(this.GenerateRegistrationNo(areaNumber.ToString().PadRight(6, '0').Substring(0, 6), code, kind));
        }
        /// <summary>
        /// 生成随机的统一社会信用代码
        /// </summary>
        /// <param name="areaNumber"></param>
        /// <returns></returns>
        protected override string GenerateRegistrationNo(string areaNumber)
        {
            ManagementCode     code = ManagementCodes.OrderBy(g => Guid.NewGuid()).First();
            ManagementKindCode kind = ManagementKindCode.NonSpecific;
            var query = ManagementKindCodes.Where(c => c / 100 == (int)code);

            if (query.Any())
            {
                kind = (ManagementKindCode)query.OrderBy(g => Guid.NewGuid()).First();
            }
            return(this.GenerateRegistrationNo(areaNumber, code, kind));
        }
Exemple #3
0
        private string GenerateRegistrationNo(string areaNumber, ManagementCode code, ManagementKindCode kind)
        {
            var tmp = string.Format("{0}{1}{2}{3}", (char)((int)code), (char)((int)kind % 100), areaNumber, this.GenerateOrganizationCode());

            return(string.Format("{0}{1}", tmp, this.GetCheckBit(tmp)));
        }
Exemple #4
0
 /// <summary>
 /// 生成统一社会信用代码
 /// </summary>
 /// <param name="areaNumber"></param>
 /// <param name="code"></param>
 /// <param name="kind"></param>
 /// <returns></returns>
 public string GenerateRegistrationNo(int areaNumber, ManagementCode code, ManagementKindCode kind)
 {
     return(this.GenerateRegistrationNo(areaNumber.ToString().PadRight(6, '0').Substring(0, 6), code, kind));
 }