//取款 private void btnOk_Click(object sender, RoutedEventArgs e) { string str; Custom custom = DataOperation.GetCustom(this.txtAccount.Text); // CustomFixed customFixed = (CustomFixed)DataOperation.GetCustom(this.txtAccount.Text); // CustomSmallSum customSmallSum = (CustomSmallSum)DataOperation.GetCustom(this.txtAccount.Text); if (custom.AccountInfo.accountPass != this.txtPassword.Password) { MessageBox.Show("密码不正确"); return; } if (custom.AccountInfo.IsLoss == 1) { MessageBox.Show("该卡已经被挂失!"); return; } int mark = this.txtAccount.Text.IndexOf("3"); if (mark == 0) { var q = from t in context.MoneyInfo where t.accountNo == this.txtAccount.Text select t.balance; str = q.ToList().Last().ToString(); //var qq = q.Last(); if (str != this.txtmount.Text) { MessageBox.Show("请一次将零存整取账户中的余额取完\n" + "当前余额:" + str + " 元"); return; } } if (this.txtAccount.Text.IndexOf("3") == 0) { CustomSmallSum css = new CustomSmallSum(); css.setaccount(this.txtAccount.Text); } else if (this.txtAccount.Text.IndexOf("2") == 0) { CustomFixed cf = new CustomFixed(); cf.setaccount(this.txtAccount.Text); } custom.Withdraw(double.Parse(this.txtmount.Text)); OperateRecord page = new OperateRecord(); NavigationService ns = NavigationService.GetNavigationService(this); ns.Navigate(page); }
/// <summary> /// 根据存款类型创建存款用户 /// </summary> /// <param name="accountType">存款类型</param> /// <returns></returns> public static Custom CreateCustom(string accountType) { Custom custom = null; switch (accountType) { //定期1年, //定期3年, //定期5年, //活期, //零存整取1年, //零存整取3年, //零存整取5年 case "活期存款": custom = new CustomChecking(); break; case "定期1年": custom = new CustomFixed(); break; case "定期3年": custom = new CustomFixed3(); break; case "定期5年": custom = new CustomFixed5(); break; case "零存整取1年": custom = new CustomFixedL(); break; case "零存整取3年": custom = new CustomFixedL3(); break; case "零存整取5年": custom = new CustomFixedl5(); break; } custom.AccountInfo.accountType = accountType; return(custom); }
/// <summary> /// 根据存款类型创建存款用户 /// </summary> /// <param name="accountType">存款类型</param> /// <returns></returns> public static Custom CreateCustom(string accountType) { Custom custom = null; switch (accountType) { case "活期存款": custom = new CustomChecking(); break; case "定期存款": custom = new CustomFixed(); break; case "零存整取": break; } custom.AccountInfo.accountType = accountType; return(custom); }