Ejemplo n.º 1
0
        /// <summary>
        /// 注册用户
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public static BizResultInfo RegisterUser(BizUserInfo userInfo)
        {
            var result = new BizResultInfo();

            try
            {
                userInfo.Save();
                var newUserInfo = BizUserInfo.LoadByUserEmailOrUserLoginName(userInfo.UserEmail);
                if (newUserInfo != null && newUserInfo.UserInfoID != 0)
                {
                    result.IsSuccess      = true;
                    result.ResultID       = newUserInfo.UserInfoID.ConvertToCiphertext();
                    result.SuccessMessage = "注册成功,请登录注册邮箱查收激活账号邮件完成注册操作。";
                    MessageBo.CreateMessage(newUserInfo.UserInfoID, MessageTypeEnum.WelcomeToWebBookmark, newUserInfo);
                }
                else
                {
                    result.IsSuccess      = false;
                    result.SuccessMessage = "注册失败,请重试。";
                }
            }
            catch (Exception ex)
            {
                result.IsSuccess    = false;
                result.ErrorMessage = ex.ToString();
            }
            return(result);
        }
Ejemplo n.º 2
0
        public static BizResultInfo CheckUserEmail(string email)
        {
            var result = new BizResultInfo();

            if (string.IsNullOrEmpty(email))
            {
                result.IsSuccess    = false;
                result.ErrorMessage = "邮箱不能为空。";
                return(result);
            }

            var newUserInfo = BizUserInfo.LoadByUserEmailOrUserLoginName(email);

            if (newUserInfo == null || newUserInfo.UserInfoID == 0)
            {
                result.IsSuccess      = true;
                result.ResultID       = newUserInfo.UserInfoID.ConvertToCiphertext();
                result.SuccessMessage = "邮箱有效,可以注册。";
            }
            else
            {
                result.IsSuccess    = false;
                result.ErrorMessage = "此邮箱已被占用。";
            }
            return(result);
        }
Ejemplo n.º 3
0
        public static BizResultInfo GetUserInfoByLoginNameOrEmail(string loginName)
        {
            BizResultInfo result      = new BizResultInfo();
            var           newUserInfo = BizUserInfo.LoadByUserEmailOrUserLoginName(loginName);

            if (newUserInfo != null && newUserInfo.UserInfoID != 0)
            {
                result.IsSuccess = true;
                result.Target    = newUserInfo;
                result.ResultID  = newUserInfo.UserInfoID.ConvertToCiphertext();
            }
            else
            {
                result.IsSuccess    = false;
                result.ErrorMessage = "找遍了数据库都没找到这个人呀...要不,你换个号?";
            }
            return(result);
        }