Ejemplo n.º 1
0
        /// <summary>
        /// 注册用户
        /// </summary>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="nickname">昵称</param>
        /// <param name="email">电子邮箱</param>
        /// <param name="needActive">是否需要激活</param>
        /// <returns>返回注册成功的用户编号</returns>
        public int Regsiter(string username, string password, string nickname, string email, string ip, bool needActive)
        {
            //如果用户名和昵称已经被注册,则返回-1
            if (dal.DetectUserAndNickNameExist(username, nickname))
            {
                return(-1);
            }

            //注册会员
            dal.RegisterMember(
                username,
                password,
                "",
                "UnKnown",
                nickname,
                "",
                email,
                "");

            int uid = dal.GetMemberUid(username);

            dal.InsertDetails(
                uid,
                needActive ? "Active" : "Normal",
                ip,
                GenericMemberToken(username)
                );
            return(uid);
        }