private void BtnSure_Click(object sender, RoutedEventArgs e) { if (Check_All()) { using (BankEntities2 db = new BankEntities2()) { var a = from i in db.LoginInfo where i.Bno == setTxt1.Text select i; foreach (var v in a) { v.Password = Box_Password.Password; } int j = db.SaveChanges(); string show1 = "密码重置成功,修改了" + j + "条记录"; MessageBox.Show(show1, "提示"); this.Close(); Main enter = new Main(); enter.ShowDialog(); } } else { MessageBox.Show("请检查无误后重试!", "提示"); //Main relogin = new Main(); //relogin.ShowDialog(); } }
/// 开户 /// </summary> /// <param name="accountNumber">帐号</param> /// <param name="money">开户金额</param> public virtual void Create(string accountNumber, double money) { this.AccountBalance = money; bool success = false; //插入到数据库 try { context.AccountInfo.Add(AccountInfo); context.SaveChanges(); success = true; } catch (Exception err) { success = false; MessageBox.Show("开户失败!" + err.Message); } if (success) { this.MoneyInfo.accountNo = accountNumber; InsertData("开户", money); } }