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(); } }
// 检测密保问题的答案 private void Check_Answer() { using (BankEntities2 db = new BankEntities2()) { var t = from x in db.LoginInfo where x.Bno == setTxt1.Text && x.SecurityAnswer == setTxt2.Text select x; if (t.Count() != 0) { TipLabel1.Content = "验证成功"; } else { TipLabel1.Content = "答案错误,请重新输入"; } } }