/// <summary> /// 新增 /// </summary> /// <param name="userEntity">用户实体</param> /// <returns></returns> public bool Insert(UserEntity userEntity) { using (var db = _dbContext.GetIntance()) { userEntity.SecretKey = AccountAuthHelper.CreateSecretKey(); userEntity.Password = AccountAuthHelper.CreatePassword(userEntity.Password, userEntity.SecretKey); var count = db.Insertable(userEntity).ExecuteCommand(); result = count > 0 ? true : false; } return(result); }
/// <summary> /// 修改用户登录密码 /// </summary> /// <param name="keyValue">主键值</param> /// <param name="Password">新密码(页面加密过的)</param> public bool RevisePassword(string keyValue, string Password) { using (var db = _dbContext.GetIntance()) { UserEntity userEntity = new UserEntity(); userEntity.UserId = keyValue; userEntity.SecretKey = AccountAuthHelper.CreateSecretKey(); userEntity.Password = AccountAuthHelper.CreatePassword(Password, userEntity.SecretKey); var count = db.Updateable(userEntity) .UpdateColumns(it => new UserEntity { Password = userEntity.Password, SecretKey = userEntity.SecretKey }) .Where(it => it.UserId == keyValue).ExecuteCommand(); result = count > 0 ? true : false; } return(result); }