예제 #1
0
        //注册时确定按钮
        protected void OK_Btu_Click(object sender, EventArgs e)
        {
            phoneNumber = this.user_PhoneNumber.Value.ToString().Trim();
            if (String.IsNullOrEmpty(phoneNumber))
            {
                MessageTxt.Value = "请输入电话号码!";
                return;
            }
            if (String.IsNullOrEmpty(this.password.Value.ToString().Trim()))
            {
                MessageTxt.Value = "请输入密码!";
                return;
            }
            else
            {
                if (this.password.Value.ToString().Trim() != this.sure_password.Value.ToString().Trim())
                {
                    MessageTxt.Value = "两次输入密码不一致!";
                    return;
                }
            }
            if (MetarnetRegex.IsMobilePhone(phoneNumber))
            {
                if (IsHaveSend && (IdentifyCode.Value.ToString().Trim() == SecurityCode.ToString())) //判断验证码是否正确
                {
                    EnUserInfo Euser = new EnUserInfo();
                    Euser.uerName      = this.UserNameText.Value.ToString().Trim();
                    Euser.phoneNumber  = phoneNumber;
                    Euser.registerTime = DateTime.Now;
                    Euser.password     = this.password.Value.ToString().Trim();

                    if (users.Register(Euser))
                    {
                        MessageTxt.Value = "注册成功!";
                        //还原
                        IsHaveSend   = false;
                        SecurityCode = 0;
                        return;
                    }
                }
                else
                {
                    MessageTxt.Value = "验证码不正确!";
                    return;
                }
            }
            else
            {
                MessageTxt.Value = "手机号格式不正确!";
                return;
            }
        }
예제 #2
0
        /// <summary>
        /// 注册 1,成功;2,用户名已存在;3,电话号码已存在
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public bool  Register(EnUserInfo obj)
        {
            DataTable user = getDatable(obj);

            int key;

            try
            {
                key = DataBase.update("UserInfo", "UserRecID", user);
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
예제 #3
0
        /// <summary>
        /// 获取表
        /// </summary>
        /// <returns></returns>
        public DataTable getDatable(EnUserInfo obj)
        {
            string    sql  = "select * from UserInfo where 0=1";
            DataSet   ds   = DataBase.RunDataSet(sql);
            DataTable user = ds.Tables[0];
            DataRow   dr   = user.NewRow();

            dr["UserRecID"]    = 0;
            dr["UserName"]     = obj.uerName;
            dr["Password"]     = obj.password;
            dr["RegisterTime"] = obj.registerTime;
            dr["PhoneNumber"]  = obj.phoneNumber;
            dr["UserType"]     = 1;
            user.Rows.Add(dr);
            return(user);
        }