public void RegisterUser(UserRegistrationPM userRegistrationPM, bool sendConfirmationEmail) { var user = UserBiz.CreateUser(userRegistrationPM.GetUser()); var membership = MembershipBiz.CreateMembershipForNewUser(user, userRegistrationPM.Password); if (sendConfirmationEmail) { try { SendActivationEmail(user, membership); } catch (Exception ex) { Logger.AddException(ex, "signIn"); } } UnitOfWork.SaveChanges(); }
/// <summary> /// 用户注册 /// </summary> /// <param name="context">当前请求上下文应答实例</param> /// <param name="acount">账号信息</param> /// <param name="uAccount">用户账户信息</param> /// <param name="uInfo">用户个人信息</param> private static void UserSignUp(DataContext context, Account acount, UserAccount uAccount, UserInfo uInfo) { UserExtInfo extInfo = new UserExtInfo { CreateDeviceId = context.DeviceId, CreateAPPChannel = context.ReqChannel, CreateAccountChannel = (int)acount.AccountChannel }; UserBiz.CreateUser(uAccount, uInfo, extInfo); //注册结果:uAccount.UserId > 0 为成功,反之为失败! if (uAccount.UserId > 0) { //注册成功后,更新游客账户用户名、昵称信息 if (acount.AccountChannel == AccountChannel.Guest) { uAccount.UserName = string.Format("{0}{1}", GuestUserNamePreFix, uAccount.UserId); uInfo.NickName = string.Format("游客{0}", Convert.ToBase64String(uAccount.UserId.GetIntOffsetBytes(), Base64FormattingOptions.None).TrimEnd('=')); UserBiz.UpdateGuestUserInfo(uAccount, uInfo); } //写注册日志 CreateSignUpLog(context, acount, uAccount); //输出登录结果 UserVaildInfo vaildInfo = new UserVaildInfo { UserId = uAccount.UserId, LastLoginDeviceId = context.DeviceId, LastLoginDate = uAccount.CreateDate, LoginCount = uAccount.LoginCount }; SignIn.FlushResult(context, vaildInfo); } else { context.Flush(RespondCode.ExecError); } }
public object CreateUser(object json) { return(UserBiz.CreateUser(json)); }