示例#1
0
        /// <summary>
        /// 创建所有卡和账号名空间
        /// </summary>
        private void GetAllCardNumInfo()
        {
            ISysUserService mSysUserService = IoC.Resolve <ISysUserService>();

            if (mSysUserService.GetUserLockUserCount(CookUserInfo.Id) >= 2)
            {
                Response.Write("<script>alert('您已经解锁过一次,请联系客户!'); parent.window.location.href = '/Views/Users/BindBankCard.aspx?dt=" + DateTime.Now.ToString() + "';</script>");
                return;
            }
            //获取当前绑定卡集合
            ISysUserBankService userbankService = IoC.Resolve <ISysUserBankService>();
            var result = userbankService.GetUserBanks(this.CookUserInfo.Id);

            StringBuilder builder = new StringBuilder();

            for (var i = 0; i < result.Count; i++)
            {
                var    item  = result[i];
                string title = string.Format("开户名({0})", item.BankName);
                builder.Append("<tr>");

                builder.Append("<td class='lsrd'>");
                builder.Append(title + " :");
                builder.Append("</td>");
                builder.Append("<td>");
                builder.Append("<input type='text' name='BankOwner' style='width:150px;' class='input normal' /><span class='Validform_checktip'>*</span>");
                builder.Append("</td>");
                builder.Append("<td class='lsrd'>");
                builder.Append("卡号 :");
                builder.Append("</td>");
                builder.Append("<td>");
                builder.Append("<input type='text' name='cardNum' class='input normal' style='width:200px;'/><span class='Validform_checktip'>*</span>");
                builder.Append("</td>");
                builder.Append("</tr>");

                //builder.Append("<dl><dt style='width:130px;'>" + title + "</dt><dd></dd>");
                // builder.Append("<dt>卡号</dt><dd></dd></dl>");
            }

            this.BindCardNums = builder.ToString();
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.txtZjPwd.Text.Trim()))
            {
                Response.End();
                return;
            }
            //验证资金密码
            ISysUserBalanceService userBalanceService = IoC.Resolve <ISysUserBalanceService>();

            if (!userBalanceService.VdUserBalancePwd(CookUserInfo.Id, this.txtZjPwd.Text.Trim()))
            {
                //验证失败
                Alert("资金密码验证失败!");
                return;
            }

            var bank = new SysUserBank
            {
                BankNo     = opsNo.Text,
                BankId     = Convert.ToInt32(ViewState["drpBanks"].ToString().Split('_')[0]),
                BankOwner  = opsname.Text,
                Branch     = opszhihang.Text,
                CityId     = Convert.ToInt32(ViewState["drpCity"]),
                IsDelete   = false,
                OccDate    = DateTime.Now,
                ProvinceId = Convert.ToInt32(ViewState["drpPro"]),
                UserId     = this.CookUserInfo.Id
            };
            ISysUserBankService userBanks = IoC.Resolve <ISysUserBankService>();

            //验证是否存在同样的银行卡号
            if (userBanks.Where(c => c.BankNo == bank.BankNo).FirstOrDefault() != null)
            {
                Alert("银行卡号已经被绑定,请确认是否输入正确!", "", 3);
                return;
            }
            //验证开户姓名是否一致
            var  userBindBanks = userBanks.GetUserBanks(this.CookUserInfo.Id);
            var  firstBindCard = userBindBanks.FirstOrDefault();
            bool isCompled     = false;

            if (firstBindCard == null)
            {
                isCompled = true;
            }
            else
            {
                //验证是否存在同一银行,的卡
                if (firstBindCard.BankOwner != bank.BankOwner)
                {
                    BackParam += "&at=nb";
                    Response.Redirect("/Mobile/user/ConfirmBindCardNum.aspx?" + BackParam);
                    //Alert("一个账户只能绑定同一个开户人姓名的银行卡!");
                    //ClientScript.RegisterStartupScript(this.GetType(),"_down_key","<script>$('#bankback').click();</script>",true);
                    return;
                }
                if (userBindBanks.Where(x => x.BankId == bank.BankId).FirstOrDefault() != null)
                {
                    BackParam += "&at=cb";
                    Response.Redirect("/Mobile/user/ConfirmBindCardNum.aspx?" + BackParam);
                    //Alert("同一个银行只允许绑定一张卡!");
                    //ClientScript.RegisterStartupScript(this.GetType(), "_down_key", "<script>$('#bankback').click();</script>", true);
                    return;
                }
            }

            if (userBanks.CreateBank(bank))
            {
                Response.Write("<script>parent.window.location.href = '/Mobile/user/BindBankCard.aspx?dt=dt';</script>");
            }
            else
            {
                Alert("绑定银行卡失败,请稍后重试!");
            }
        }
示例#3
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            //
            string bankOwners = Request.Params["BankOwner"]; //开户名
            string cardNums   = Request.Params["cardNum"];   //账号

            //
            if (string.IsNullOrEmpty(bankOwners) || string.IsNullOrEmpty(cardNums) || string.IsNullOrEmpty(this.txtpwd.Text.Trim()))
            {
                Response.End();
                return;
            }
            var bankOwnersArray = bankOwners.Split(',');
            var cardNumsArray   = cardNums.Split(',');

            if (bankOwnersArray.Length != cardNumsArray.Length)
            {
                Response.End();
                return;
            }
            //验证
            ISysUserBankService userbankService = IoC.Resolve <ISysUserBankService>();
            var result = userbankService.GetUserBanks(this.CookUserInfo.Id);

            for (var i = 0; i < bankOwnersArray.Length; i++)
            {
                string bankOwner = bankOwnersArray[i];
                string cardNum   = cardNumsArray[i];
                var    fs        = result.Where(c => c.BankOwner == bankOwner && c.BankNo == cardNum).FirstOrDefault();
                if (null != fs)
                {
                    result.Remove(fs);
                }
            }
            if (result.Count > 0)
            {
                Alert("请正确填写银行卡信息!");
                GetAllCardNumInfo();//重新绑定
                return;
            }
            //验证资金密码
            ISysUserService        mSysUserService        = IoC.Resolve <ISysUserService>();
            ISysUserBalanceService mSysUserBalanceService = IoC.Resolve <ISysUserBalanceService>();

            //验证资金密码
            if (!mSysUserBalanceService.VdUserBalancePwd(CookUserInfo.Id, this.txtpwd.Text.Trim()))
            {
                Alert("资金密码验证失败!");
                GetAllCardNumInfo();//重新绑定
                return;
            }
            //修改为锁定
            if (mSysUserService.UnLockUserCards(this.CookUserInfo.Id))
            {
                //关闭窗口
                Response.Write("<script>parent.window.location.href = '/Views/Users/BindBankCard.aspx?dt=" + DateTime.Now.ToString() + "';</script>");
            }
            else
            {
                Alert("解锁失败!");
                GetAllCardNumInfo();//重新绑定
            }
        }