private void Cancel_Click(object sender, EventArgs e) { this.Close(); MainFunction mainFunction = new MainFunction(user); mainFunction.Show(); }
private void Login_Click(object sender, EventArgs e) { //Console.WriteLine("户名{0}是在...", user.UserName); if (textBoxUser.Text == "") { MessageBox.Show("请输入用户名"); } else { DAO.Login(user); switch (user.UserId) { case "1": MessageBox.Show("不存在该用户,请重新输入!"); break; case "2": MessageBox.Show("密码输入有误,请重新输入!"); break; case "3": MessageBox.Show("程序异常,请联系管理员"); break; default: MainFunction mainFunction = new MainFunction(user); mainFunction.Show(); this.Close(); MessageBox.Show("欢迎" + user.UserName + "登入", "自助存取款系统"); break; } } }
private void Add_Click(object sender, EventArgs e) { ResetLabel(); account.AccountName = accountName.Text.ToString().Trim(); if (accountBank.SelectedIndex == -1) { account.AccountBank = -1; } else { account.AccountBank = Convert.ToInt16(accountBank.SelectedValue); } if (yes.Checked) { account.AccountType = true; account.Grade = 1; } else if (no.Checked) { account.AccountType = false; account.Grade = 0; } int result = DAO.AddAcount(account); switch (result) { case -1: MessageBox.Show("添加账户失败!"); break; case 0: MessageBox.Show("添加账户成功!"); this.Close(); MainFunction mainFunction = new MainFunction(user); mainFunction.Show(); break; case 1: idLabel.Text = "程序异常!"; break; case 2: nameLabel.Text = "请输入!"; break; case 3: nameLabel.Text = "账户名过短!"; break; case 4: bankLabel.Text = "请选择!"; break; case 5: creditLabel.Text = "请选择!"; break; } }
private void Exit_Click(object sender, EventArgs e) { User user = new User(account.UserID); this.Close(); MainFunction mainFunction = new MainFunction(user); mainFunction.Show(); }
private void Change_Click(object sender, EventArgs e) { string OldUserName = oldUserName.Text.ToString().Trim(); string NewUserName = newUserName.Text.ToString().Trim(); //Console.WriteLine(UserID); //Console.WriteLine(UserName); //Console.WriteLine(NewPsw); //Console.WriteLine(ConfirmPsw); //Console.WriteLine(checkName); ResetLabel(); int result = DAO.ChangeUserName(OldUserName, NewUserName, user); switch (result) { case -1: MessageBox.Show("用户名更新失败!"); break; case 0: MessageBox.Show("用户名更新成功!"); this.Close(); MainFunction mainFunction = new MainFunction(user); mainFunction.Show(); break; case 1: oldLabel.Text = "旧用户名不应为空!"; break; case 2: oldLabel.Text = "旧用户名错误!"; break; case 3: newLabel.Text = "新用户名过短!"; break; case 4: newLabel.Text = "新名不应与旧名一致!"; break; case 5: newLabel.Text = "新名旧名重名!"; break; case 6: newLabel.Text = "数据库中有重名数据!"; break; case 7: newLabel.Text = "检查重名出错!"; break; } }
private void Change_Click(object sender, EventArgs e) { string OldPsw = oldPsw.Text.ToString().Trim(); string NewPsw = newPsw.Text.ToString().Trim(); string ConfirmPsw = confirmPsw.Text.ToString().Trim(); //Console.WriteLine(UserID); //Console.WriteLine(UserName); //Console.WriteLine(NewPsw); //Console.WriteLine(ConfirmPsw); //Console.WriteLine(checkName); ResetLabel(); int result = DAO.ChangePassword(OldPsw, NewPsw, ConfirmPsw, user); switch (result) { case -1: MessageBox.Show("密码更新失败!"); break; case 0: MessageBox.Show("密码更新成功!"); this.Close(); MainFunction mainFunction = new MainFunction(user); mainFunction.Show(); break; case 1: oldLabel.Text = "旧密码不应为空!"; break; case 2: oldLabel.Text = "旧密码错误!"; break; case 3: newLabel.Text = "密码过短!"; break; case 4: newLabel.Text = "密码存在非法值"; break; case 5: confirmLabel.Text = "密码不一致!"; break; } }
private void Delete_Click(object sender, EventArgs e) { if (account.Balance == 0) { if (DAO.DeleteAcount(account) == 0) { this.Close(); User user = new User(account.UserID); MainFunction mainFunction = new MainFunction(user); mainFunction.Show(); MessageBox.Show(String.Format("删除{0}账户成功!", account.AccountName)); } else { MessageBox.Show(String.Format("删除{0}账户失败!", account.AccountName)); } } else { MessageBox.Show(String.Format("您的账户上有{0}元,\n只有账户清零才可以删除账户!", account.Balance.ToString())); } }