private void btnOk_Click(object sender, RoutedEventArgs e) { Custom custom = DataOperation.GetCustom(this.txtAccount.Text); if (custom == null) { MessageBox.Show("帐号不存在!"); return; } if (custom.CheckLost()) { MessageBox.Show("账户已挂失不能使用!"); return; } if (custom.AccountInfo.accountPass != this.txtPassword.Password) { MessageBox.Show("密码不正确"); return; } if (this.CheckAlreadyLoan(this.txtAccount.Text)) { MessageBox.Show("您已经贷款,每个客户只能贷一次!"); return; } double loanAmount; if (!double.TryParse(this.txtmount.Text.Trim(), out loanAmount)) { MessageBox.Show("输入的金额格式不正确"); return; } if (loanAmount > this.CheckLoadMax(this.txtAccount.Text.Trim())) { MessageBox.Show("贷款金额超出信用额度(历史交易额总和的10倍)"); return; } int loanYear; if (!int.TryParse(this.txtYear.Text.Trim(), out loanYear)) { MessageBox.Show("输入的贷款年限格式不正确"); return; } double rate = this.GetLoadRateOfYear(loanYear); CalcAndShowTotalInterest(loanAmount, rate, loanYear); custom.Diposit("贷款", loanAmount); OperateRecord page = new OperateRecord(); NavigationService ns = NavigationService.GetNavigationService(this); ns.Navigate(page); }
//存款 private void btnOk_Click(object sender, RoutedEventArgs e) { string str; int a = 0; Custom custom = DataOperation.GetCustom(this.txtAccount.Text); if (custom == null) { MessageBox.Show("帐号不存在!"); return; } if (custom.CheckLost()) { MessageBox.Show("账户已挂失不能使用!"); return; } str = this.txtmount.Text; a = 0; for (int i = 0; i < str.Length; i++) { if (char.IsNumber(str[i])) { a++; } } if (a == str.Length && a != 0) { custom.MoneyInfo.accountNo = txtAccount.Text; } else { MessageBox.Show("操作失败,请输入存款为数字"); this.txtmount.Text = null; return; } custom.Diposit("存款", double.Parse(this.txtmount.Text)); OperateRecord page = new OperateRecord(); NavigationService ns = NavigationService.GetNavigationService(this); ns.Navigate(page); }