using Stone.Common; using Stone.Entity; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Stone.WinModule.Standard { public partial class frmPasswordVerify : Form { public string UserName = ""; public frmPasswordVerify() { InitializeComponent(); } private void frmPasswordVerify_Load(object sender, EventArgs e) { this.lblName.Text = $"请输入 {UserName} 的密码进行验证!!!"; } private void txtPassword_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { btnOK_Click(new object(), new EventArgs()); } } private void btnOK_Click(object sender, EventArgs e) { try { string Password = this.txtPassword.Text.Trim(); Password = MyStrings.EncryptStr(Password); Entity_t_Sys_User t_User = new Entity_t_Sys_User(); DataSet dsUser = t_User.GetData("", "[Name]='" + UserName + "' and [Password]='" + Password + "' and [Enabled]=1", "ID asc"); dsUser.Tables[0].TableName = "User"; if (dsUser.Tables[0].Rows.Count == 0) throw new Exception("密码输入不正确"); this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { MyMessageBox.ShowErrorMessage(ex.Message); } } private void btnClose_Click(object sender, EventArgs e) { this.Close(); } } }