예제 #1
0
 private void btnSaveUser_Click(object sender, EventArgs e)
 {
     if ((!string.IsNullOrEmpty(this.txtQuestion.Text) && string.IsNullOrEmpty(this.txtAnswer.Text)) || (string.IsNullOrEmpty(this.txtQuestion.Text) && !string.IsNullOrEmpty(this.txtAnswer.Text)))
     {
         this.ShowMessage("密码问题和问题答案要设置的话就两者都必须填写", false, "", 1);
     }
     else
     {
         MemberInfo user = Users.GetUser(this.userId);
         if (!string.IsNullOrEmpty(this.txtTradeKey.Text))
         {
             if (this.txtTradeKey.Text.Length < 6 || this.txtTradeKey.Text.Length > 20)
             {
                 this.ShowMessage("交易密码长度必须为6-20个字符", false, "", 1);
                 return;
             }
             if (string.Compare(this.txtTradeKey.Text, this.txtTradeKey2.Text) != 0)
             {
                 this.ShowMessage("两次输入的交易密码不一致", false, "", 1);
                 return;
             }
             user.IsOpenBalance = true;
             user.TradePassword = this.txtTradeKey.Text;
         }
         if (!string.IsNullOrEmpty(this.txtQuestion.Text) && !string.IsNullOrEmpty(this.txtAnswer.Text))
         {
             MemberProcessor.ChangePasswordQuestionAndAnswer("", Globals.HtmlEncode(this.txtQuestion.Text), Globals.HtmlEncode(this.txtAnswer.Text));
         }
         user.RealName = this.txtRealName.Text;
         if (this.dropRegions.GetSelectedRegionId().HasValue)
         {
             user.RegionId    = this.dropRegions.GetSelectedRegionId().Value;
             user.TopRegionId = RegionHelper.GetTopRegionId(user.RegionId, true);
         }
         user.Address   = Globals.HtmlEncode(this.txtAddress.Text);
         user.QQ        = this.txtQQ.Text;
         user.WeChat    = this.txtMSN.Text;
         user.CellPhone = this.txtHandSet.Text;
         user.Wangwang  = this.txtWW.Text;
         if (MemberProcessor.UpdateMember(user))
         {
             this.Page.Response.Redirect("/user/MyAccountSummary.aspx");
         }
     }
 }
        private void btnOK3_Click(object sender, EventArgs e)
        {
            MemberInfo user = HiContext.Current.User;

            if (user != null)
            {
                if (string.IsNullOrEmpty(this.txtQuestion.Text) || string.IsNullOrEmpty(this.txtAnswer.Text))
                {
                    this.ShowMessage(this.StatusPasswordProtection, "问题和答案为必填项", false);
                }
                else if (MemberProcessor.ChangePasswordQuestionAndAnswer(Globals.HtmlEncode(this.txtOdeAnswer.Text), Globals.HtmlEncode(this.txtQuestion.Text), Globals.HtmlEncode(this.txtAnswer.Text)))
                {
                    this.BindAnswerAndQuestion();
                    this.ShowMessage(this.StatusPasswordProtection, "成功修改了密码答案", true);
                }
                else
                {
                    this.ShowMessage(this.StatusPasswordProtection, "修改密码答案失败", false);
                }
            }
        }