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.

72 lines
2.3 KiB

using GalaSoft.MvvmLight.Command;
using MahApps.Metro.Controls;
using Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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>
/// LogWindow.xaml 的交互逻辑
/// </summary>
public partial class LogWindow : MetroWindow
{
public LogWindow()
{
InitializeComponent();
}
private void Exit(object sender, RoutedEventArgs e)//退出按钮
{
Application.Current.Shutdown();//关闭窗口
}
// public UserAccount UserAccount { get; private set; } = AuditData.Instance.Useraccount;
public AuditData AuditData { get; set; } = AuditData.Instance;
private void Log(object sender, RoutedEventArgs e)//登录按钮
{
if (this.users.Text == "sunlight")
{
if (this.Passwds.Text == "sunlight")
{
MessageBox.Show("警告:进入设置模式请您明确操作目的及可能需承担的后果");
Windows.Set_up setup = new Windows.Set_up();
setup.Show();//实例化并打开设置窗口
this.Close();//关闭当前窗口
}
else
{
MessageBox.Show("ERR.C0011:拒绝登录");//设置密码错误
}
}
else
{
UserAccountProvide UserAccountProvide = new UserAccountProvide();
var list = UserAccountProvide.Select();
var usersql = list.FirstOrDefault(item => item.UserCode==AuditData.Useraccount.UserCode && item.PassWord==AuditData.Useraccount.PassWord);
if (usersql == null)
{
MessageBox.Show("ERR.C0000:用户名或密码错误");
}
else
{
MainWindow mainWindow = new MainWindow();
mainWindow.Show();
this.Close();
}
}
}
}
}