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 lyfzAttendance { public partial class frmAuthority : LYFZ.ComponentLibrary.BaseContentsFormMain { private static int MissCount { get; set; } = 3; public string AdminPassword { get; set; } = ""; public frmAuthority(string password) { InitializeComponent(); AdminPassword = password; this.btn_OK.Click += Btn_OK_Click; this.btn_Cancel.Click += Btn_Cancel_Click; } private void Btn_Cancel_Click(object sender, EventArgs e) { this.Close(); } private void Btn_OK_Click(object sender, EventArgs e) { if (MissCount == 0) { MessageBox.Show("输入密码错误次数超过3次!"); this.Close(); return; } string md5 = LYFZ.WinAPI.SDKSecurity.MD5Encrypt(tx_Password.Text).ToLower(); if ( md5.Equals(AdminPassword) ) { this.DialogResult = DialogResult.OK; } else { MessageBox.Show("密码不正确!"); MissCount--; } } } }