87 lines
2.4 KiB
C#
87 lines
2.4 KiB
C#
using System;
|
|
using System.Windows.Forms;
|
|
|
|
namespace SLZ_4
|
|
{
|
|
public partial class LogOn : Form
|
|
{
|
|
public string password;
|
|
public LogOn()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void LogOn_Load(object sender, EventArgs e)
|
|
{
|
|
Logtime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
Timer1.Interval = 1000;
|
|
Timer1.Start();
|
|
Password.Focus();
|
|
}
|
|
public void setOperator(string strOperator)
|
|
{
|
|
textUser.Text = strOperator;
|
|
}
|
|
|
|
private void Login()
|
|
{
|
|
FormMain.form.labelOperator.Text = textUser.Text;
|
|
Config.saveOperator(textUser.Text);
|
|
|
|
if (Password.Text == "linglong29529959" || Password.Text == "29529959" || Password.Text == "qwe")
|
|
{
|
|
FormMain.form.labelUser.Text = "厂商";
|
|
Password.Text = "";
|
|
this.Close();
|
|
}
|
|
else
|
|
{
|
|
string userpassword = DateTime.Now.ToString("ddHHmm");
|
|
//string userpassword3 = "ghkj.2021";
|
|
if (Password.Text == userpassword)
|
|
{
|
|
FormMain.form.labelUser.Text = "工程师";
|
|
Password.Text = "";
|
|
this.Close();
|
|
}
|
|
|
|
else if (Password.Text == password)
|
|
{
|
|
FormMain.form.labelUser.Text = "管理员";
|
|
Password.Text = "";
|
|
this.Close();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("密码错误!");
|
|
Password.ResetText();
|
|
Password.Focus();
|
|
}
|
|
}
|
|
}
|
|
private void Log_Click(object sender, EventArgs e)
|
|
{
|
|
Login();
|
|
}
|
|
|
|
private void Timer1_Tick(object sender, EventArgs e)
|
|
{
|
|
Logtime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
}
|
|
|
|
private void Account_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
e.Handled = true;
|
|
}
|
|
|
|
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
|
{
|
|
if (keyData == Keys.Enter)
|
|
{
|
|
Login();
|
|
}
|
|
return base.ProcessCmdKey(ref msg, keyData);
|
|
}
|
|
}
|
|
}
|