コード例 #1
0
        public void Register(LoginLocal loginEntity, string userId)
        {
            if (loginEntity.Password == null)
            {
                loginEntity.Password = C_DefaultPassword;
            }
            loginEntity.Password = Encipherment.MD5(string.Format("{0}{1}", loginEntity.Password, _gbKey)).ToUpper();

            using (var biz = new GameBiz.Business.GameBizBusinessManagement())
            {
                biz.BeginTran();
                using (var loginManager = new LoginLocalManager())
                {
                    var tmp = loginManager.GetLoginByName(loginEntity.LoginName);
                    if (tmp != null)
                    {
                        throw new AuthException("登录名已经存在 - " + loginEntity.LoginName);
                    }
                    loginEntity.User     = loginManager.LoadUser(userId);
                    loginEntity.Register = loginManager.LoadRegister(userId);
                    loginManager.Register(loginEntity);
                }
                biz.CommitTran();
            }
        }
コード例 #2
0
        public string GetUserId(string loginName)
        {
            var loginManager = new LoginLocalManager();
            var info         = loginManager.GetLoginByName(loginName);

            return(info == null ? string.Empty : info.UserId);
        }
コード例 #3
0
 public LoginLocal GetUserByLoginName(string loginName)
 {
     using (var loginManager = new LoginLocalManager())
     {
         var user = loginManager.GetLoginByName(loginName);
         if (user == null)
         {
             throw new AuthException("用户不存在或不是本地注册用户。请确定是否是通过支付宝或QQ帐号进行登录,如有疑问,请联系客服。");
         }
         return(user);
     }
 }
コード例 #4
0
 public string GetLoginNameIsExsite(string loginName)
 {
     using (var loginManager = new LoginLocalManager())
     {
         var user = loginManager.GetLoginByName(loginName);
         if (user == null)
         {
             return("");
         }
         else
         {
             return(user.LoginName);
         }
     }
 }