Ejemplo n.º 1
0
        protected void Button_register_Click(object sender, EventArgs e)
        {
            string account = TextBox_account.Text.Trim();
            string phone   = TextBox_phone.Text.Trim();
            string Id      = TextBox_IdCard.Text.Trim();

            string password = TextBox_psw.Text.Trim();

            bool result = CheckInput(account, password, phone, Id);

            if (result)
            {
                Dictionary <String, String> row = UserTool.Get(account);
                if (!row.ContainsKey("Account"))
                {
                    Label_TipInfo.Text = "帐号“" + account + "”不存在!";
                }
                else
                {
                    if (!row.ContainsKey("Phone") || !row["Phone"].Equals(phone))
                    {
                        Label_TipInfo.Text = "手机号“" + phone + "”不正确!";
                    }
                    else if (!row.ContainsKey("IdCard") || !row["IdCard"].Equals(Id))
                    {
                        Label_TipInfo.Text = "身份证号不正确!";
                    }
                    else
                    {
                        string msg = UserTool.Update(row["ID"], null, password, null, null, null, null, null, null, null);

                        if (msg.Equals("success"))
                        {
                            Response.Redirect("UserLogin.aspx?Account=" + account);
                        }
                        else
                        {
                            Label_TipInfo.Text = "重置密码失败!";
                        }
                    }
                }
            }
        }