Ejemplo n.º 1
0
        private void btnSubmit_Click(object sender, System.EventArgs e)
        {
            if (string.IsNullOrEmpty(this.txtRealName.Text.Trim()))
            {
                this.ShowMessage("请输入姓名", false);
                return;
            }
            if (string.IsNullOrEmpty(this.txtIdentityCard.Text.Trim()))
            {
                this.ShowMessage("请输入身份证号码", false);
                return;
            }
            string patternIdentityCard = "^[1-9]\\d{5}[1-9]\\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\\d{3}(\\d|x|X)";

            System.Text.RegularExpressions.Regex regexIdentityCard = new System.Text.RegularExpressions.Regex(patternIdentityCard);
            if (!string.IsNullOrEmpty(this.txtIdentityCard.Text) && !regexIdentityCard.IsMatch(this.txtIdentityCard.Text.Trim()))
            {
                this.ShowMessage("请输入正确的身份证号码", false);
                return;
            }
            Member member = Users.GetUser(HiContext.Current.User.UserId, true) as Member;

            if (string.IsNullOrEmpty(member.IdentityCard))
            {
                member.IdentityCard = "";
            }

            if ((member.RealName != this.txtRealName.Text.Trim() || member.IdentityCard.ToUpper() != this.txtIdentityCard.Text.Trim().ToUpper()) && UserHelper.IsExistIdentityCard(txtIdentityCard.Text.Trim(), HiContext.Current.User.UserId) > 0)
            {
                this.ShowMessage("存在已认证的身份证号码,不能保存!", false);
                return;
            }

            if (!OrderHelper.Checkisverify(HiContext.Current.User.UserId) || member.RealName != this.txtRealName.Text.Trim() || member.IdentityCard.ToUpper() != this.txtIdentityCard.Text.Trim().ToUpper())
            {
                int MaxCount = string.IsNullOrEmpty(ConfigurationManager.AppSettings["IsVerifyCount"]) ? 3 : int.Parse(ConfigurationManager.AppSettings["IsVerifyCount"]);
                int fcount   = MemberHelper.CheckErrorCount(HiContext.Current.User.UserId);
                //if (fcount >= MaxCount || (MaxCount - fcount - 1) == 0)//超过失败次数
                if (fcount >= MaxCount)//超过失败次数 20160315 修改之前
                {
                    this.ShowMessage("您今天已提交验证" + (MaxCount) + "次,不能再验证!", false);
                    return;
                }

                CertNoValidHelper cv   = new CertNoValidHelper();
                string            rest = cv.CertNoValid(this.txtRealName.Text.Trim(), this.txtIdentityCard.Text.Trim().ToUpper());
                MemberHelper.AddIsVerifyMsg(HiContext.Current.User.UserId);
                if (!rest.Equals("实名通过"))
                {
                    string message = "验证失败,您还有" + (MaxCount - fcount - 1) + "次验证机会,请确认身份信息是否有误!";
                    if ((MaxCount - fcount - 1) == 0)
                    {
                        message = "您今天已提交验证" + (MaxCount) + "次,不能再验证!";
                    }
                    this.ShowMessage(message, false);
                    return;
                }
            }

            member.IsVerify     = 1;
            member.VerifyDate   = DateTime.Now;
            member.IdentityCard = this.txtIdentityCard.Text.Trim().ToUpper();
            member.RealName     = Globals.HtmlEncode(this.txtRealName.Text.Trim());
            if (Users.UpdateUser(member))
            {
                string type = string.IsNullOrEmpty(this.Page.Request.QueryString["type"]) ? "" : this.Page.Request.QueryString["type"];
                if (type == "submit")
                {
                    this.Page.Response.Redirect("../SubmmitOrder.aspx?buyAmount=" + this.Page.Request.QueryString["buyAmount"] + "&productSku=" + this.Page.Request.QueryString["productSku"] + "&from=" + this.Page.Request.QueryString["from"] + "&storeId=");
                    return;
                }
                this.ShowMessage("认证成功", true);
                return;
            }
            this.ShowMessage("认证失败", false);
        }
Ejemplo n.º 2
0
        private void btnOK1_Click(object sender, System.EventArgs e)
        {
            Member member = Users.GetUser(HiContext.Current.User.UserId, true) as Member;

            string patternIdentityCard = "^[1-9]\\d{5}[1-9]\\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\\d{3}(\\d|x|X)";

            System.Text.RegularExpressions.Regex regexIdentityCard = new System.Text.RegularExpressions.Regex(patternIdentityCard);
            if (!string.IsNullOrEmpty(this.txtIdentityCard.Text) && !regexIdentityCard.IsMatch(this.txtIdentityCard.Text.Trim()))
            {
                this.ShowMessage("请输入正确的身份证号码", false);
                return;
            }
            if (!this.dropRegionsSelect.GetSelectedRegionId().HasValue)
            {
                member.RegionId = 0;
            }
            else
            {
                member.RegionId    = this.dropRegionsSelect.GetSelectedRegionId().Value;
                member.TopRegionId = RegionHelper.GetTopRegionId(member.RegionId);
            }
            member.Gender    = this.gender.SelectedValue;
            member.BirthDate = this.calendDate.SelectedDate;
            member.Address   = Globals.HtmlEncode(this.txtAddress.Text);
            member.QQ        = Globals.HtmlEncode(this.txtQQ.Text);
            member.MSN       = Globals.HtmlEncode(this.txtMSN.Text);
            member.TelPhone  = Globals.HtmlEncode(this.txtTel.Text);
            member.CellPhone = Globals.HtmlEncode(this.txtHandSet.Text);
            member.Wangwang  = Globals.HtmlEncode(this.txtwangwang.Text);
            if (string.IsNullOrWhiteSpace(member.IdentityCard))
            {
                member.IdentityCard = "";
            }

            if ((member.IdentityCard.ToUpper() != this.txtIdentityCard.Text.ToUpper() || member.RealName != this.txtRealName.Text) && UserHelper.IsExistIdentityCard(txtIdentityCard.Text.Trim(), HiContext.Current.User.UserId) > 0)
            {
                this.ShowMessage("存在已认证的身份证号码,不能保存!", false);
                return;
            }

            if (!OrderHelper.Checkisverify(HiContext.Current.User.UserId) || member.IdentityCard.ToUpper() != this.txtIdentityCard.Text.ToUpper() || member.RealName != this.txtRealName.Text)
            {
                int MaxCount = string.IsNullOrEmpty(ConfigurationManager.AppSettings["IsVerifyCount"]) ? 3 : int.Parse(ConfigurationManager.AppSettings["IsVerifyCount"]);
                int fcount   = MemberHelper.CheckErrorCount(HiContext.Current.User.UserId);
                if (fcount >= MaxCount)//超过失败次数
                {
                    this.ShowMessage("您今天已提交验证" + (MaxCount) + "次,不能再验证!", false);
                    return;
                }

                CertNoValidHelper cv   = new CertNoValidHelper();
                string            rest = cv.CertNoValid(this.txtRealName.Text, this.txtIdentityCard.Text.ToUpper());
                MemberHelper.AddIsVerifyMsg(HiContext.Current.User.UserId);

                if (!rest.Equals("实名通过"))
                {
                    string message = "验证失败,您还有" + (MaxCount - fcount - 1) + "次验证机会,请确认身份信息是否有误!";
                    if ((MaxCount - fcount - 1) == 0)
                    {
                        message = "您今天已提交验证" + (MaxCount) + "次,不能再验证!";
                    }
                    this.ShowMessage(message, false);
                    return;
                }
            }
            member.IdentityCard = this.txtIdentityCard.Text.ToUpper();
            member.RealName     = Globals.HtmlEncode(this.txtRealName.Text);
            member.IsVerify     = 1;
            member.VerifyDate   = DateTime.Now;
            if (!this.ValidationMember(member))
            {
                return;
            }
            if (!string.IsNullOrWhiteSpace(member.Email))
            {
                if (UserHelper.IsExistEmal(member.Email, member.Username))
                {
                    this.ShowMessage("邮箱已被使用过", false);
                    return;
                }
            }
            if (Users.UpdateUser(member))
            {
                this.ShowMessage("成功的修改了用户的个人资料", true);
                return;
            }
            this.ShowMessage("修改用户个人资料失败", false);
        }