添加项目文件。
This commit is contained in:
@@ -0,0 +1,131 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using JY.Inspection.Common;
|
||||
using JY.Utility;
|
||||
using MetroFramework.Forms;
|
||||
|
||||
namespace JY.Inspection.Frm
|
||||
{
|
||||
public delegate void SendLoginIN(User user);
|
||||
public partial class LoginForm : MetroForm
|
||||
{
|
||||
public SendLoginIN sendLogin;
|
||||
|
||||
private int loginFailedCount = 0;
|
||||
public LoginForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
pLogin_card.Location = new System.Drawing.Point(81, 282);
|
||||
|
||||
chkIsSK.CheckedChanged += chkIsSK_CheckedChanged;
|
||||
txtPassword2.KeyUp += txtPassWord_KeyUp;
|
||||
txtPassword2.KeyDown += txtPassword2_KeyDown;
|
||||
btLogin.Click += btLogin_Click;
|
||||
}
|
||||
|
||||
private void LoginForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
chkIsSK.Checked = IniFileHelper.ReadIniData("SYSTEM_CONFIGURE", "IsSK") == "1" ? true : false;
|
||||
chkIsSK_CheckedChanged(null, null);
|
||||
//loginFailedCount = 0;
|
||||
//txtPassWord.Focus();
|
||||
//txtPassWord.Text = null;
|
||||
//lblICCard.Visible = txtPassword2.Visible = true;
|
||||
//btLogin.Visible = pLogin_pwd.Visible = false;
|
||||
}
|
||||
|
||||
private void txtPassWord_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
|
||||
DateTime _tempDt = DateTime.Now;
|
||||
TimeSpan ts = _tempDt.Subtract(_dt);
|
||||
if (ts.Milliseconds > 100)
|
||||
{
|
||||
|
||||
txtPassword2.Text = "";//清空
|
||||
}
|
||||
else
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
{
|
||||
|
||||
if (txtPassword2.Text == string.Empty)
|
||||
{
|
||||
txtPassword2.Focus();
|
||||
MessageBox.Show("IC卡号为空", "系统提示");
|
||||
return;
|
||||
}
|
||||
UserHelper helper = new UserHelper("");
|
||||
string strErr = "";
|
||||
var res = helper.CheckUserLogin("user.pt", "", txtPassword2.Text.Trim(), ref strErr);
|
||||
if (res == null)
|
||||
{
|
||||
txtPassword2.Text = "";
|
||||
txtPassword2.Focus();
|
||||
MessageBox.Show("IC卡号不正确" + strErr, "系统提示");
|
||||
return;
|
||||
}
|
||||
sendLogin(res);
|
||||
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void btLogin_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (string.IsNullOrEmpty(txtUserID.Text) | string.IsNullOrEmpty(txtPassWord.Text))
|
||||
{
|
||||
txtUserID.Focus();
|
||||
MessageBox.Show("用户名或密码为空", "系统提示");
|
||||
return;
|
||||
}
|
||||
UserHelper helper = new UserHelper("");
|
||||
string strErr = "";
|
||||
var res = helper.CheckUserLogin("user.pt", txtUserID.Text.Trim(), txtPassWord.Text.Trim(), ref strErr);
|
||||
if (res == null)
|
||||
{
|
||||
txtPassWord.Focus();
|
||||
loginFailedCount++;
|
||||
MessageBox.Show($"用户名或密码不正确,登录失败({loginFailedCount})次!", "系统提示");
|
||||
return;
|
||||
}
|
||||
|
||||
sendLogin(res);
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btExit_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
|
||||
private void chkIsSK_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
//IniFileHelper.WriteIniData("SYSTEM_CONFIGURE", "IsSK", chkIsSK.Checked ? "1" : "0");
|
||||
//lblICCard.Visible = txtPassword2.Visible = chkIsSK.Checked;
|
||||
//btLogin.Visible = pLogin_pwd.Visible = !chkIsSK.Checked;
|
||||
//lblICCard.Visible = txtPassword2.Visible = true;
|
||||
//btLogin.Visible = pLogin.Visible = false;
|
||||
if (chkIsSK.Checked)
|
||||
{
|
||||
pLogin_card.Visible = true;
|
||||
pLogin_pwd.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
pLogin_pwd.Visible = true;
|
||||
pLogin_card.Visible = false;
|
||||
}
|
||||
|
||||
}
|
||||
//定义输入时间变量
|
||||
private DateTime _dt;
|
||||
private void txtPassword2_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user