Esempio n. 1
0
        /// <summary>
        /// 从IDataReader创建UserInfo
        /// </summary>
        public static UserInfo BuildUserFromReader(IDataReader reader)
        {
            UserInfo userInfo = new UserInfo();

            userInfo.Uid = TypeHelper.ObjectToInt(reader["uid"]);
            userInfo.UserName = reader["username"].ToString();
            userInfo.Email = reader["email"].ToString();
            userInfo.Mobile = reader["mobile"].ToString();
            userInfo.Password = reader["password"].ToString();
            userInfo.UserRid = TypeHelper.ObjectToInt(reader["userrid"]);
            userInfo.StoreId = TypeHelper.ObjectToInt(reader["storeid"]);
            userInfo.MallAGid = TypeHelper.ObjectToInt(reader["mallagid"]);
            userInfo.NickName = reader["nickname"].ToString();
            userInfo.Avatar = reader["avatar"].ToString();
            userInfo.PayCredits = TypeHelper.ObjectToInt(reader["paycredits"]);
            userInfo.RankCredits = TypeHelper.ObjectToInt(reader["rankcredits"]);
            userInfo.VerifyEmail = TypeHelper.ObjectToInt(reader["verifyemail"]);
            userInfo.VerifyMobile = TypeHelper.ObjectToInt(reader["verifymobile"]);
            userInfo.LiftBanTime = TypeHelper.ObjectToDateTime(reader["liftbantime"]);
            userInfo.Salt = reader["salt"].ToString();
            userInfo.LastVisitTime = TypeHelper.ObjectToDateTime(reader["lastvisittime"]);
            userInfo.LastVisitIP = reader["lastvisitip"].ToString();
            userInfo.LastVisitRgId = TypeHelper.ObjectToInt(reader["lastvisitrgid"]);
            userInfo.RegisterTime = TypeHelper.ObjectToDateTime(reader["registertime"]);
            userInfo.RegisterIP = reader["registerip"].ToString();
            userInfo.RegisterRgId = TypeHelper.ObjectToInt(reader["registerrgid"]);
            userInfo.Gender = TypeHelper.ObjectToInt(reader["gender"]);
            userInfo.RealName = reader["realname"].ToString();
            userInfo.Bday = TypeHelper.ObjectToDateTime(reader["bday"]);
            userInfo.IdCard = reader["idcard"].ToString();
            userInfo.RegionId = TypeHelper.ObjectToInt(reader["regionid"]);
            userInfo.Address = reader["address"].ToString();
            userInfo.Bio = reader["bio"].ToString();

            return userInfo;
        }
Esempio n. 2
0
        /// <summary>
        /// 更新用户
        /// </summary>
        /// <returns></returns>
        public void UpdateUser(UserInfo userInfo)
        {
            DbParameter[] parms = {
									   GenerateInParam("@username",SqlDbType.NChar,20,userInfo.UserName),
									   GenerateInParam("@email",SqlDbType.Char,50,userInfo.Email),
                                       GenerateInParam("@mobile",SqlDbType.Char,15,userInfo.Mobile),
									   GenerateInParam("@password",SqlDbType.Char,32,userInfo.Password),
									   GenerateInParam("@userrid",SqlDbType.SmallInt,2,userInfo.UserRid),
									   GenerateInParam("@storeid",SqlDbType.Int,4,userInfo.StoreId),
                                       GenerateInParam("@mallagid",SqlDbType.SmallInt,2,userInfo.MallAGid),
									   GenerateInParam("@nickname",SqlDbType.NChar,20,userInfo.NickName),
									   GenerateInParam("@avatar",SqlDbType.Char,40,userInfo.Avatar),
									   GenerateInParam("@paycredits",SqlDbType.Int,4,userInfo.PayCredits),
									   GenerateInParam("@rankcredits",SqlDbType.Int,4,userInfo.RankCredits),
									   GenerateInParam("@verifyemail",SqlDbType.TinyInt,1,userInfo.VerifyEmail),
									   GenerateInParam("@verifymobile",SqlDbType.TinyInt,1,userInfo.VerifyMobile),
									   GenerateInParam("@liftbantime",SqlDbType.DateTime,8,userInfo.LiftBanTime),
                                       GenerateInParam("@salt",SqlDbType.NChar,6,userInfo.Salt),
                                       GenerateInParam("@lastvisittime",SqlDbType.DateTime,8,userInfo.LastVisitTime),
                                       GenerateInParam("@lastvisitip",SqlDbType.Char,15,userInfo.LastVisitIP),
                                       GenerateInParam("@lastvisitrgid",SqlDbType.SmallInt,2,userInfo.LastVisitRgId),
									   GenerateInParam("@registertime",SqlDbType.DateTime,8,userInfo.RegisterTime),
                                       GenerateInParam("@registerip",SqlDbType.Char,15,userInfo.RegisterIP),
                                       GenerateInParam("@registerrgid",SqlDbType.SmallInt,2,userInfo.RegisterRgId),
									   GenerateInParam("@gender",SqlDbType.TinyInt,1,userInfo.Gender),
                                       GenerateInParam("@realname",SqlDbType.NVarChar,10,userInfo.RealName),
									   GenerateInParam("@bday",SqlDbType.DateTime,8,userInfo.Bday),
                                       GenerateInParam("@idcard",SqlDbType.VarChar,18,userInfo.IdCard),
									   GenerateInParam("@regionid",SqlDbType.SmallInt,2,userInfo.RegionId),
									   GenerateInParam("@address",SqlDbType.NVarChar,150,userInfo.Address),
									   GenerateInParam("@bio",SqlDbType.NVarChar,300,userInfo.Bio),
									   GenerateInParam("@uid",SqlDbType.Int,4,userInfo.Uid)
								   };

            RDBSHelper.ExecuteScalar(CommandType.StoredProcedure,
                                     string.Format("{0}updateuser", RDBSHelper.RDBSTablePre),
                                     parms);
        }
Esempio n. 3
0
        /// <summary>
        /// 注册
        /// </summary>
        public ActionResult Register()
        {
            string returnUrl = WebHelper.GetQueryString("returnUrl");
            if (returnUrl.Length == 0)
                returnUrl = "/";

            if (WorkContext.MallConfig.RegType.Length == 0)
                return PromptView(returnUrl, "商城目前已经关闭注册功能!");
            if (WorkContext.Uid > 0)
                return PromptView(returnUrl, "你已经是本商城的注册用户,无需再注册!");
            if (WorkContext.MallConfig.RegTimeSpan > 0)
            {
                DateTime registerTime = Users.GetRegisterTimeByRegisterIP(WorkContext.IP);
                if ((DateTime.Now - registerTime).Minutes <= WorkContext.MallConfig.RegTimeSpan)
                    return PromptView(returnUrl, "你注册太频繁,请间隔一定时间后再注册!");
            }

            //get请求
            if (WebHelper.IsGet())
            {
                RegisterModel model = new RegisterModel();

                model.ReturnUrl = returnUrl;
                model.ShadowName = WorkContext.MallConfig.ShadowName;
                model.IsVerifyCode = CommonHelper.IsInArray(WorkContext.PageKey, WorkContext.MallConfig.VerifyPages);

                return View(model);
            }

            //ajax请求
            string accountName = WebHelper.GetFormString(WorkContext.MallConfig.ShadowName).Trim().ToLower();
            string password = WebHelper.GetFormString("password");
            string confirmPwd = WebHelper.GetFormString("confirmPwd");
            string verifyCode = WebHelper.GetFormString("verifyCode");

            StringBuilder errorList = new StringBuilder("[");
            #region 验证

            //账号验证
            if (string.IsNullOrWhiteSpace(accountName))
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "账户名不能为空", "}");
            }
            else if (accountName.Length < 4 || accountName.Length > 50)
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "账户名必须大于3且不大于50个字符", "}");
            }
            else if (accountName.Contains(" "))
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "账户名中不允许包含空格", "}");
            }
            else if (accountName.Contains(":"))
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "账户名中不允许包含冒号", "}");
            }
            else if (accountName.Contains("<"))
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "账户名中不允许包含'<'符号", "}");
            }
            else if (accountName.Contains(">"))
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "账户名中不允许包含'>'符号", "}");
            }
            else if ((!SecureHelper.IsSafeSqlString(accountName)))
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "账户名已经存在", "}");
            }
            else if (CommonHelper.IsInArray(accountName, WorkContext.MallConfig.ReservedName, "\n"))
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "账户名已经存在", "}");
            }
            else if (FilterWords.IsContainWords(accountName))
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "账户名包含禁止单词", "}");
            }

            //密码验证
            if (string.IsNullOrWhiteSpace(password))
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "password", "密码不能为空", "}");
            }
            else if (password.Length < 4 || password.Length > 32)
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "password", "密码必须大于3且不大于32个字符", "}");
            }
            else if (password != confirmPwd)
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "password", "两次输入的密码不一样", "}");
            }

            //验证码验证
            if (CommonHelper.IsInArray(WorkContext.PageKey, WorkContext.MallConfig.VerifyPages))
            {
                if (string.IsNullOrWhiteSpace(verifyCode))
                {
                    errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "verifyCode", "验证码不能为空", "}");
                }
                else if (verifyCode.ToLower() != Sessions.GetValueString(WorkContext.Sid, "verifyCode"))
                {
                    errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "verifyCode", "验证码不正确", "}");
                }
            }

            //其它验证
            int gender = WebHelper.GetFormInt("gender");
            if (gender < 0 || gender > 2)
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "gender", "请选择正确的性别", "}");

            string nickName = WebHelper.GetFormString("nickName");
            if (nickName.Length > 10)
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "nickName", "昵称的长度不能大于10", "}");
            }
            else if (FilterWords.IsContainWords(nickName))
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "nickName", "昵称中包含禁止单词", "}");
            }

            if (WebHelper.GetFormString("realName").Length > 5)
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "realName", "真实姓名的长度不能大于5", "}");
            }

            string bday = WebHelper.GetFormString("bday");
            if (bday.Length == 0)
            {
                string bdayY = WebHelper.GetFormString("bdayY");
                string bdayM = WebHelper.GetFormString("bdayM");
                string bdayD = WebHelper.GetFormString("bdayD");
                bday = string.Format("{0}-{1}-{2}", bdayY, bdayM, bdayD);
            }
            if (bday.Length > 0 && bday != "--" && !ValidateHelper.IsDate(bday))
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "bday", "请选择正确的日期", "}");

            string idCard = WebHelper.GetFormString("idCard");
            if (idCard.Length > 0 && !ValidateHelper.IsIdCard(idCard))
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "idCard", "请输入正确的身份证号", "}");
            }

            int regionId = WebHelper.GetFormInt("regionId");
            if (regionId > 0)
            {
                if (Regions.GetRegionById(regionId) == null)
                    errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "regionId", "请选择正确的地址", "}");
                if (WebHelper.GetFormString("address").Length > 75)
                {
                    errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "address", "详细地址的长度不能大于75", "}");
                }
            }

            if (WebHelper.GetFormString("bio").Length > 150)
            {
                errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "bio", "简介的长度不能大于150", "}");
            }

            //当以上验证都通过时
            UserInfo userInfo = null;
            if (errorList.Length == 1)
            {
                if (WorkContext.MallConfig.RegType.Contains("2") && ValidateHelper.IsEmail(accountName))//验证邮箱
                {
                    string emailProvider = CommonHelper.GetEmailProvider(accountName);
                    if (WorkContext.MallConfig.AllowEmailProvider.Length != 0 && (!CommonHelper.IsInArray(emailProvider, WorkContext.MallConfig.AllowEmailProvider, "\n")))
                    {
                        errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "不能使用'" + emailProvider + "'类型的邮箱", "}");
                    }
                    else if (CommonHelper.IsInArray(emailProvider, WorkContext.MallConfig.BanEmailProvider, "\n"))
                    {
                        errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "不能使用'" + emailProvider + "'类型的邮箱", "}");
                    }
                    else if (Users.IsExistEmail(accountName))
                    {
                        errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "邮箱已经存在", "}");
                    }
                    else
                    {
                        userInfo = new UserInfo();
                        userInfo.UserName = string.Empty;
                        userInfo.Email = accountName;
                        userInfo.Mobile = string.Empty;
                    }
                }
                else if (WorkContext.MallConfig.RegType.Contains("3") && ValidateHelper.IsMobile(accountName))//验证手机
                {
                    if (Users.IsExistMobile(accountName))
                    {
                        errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "手机号已经存在", "}");
                    }
                    else
                    {
                        userInfo = new UserInfo();
                        userInfo.UserName = string.Empty;
                        userInfo.Email = string.Empty;
                        userInfo.Mobile = accountName;
                    }
                }
                else if (WorkContext.MallConfig.RegType.Contains("1"))//验证用户名
                {
                    if (BrnMall.Services.Users.IsExistUserName(accountName))
                    {
                        errorList.AppendFormat("{0}\"key\":\"{1}\",\"msg\":\"{2}\"{3},", "{", "accountName", "用户名已经存在", "}");
                    }
                    else
                    {
                        userInfo = new UserInfo();
                        userInfo.UserName = accountName;
                        userInfo.Email = string.Empty;
                        userInfo.Mobile = string.Empty;
                    }
                }
            }

            #endregion

            if (errorList.Length > 1)//验证失败
            {
                return AjaxResult("error", errorList.Remove(errorList.Length - 1, 1).Append("]").ToString(), true);
            }
            else//验证成功
            {
                #region 绑定用户信息

                userInfo.Salt = Randoms.CreateRandomValue(6);
                userInfo.Password = Users.CreateUserPassword(password, userInfo.Salt);
                userInfo.UserRid = UserRanks.GetLowestUserRank().UserRid;
                userInfo.StoreId = 0;
                userInfo.MallAGid = 1;//非管理员组
                if (nickName.Length > 0)
                    userInfo.NickName = WebHelper.HtmlEncode(nickName);
                else
                    userInfo.NickName = "bma" + Randoms.CreateRandomValue(7);
                userInfo.Avatar = "";
                userInfo.PayCredits = 0;
                userInfo.RankCredits = 0;
                userInfo.VerifyEmail = 0;
                userInfo.VerifyMobile = 0;

                userInfo.LastVisitIP = WorkContext.IP;
                userInfo.LastVisitRgId = WorkContext.RegionId;
                userInfo.LastVisitTime = DateTime.Now;
                userInfo.RegisterIP = WorkContext.IP;
                userInfo.RegisterRgId = WorkContext.RegionId;
                userInfo.RegisterTime = DateTime.Now;

                userInfo.Gender = WebHelper.GetFormInt("gender");
                userInfo.RealName = WebHelper.HtmlEncode(WebHelper.GetFormString("realName"));
                userInfo.Bday = bday.Length > 0 ? TypeHelper.StringToDateTime(bday) : new DateTime(1900, 1, 1);
                userInfo.IdCard = WebHelper.GetFormString("idCard");
                userInfo.RegionId = WebHelper.GetFormInt("regionId");
                userInfo.Address = WebHelper.HtmlEncode(WebHelper.GetFormString("address"));
                userInfo.Bio = WebHelper.HtmlEncode(WebHelper.GetFormString("bio"));

                #endregion

                //创建用户
                userInfo.Uid = Users.CreateUser(userInfo);

                //添加用户失败
                if (userInfo.Uid < 1)
                    return AjaxResult("exception", "创建用户失败,请联系管理员");

                //发放注册积分
                Credits.SendRegisterCredits(ref userInfo, DateTime.Now);
                //更新购物车中用户id
                Carts.UpdateCartUidBySid(userInfo.Uid, WorkContext.Sid);
                //将用户信息写入cookie
                MallUtils.SetUserCookie(userInfo, 0);

                //发送注册欢迎信息
                if (WorkContext.MallConfig.IsWebcomeMsg == 1)
                {
                    if (userInfo.Email.Length > 0)
                        Emails.SendWebcomeEmail(userInfo.Email);
                    if (userInfo.Mobile.Length > 0)
                        SMSes.SendWebcomeSMS(userInfo.Mobile);
                }

                //同步上下午
                WorkContext.Uid = userInfo.Uid;
                WorkContext.UserName = userInfo.UserName;
                WorkContext.UserEmail = userInfo.Email;
                WorkContext.UserMobile = userInfo.Mobile;
                WorkContext.NickName = userInfo.NickName;

                return AjaxResult("success", "注册成功");
            }
        }
Esempio n. 4
0
        public ActionResult Add(UserModel model)
        {
            if (string.IsNullOrWhiteSpace(model.Password))
                ModelState.AddModelError("Password", "密码不能为空");

            if (AdminUsers.IsExistUserName(model.UserName))
                ModelState.AddModelError("UserName", "名称已经存在");

            if (AdminUsers.IsExistEmail(model.Email))
                ModelState.AddModelError("Email", "email已经存在");

            if (AdminUsers.IsExistMobile(model.Mobile))
                ModelState.AddModelError("Mobile", "手机号已经存在");

            if (ModelState.IsValid)
            {
                string salt = Users.GenerateUserSalt();
                string nickName;
                if (string.IsNullOrWhiteSpace(model.NickName))
                    nickName = "bma" + Randoms.CreateRandomValue(7);
                else
                    nickName = model.NickName;

                UserInfo userInfo = new UserInfo()
                {
                    UserName = model.UserName,
                    Email = model.Email == null ? "" : model.Email,
                    Mobile = model.Mobile == null ? "" : model.Mobile,
                    Salt = salt,
                    Password = Users.CreateUserPassword(model.Password, salt),
                    UserRid = model.UserRid,
                    StoreId = 0,
                    MallAGid = model.MallAGid,
                    NickName = WebHelper.HtmlEncode(nickName),
                    Avatar = model.Avatar == null ? "" : WebHelper.HtmlEncode(model.Avatar),
                    PayCredits = model.PayCredits,
                    RankCredits = AdminUserRanks.GetUserRankById(model.UserRid).CreditsLower,
                    VerifyEmail = 1,
                    VerifyMobile = 1,
                    LiftBanTime = UserRanks.IsBanUserRank(model.UserRid) ? DateTime.Now.AddDays(WorkContext.UserRankInfo.LimitDays) : new DateTime(1900, 1, 1),
                    LastVisitTime = DateTime.Now,
                    LastVisitIP = WorkContext.IP,
                    LastVisitRgId = WorkContext.RegionId,
                    RegisterTime = DateTime.Now,
                    RegisterIP = WorkContext.IP,
                    RegisterRgId = WorkContext.RegionId,
                    Gender = model.Gender,
                    RealName = model.RealName == null ? "" : WebHelper.HtmlEncode(model.RealName),
                    Bday = model.Bday ?? new DateTime(1970, 1, 1),
                    IdCard = model.IdCard == null ? "" : model.IdCard,
                    RegionId = model.RegionId,
                    Address = model.Address == null ? "" : WebHelper.HtmlEncode(model.Address),
                    Bio = model.Bio == null ? "" : WebHelper.HtmlEncode(model.Bio)
                };

                AdminUsers.CreateUser(userInfo);
                AddMallAdminLog("添加用户", "添加用户,用户为:" + model.UserName);
                return PromptView("用户添加成功");
            }
            Load(model.RegionId);

            return View(model);
        }
Esempio n. 5
0
        /// <summary>
        /// 发放注册积分
        /// </summary>
        /// <param name="userInfo">用户信息</param>
        /// <param name="verifyTime">注册时间</param>
        public static void SendRegisterCredits(ref UserInfo userInfo, DateTime registerTime)
        {
            if (_creditconfiginfo.RegisterPayCredits > 0 || _creditconfiginfo.RegisterRankCredits > 0)
            {
                int surplusPayCredits = GetDaySurplusPayCredits(userInfo.Uid, registerTime.Date);
                int surplusRankCredits = GetDaySurplusRankCredits(userInfo.Uid, registerTime.Date);
                if (surplusPayCredits == 0 && surplusRankCredits == 0)
                    return;

                int payCredits = 0;
                int rankCredits = 0;
                if (surplusPayCredits > 0)
                    payCredits = surplusPayCredits < _creditconfiginfo.RegisterPayCredits ? surplusPayCredits : _creditconfiginfo.RegisterPayCredits;
                else if (surplusPayCredits == -1)
                    payCredits = _creditconfiginfo.RegisterPayCredits;
                if (surplusRankCredits > 0)
                    rankCredits = surplusRankCredits < _creditconfiginfo.RegisterRankCredits ? surplusRankCredits : _creditconfiginfo.RegisterRankCredits;
                else if (surplusRankCredits == -1)
                    rankCredits = _creditconfiginfo.RegisterRankCredits;

                userInfo.PayCredits += payCredits;
                userInfo.RankCredits += rankCredits;

                int userRid = UserRanks.GetUserRankByCredits(userInfo.RankCredits).UserRid;
                if (userRid != userInfo.UserRid)
                    userInfo.UserRid = userRid;
                else
                    userRid = 0;

                CreditLogInfo creditLogInfo = new CreditLogInfo();
                creditLogInfo.Uid = userInfo.Uid;
                creditLogInfo.PayCredits = payCredits;
                creditLogInfo.RankCredits = rankCredits;
                creditLogInfo.Action = (int)CreditAction.Register;
                creditLogInfo.ActionCode = 0;
                creditLogInfo.ActionTime = registerTime;
                creditLogInfo.ActionDes = "注册赠送积分";
                creditLogInfo.Operator = 0;

                SendCredits(userRid, creditLogInfo);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 初始化用户
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <param name="uNamePrefix">用户名前缀</param>
        /// <param name="regionId">区域id</param>
        /// <returns></returns>
        private static UserInfo InitUser(string userName, string uNamePrefix, int regionId)
        {
            UserInfo userInfo = new UserInfo();

            userInfo.Salt = Randoms.CreateRandomValue(6);
            userInfo.Password = Users.CreateUserPassword(Randoms.CreateRandomValue(32, false), userInfo.Salt);
            userInfo.StoreId = 0;//无店铺
            userInfo.MallAGid = 1;//非管理员组
            userInfo.UserName = GetValidUserName(userName, uNamePrefix);
            userInfo.Email = string.Empty;
            userInfo.Mobile = string.Empty;
            userInfo.NickName = StringHelper.SubString(userName, 20);
            userInfo.Avatar = "";
            userInfo.PayCredits = 0;
            userInfo.RankCredits = 0;
            userInfo.VerifyEmail = 0;
            userInfo.VerifyMobile = 0;
            userInfo.UserRid = UserRanks.GetUserRankByCredits(userInfo.PayCredits).UserRid;//根据积分判读用户等级
            userInfo.LiftBanTime = new DateTime(1900, 1, 1);
            userInfo.LastVisitTime = DateTime.Now;
            userInfo.LastVisitIP = WebHelper.GetIP();
            userInfo.LastVisitRgId = regionId;
            userInfo.RegisterTime = DateTime.Now;
            userInfo.RegisterIP = WebHelper.GetIP();
            userInfo.RegisterRgId = regionId;
            userInfo.Gender = 0;
            userInfo.RealName = string.Empty;
            userInfo.Bday = new DateTime(1900, 1, 1);
            userInfo.IdCard = string.Empty;
            userInfo.RegionId = 0;
            userInfo.Address = string.Empty;
            userInfo.Bio = string.Empty;

            return userInfo;
        }
Esempio n. 7
0
 /// <summary>
 /// 更新用户
 /// </summary>
 /// <returns></returns>
 public static void UpdateUser(UserInfo userInfo)
 {
     BrnMall.Data.Users.UpdateUser(userInfo);
 }
Esempio n. 8
0
 /// <summary>
 /// 创建用户
 /// </summary>
 /// <returns></returns>
 public static int CreateUser(UserInfo userInfo)
 {
     return BrnMall.Data.Users.CreateUser(userInfo);
 }
Esempio n. 9
0
 /// <summary>
 /// 更新用户
 /// </summary>
 /// <returns></returns>
 public static void UpdateUser(UserInfo userInfo)
 {
     BrnMall.Core.BMAData.RDBS.UpdateUser(userInfo);
     if (_usernosql != null)
         _usernosql.UpdateUser(userInfo);
 }
Esempio n. 10
0
 /// <summary>
 /// 创建用户
 /// </summary>
 /// <returns></returns>
 public static int CreateUser(UserInfo userInfo)
 {
     return BrnMall.Core.BMAData.RDBS.CreateUser(userInfo);
 }