Exemple #1
0
        /// <summary>
        /// 创建账号数据模型信息
        /// </summary>
        /// <param name="account">账号</param>
        /// <param name="password">密码</param>
        public void Creat(string account, string password)
        {
            AccountModel model = new AccountModel();

            model.Account  = account;
            model.Password = Convert.ToBase64String(Encoding.UTF8.GetBytes(password));
            model.Add();
            accModelDict.Add(account, model);
        }
Exemple #2
0
        //private int index = 0;

        /// <summary>
        /// 注册账号
        /// </summary>
        /// <param name="acc">账号</param>
        /// <param name="pwd">密码</param>
        public void Add(string acc, string pwd)
        {
            //不使用数据库
            //idModelDict.Add(index, new AccountModel(index, acc, pwd));
            //index++;
            //存到数据库
            AccountModel model = new AccountModel();

            model.Account  = acc;
            model.Password = pwd;
            model.Id       = model.Add();
            //存到内存
            idModelDict.Add(model.Id, model);
        }
        /// <summary>
        /// 添加账号信息
        /// </summary>
        /// <param name="acc"></param>
        /// <param name="pwd"></param>
        public bool Add(string acc, string pwd)
        {
            if (Has(acc))
            {
                return(false);
            }
            //添加
            AccountModel model = new AccountModel();

            model.Account  = acc;
            model.Password = pwd;
            //添加到数据库
            model.Id = model.Add();
            //添加到内存
            accModelDict[acc] = model;
            return(true);
        }