public string BindBankCard(string Guid, WS_BankCard BankCard) { try { var accId = GetLoginId(Guid); if (accId == 0) { return("请先登录"); } if (!AccountDAL.IsExistsOpenCardName(accId, BankCard.OpenCardName)) { return("新卡与已存在的开户名不一致"); } if (AccountDAL.IsExistsOpenCardNo(accId, BankCard.CardNo)) { return("该卡号已存在"); } var bankCard = new BankCard { AccountId = accId, BankName = BankCard.BankName, CardNo = BankCard.CardNo, City = BankCard.City, CityId = BankCard.CityId, OpenCardName = BankCard.OpenCardName, Province = BankCard.Province, }; AccountDAL.BindBankCard(bankCard); return("true"); } catch (Exception ex) { return(ex.Message); } }
private void btn1_Click(object sender, EventArgs e) { if (txtMoneyPwd.Text != AccountDAL.GetAccount(StaticInfo.Account.Id).AccountMoneyPwd) { MessageBox.Show("资金密码输入错误!"); return; } var name = txtName.Text.Trim(); if (string.IsNullOrEmpty(name)) { MessageBox.Show("开户名不能为空!"); return; } if (txtCardNo.Text.Length > 19 || txtCardNo.Text.Length < 16) { MessageBox.Show("银行卡号长度不正确!"); return; } if (txtCardNo.Text != txtCardNo2.Text) { MessageBox.Show("两次银行卡号输入不正确!"); return; } BankCard BankCard = new BankCard { AccountId = StaticInfo.Account.Id, BankName = cbo1.Text, CardNo = txtCardNo.Text, City = cbo3.Text, Province = cbo2.Text, OpenCardName = txtName.Text, }; try { AccountDAL.BindBankCard(BankCard); flag = true; MessageBox.Show("绑定成功!"); txtCardNo.Text = ""; txtCardNo2.Text = ""; } catch (Exception) { throw; } }