コード例 #1
0
        public void RegisterUser(SystemUser user, UserRegInfo regInfo)
        {
            using (var biz = new GameBizBusinessManagement())
            {
                biz.BeginTran();

                using (var manager = new UserBalanceManager())
                {
                    var register = new UserRegister
                    {
                        User        = user,
                        DisplayName = regInfo.DisplayName,
                        ComeFrom    = regInfo.ComeFrom,
                        RegType     = regInfo.RegType,
                        RegisterIp  = regInfo.RegisterIp,
                        Referrer    = regInfo.Referrer,
                        ReferrerUrl = regInfo.ReferrerUrl,
                        IsEnable    = true,
                        IsAgent     = false,
                        IsFillMoney = false,
                        AgentId     = regInfo.AgentId,
                        CreateTime  = DateTime.Now,
                        VipLevel    = 0,
                        UserId      = user.UserId,
                    };
                    try
                    {
                        if (!string.IsNullOrEmpty(regInfo.AgentId))
                        {
                            var agentUser = manager.GetUserRegister(regInfo.AgentId);
                            if (agentUser != null)
                            {
                                register.ParentPath = agentUser.ParentPath + "/" + agentUser.UserId;
                            }
                        }
                    }
                    catch { }
                    manager.AddUserRegister(register);

                    var balance = new UserBalance
                    {
                        User              = user,
                        BonusBalance      = 0M,
                        FreezeBalance     = 0M,
                        CommissionBalance = 0M,
                        ExpertsBalance    = 0M,
                        FillMoneyBalance  = 0M,
                        RedBagBalance     = 0M,
                        CurrentDouDou     = 0,
                        UserGrowth        = 0,
                        IsSetPwd          = false,
                        NeedPwdPlace      = string.Empty,
                        Password          = string.Empty,
                        UserId            = user.UserId,
                        Version           = 0,
                        AgentId           = regInfo.AgentId,
                    };
                    manager.AddUserBalance(balance);
                }
                biz.CommitTran();
            }
        }