You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.5 KiB
76 lines
2.5 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Text.RegularExpressions;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Shapes;
|
|
|
|
namespace Audit.Windows
|
|
{
|
|
/// <summary>
|
|
/// user.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class user : Window
|
|
{
|
|
string logPath = "" + System.Environment.CurrentDirectory + "\\Log\\AuditLog.txt";//日志文件
|
|
string Log_time = "[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]:";
|
|
|
|
public user()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void Imitnumber(object sender, TextCompositionEventArgs e)//输入框对象限制
|
|
{
|
|
Regex re = new Regex("[^0-9]+");
|
|
e.Handled = re.IsMatch(e.Text);
|
|
}
|
|
|
|
private void Exit(object sender, RoutedEventArgs e)//退出按钮
|
|
{
|
|
this.Close();//关闭当前窗口
|
|
}
|
|
|
|
private void Log(object sender, RoutedEventArgs e)//登录按钮
|
|
{
|
|
|
|
string users = this.users.Text;
|
|
string Passwds = this.Passwds.Text;
|
|
FileStream fs = new FileStream(logPath, FileMode.Append, FileAccess.Write);
|
|
StreamWriter wr = new StreamWriter(fs);//创建文件
|
|
if ((users == "sunlight") || (users == "SUNLIGHT"))//内置账号
|
|
{
|
|
if ((Passwds == "sunlight") || (users == "SUNLIGHT"))//主页面判断
|
|
{
|
|
Audit.MainWindow.user_t = int.Parse(this.userst.Text);
|
|
Audit.MainWindow.user_n = "SUNLIGHT";
|
|
this.Close();//关闭当前窗口
|
|
wr.WriteLine(Log_time + "SUNLIGHT账号登录[" + this.userst.Text + "]");
|
|
wr.Close();//写入配置文件
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("ERR.C0001:拒绝登录", "错误");//设置密码错误
|
|
wr.WriteLine(Log_time + "拒绝登录");
|
|
wr.Close();//写入配置文件
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("ERR.C0001:拒绝登录", "错误");//设置密码错误
|
|
wr.WriteLine(Log_time + "拒绝登录");
|
|
wr.Close();//写入配置文件
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|