/// <summary>
        /// 用户注册
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="type">许可证类型</param>
        /// <returns>序列号</returns>
        public string Registe(string userName, string password, int type, int time)
        {
            if (registedUser.ContainsUserName(userName))
            {
                return("用户已存在");
            }

            string serialNumber = string.Empty;

            do
            {
                for (int i = 0; i < 10; ++i)
                {
                    serialNumber += new Random().Next(1, 9).ToString();
                }
            } while (registedUser.Contains(serialNumber));

            RegRecord regRecord1 = new RegRecord(userName, password, serialNumber, type, time);

            registedUser.Add(regRecord1);
            registedUser.WriteToFile();
            return(serialNumber);
        }
Example #2
0
 public void Add(RegRecord regRecord)
 {
     regDic.Add(regRecord.serialNumber, regRecord);
     WriteToFile();
 }