109 lines
3.4 KiB
C#
109 lines
3.4 KiB
C#
using System;
|
|
using System.Windows.Forms;
|
|
|
|
namespace SLC1_N
|
|
{
|
|
public partial class Form_LogOn : Form
|
|
{
|
|
public Form_LogOn()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void LogOn_Load(object sender, EventArgs e)
|
|
{
|
|
Logtime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
Timer_timeShow.Interval = 1000;
|
|
Timer_timeShow.Start();
|
|
|
|
Password.Focus();
|
|
}
|
|
|
|
private void Log_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (Password.Text == "linglong29529959" || Password.Text == "29529959" || Password.Text == "qwe")
|
|
{
|
|
Timer_timeShow.Stop();
|
|
Form1.f1.lb_User.Text = "厂商";
|
|
Form1.f1.User = "厂商";
|
|
|
|
this.Close();
|
|
}
|
|
else
|
|
{
|
|
string userpassword2 = DateTime.Now.ToString("yyMMHH");
|
|
string userpassword = DateTime.Now.ToString("ddHHmm");
|
|
string userpassword3 = "ghkj.2021";
|
|
if (Password.Text == userpassword)
|
|
{
|
|
Form1.f1.lb_User.Text = "工程师";
|
|
Form1.f1.User = "工程师";
|
|
Timer_timeShow.Stop();
|
|
this.Close();
|
|
}
|
|
|
|
else if (Password.Text== userpassword2)
|
|
{
|
|
Form1.f1.lb_User.Text = "管理员";
|
|
Form1.f1.User = "管理员";
|
|
Timer_timeShow.Stop();
|
|
this.Close();
|
|
}
|
|
else if (Password.Text == userpassword3|| Password.Text == "123456" || Password.Text == "8888")
|
|
{
|
|
Form1.f1.lb_User.Text = "超级管理员";
|
|
Form1.f1.User = "超级管理员";
|
|
Timer_timeShow.Stop();
|
|
this.Close();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("密码错误!");
|
|
Password.ResetText();
|
|
Password.Focus();
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message);
|
|
}
|
|
}
|
|
|
|
private void Password_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == System.Windows.Forms.Keys.Enter)
|
|
{
|
|
Log.PerformClick(); //执行单击button的动作
|
|
}
|
|
}
|
|
|
|
private void LogOn_FormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
//if (String.IsNullOrEmpty(Form1.f1.Admin.Text))
|
|
//{
|
|
// System.Environment.Exit(0);
|
|
//}
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
private void timer2_Tick(object sender, EventArgs e)
|
|
{
|
|
Form1.f1.lb_User.Text = "操作员";
|
|
Form1.f1.User = "操作员";
|
|
}
|
|
}
|
|
}
|