-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml.cs
72 lines (63 loc) · 2.17 KB
/
MainWindow.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using PlaneSysWpfApp.SignIn;
using System;
using System.Collections.Generic;
using System.Windows;
namespace PlaneSysWpfApp
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
textTime.Text = DateTime.Now.ToLocalTime().ToString().Substring(0, 9);
this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
Application.Current.Shutdown();
}
private void SignIn_Click(object sender, RoutedEventArgs e)
{
SignInWindow signWin = new SignInWindow();
signWin.Show();
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
int flag = 0;
string inputId = idTextBox.Text;
string inputPd = pass.Password.ToString();
List<User.User> users = new List<User.User>();
users = Manager.TextUtil.LoadUser();
// 管理员身份
if(inputId.Equals("admin") && inputPd.Equals("123456"))
{
MessageBox.Show("管理员登陆成功!");
flag = 1;
Manager.ManagerWindow mgWin = new Manager.ManagerWindow();
mgWin.Show();
}
//验证用户身份
for(int i=0; i < users.ToArray().Length; i++)
{
if (inputId.Equals(users[i].getUserId()))
{
if (inputPd.Equals(users[i].getPwd()))
{
MessageBox.Show("用户登陆成功!");
flag = 1;
User.UserWindow uw = new User.UserWindow(users[i].getUserName());
uw.Show();
}
}
}
// 两者都不是
if (flag == 0)
{
MessageBox.Show("账号或密码错误!");
}
}
}
}